diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d1afc4e0..d27055705 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,7 @@ jobs: spatialite-bin \ libsqlite3-mod-spatialite pip install -U pip wheel setuptools + pip install -U ${{ matrix.django-version }} pip install -r requirements-test.txt pip install -U -I -e . pip install -U ${{ matrix.django-version }} diff --git a/openwisp_monitoring/device/admin.py b/openwisp_monitoring/device/admin.py index cf327ef84..3870bcf08 100644 --- a/openwisp_monitoring/device/admin.py +++ b/openwisp_monitoring/device/admin.py @@ -588,8 +588,8 @@ class MapPageAdmin(MultitenantAdminMixin, admin.ModelAdmin): class Media: js = [ - "monitoring/js/lib/netjsongraph.min.js", "monitoring/js/lib/leaflet.fullscreen.min.js", + "monitoring/js/lib/netjsongraph.echarts.min.js", ] css = { "all": [ diff --git a/openwisp_monitoring/device/apps.py b/openwisp_monitoring/device/apps.py index 2f2a5ff04..4045b1805 100644 --- a/openwisp_monitoring/device/apps.py +++ b/openwisp_monitoring/device/apps.py @@ -378,8 +378,8 @@ def register_dashboard_items(self): "monitoring/css/netjsongraph.css", ), "js": ( - "monitoring/js/lib/netjsongraph.min.js", "monitoring/js/lib/leaflet.fullscreen.min.js", + "monitoring/js/lib/netjsongraph.echarts.min.js", "monitoring/js/device-map.js", "monitoring/js/floorplan.js", ), diff --git a/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css b/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css index 46b648b85..2736f087d 100644 --- a/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css +++ b/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css @@ -1,7 +1,7 @@ .daterangepicker { position: absolute; color: inherit; - background-color: #fff; + background-color: var(--ow-color-white); border-radius: 4px; border: 1px solid #ddd; width: 278px; @@ -32,7 +32,7 @@ .daterangepicker:after { top: -6px; border-right: 6px solid transparent; - border-bottom: 6px solid #fff; + border-bottom: 6px solid var(--ow-color-white); border-left: 6px solid transparent; } .daterangepicker.opensleft:before { @@ -74,7 +74,7 @@ top: initial; bottom: -6px; border-bottom: initial; - border-top: 6px solid #fff; + border-top: 6px solidvar(--ow-color-white); } .daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar { @@ -107,7 +107,7 @@ } .daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span { - color: #fff; + color: var(--ow-color-white); border: solid black; border-width: 0 2px 2px 0; border-radius: 0; @@ -138,9 +138,9 @@ cursor: pointer; } .daterangepicker .calendar-table { - border: 1px solid #fff; + border: 1px solidvar(--ow-color-white); border-radius: 4px; - background-color: #fff; + background-color: var(--ow-color-white); } .daterangepicker .calendar-table table { width: 100%; @@ -163,14 +163,14 @@ .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date { - background-color: #fff; + background-color: var(--ow-color-white); border-color: transparent; color: #999; } .daterangepicker td.in-range { background-color: #ebf4f8; border-color: transparent; - color: #000; + color: var(--ow-color-black); border-radius: 0; } .daterangepicker td.start-date { @@ -186,7 +186,7 @@ .daterangepicker td.active:hover { background-color: #357ebd; border-color: transparent; - color: #fff; + color: var(--ow-color-white); } .daterangepicker th.month { width: auto; @@ -290,7 +290,7 @@ } .daterangepicker .ranges li.active { background-color: #08c; - color: #fff; + color: var(--ow-color-white); } .daterangepicker { width: auto; @@ -341,7 +341,7 @@ } .daterangepicker .ranges ul li.active { background-color: #fce5e5; - color: #df5d43; + color: var(--ow-color-primary); } .daterangepicker .ranges ul li:hover { background-color: #fce5e5; @@ -349,7 +349,7 @@ } .daterangepicker .drp-buttons button.btn { margin: 0 2px; - color: #fff; + color: var(--ow-color-white); background-color: #666; padding: 5px 15px; text-decoration: none; @@ -361,12 +361,12 @@ .daterangepicker td.active, .daterangepicker td.active:hover { border-radius: 1.25px; - color: #fff; - background-color: #df5d43; + color: var(--ow-color-white); + background-color: var(--ow-color-primary); border-color: transparent; } .daterangepicker td.in-range { - background-color: #df5d43; + background-color: var(--ow-color-primary); border-color: transparent; color: white; @@ -375,24 +375,24 @@ .daterangepicker td.in-range:hover { color: white; border-radius: 1, 25px; - background-color: #df5d43; + background-color: var(--ow-color-primary); } .daterangepicker .drp-buttons button.btn { - background-color: #333; + background-color: var(--ow-color-fg-darker); border-radius: 3.75px; } .daterangepicker .drp-buttons button.btn:hover { - background-color: #777; + background-color: var(--ow-color-fg-dark); } .daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date :hover { - background-color: #fff; + background-color: var(--ow-color-white); color: rgba(119, 119, 119, 0.56); } .daterangepicker .drp-selected { - color: #df5d43; + color: var(--ow-color-primary); } .daterangepicker .drp-calendar { max-width: 370px; diff --git a/openwisp_monitoring/device/static/monitoring/css/device-map.css b/openwisp_monitoring/device/static/monitoring/css/device-map.css index 0d2590e8d..830bf8f35 100644 --- a/openwisp_monitoring/device/static/monitoring/css/device-map.css +++ b/openwisp_monitoring/device/static/monitoring/css/device-map.css @@ -1,5 +1,5 @@ .health-deactivated { - color: #000; + color: var(--ow-color-black); background-color: #f2f4f7; border: 1px solid #d0d5dd; } @@ -60,7 +60,7 @@ padding-top: 115px; } .no-data a.button { - color: #fff; + color: var(--ow-color-white); padding: 5px 10px; font-weight: bold; text-decoration: none !important; @@ -238,9 +238,9 @@ border-radius: 12px; display: flex; flex-direction: column; - box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4); + box-shadow: 0 3px 14px var(--ow-overlay-40); pointer-events: all; - background: #fff; + background: var(--ow-color-white); flex-grow: 1; } #floorplan-close-btn { @@ -263,7 +263,7 @@ margin: 0; padding: 0; font-size: 18px; - color: #333; + color: var(--ow-color-fg-darker); white-space: normal; display: inline-block; } @@ -306,7 +306,7 @@ display: flex; flex-direction: row; align-items: center; - box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4); + box-shadow: 0 3px 14px var(--ow-overlay-40); } .floor-btn { diff --git a/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css b/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css index 333ead9fa..4414b4b37 100644 --- a/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css +++ b/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css @@ -1,5 +1,5 @@ .njg-container .leaflet-control-fullscreen a { - background: #fff url(fullscreen.png) no-repeat 0 0; + background: var(--ow-color-white) url("fullscreen.png") no-repeat 0 0; background-size: 26px 52px; } .njg-container .leaflet-touch .leaflet-control-fullscreen a { diff --git a/openwisp_monitoring/device/static/monitoring/css/monitoring.css b/openwisp_monitoring/device/static/monitoring/css/monitoring.css index dc0299601..06c061fe5 100644 --- a/openwisp_monitoring/device/static/monitoring/css/monitoring.css +++ b/openwisp_monitoring/device/static/monitoring/css/monitoring.css @@ -2,8 +2,8 @@ padding: 0 1px; } #ow-device-status h2 { - color: #333; - background-color: rgba(0, 0, 0, 0.05); + color: var(--ow-color-fg-darker); + background-color: var(--ow-overlay-5); outline: 1px solid rgba(0, 0, 0, 0.3); padding: 15px; } @@ -31,7 +31,7 @@ } #ow-device-status th { border-top: 0 none; - background: #f9f9f9 !important; + background: var(--ow-color-fg-lightest) !important; } td.field-health_status, .field-health_status .readonly { @@ -39,7 +39,7 @@ td.field-health_status, text-transform: uppercase; } .health-deactivated { - color: #000; + color: var(--ow-color-black); } .health-unknown { color: grey; diff --git a/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css b/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css index 451d90720..bdcc6d002 100755 --- a/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css +++ b/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css @@ -45,7 +45,7 @@ background-size: 20px 20px !important; } .njg-container .marker-cluster div { - color: #fff; + color: var(--ow-color-white); background-color: rgba(53, 60, 68, 0.8) !important; } .njg-container .ok div { @@ -74,7 +74,7 @@ display: none; } .njg-container .njg-tooltip { - background: #fff !important; + background: var(--ow-color-white) !important; border: none !important; } .njg-container .njg-tooltip-item { @@ -90,12 +90,12 @@ flex-wrap: wrap; text-transform: capitalize; font-weight: 600; - color: #000; + color: var(--ow-color-black); } .njg-container .njg-tooltip-value { display: inline-flex; align-items: center; flex-wrap: wrap; flex-basis: 60%; - color: #000; + color: var(--ow-color-black); } diff --git a/openwisp_monitoring/device/static/monitoring/css/percircle.min.css b/openwisp_monitoring/device/static/monitoring/css/percircle.min.css index 36041a8e9..7b6de2198 100644 --- a/openwisp_monitoring/device/static/monitoring/css/percircle.min.css +++ b/openwisp_monitoring/device/static/monitoring/css/percircle.min.css @@ -1 +1 @@ -.percircle.dark{background-color:#777}.percircle.dark .bar,.percircle.dark .fill{border-color:#c6ff00}.percircle.dark>span{color:#777}.percircle.dark:after{background-color:#555}.percircle.dark:hover>span{color:#c6ff00}.percircle.red .bar,.percircle.red .fill{border-color:#dd5454}.percircle.red:hover>span{color:#dd5454}.percircle.red.dark .bar,.percircle.red.dark .fill{border-color:#f84a4a}.percircle.red.dark:hover>span{color:#f84a4a}.percircle.blue .bar,.percircle.blue .fill{border-color:#82cefa}.percircle.blue:hover>span{color:#82cefa}.percircle.blue.dark .bar,.percircle.blue.dark .fill{border-color:#20cceb}.percircle.blue.dark:hover>span{color:#20cceb}.percircle.green .bar,.percircle.green .fill{border-color:#8dea7b}.percircle.green:hover>span{color:#8dea7b}.percircle.green.dark .bar,.percircle.green.dark .fill{border-color:#a9ff3a}.percircle.green.dark:hover>span{color:#a9ff3a}.percircle.orange .bar,.percircle.orange .fill{border-color:#e88239}.percircle.orange:hover>span{color:#e88239}.percircle.orange.dark .bar,.percircle.orange.dark .fill{border-color:#dc5b00}.percircle.orange.dark:hover>span{color:#dc5b00}.percircle.pink .bar,.percircle.pink .fill{border-color:#ff8ed0}.percircle.pink:hover>span{color:#ff8ed0}.percircle.pink.dark .bar,.percircle.pink.dark .fill{border-color:#ff58b9}.percircle.pink.dark:hover>span{color:#ff58b9}.percircle.purple .bar,.percircle.purple .fill{border-color:#aa7eff}.percircle.purple:hover>span{color:#aa7eff}.percircle.purple.dark .bar,.percircle.purple.dark .fill{border-color:#7a38f7}.percircle.purple.dark:hover>span{color:#7a38f7}.percircle.yellow .bar,.percircle.yellow .fill{border-color:#dcbd00}.percircle.yellow:hover>span{color:#dcbd00}.percircle.yellow.dark .bar,.percircle.yellow.dark .fill{border-color:#ffdb00}.percircle.yellow.dark:hover>span{color:#ffdb00}.percircle.gt50 .slice,.rect-auto{clip:rect(auto,auto,auto,auto)}.gt50 .fill,.percircle .bar,.pie{position:absolute;border:.08em solid #307bbb;width:.84em;height:.84em;clip:rect(0,.5em,1em,0);border-radius:50%;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.bar{-webkit-backface-visibility:hidden;backface-visibility:hidden}.gt50 .bar:after,.gt50 .fill,.pie-fill{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.percircle{position:relative;font-size:120px;width:1em;height:1em;border-radius:50%;float:left;margin:0 .1em .1em 0;background-color:#ccc}.percircle *,.percircle :after,.percircle :before{box-sizing:content-box}.percircle.animate:after,.percircle.animate>span{-webkit-transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out}.percircle.animate .bar{-webkit-transition:-webkit-transform .6s ease-in-out;transition:transform .6s ease-in-out}.percircle.center{float:none;margin:0 auto}.percircle.big{font-size:240px}.percircle.small{font-size:80px}.percircle>span{position:absolute;z-index:1;width:100%;top:50%;top:calc(50% - .1em);transform:translateY(-50%);height:1em;font-size:.2em;color:#ccc;display:block;text-align:center;white-space:nowrap}.perclock>span{font-size:.175em}.percircle:after{position:absolute;top:.08em;left:.08em;display:block;content:" ";border-radius:50%;background-color:#f5f5f5;width:.84em;height:.84em}.percircle .slice{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.percircle:hover{cursor:default}.percircle:hover>span{-webkit-transform:scale(1.3) translateY(-50%);transform:scale(1.3) translateY(-50%);color:#307bbb}.percircle:hover:after{-webkit-transform:scale(1.1);transform:scale(1.1)} +.percircle.dark{background-color:var(--ow-color-fg-dark)}.percircle.dark .bar,.percircle.dark .fill{border-color:#c6ff00}.percircle.dark>span{color:var(--ow-color-fg-dark)}.percircle.dark:after{background-color:#555}.percircle.dark:hover>span{color:#c6ff00}.percircle.red .bar,.percircle.red .fill{border-color:#dd5454}.percircle.red:hover>span{color:#dd5454}.percircle.red.dark .bar,.percircle.red.dark .fill{border-color:#f84a4a}.percircle.red.dark:hover>span{color:#f84a4a}.percircle.blue .bar,.percircle.blue .fill{border-color:#82cefa}.percircle.blue:hover>span{color:#82cefa}.percircle.blue.dark .bar,.percircle.blue.dark .fill{border-color:#20cceb}.percircle.blue.dark:hover>span{color:#20cceb}.percircle.green .bar,.percircle.green .fill{border-color:#8dea7b}.percircle.green:hover>span{color:#8dea7b}.percircle.green.dark .bar,.percircle.green.dark .fill{border-color:#a9ff3a}.percircle.green.dark:hover>span{color:#a9ff3a}.percircle.orange .bar,.percircle.orange .fill{border-color:#e88239}.percircle.orange:hover>span{color:#e88239}.percircle.orange.dark .bar,.percircle.orange.dark .fill{border-color:#dc5b00}.percircle.orange.dark:hover>span{color:#dc5b00}.percircle.pink .bar,.percircle.pink .fill{border-color:#ff8ed0}.percircle.pink:hover>span{color:#ff8ed0}.percircle.pink.dark .bar,.percircle.pink.dark .fill{border-color:#ff58b9}.percircle.pink.dark:hover>span{color:#ff58b9}.percircle.purple .bar,.percircle.purple .fill{border-color:#aa7eff}.percircle.purple:hover>span{color:#aa7eff}.percircle.purple.dark .bar,.percircle.purple.dark .fill{border-color:#7a38f7}.percircle.purple.dark:hover>span{color:#7a38f7}.percircle.yellow .bar,.percircle.yellow .fill{border-color:#dcbd00}.percircle.yellow:hover>span{color:#dcbd00}.percircle.yellow.dark .bar,.percircle.yellow.dark .fill{border-color:#ffdb00}.percircle.yellow.dark:hover>span{color:#ffdb00}.percircle.gt50 .slice,.rect-auto{clip:rect(auto,auto,auto,auto)}.gt50 .fill,.percircle .bar,.pie{position:absolute;border:.08em solid #307bbb;width:.84em;height:.84em;clip:rect(0,.5em,1em,0);border-radius:50%;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.bar{-webkit-backface-visibility:hidden;backface-visibility:hidden}.gt50 .bar:after,.gt50 .fill,.pie-fill{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.percircle{position:relative;font-size:120px;width:1em;height:1em;border-radius:50%;float:left;margin:0 .1em .1em 0;background-color:#ccc}.percircle *,.percircle :after,.percircle :before{box-sizing:content-box}.percircle.animate:after,.percircle.animate>span{-webkit-transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out}.percircle.animate .bar{-webkit-transition:-webkit-transform .6s ease-in-out;transition:transform .6s ease-in-out}.percircle.center{float:none;margin:0 auto}.percircle.big{font-size:240px}.percircle.small{font-size:80px}.percircle>span{position:absolute;z-index:1;width:100%;top:50%;top:calc(50% - .1em);transform:translateY(-50%);height:1em;font-size:.2em;color:#ccc;display:block;text-align:center;white-space:nowrap}.perclock>span{font-size:.175em}.percircle:after{position:absolute;top:.08em;left:.08em;display:block;content:" ";border-radius:50%;background-color:#f5f5f5;width:.84em;height:.84em}.percircle .slice{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.percircle:hover{cursor:default}.percircle:hover>span{-webkit-transform:scale(1.3) translateY(-50%);transform:scale(1.3) translateY(-50%);color:#307bbb}.percircle:hover:after{-webkit-transform:scale(1.1);transform:scale(1.1)} diff --git a/openwisp_monitoring/device/static/monitoring/js/chart.css b/openwisp_monitoring/device/static/monitoring/js/chart.css new file mode 100644 index 000000000..9aea8a1cc --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/chart.css @@ -0,0 +1,156 @@ +#ow-chart-fallback { + text-align: center; +} +#ow-chart-utils { + display: flex; + justify-content: space-between; +} +#ow-chart-utils .select2-container { + min-width: 150px !important; + width: unset !important; +} +#ow-chart-utils span.select2-selection { + min-height: 27px; + min-width: 200px; + height: 27px; +} +#ow-chart-utils .select2-selection__rendered { + line-height: 27px; + height: 27px; +} +#ow-chart-utils .select2-selection__arrow { + top: 0; + height: 27px; +} +#ow-chart-utils > span { + display: flex; + justify-content: space-between; + width: 100%; +} +#ow-chart-utils .button { + font-size: 14px; + padding: 5px 10px; +} +#ow-chart-export { + margin-left: 10px; +} +#ow-chart-fallback { + display: none; + border: 0 none; +} +#ow-chart-contents > div { + position: relative; +} +.chart-help { + display: inline-block; + width: 22px; + height: 21px; + text-indent: -9999px; + background: url(../../admin/img/icon-unknown.svg) 0 0 no-repeat; + background-size: 80%; + background-position: 50% 50%; + opacity: 0.6; + cursor: pointer; + margin-left: 3px; +} +.chart-heading { + margin: 0; + font-size: 2em; + text-align: center; + font-size: 1.22em; + font-weight: normal; + color: #434b62; +} +.ow-chart { + margin-top: 1.5em; + padding-top: 1.5em; + border-top: 1px dotted rgba(0, 0, 0, 0.2); + text-align: center; +} +.ow-chart:first-child { + border: 0 none; + padding-top: 0; + margin-top: 2.25em; +} +.ow-chart .summary { + text-align: right; + margin: 0; +} +.ow-chart .circle { + display: inline-block; + float: none; + margin: 0em 0.15em 0 0.15em; + background: rgba(0, 0, 0, 0.125); +} +#ow-chart-contents .percircle:hover > span { + transform: scale(1.15) translateY(-50%); + letter-spacing: -0.3px; +} +.percircle:hover:after { + transform: scale(1.05); +} +.percircle.small { + font-size: 90px; +} +.ow-chart .custom-legend { + margin: 0 0 1.5em; +} +.ow-chart .legend { + display: inline-block; + margin: 0 0.5em; + font-size: 13px; + cursor: default; +} +.ow-chart .legend span { + display: inline-block; + width: 10px; + height: 10px; + margin-right: 2px; +} +#ow-chart-contents .circle > span { + font-size: 0.15em; + word-spacing: -0.75px; + color: var(--ow-overlay-60) !important; + font-size: 13px; + font-weight: bold; +} +#ow-chart-contents b { + background-color: var(--ow-color-black) !important; +} +.chart-heading { + margin: 0; + font-size: 2em; + text-align: center; + font-size: 1.22em; + font-weight: normal; + color: #434b62; +} +#chart-loading-overlay { + width: 100%; + margin: 25px auto; + display: none; +} +.tooltip { + position: absolute; + background-color: rgba(0, 0, 0, 0.7); + color: var(--ow-color-white); + padding: 15px !important; + max-width: 500px; + line-height: 1.6em; + border-radius: 4px; + top: 40%; + left: 50%; + transform: translate(-50%, -50%); + text-align: center; + display: none; + font-size: 1.2em; +} +@media (max-width: 768px) { + #ow-chart-utils { + display: block; + } + #ow-chart-utils > span + span { + margin: 5px 0px; + justify-content: end; + } +} diff --git a/openwisp_monitoring/device/static/monitoring/js/device-map.js b/openwisp_monitoring/device/static/monitoring/js/device-map.js index 426efaa16..264891656 100644 --- a/openwisp_monitoring/device/static/monitoring/js/device-map.js +++ b/openwisp_monitoring/device/static/monitoring/js/device-map.js @@ -10,7 +10,7 @@ problem: "#ffb442", critical: "#a72d1d", unknown: "#353c44", - deactivated: "#000000", + deactivated: "000", }; const STATUS_COLORS = window._owGeoMapConfig.STATUS_COLORS; const STATUS_LABELS = window._owGeoMapConfig.labels; diff --git a/openwisp_monitoring/device/static/monitoring/js/floorplan.js b/openwisp_monitoring/device/static/monitoring/js/floorplan.js index 4a080033d..0d607ef98 100644 --- a/openwisp_monitoring/device/static/monitoring/js/floorplan.js +++ b/openwisp_monitoring/device/static/monitoring/js/floorplan.js @@ -417,8 +417,8 @@ nodeConfig: { label: { show: true, - color: "#ffffff", - backgroundColor: "#000000", + color: "var(--ow-color-white)", + backgroundColor: "var(--ow-color-black)", borderWidth: 1, borderRadius: 8, opacity: 1, diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.echarts.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.echarts.min.js new file mode 100644 index 000000000..9ab053ad0 --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.echarts.min.js @@ -0,0 +1 @@ +(()=>{"use strict";function t(t,e){function n(){this.constructor=t}if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ed(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function e(){return bd++}function n(){for(var t=[],e=0;e>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",r[l]+":0",i[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}(e,o),s=function(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,p=h.left,d=h.top;a.push(p,d),l=l&&o&&p===o[c]&&d===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?rt(s,a):rt(a,s))}(a,o,r);if(s)return s(t,n,i),!0}return!1}function at(t){return"CANVAS"===t.nodeName.toUpperCase()}function st(t){return null==t?"":(t+"").replace(Vd,function(t,e){return Hd[e]})}function lt(t,e,n,i){return n=n||{},i?ut(t,e,n):Ud&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):ut(t,e,n),n}function ut(t,e,n){if(rd.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(at(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(ot(Gd,t,i,r))return n.zrX=Gd[0],void(n.zrY=Gd[1])}n.zrX=n.zrY=0}function ht(t){return t||window.event}function ct(t,e,n){if(null!=(e=ht(e)).zrX)return e;var i=e.type;if(i&&i.indexOf("touch")>=0){var r="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];r&<(t,r,e,n)}else{lt(t,e,e,n);var o=function(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;return null==n||null==i?e:3*(0!==i?Math.abs(i):Math.abs(n))*(i>0?-1:i<0?1:n>0?-1:1)}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&Wd.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function pt(t,e,n,i){t.addEventListener(e,n,i)}function dt(t,e,n,i){t.removeEventListener(e,n,i)}function ft(t){return 2===t.which||3===t.which}function gt(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function yt(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function mt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function vt(t,e,n){var i=e[1]*n[0]+e[3]*n[1],r=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],a=e[0]*n[4]+e[2]*n[5]+e[4],s=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=e[0]*n[0]+e[2]*n[1],t[1]=i,t[2]=r,t[3]=o,t[4]=a,t[5]=s,t}function _t(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function xt(t,e,n,i){void 0===i&&(i=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],u=e[5],h=Math.sin(n),c=Math.cos(n);return t[0]=r*c+s*h,t[1]=-r*h+s*c,t[2]=o*c+l*h,t[3]=-o*h+c*l,t[4]=c*(a-i[0])+h*(u-i[1])+i[0],t[5]=c*(u-i[1])-h*(a-i[0])+i[1],t}function wt(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(t[0]=a*(l=1/l),t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function bt(){jd(this.event)}function St(t,e,n){if(t[t.rectHover?"rectContain":"contain"](e,n)){for(var i=t,r=void 0,o=!1;i;){if(i.ignoreClip&&(o=!0),!o){var a=i.getClipPath();if(a&&!a.contain(e,n))return!1}i.silent&&(r=!0),i=i.__hostTarget||i.parent}return!r||sf}return!1}function Ct(t,e,n,i,r){for(var o=t.length-1;o>=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=St(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==sf)){e.target=a;break}}}function Mt(t,e,n){var i=t.painter;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}function Tt(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function It(t,e,n,i,r){for(i===e&&i++;i>>1])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function kt(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function Dt(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function At(t,e,n,i){n||(n=0),i||(i=t.length);var r=i-n;if(!(r<2)){var o=0;if(r<32)It(t,n,i,n+(o=Tt(t,n,i,e)),e);else{var a=function(t,e){function n(n){var l=i[n],u=r[n],h=i[n+1],c=r[n+1];r[n]=u+c,n===a-3&&(i[n+1]=i[n+2],r[n+1]=r[n+2]),a--;var p=Dt(t[h],t,l,u,0,e);l+=p,0!==(u-=p)&&0!==(c=kt(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(n,i,r,a){var l=0;for(l=0;l=7||d>=7);if(f)break;g<0&&(g=0),g+=2}if((o=g)<1&&(o=1),1===i){for(l=0;l=0;l--)t[d+l]=t[p+l];if(0===i){m=!0;break}}if(t[c--]=s[h--],1===--a){m=!0;break}if(0!==(y=a-kt(t[u],s,0,a,a-1,e))){for(a-=y,d=1+(c-=y),p=1+(h-=y),l=0;l=7||y>=7);if(m)break;f<0&&(f=0),f+=2}if((o=f)<1&&(o=1),1===a){for(d=1+(c-=i),p=1+(u-=i),l=i-1;l>=0;l--)t[d+l]=t[p+l];t[c]=s[h]}else{if(0===a)throw new Error;for(p=c-(a-1),l=0;l=0;l--)t[d+l]=t[p+l];t[c]=s[h]}else for(p=c-(a-1),l=0;l1;){var t=a-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;n(t)}},forceMergeRuns:function(){for(;a>1;){var t=a-2;t>0&&r[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=Tt(t,n,i,e))s&&(l=s),It(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}}function Lt(){ff||(ff=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function Ot(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function Pt(t){return t>-1e-8&&tbf||t<-1e-8}function Nt(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function Et(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function zt(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,p=l*l-3*s*u,d=0;if(Pt(h)&&Pt(c))Pt(s)?o[0]=0:(C=-l/s)>=0&&C<=1&&(o[d++]=C);else{var f=c*c-4*h*p;if(Pt(f)){var g=c/h,y=-g/2;(C=-s/a+g)>=0&&C<=1&&(o[d++]=C),y>=0&&y<=1&&(o[d++]=y)}else if(f>0){var m=wf(f),v=h*s+1.5*a*(-c+m),_=h*s+1.5*a*(-c-m);(C=(-s-((v=v<0?-xf(-v,Mf):xf(v,Mf))+(_=_<0?-xf(-_,Mf):xf(_,Mf))))/(3*a))>=0&&C<=1&&(o[d++]=C)}else{var x=(2*h*s-3*a*c)/(2*wf(h*h*h)),w=Math.acos(x)/3,b=wf(h),S=Math.cos(w),C=(-s-2*b*S)/(3*a),M=(y=(-s+b*(S+Cf*Math.sin(w)))/(3*a),(-s+b*(S-Cf*Math.sin(w)))/(3*a));C>=0&&C<=1&&(o[d++]=C),y>=0&&y<=1&&(o[d++]=y),M>=0&&M<=1&&(o[d++]=M)}}return d}function Bt(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(Pt(a))Rt(o)&&(h=-s/o)>=0&&h<=1&&(r[l++]=h);else{var u=o*o-4*a*s;if(Pt(u))r[0]=-o/(2*a);else if(u>0){var h,c=wf(u),p=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),p>=0&&p<=1&&(r[l++]=p)}}return l}function Ft(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function Vt(t,e,n,i,r,o,a,s,l){for(var u=t,h=e,c=0,p=1/l,d=1;d<=l;d++){var f=d*p,g=Nt(t,n,r,a,f),y=Nt(e,i,o,s,f),m=g-u,v=y-h;c+=Math.sqrt(m*m+v*v),u=g,h=y}return c}function Ht(t,e,n,i){var r=1-i;return r*(r*t+2*i*e)+i*i*n}function Wt(t,e,n,i){return 2*((1-i)*(e-t)+i*(n-e))}function Gt(t,e,n){var i=t+n-2*e;return 0===i?.5:(t-e)/i}function Ut(t,e,n,i,r){var o=(e-t)*i+t,a=(n-e)*i+e,s=(a-o)*i+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=n}function jt(t,e,n,i,r,o,a){for(var s=t,l=e,u=0,h=1/a,c=1;c<=a;c++){var p=c*h,d=Ht(t,n,r,p),f=Ht(e,i,o,p),g=d-s,y=f-l;u+=Math.sqrt(g*g+y*y),s=d,l=f}return u}function Zt(t){var e=t&&Df.exec(t);if(e){var n=e[1].split(","),i=+P(n[0]),r=+P(n[1]),o=+P(n[2]),a=+P(n[3]);if(isNaN(i+r+o+a))return;var s=[];return function(t){return t<=0?0:t>=1?1:zt(0,i,o,1,t,s)&&Nt(0,r,a,1,s[0])}}}function Yt(t){return(t=Math.round(t))<0?0:t>255?255:t}function Xt(t){return t<0?0:t>1?1:t}function qt(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Yt(parseFloat(e)/100*255):Yt(parseInt(e,10))}function $t(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Xt(parseFloat(e)/100):Xt(parseFloat(e))}function Kt(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function Jt(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Qt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function te(t,e){zf&&Qt(zf,e),zf=Ef.put(t,zf||e.slice())}function ee(t,e){if(t){e=e||[];var n=Ef.get(t);if(n)return Qt(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in Nf)return Qt(e,Nf[i]),te(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(Jt(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),te(t,e),e):void Jt(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(Jt(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),te(t,e),e):void Jt(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?Jt(e,+u[0],+u[1],+u[2],1):Jt(e,0,0,0,1);h=$t(u.pop());case"rgb":return u.length>=3?(Jt(e,qt(u[0]),qt(u[1]),qt(u[2]),3===u.length?h:$t(u[3])),te(t,e),e):void Jt(e,0,0,0,1);case"hsla":return 4!==u.length?void Jt(e,0,0,0,1):(u[3]=$t(u[3]),ne(u,e),te(t,e),e);case"hsl":return 3!==u.length?void Jt(e,0,0,0,1):(ne(u,e),te(t,e),e);default:return}}Jt(e,0,0,0,1)}}function ne(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=$t(t[1]),r=$t(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return Jt(e=e||[],Yt(255*Kt(a,o,n+1/3)),Yt(255*Kt(a,o,n)),Yt(255*Kt(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function ie(t,e){var n=ee(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return re(n,4===n.length?"rgba":"rgb")}}function re(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function oe(t,e){var n=ee(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function ae(t){if(v(t)){var e=Bf.get(t);return e||(e=ie(t,-.1),Bf.put(t,e)),e}if(M(t)){var n=o({},t);return n.colorStops=c(t.colorStops,function(t){return{offset:t.offset,color:ie(t.color,-.1)}}),n}return t}function se(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var n=ee(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}}else t="none";return{color:t,opacity:null==e?1:e}}function le(t){return t-1e-4}function ue(t){return Ff(1e3*t)/1e3}function he(t){return Ff(1e4*t)/1e4}function ce(t){return t&&!!t.image}function pe(t){return ce(t)||function(t){return t&&!!t.svgElement}(t)}function de(t){return"linear"===t.type}function fe(t){return"radial"===t.type}function ge(t){return t&&("linear"===t.type||"radial"===t.type)}function ye(t){return"url(#"+t+")"}function me(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function ve(t){var e=t.x||0,n=t.y||0,i=(t.rotation||0)*kd,r=k(t.scaleX,1),o=k(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||n)&&l.push("translate("+e+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+Ff(a*kd)+"deg, "+Ff(s*kd)+"deg)"),l.join(" ")}function _e(t,e,n){return(e-t)*n+t}function xe(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;sdg||t<-5e-5}function Ee(t,e){for(var n=0;n<_g.length;n++){var i=_g[n];t[i]=e[i]}}function ze(t,e){var n=wg[e=e||ld];n||(n=wg[e]=new Rf(500));var i=n.get(t);return null==i&&(i=hd.measureText(t,e).width,n.put(t,i)),i}function Be(t,e,n,i){var r=ze(t,e),o=We(e),a=Ve(0,r,n),s=He(0,o,i);return new af(a,s,r,o)}function Fe(t,e,n,i){var r=((t||"")+"").split("\n");if(1===r.length)return Be(r[0],e,n,i);for(var o=new af(0,0,0,0),a=0;a=0?parseFloat(t)/100*e:parseFloat(t):t}function Ue(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=Ge(i[0],n.width),u+=Ge(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}function je(t,e,n,i,r){var o=[];Xe(t,"",t,e,n=n||{},i,o,r);var a=o.length,s=!1,l=n.done,u=n.aborted,h=function(){s=!0,--a<=0&&(s?l&&l():u&&u())},c=function(){--a<=0&&(s?l&&l():u&&u())};a||l&&l(),o.length>0&&n.during&&o[0].during(function(t,e){n.during(e)});for(var p=0;p0||r.force&&!a.length){var I,k=void 0,D=void 0,A=void 0;if(l)for(D={},y&&(k={}),C=0;C0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function Ke(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return v(t)?(n=t,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var n}function Je(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),n?t:+t}function Qe(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return function(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf(".");return Math.max(0,(o<0?0:r-1-o)-i)}(t)}function tn(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function en(t,e){var n=Math.max(Qe(t),Qe(e)),i=t+e;return n>20?i:Je(i,n)}function nn(t){var e=2*Math.PI;return(t%e+e)%e}function rn(t){return t>-1e-4&&t=10&&e++,e}function sn(t,e){var n=an(t),i=Math.pow(10,n),r=t/i;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t}function ln(t){var e=parseFloat(t);return e==t&&(0!==e||!v(t)||t.indexOf("x")<=0)?e:NaN}function un(){return Math.round(9*Math.random())}function hn(t,e){return 0===e?t:hn(e,t%e)}function cn(t,e){return null==t?e:null==e?t:t*e/hn(t,e)}function pn(t){return t instanceof Array?t:null==t?[]:[t]}function dn(t,e,n){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var i=0,r=n.length;i=0||r&&s(r,l)<0)){var u=n.getShallow(l,e);null!=u&&(o[t[a][0]]=u)}}return o}}function Nn(t){if("string"==typeof t){var e=Xg.get(t);return e&&e.image}return t}function En(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=Xg.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?!Bn(e=o.image)&&o.pending.push(a):((e=hd.loadImage(t,zn,zn)).__zrImageSrc=t,Xg.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function zn(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=s;u++)l-=s;var h=ze(n,e);return h>l&&(n="",h=0),l=t-h,r.ellipsis=n,r.ellipsisWidth=h,r.contentWidth=l,r.containerWidth=t,r}function Hn(t,e,n){var i=n.containerWidth,r=n.font,o=n.contentWidth;if(!i)return t.textLine="",void(t.isTruncated=!1);var a=ze(e,r);if(a<=i)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=o||s>=n.maxIterations){e+=n.ellipsis;break}var l=0===s?Wn(e,o,n.ascCharWidth,n.cnCharWidth):a>0?Math.floor(e.length*o/a):0;a=ze(e=e.substr(0,l),r)}""===e&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function Wn(t,e,n,i){for(var r=0,o=0,a=t.length;o0&&f+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=f}else{var g=jn(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+d,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var y=0;y=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}(t)||!!Qg[t]}function jn(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+d>n)?h?(s||l)&&(f?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=p,s="",h=u+=d):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=p,h=d)):f?(o.push(l),a.push(u),l=p,u=d):(o.push(p),a.push(d)):(h+=d,f?(l+=p,u+=d):(l&&(s+=l,l="",u=0),s+=p))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}function Zn(t,e,n,i,r,o){r[0]=uy(t,n),r[1]=uy(e,i),o[0]=hy(t,n),o[1]=hy(e,i)}function Yn(t,e,n,i,r,o,a,s,l,u){var h=Bt,c=Nt,p=h(t,n,r,a,my);l[0]=1/0,l[1]=1/0,u[0]=-1/0,u[1]=-1/0;for(var d=0;d1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(fy[0]=py(r)*n+t,fy[1]=cy(r)*i+e,gy[0]=py(o)*n+t,gy[1]=cy(o)*i+e,u(s,fy,gy),h(l,fy,gy),(r%=dy)<0&&(r+=dy),(o%=dy)<0&&(o+=dy),r>o&&!a?o+=dy:rr&&(yy[0]=py(d)*n+t,yy[1]=cy(d)*i+e,u(s,yy,s),h(l,yy,l))}function $n(t){return Math.round(t/Ly*1e8)/1e8%2*Ly}function Kn(t,e,n,i,r,o,a){if(0===r)return!1;var s,l=r;if(a>e+l&&a>i+l||at+l&&o>n+l||oe+c&&h>i+c&&h>o+c&&h>s+c||ht+c&&u>n+c&&u>r+c&&u>a+c||u=0&&de+u&&l>i+u&&l>o+u||lt+u&&s>n+u&&s>r+u||s=0&&gn||h+ur&&(r+=By);var p=Math.atan2(l,s);return p<0&&(p+=By),p>=i&&p<=r||p+By>=i&&p+By<=r}function ni(t,e,n,i,r,o){if(o>e&&o>i||or?s:0}function ii(){var t=Wy[0];Wy[0]=Wy[1],Wy[1]=t}function ri(t,e,n,i,r,o,a,s,l,u){if(u>e&&u>i&&u>o&&u>s||u1&&ii(),d=Nt(e,i,o,s,Wy[0]),p>1&&(f=Nt(e,i,o,s,Wy[1]))),c+=2===p?ye&&s>i&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(Pt(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=wf(u),p=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),p>=0&&p<=1&&(r[l++]=p)}}return l}(e,i,o,s,Hy);if(0===l)return 0;var u=Gt(e,i,o);if(u>=0&&u<=1){for(var h=0,c=Ht(e,i,o,u),p=0;pn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);Hy[0]=-l,Hy[1]=l;var u=Math.abs(i-r);if(u<1e-4)return 0;if(u>=Vy-1e-4){i=0,r=Vy;var h=o?1:-1;return a>=Hy[0]+t&&a<=Hy[1]+t?h:0}if(i>r){var c=i;i=r,r=c}i<0&&(i+=Vy,r+=Vy);for(var p=0,d=0;d<2;d++){var f=Hy[d];if(f+t>a){var g=Math.atan2(s,f);h=o?1:-1,g<0&&(g=Vy+g),(g>=i&&g<=r||g+Vy>=i&&g+Vy<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),p+=h)}}return p}function si(t,e,n,i,r){for(var o,a,s=t.data,l=t.len(),u=0,h=0,c=0,p=0,d=0,f=0;f1&&(n||(u+=ni(h,c,p,d,i,r))),y&&(p=h=s[f],d=c=s[f+1]),g){case Fy.M:h=p=s[f++],c=d=s[f++];break;case Fy.L:if(n){if(Kn(h,c,s[f],s[f+1],e,i,r))return!0}else u+=ni(h,c,s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case Fy.C:if(n){if(Jn(h,c,s[f++],s[f++],s[f++],s[f++],s[f],s[f+1],e,i,r))return!0}else u+=ri(h,c,s[f++],s[f++],s[f++],s[f++],s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case Fy.Q:if(n){if(Qn(h,c,s[f++],s[f++],s[f],s[f+1],e,i,r))return!0}else u+=oi(h,c,s[f++],s[f++],s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case Fy.A:var m=s[f++],v=s[f++],_=s[f++],x=s[f++],w=s[f++],b=s[f++];f+=1;var S=!!(1-s[f++]);o=Math.cos(w)*_+m,a=Math.sin(w)*x+v,y?(p=o,d=a):u+=ni(h,c,o,a,i,r);var C=(i-m)*x/_+m;if(n){if(ei(m,v,x,w,w+b,S,e,C,r))return!0}else u+=ai(m,v,x,w,w+b,S,C,r);h=Math.cos(w+b)*_+m,c=Math.sin(w+b)*x+v;break;case Fy.R:if(p=h=s[f++],d=c=s[f++],o=p+s[f++],a=d+s[f++],n){if(Kn(p,d,o,d,e,i,r)||Kn(o,d,o,a,e,i,r)||Kn(o,a,p,a,e,i,r)||Kn(p,a,p,d,e,i,r))return!0}else u+=ni(o,d,o,a,i,r),u+=ni(p,a,p,d,i,r);break;case Fy.Z:if(n){if(Kn(h,c,p,d,e,i,r))return!0}else u+=ni(h,c,p,d,i,r);h=p,c=d}}return n||Math.abs(c-d)<1e-4||(u+=ni(h,c,p,d,i,r)||0),0!==u}function li(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(tm(2*i)===tm(2*r)&&(t.x1=t.x2=hi(i,s,!0)),tm(2*o)===tm(2*a)&&(t.y1=t.y2=hi(o,s,!0)),t):t}}function ui(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=hi(i,s,!0),t.y=hi(r,s,!0),t.width=Math.max(hi(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(hi(r+a,s,!1)-t.y,0===a?0:1),t):t}}function hi(t,e,n){if(!e)return t;var i=tm(2*t);return(i+tm(e))%2==0?i/2:(i+(n?1:-1))/2}function ci(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?"12px":t+"px":t}function pi(t,e){for(var n=0;n=0,a=!1;if(t instanceof Zy){var l=gm(t),u=r&&l.selectFill||l.normalFill,h=r&&l.selectStroke||l.normalStroke;if(xi(u)||xi(h)){var c=(i=i||{}).style||{};"inherit"===c.fill?(a=!0,i=o({},i),(c=o({},c)).fill=u):!xi(c.fill)&&xi(u)?(a=!0,i=o({},i),(c=o({},c)).fill=ae(u)):!xi(c.stroke)&&xi(h)&&(a||(i=o({},i),c=o({},c)),c.stroke=ae(h)),i.style=c}}if(i&&null==i.z2){a||(i=o({},i));var p=t.z2EmphasisLift;i.z2=t.z2+(null!=p?p:10)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=s(t.currentStates,e)>=0,r=t.style.opacity,a=i?null:function(t,e,n,i){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}})}),e}function Zi(t,e,n){Xi(t,!0),Di(t,Li),function(t,e,n){var i=pm(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}(t,e,n)}function Yi(t,e,n,i){i?function(t){Xi(t,!1)}(t):Zi(t,e,n)}function Xi(t,e){var n=!1===e,i=t;t.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=t.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function qi(t){return!(!t||!t.__highDownDispatcher)}function $i(t){var e=t.type;return e===wm||e===bm||e===Sm}function Ki(t){var e=t.type;return e===_m||e===xm}function Ji(t,e,n){var i,r=t.labelFetcher,o=t.labelDataIndex,a=t.labelDimIndex,s=e.normal;r&&(i=r.getFormattedLabel(o,"normal",null,a,s&&s.get("formatter"),null!=n?{interpolatedValue:n}:null)),null==i&&(i=m(t.defaultText)?t.defaultText(o,t,n):t.defaultText);for(var l={normal:i},u=0;u=12?"pm":"am",y=g.toUpperCase(),m=i instanceof Wm?i:function(t){return Xm[t]}(i||qm)||Xm[Zm],v=m.getModel("time"),_=v.get("month"),x=v.get("monthAbbr"),w=v.get("dayOfWeek"),b=v.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,sr(o%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,_[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,sr(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,sr(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[u]).replace(/{ee}/g,b[u]).replace(/{e}/g,u+"").replace(/{HH}/g,sr(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,sr(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,sr(p,2)).replace(/{m}/g,p+"").replace(/{ss}/g,sr(d,2)).replace(/{s}/g,d+"").replace(/{SSS}/g,sr(f,3)).replace(/{S}/g,f+"")}function cr(t,e){var n=on(t),i=n[fr(e)]()+1,r=n[gr(e)](),o=n[yr(e)](),a=n[mr(e)](),s=n[vr(e)](),l=0===n[_r(e)](),u=l&&0===s,h=u&&0===a,c=h&&0===o,p=c&&1===r;return p&&1===i?"year":p?"month":c?"day":h?"hour":u?"minute":l?"second":"millisecond"}function pr(t,e,n){var i=x(t)?on(t):t;switch(e=e||cr(t,n)){case"year":return i[dr(n)]();case"half-year":return i[fr(n)]()>=6?1:0;case"quarter":return Math.floor((i[fr(n)]()+1)/4);case"month":return i[fr(n)]();case"day":return i[gr(n)]();case"half-day":return i[yr(n)]()/24;case"hour":return i[yr(n)]();case"minute":return i[mr(n)]();case"second":return i[vr(n)]();case"millisecond":return i[_r(n)]()}}function dr(t){return t?"getUTCFullYear":"getFullYear"}function fr(t){return t?"getUTCMonth":"getMonth"}function gr(t){return t?"getUTCDate":"getDate"}function yr(t){return t?"getUTCHours":"getHours"}function mr(t){return t?"getUTCMinutes":"getMinutes"}function vr(t){return t?"getUTCSeconds":"getSeconds"}function _r(t){return t?"getUTCMilliseconds":"getMilliseconds"}function xr(t){return t?"setUTCFullYear":"setFullYear"}function wr(t){return t?"setUTCMonth":"setMonth"}function br(t){return t?"setUTCDate":"setDate"}function Sr(t){return t?"setUTCHours":"setHours"}function Cr(t){return t?"setUTCMinutes":"setMinutes"}function Mr(t){return t?"setUTCSeconds":"setSeconds"}function Tr(t){return t?"setUTCMilliseconds":"setMilliseconds"}function Ir(t){if(isNaN(ln(t)))return v(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function kr(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function Dr(t,e,n){function i(t){return t&&P(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="time"===e,a=t instanceof Date;if(o||a){var s=o?on(t):t;if(!isNaN(+s))return hr(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(a)return"-"}if("ordinal"===e)return _(t)?i(t):x(t)&&r(t)?t+"":"-";var l=ln(t);return r(l)?Ir(l):_(t)?i(t):"boolean"==typeof t?t+"":"-"}function Ar(t,e,n){y(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;oi||l.newline?(o=0,h=g,a+=s+n,s=p.height):s=Math.max(s,p.height)}else{var y=p.height+(f?-f.y+p.y:0);(c=a+y)>r||l.newline?(o+=s+n,a=0,c=y,s=p.width):s=Math.max(s,p.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)})}function Rr(t,e,n){n=av(n||0);var i=e.width,r=e.height,o=Ke(t.left,i),a=Ke(t.top,r),s=Ke(t.right,i),l=Ke(t.bottom,r),u=Ke(t.width,i),h=Ke(t.height,r),c=n[2]+n[0],p=n[1]+n[3],d=t.aspect;switch(isNaN(u)&&(u=i-s-p-o),isNaN(h)&&(h=r-l-c-a),null!=d&&(isNaN(u)&&isNaN(h)&&(d>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=d*h),isNaN(h)&&(h=u/d)),isNaN(o)&&(o=i-s-u-p),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-p}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-p-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var f=new af(o+n[3],a+n[0],u,h);return f.margin=n,f}function Nr(t,e,n,i,r,o){var s,l=!r||!r.hv||r.hv[0],u=!r||!r.hv||r.hv[1],h=r&&r.boundingMode||"all";if((o=o||t).x=t.x,o.y=t.y,!l&&!u)return!1;if("raw"===h)s="group"===t.type?new af(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(s=t.getBoundingRect(),t.needLocalTransform()){var c=t.getLocalTransform();(s=s.clone()).applyTransform(c)}var p=Rr(a({width:s.width,height:s.height},e),n,i),d=l?p.x-s.x:0,f=u?p.y-s.y:0;return"raw"===h?(o.x=d,o.y=f):(o.x+=d,o.y+=f),o===t&&t.markRedraw(),!0}function Er(t){var e=t.layoutMode||t.constructor.layoutMode;return w(e)?e:e?{type:e}:null}function zr(t,e,n){function i(n,i){var a={},l=0,u={},h=0;if(uv(n,function(e){u[e]=t[e]}),uv(n,function(t){r(e,t)&&(a[t]=u[t]=e[t]),o(a,t)&&l++,o(u,t)&&h++}),s[i])return o(e,n[1])?u[n[2]]=null:o(e,n[2])&&(u[n[1]]=null),u;if(2!==h&&l){if(l>=2)return a;for(var c=0;c=e:"max"===n?t<=e:t===e})(i[a],t,o)||(r=!1)}}),r}function Yr(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=i_.length;n=0;g--){var y=t[g];if(s||(p=y.data.rawIndexOf(y.stackedByDimension,c)),p>=0){var m=y.data.getByRawIndex(y.stackResultDimension,p);if("all"===l||"positive"===l&&m>0||"negative"===l&&m<0||"samesign"===l&&d>=0&&m>0||"samesign"===l&&d<=0&&m<0){d=en(d,m),f=m;break}}}return i[0]=d,i[1]=f,i})})}function so(t){return t instanceof s_}function lo(t,e,n){n=n||ho(t);var r=e.seriesLayoutBy,o=function(t,e,n,i,r){var o,a;if(!t)return{dimensionsDefine:co(r),startIndex:a,dimensionsDetectedCount:o};if(e===Cv){var s=t;"auto"===i||null==i?po(function(t){null!=t&&"-"!==t&&(v(t)?null==a&&(a=1):a=0)},n,s,10):a=x(i)?i:i?1:0,r||1!==a||(r=[],po(function(t,e){r[e]=null!=t?t+"":""},n,s,1/0)),o=r?r.length:n===Av?s.length:s[0]?s[0].length:null}else if(e===Mv)r||(r=function(t){for(var e,n=0;n65535?S_:C_}function Lo(){return[1/0,-1/0]}function Oo(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function Po(t,e,n,i,r){var o=I_[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;u1||n>0&&!t.noHeader;return h(t.blocks,function(t){var n=Ho(t);n>=e&&(e=n+ +(i&&(!n||Fo(t)&&!t.noHeader)))}),e}return 0}function Wo(t,e,n,i){var r,a=e.noHeader,s=(r=Ho(e),{html:L_[r],richText:O_[r]}),l=[],u=e.blocks||[];O(!u||y(u)),u=u||[];var c=t.orderMode;if(e.sortBlocks&&c){u=u.slice();var p={valueAsc:"asc",valueDesc:"desc"};if(V(p,c)){var d=new __(p[c],null);u.sort(function(t,e){return d.evaluate(t.sortParam,e.sortParam)})}else"seriesDesc"===c&&u.reverse()}h(u,function(n,r){var a=e.valueFormatter,u=Vo(n)(a?o(o({},t),{valueFormatter:a}):t,n,r>0?s.html:0,i);null!=u&&l.push(u)});var f="richText"===t.renderMode?l.join(s.richText):jo(i,l.join(""),a?n:s.html);if(a)return f;var g=Dr(e.header,"ordinal",t.useUTC),m=zo(i,t.renderMode).nameStyle,v=Eo(i);return"richText"===t.renderMode?Zo(t,g,m)+s.richText+f:jo(i,'
'+st(g)+"
"+f,n)}function Go(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return c(t=y(t)?t:[t],function(t,e){return Dr(t,y(f)?f[e]:f,u)})};if(!o||!a){var p=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),d=o?"":Dr(l,"ordinal",u),f=e.valueType,g=a?[]:h(e.value,e.dataIndex),m=!s||!o,v=!s&&o,_=zo(i,r),x=_.nameStyle,w=_.valueStyle;return"richText"===r?(s?"":p)+(o?"":Zo(t,d,x))+(a?"":function(t,e,n,i,r){var o=[r];return n&&o.push({padding:[0,0,0,i?10:20],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(y(e)?e.join(" "):e,o)}(t,g,m,v,w)):jo(i,(s?"":p)+(o?"":function(t,e,n){return''+st(t)+""}(d,!s,x))+(a?"":function(t,e,n,i){return''+c(t=y(t)?t:[t],function(t){return st(t)}).join("  ")+""}(g,m,v,w)),n)}}function Uo(t,e,n,i,r,o){if(t)return Vo(t)({useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function jo(t,e,n){return'
'+e+'
'}function Zo(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function Yo(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}function Xo(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),c=u.length,d=o.getRawValue(a),f=y(d),g=function(t,e){return Lr(t.getData().getItemVisual(e,"style")[t.visualDrawType])}(o,a);if(c>1||f&&!c){var m=function(t,e,n,i,r){function o(t,e){var n=a.getDimensionInfo(e);n&&!1!==n.otherDims.tooltip&&(s?c.push(Bo("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(l.push(t),u.push(n.type)))}var a=e.getData(),s=p(t,function(t,e,n){var i=a.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName},!1),l=[],u=[],c=[];return i.length?h(i,function(t){o(_o(a,n,t),t)}):h(t,o),{inlineValues:l,inlineValueTypes:u,blocks:c}}(d,o,a,u,g);e=m.inlineValues,n=m.inlineValueTypes,i=m.blocks,r=m.inlineValues[0]}else if(c){var v=l.getDimensionInfo(u[0]);r=e=_o(l,a,u[0]),n=v.type}else r=e=f?d[0]:d;var _=xn(o),x=_&&o.name||"",w=l.getName(a),b=s?x:w;return Bo("section",{header:x,noHeader:s||!_,sortParam:r,blocks:[Bo("nameValue",{markerType:"item",markerColor:g,name:b,noName:!P(b),value:e,valueType:n,dataIndex:a})].concat(i||[])})}function qo(t,e){return t.getName(e)||t.getId(e)}function $o(t){var e=t.name;xn(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return h(n,function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)}),i.join(" ")}(t)||e)}function Ko(t){return t.model.getRawData().count()}function Jo(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Qo}function Qo(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function ta(t,e){h(z(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(n){t.wrapMethod(n,g(ea,e))})}function ea(t,e){var n=na(t);return n&&n.setOutputEnd((e||this).count()),e}function na(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}function ia(){var t=Sn();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}function ra(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function oa(t,e){return(t[0]*e[0]+t[1]*e[1])/(ra(t)*ra(e))}function aa(t,e){return(t[0]*e[1]1&&(a*=G_(f),s*=G_(f));var g=(r===o?-1:1)*G_((a*a*(s*s)-a*a*(d*d)-s*s*(p*p))/(a*a*(d*d)+s*s*(p*p)))||0,y=g*a*d/s,m=g*-s*p/a,v=(t+n)/2+j_(c)*y-U_(c)*m,_=(e+i)/2+U_(c)*y+j_(c)*m,x=aa([1,0],[(p-y)/a,(d-m)/s]),w=[(p-y)/a,(d-m)/s],b=[(-1*p-y)/a,(-1*d-m)/s],S=aa(w,b);if(oa(w,b)<=-1&&(S=Z_),oa(w,b)>=1&&(S=0),S<0){var C=Math.round(S/Z_*1e6)/1e6;S=2*Z_+C%2*Z_}h.addData(u,v,_,a,s,x,S,c,o)}function la(t){return null!=t.setData}function ua(t,e){var n=function(t){var e=new Ey;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=Ey.CMD,l=t.match(Y_);if(!l)return e;for(var u=0;uA*A+L*L&&(C=T,M=I),{cx:C,cy:M,x0:-h,y0:-c,x1:C*(r/w-1),y1:M*(r/w-1)}}function ca(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=function(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var p=0,d=t.length;p0){var c={duration:h.duration,delay:h.delay||0,easing:h.easing,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,c):e.animateTo(n,c)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function ga(t,e,n,i,r,o){fa("update",t,e,n,i,r,o)}function ya(t,e,n,i,r,o){fa("enter",t,e,n,i,r,o)}function ma(t){if(!t.__zr)return!0;for(var e=0;eMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function Ra(t){return!t.isGroup}function Na(t,e,n){function i(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=o({},t.shape)),e}if(t&&e){var r,a=(r={},t.traverse(function(t){Ra(t)&&t.anid&&(r[t.anid]=t)}),r);e.traverse(function(t){if(Ra(t)&&t.anid){var e=a[t.anid];if(e){var r=i(t);t.attr(i(e)),ga(t,r,n,pm(t).dataIndex)}}})}}function Ea(t,e){return c(t,function(t){var n=t[0];n=Kx(n,e.x),n=Jx(n,e.x+e.width);var i=t[1];return i=Kx(i,e.y),[n,i=Jx(i,e.y+e.height)]})}function za(t,e){var n=Kx(t.x,e.x),i=Jx(t.x+t.width,e.x+e.width),r=Kx(t.y,e.y),o=Jx(t.y+t.height,e.y+e.height);if(i>=n&&o>=r)return{x:n,y:r,width:i-n,height:o-r}}function Ba(t,e,n){var i=o({rectHover:!0},e),r=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),a(r,n),new Qy(i)):Ma(t.replace("path://",""),i,n,"center")}function Fa(t,e,n,i,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var f=t-r,g=e-o,y=Ha(f,g,u,h)/d;if(y<0||y>1)return!1;var m=Ha(f,g,c,p)/d;return!(m<0||m>1)}function Ha(t,e,n,i){return t*i-n*e}function Wa(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=v(e)?{formatter:e}:e,o=n.mainType,s=n.componentIndex,l={componentType:o,name:i,$vars:["name"]};l[o+"Index"]=s;var u=t.formatterParamsExtra;u&&h(f(u),function(t){V(l,t)||(l[t]=u[t],l.$vars.push(t))});var c=pm(t.el);c.componentMainType=o,c.componentIndex=s,c.tooltipConfig={name:i,option:a({content:i,encodeHTMLContent:!0,formatterParams:l},r)}}function Ga(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Ua(t,e){if(t)if(y(t))for(var n=0;n=0?i():c=setTimeout(i,-o),u=r};return p.clear=function(){c&&(clearTimeout(c),c=null)},p.debounceNextCall=function(t){l=t},p}function $a(t,e,n,i){var r=t[e];if(r){var o=r[uw]||r;if(r[hw]!==n||r[cw]!==i){if(null==n||!i)return t[e]=o;(r=t[e]=qa(o,n,"debounce"===i))[uw]=o,r[cw]=i,r[hw]=n}return r}}function Ka(t,e){var n=t[e];n&&n[uw]&&(n.clear&&n.clear(),t[e]=n[uw])}function Ja(t,e){return t.visualStyleMapper||dw[e]||(console.warn("Unknown style type '"+e+"'."),dw.itemStyle)}function Qa(t,e){return t.visualDrawType||fw[e]||(console.warn("Unknown style type '"+e+"'."),"fill")}function ts(t){t.overallReset(t.ecModel,t.api,t.payload)}function es(t){return t.overallProgress&&ns}function ns(){this.agent.dirty(),this.getDownstream().dirty()}function is(){this.agent&&this.agent.dirty()}function rs(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function os(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=pn(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?c(e,function(t,e){return as(e)}):ww}function as(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o=0&&ys(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}(t,e,n):function(t,e,n){var i=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(i=i*n.width+n.x,r=r*n.width+n.x,o=o*n.height+n.y,a=a*n.height+n.y),i=ys(i)?i:0,r=ys(r)?r:1,o=ys(o)?o:0,a=ys(a)?a:0,t.createLinearGradient(i,o,r,a)}(t,e,n),r=e.colorStops,o=0;o0&&(n=i.lineWidth,(e=i.lineDash)&&"solid"!==e&&n>0?"dashed"===e?[4*n,2*n]:"dotted"===e?[n]:x(e)?[e]:y(e)?e:null:null),o=i.lineDashOffset;if(r){var a=i.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=c(r,function(t){return t/a}),o/=a)}return[r,o]}function ws(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function bs(t){return"string"==typeof t&&"none"!==t}function Ss(t){var e=t.fill;return null!=e&&"none"!==e}function Cs(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function Ms(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function Ts(t,e,n){var i=En(e.image,e.__image,n);if(Bn(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*kd),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}function Is(t,e,n,i,r){var o=!1;if(!i&&e===(n=n||{}))return!1;if(i||e.opacity!==n.opacity){As(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?ey.opacity:a}(i||e.blend!==n.blend)&&(o||(As(t,r),o=!0),t.globalCompositeOperation=e.blend||ey.blend);for(var s=0;s<$w.length;s++){var l=$w[s];(i||e[l]!==n[l])&&(o||(As(t,r),o=!0),t[l]=t.dpr*(e[l]||0))}return(i||e.shadowColor!==n.shadowColor)&&(o||(As(t,r),o=!0),t.shadowColor=e.shadowColor||ey.shadowColor),o}function ks(t,e,n,i,r){var o=Ls(e,r.inHover),a=i?null:n&&Ls(n,r.inHover)||{};if(o===a)return!1;var s=Is(t,o,a,i,r);if((i||o.fill!==a.fill)&&(s||(As(t,r),s=!0),bs(o.fill)&&(t.fillStyle=o.fill)),(i||o.stroke!==a.stroke)&&(s||(As(t,r),s=!0),bs(o.stroke)&&(t.strokeStyle=o.stroke)),(i||o.opacity!==a.opacity)&&(s||(As(t,r),s=!0),t.globalAlpha=null==o.opacity?1:o.opacity),e.hasStroke()){var l=o.lineWidth/(o.strokeNoScale&&e.getLineScale?e.getLineScale():1);t.lineWidth!==l&&(s||(As(t,r),s=!0),t.lineWidth=l)}for(var u=0;u=0)){jb.push(n);var o=Cw.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function $s(t,e){Vb[t]=e}function Ks(t=!1){return Zb||("undefined"!=typeof window&&window.L?(Zb=window.L,Zb):void(t||console.warn("Leaflet (L) is not defined! Make sure Leaflet is loaded before NetJSONGraph.")))}function Js(t,e,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;Qs(t,e,a,i,r,o),Js(t,e,n,i,a-1,1-o),Js(t,e,n,a+1,r,1-o)}function Qs(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);Qs(t,e,n,Math.max(i,Math.floor(n-s*u/a+h)),Math.min(r,Math.floor(n+(a-s)*u/a+h)),o)}const a=e[2*n+o];let s=i,l=r;for(tl(t,e,i,n),e[2*r+o]>a&&tl(t,e,i,r);sa;)l--}e[2*i+o]===a?tl(t,e,i,l):(l++,tl(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function tl(t,e,n,i){el(t,n,i),el(e,2*n,2*i),el(e,2*n+1,2*i+1)}function el(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function nl(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function il(t){y(t)?h(t,function(t){il(t)}):s(eS,t)>=0||(eS.push(t),m(t)&&(t={install:t}),t.install(nS))}function rl(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}function ol(t){return"_"+t+"Type"}function al(t,e,n){var i=e.getItemVisual(n,t);if(!i||"none"===i)return i;var r=e.getItemVisual(n,t+"Size"),o=e.getItemVisual(n,t+"Rotate"),a=e.getItemVisual(n,t+"Offset"),s=e.getItemVisual(n,t+"KeepAspect"),l=fs(r);return i+l+gs(a||0,l)+(o||"")+(s||"")}function sl(t,e,n){var i=e.getItemVisual(n,t);if(i&&"none"!==i){var r=e.getItemVisual(n,t+"Size"),o=e.getItemVisual(n,t+"Rotate"),a=e.getItemVisual(n,t+"Offset"),s=e.getItemVisual(n,t+"KeepAspect"),l=fs(r),u=gs(a||0,l),h=ds(i,-l[0]/2+u[0],-l[1]/2+u[1],l[0],l[1],null,s);return h.__specifiedRotation=null==o||isNaN(o)?void 0:+o*Math.PI/180||0,h.name=t,h}}function ll(t,e){t.x1=e[0][0],t.y1=e[0][1],t.x2=e[1][0],t.y2=e[1][1],t.percent=1;var n=e[2];n?(t.cpx1=n[0],t.cpy1=n[1]):(t.cpx1=NaN,t.cpy1=NaN)}function ul(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:tr(e)}}function hl(t){return isNaN(t[0])||isNaN(t[1])}function cl(t){return t&&!hl(t[0])&&!hl(t[1])}function pl(t){return null==t?0:t.length||1}function dl(t){return t}function fl(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function gl(t){return t instanceof ES}function yl(t){for(var e=E(),n=0;n<(t||[]).length;n++){var i=t[n],r=w(i)?i.name:i;null!=r&&null==e.get(r)&&e.set(r,n)}return e}function ml(t){var e=RS(t);return e.dimNameMap||(e.dimNameMap=yl(t.dimensionsDefine))}function vl(t){return t>30}function _l(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=c(e,function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),function(t){for(var e=t[0],n=1,i=t.length;n=0?i+=u:i-=u:f>=0?i-=u:i+=u}return i}function Xl(t,e){var n=[],i=Ut,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge(function(t,s){var l=t.getLayout(),u=t.getVisual("fromSymbol"),h=t.getVisual("toSymbol");l.__original||(l.__original=[j(l[0]),j(l[1])],l[2]&&l.__original.push(j(l[2])));var c=l.__original;if(null!=l[2]){if(U(r[0],c[0]),U(r[1],c[2]),U(r[2],c[1]),u&&"none"!==u){var p=Al(t.node1),d=Yl(r,c[0],p*e);i(r[0][0],r[1][0],r[2][0],d,n),r[0][0]=n[3],r[1][0]=n[4],i(r[0][1],r[1][1],r[2][1],d,n),r[0][1]=n[3],r[1][1]=n[4]}h&&"none"!==h&&(p=Al(t.node2),d=Yl(r,c[1],p*e),i(r[0][0],r[1][0],r[2][0],d,n),r[1][0]=n[1],r[2][0]=n[2],i(r[0][1],r[1][1],r[2][1],d,n),r[1][1]=n[1],r[2][1]=n[2]),U(l[0],r[0]),U(l[1],r[2]),U(l[2],r[1])}else U(o[0],c[0]),U(o[1],c[1]),q(a,o[1],o[0]),J(a,a),u&&"none"!==u&&(p=Al(t.node1),X(o[0],o[0],a,p*e)),h&&"none"!==h&&(p=Al(t.node2),X(o[1],o[1],a,-p*e)),U(l[0],o[0]),U(l[1],o[1])})}function ql(t){return"view"===t.type}function $l(t){return"_EC_"+t}function Kl(t,e){return{getValue:function(n){var i=this[t][e];return i.getStore().get(i.getDimensionIndex(n||"value"),this.dataIndex)},setVisual:function(n,i){this.dataIndex>=0&&this[t][e].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[t][e].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}function Jl(t,e){if(kC(this).mainData===this){var n=o({},kC(this).datas);n[this.dataType]=e,iu(e,n,t)}else ru(e,this.dataType,kC(this).mainData,t);return e}function Ql(t,e){return t.struct&&t.struct.update(),e}function tu(t,e){return h(kC(e).datas,function(n,i){n!==e&&ru(n.cloneShallow(),i,e,t)}),e}function eu(t){var e=kC(this).mainData;return null==t||null==e?e:kC(e).datas[t]}function nu(){var t=kC(this).mainData;return null==t?[{data:t}]:c(f(kC(t).datas),function(e){return{type:e,data:kC(t).datas[e]}})}function iu(t,e,n){kC(t).datas={},h(e,function(e,i){ru(e,i,t,n)})}function ru(t,e,n,i){kC(n).datas[e]=t,kC(t).mainData=n,t.dataType=e,i.struct&&(t[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=t),t.getLinkedData=eu,t.getLinkedDataAll=nu}function ou(t,e){function n(t){var e=_[t];if(e<0){var n=l[t],i=w(n)?n:{name:n},r=new TS,o=i.name;return null!=o&&null!=g.get(o)&&(r.name=r.displayName=o),null!=i.type&&(r.type=i.type),null!=i.displayName&&(r.displayName=i.displayName),_[t]=c.length,r.storeDimIndex=t,c.push(r),r}return c[e]}function i(t,e,n){null!=bv.get(e)?t.otherDims[e]=n:(t.coordDim=e,t.coordDimIndex=n,u.set(e,!0))}function r(t){null==t.name&&(t.name=t.coordDim)}so(t)||(t=uo(t));var s=(e=e||{}).coordDimensions||[],l=e.dimensionsDefine||t.dimensionsDefine||[],u=E(),c=[],p=function(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return h(e,function(t){var e;w(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))}),r}(t,s,l,e.dimensionsCount),d=e.canOmitUnusedDimensions&&vl(p),f=l===t.dimensionsDefine,g=f?ml(t):yl(l),y=e.encodeDefine;!y&&e.encodeDefaulter&&(y=e.encodeDefaulter(t,p));for(var m=E(y),_=new M_(p),x=0;x<_.length;x++)_[x]=-1;if(!d)for(x=0;x0&&(i.name=r+(o-1)),o++,e.set(r,o)}}(c),new ES({source:t,dimensions:c,fullDimensionCount:p,dimensionOmitted:d})}function au(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}function su(t){return"category"===t.get("type")}function lu(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function uu(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}function hu(t,e){return{seriesType:t,plan:ia(),reset:function(t){var n=t.getData(),i=t.coordinateSystem,r=e||t.pipelineContext.large;if(i){var o=c(i.dimensions,function(t){return n.mapDimension(t)}).slice(0,2),a=o.length,s=n.getCalculationInfo("stackResultDimension");lu(n,o[0])&&(o[0]=s),lu(n,o[1])&&(o[1]=s);var l=n.getStore(),u=n.getDimensionIndex(o[0]),h=n.getDimensionIndex(o[1]);return a&&{progress:function(t,e){for(var n,o=r&&(y(n=(t.end-t.start)*a)?WC?new Float32Array(n):n:new GC(n)),s=[],c=[],p=t.start,d=0;p=e[0]&&t<=e[1]}function _u(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function xu(t,e){return t*(e[1]-e[0])+e[0]}function wu(t){return t.get("stack")||lM+t.seriesIndex}function bu(t){return t.dim+t.index}function Su(t,e){return(t/=Qm)>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function Cu(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function Mu(t){return(t/=Jm)>12?12:t>6?6:t>3.5?4:t>2?2:1}function Tu(t,e){return(t/=e?Km:$m)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function Iu(t){return sn(t,!0)}function ku(t,e,n){var i=new Date(t);switch(lr(e)){case"year":case"month":i[wr(n)](0);case"day":i[br(n)](1);case"hour":i[Sr(n)](0);case"minute":i[Cr(n)](0);case"second":i[Mr(n)](0),i[Tr(n)](0)}return i.getTime()}function Du(t,e){return fM(t,Qe(e))}function Au(t,e,n){var i=t.rawExtentInfo;return i||(i=new bM(t,e,n),t.rawExtentInfo=i,i)}function Lu(t,e){return null==e?null:T(e)?NaN:t.parse(e)}function Ou(t,e){var n=t.type,i=Au(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var r,o,a,s=i.min,l=i.max,u=e.ecModel;if(u&&"time"===n){var c=function(t,e){var n=[];return e.eachSeriesByType("bar",function(t){(function(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type})(t)&&n.push(t)}),n}(0,u),p=!1;if(h(c,function(t){p=p||t.getBaseAxis()===e.axis}),p){var d=(o=function(t){var e={};h(t,function(t){var n=t.coordinateSystem.getBaseAxis();if("time"===n.type||"value"===n.type)for(var i=t.getData(),r=n.dim+"_"+n.index,o=i.getDimensionIndex(i.mapDimension(n.dim)),a=i.getStore(),s=0,l=a.count();s0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}(r=c),a=[],h(r,function(t){var e,n=t.coordinateSystem.getBaseAxis(),i=n.getExtent();if("category"===n.type)e=n.getBandWidth();else if("value"===n.type||"time"===n.type){var r=o[n.dim+"_"+n.index],s=Math.abs(i[1]-i[0]),l=n.scale.getExtent(),u=Math.abs(l[1]-l[0]);e=r?s/u*r:s}else{var h=t.getData();e=Math.abs(i[1]-i[0])/h.count()}var c=Ke(t.get("barWidth"),e),p=Ke(t.get("barMaxWidth"),e),d=Ke(t.get("barMinWidth")||(function(t){return t.pipelineContext&&t.pipelineContext.large}(t)?.5:1),e),f=t.get("barGap"),g=t.get("barCategoryGap");a.push({bandWidth:e,barWidth:c,barMaxWidth:p,barMinWidth:d,barGap:f,barCategoryGap:g,axisKey:bu(n),stackId:wu(t)})}),function(t){var e={};h(t,function(t,n){var i=t.axisKey,r=t.bandWidth,o=e[i]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[i]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var p=t.barCategoryGap;null!=p&&(o.categoryGap=p)});var n={};return h(e,function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=f(i).length;o=Math.max(35-4*a,15)+"%"}var s=Ke(o,r),l=Ke(t.gap,1),u=t.remainedWidth,c=t.autoWidthCount,p=(u-s)/(c+(c-1)*l);p=Math.max(p,0),h(i,function(t){var e=t.maxWidth,n=t.minWidth;if(t.width)i=t.width,e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,c--;else{var i=p;e&&ei&&(i=n),i!==p&&(t.width=i,u-=i+l*i,c--)}}),p=(u-s)/(c+(c-1)*l),p=Math.max(p,0);var d,g=0;h(i,function(t,e){t.width||(t.width=p),d=t,g+=t.width*(1+l)}),d&&(g-=d.width*l);var y=-g/2;h(i,function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:y,width:t.width},y+=t.width*(1+l)})}),n}(a)),g=function(t,e,n,i){var r=n.axis.getExtent(),o=Math.abs(r[1]-r[0]),a=function(t,e){if(t&&e)return t[bu(e)]}(i,n.axis);if(void 0===a)return{min:t,max:e};var s=1/0;h(a,function(t){s=Math.min(t.offset,s)});var l=-1/0;h(a,function(t){l=Math.max(t.offset+t.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,c=e-t,p=c/(1-(s+l)/o)-c;return{min:t-=p*(s/u),max:e+=p*(l/u)}}(s,l,e,d);s=g.min,l=g.max}}return{extent:[s,l],fixMin:i.minFixed,fixMax:i.maxFixed}}function Pu(t,e){var n=e,i=Ou(t,n),r=i.extent,o=n.get("splitNumber");t instanceof wM&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function Ru(t){var e,n,i=t.getLabelModel().get("formatter"),r="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(n=i,function(e,i){return t.scale.getFormattedLabel(e,i,n)}):v(i)?function(e){return function(n){var i=t.scale.getLabel(n);return e.replace("{value}",null!=i?i:"")}}(i):m(i)?(e=i,function(n,i){return null!=r&&(i=n.value-r),e(Nu(t,n),i,null!=n.level?{level:n.level}:null)}):function(e){return t.scale.getLabel(e)}}function Nu(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Eu(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n));return new af(t.x,t.y,o,a)}function zu(t){var e=t.get("interval");return null==e?"auto":e}function Bu(t){return"category"===t.type&&0===zu(t.getLabelModel())}function Fu(t,e){var n={};return h(t.mapDimensionsAll(e),function(e){n[function(t,e){return lu(t,e)?t.getCalculationInfo("stackResultDimension"):e}(t,e)]=!0}),f(n)}function Vu(t){return"interval"===t.type||"time"===t.type}function Hu(t,e){var n=c(e,function(e){return t.scale.parse(e)});return"time"===t.type&&n.length>0&&(n.sort(),n.unshift(n[0]),n.push(n[n.length-1])),n}function Wu(t,e){var n,i,r=Gu(t,"labels"),o=zu(e);return Uu(r,o)||(m(o)?n=Yu(t,o):(i="auto"===o?function(t){var e=DM(t).autoInterval;return null!=e?e:DM(t).autoInterval=t.calculateCategoryInterval()}(t):o,n=Zu(t,i)),ju(r,o,{labels:n,labelCategoryInterval:i}))}function Gu(t,e){return DM(t)[e]||(DM(t)[e]=[])}function Uu(t,e){for(var n=0;n1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var p=Bu(t),d=s.get("showMinLabel")||p,f=s.get("showMaxLabel")||p;d&&h!==a[0]&&i(a[0]);for(var g=h;g<=a[1];g+=u)i(g);return f&&g-u!==a[1]&&i(a[1]),l}function Yu(t,e,n){var i=t.scale,r=Ru(t),o=[];return h(i.getTicks(),function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})}),o}function Xu(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}function qu(t,e,n){n=n||{};var i=t.coordinateSystem,r=e.axis,o={},a=r.getAxesOnZeroOf()[0],s=r.position,l=a?"onZero":s,u=r.dim,h=i.getRect(),c=[h.x,h.x+h.width,h.y,h.y+h.height],p={left:0,right:1,top:0,bottom:1,onZero:2},d=e.get("offset")||0,f="x"===u?[c[2]-d,c[3]+d]:[c[0]-d,c[1]+d];if(a){var g=a.toGlobalCoord(a.dataToCoord(0));f[p.onZero]=Math.max(Math.min(g,f[1]),f[0])}o.position=["y"===u?f[p[l]]:c[0],"x"===u?f[p[l]]:c[3]],o.rotation=Math.PI/2*("x"===u?0:1),o.labelDirection=o.tickDirection=o.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],o.labelOffset=a?f[p[s]]-f[p.onZero]:0,e.get(["axisTick","inside"])&&(o.tickDirection=-o.tickDirection),I(n.labelInside,e.get(["axisLabel","inside"]))&&(o.labelDirection=-o.labelDirection);var y=e.get(["axisLabel","rotate"]);return o.labelRotate="top"===l?-y:y,o.z2=1,o}function $u(t){return"cartesian2d"===t.get("coordinateSystem")}function Ku(t){var e={xAxisModel:null,yAxisModel:null};return h(e,function(n,i){var r=i.replace(/Model$/,""),o=t.getReferringComponents(r,Hg).models[0];e[i]=o}),e}function Ju(t,e){return t.getCoordSysModel()===e}function Qu(t,e,n,i){function r(t){return t.dim+"_"+t.index}n.getAxesOnZeroOf=function(){return o?[o]:[]};var o,a=t[e],s=n.model,l=s.get(["axisLine","onZero"]),u=s.get(["axisLine","onZeroAxisIndex"]);if(l){if(null!=u)th(a[u])&&(o=a[u]);else for(var h in a)if(a.hasOwnProperty(h)&&th(a[h])&&!i[r(a[h])]){o=a[h];break}o&&(i[r(o)]=!0)}}function th(t){return t&&"category"!==t.type&&"time"!==t.type&&function(t){var e=t.scale.getExtent(),n=e[0],i=e[1];return!(n>0&&i>0||n<0&&i<0)}(t)}function eh(t){t&&(t.ignore=!0)}function nh(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=yt([]);return xt(r,r,-t.rotation),n.applyTransform(vt([],r,t.getLocalTransform())),i.applyTransform(vt([],r,e.getLocalTransform())),n.intersect(i)}}function ih(t){return"middle"===t||"center"===t}function rh(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function ah(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[lh(t)]}function sh(t){return!!t.get(["handle","show"])}function lh(t){return t.type+"||"+t.id}function uh(t){t.registerComponentView(KM),t.registerComponentModel(jC),t.registerCoordinateSystem("cartesian2d",EM),pu(t,"x",YC,JM),pu(t,"y",YC,JM),t.registerComponentView(qM),t.registerComponentView($M),t.registerPreprocessor(function(t){t.xAxis&&t.yAxis&&!t.grid&&(t.grid={})})}function hh(t,e,n,i){ch(QM(n).lastProp,i)||(QM(n).lastProp=i,e?ga(n,i,t):(n.stopAnimation(),n.attr(i)))}function ch(t,e){if(w(t)&&w(e)){var n=!0;return h(e,function(e,i){n=n&&ch(t[i],e)}),!!n}return t===e}function ph(t,e){t[e.get(["label","show"])?"show":"hide"]()}function dh(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function fh(t,e,n){var i=e.get("z"),r=e.get("zlevel");t&&t.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=r&&(t.zlevel=r),t.silent=n)})}function gh(t,e,n,i,r){t=e.scale.parse(t);var o=e.scale.getLabel({value:t},{precision:r.precision}),a=r.formatter;if(a){var s={value:Nu(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};h(i,function(t){var e=n.getSeriesByIndex(t.seriesIndex),i=e&&e.getDataParams(t.dataIndexInside);i&&s.seriesData.push(i)}),v(a)?o=a.replace("{value}",o):m(a)&&(o=a(s))}return o}function yh(t,e,n){var i=[1,0,0,1,0,0];return xt(i,i,n.rotation),_t(i,i,n.position),Oa([t.dataToCoord(e),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function mh(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}function vh(t){return"x"===t.dim?0:1}function _h(t,e,n){if(!rd.node){var i=e.getZr();sT(i).records||(sT(i).records={}),function(t,e){function n(n,i){t.on(n,function(n){var r=function(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}(e);lT(sT(t).records,function(t){t&&i(t,n,r.dispatchAction)}),function(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}(r.pendings,e)})}sT(t).initialized||(sT(t).initialized=!0,n("click",g(wh,"click")),n("mousemove",g(wh,"mousemove")),n("globalout",xh))}(i,e),(sT(i).records[t]||(sT(i).records[t]={})).handler=n}}function xh(t,e,n){t.handler("leave",null,n)}function wh(t,e,n,i){e.handler(t,n,i)}function bh(t,e){if(!rd.node){var n=e.getZr();(sT(n).records||{})[t]&&(sT(n).records[t]=null)}}function Sh(t,e){var n,i=[],r=t.seriesIndex;if(null==r||!(n=e.getSeriesByIndex(r)))return{point:[]};var o=n.getData(),a=bn(o,t);if(null==a||a<0||y(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u).dim,p="x"===h||"radius"===h?1:0,d=o.mapDimension(u.dim),f=[];f[p]=o.get(d,a),f[1-p]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(f)||[]}else i=l.dataToPoint(o.getValues(c(l.dimensions,function(t){return o.mapDimension(t)}),a))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}function Ch(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||Sd(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){Dh(r)&&(r=Sh({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=Dh(r),u=o.axesInfo,c=s.axesInfo,p="leave"===i||Dh(r),d={},f={},y={list:[],map:{}},m={showPointer:g(Th,f),showTooltip:g(Ih,y)};h(s.coordSysMap,function(t,e){var n=l||t.containPoint(r);h(s.coordSysAxesInfo[e],function(t,e){var i=t.axis,o=function(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}(u,t);if(!p&&n&&(!u||o)){var a=o&&o.value;null!=a||l||(a=i.pointToData(r)),null!=a&&Mh(t,a,m,!1,d)}})});var v={};return h(c,function(t,e){var n=t.linkGroup;n&&!f[e]&&h(n.axesInfo,function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,kh(e),kh(t)))),v[t.key]=o}})}),h(v,function(t,e){Mh(c[e],t,m,!0,d)}),function(t,e,n){var i=n.axesInfo=[];h(e,function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})})}(f,c,d),function(t,e,n,i){if(!Dh(e)&&t.list.length){var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}else i({type:"hideTip"})}(y,r,t,a),function(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=cT(i)[r]||{},a=cT(i)[r]={};h(t,function(t,e){var n=t.axisPointerModel.option;"show"===n.status&&t.triggerEmphasis&&h(n.seriesDataIndices,function(t){a[t.seriesIndex+" | "+t.dataIndex]=t})});var s=[],l=[];h(o,function(t,e){!a[e]&&l.push(t)}),h(a,function(t,e){!o[e]&&s.push(t)}),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(c,0,n),d}}function Mh(t,e,n,i,r){var a=t.axis;if(!a.scale.isBlank()&&a.containData(e))if(t.involveSeries){var s=function(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return h(e.seriesModels,function(e,l){var u,c,p=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(p,t,n);c=d.dataIndices,u=d.nestestValue}else{if(!(c=e.getData().indicesOfNearest(p[0],t,"category"===n.type?.5:null)).length)return;u=e.getData().get(p[0],c[0])}if(null!=u&&isFinite(u)){var f=t-u,g=Math.abs(f);g<=a&&((g=0&&s<0)&&(a=g,s=f,r=u,o.length=0),h(c,function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:o,snapToValue:r}}(e,t),l=s.payloadBatch,u=s.snapToValue;l[0]&&null==r.seriesIndex&&o(r,l[0]),!i&&t.snap&&a.containData(u)&&null!=u&&(e=u),n.showPointer(t,e,l),n.showTooltip(t,s,u)}else n.showPointer(t,e)}function Th(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function Ih(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=lh(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function kh(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function Dh(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function Ah(t){GM.registerAxisPointerClass("CartesianAxisPointer",oT),t.registerComponentModel(aT),t.registerComponentView(hT),t.registerPreprocessor(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!y(e)&&(t.axisPointer.link=[e])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=function(t,e){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return function(t,e,n){var r=e.getComponent("tooltip"),o=e.getComponent("axisPointer"),s=o.get("link",!0)||[],l=[];h(n.getCoordinateSystems(),function(n){function u(r,u,c){var f=c.model.getModel("axisPointer",o),g=f.get("show");if(g&&("auto"!==g||r||sh(f))){null==u&&(u=f.get("triggerTooltip")),f=r?function(t,e,n,r,o,s){var l=e.getModel("axisPointer"),u={};h(["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],function(t){u[t]=i(l.get(t))}),u.snap="category"!==t.type&&!!s,"cross"===l.get("type")&&(u.type="line");var c=u.label||(u.label={});if(null==c.show&&(c.show=!1),"cross"===o){var p=l.get(["label","show"]);if(c.show=null==p||p,!s){var d=u.lineStyle=l.get("crossStyle");d&&a(c,d.textStyle)}}return t.model.getModel("axisPointer",new Wm(u,n,r))}(c,d,o,e,r,u):f;var y=f.get("snap"),m=f.get("triggerEmphasis"),v=lh(c.model),_=u||y||"category"===c.type,x=t.axesInfo[v]={key:v,axis:c,coordSys:n,axisPointerModel:f,triggerTooltip:u,triggerEmphasis:m,involveSeries:_,snap:y,useHandle:sh(f),seriesModels:[],linkGroup:null};p[v]=x,t.seriesInvolved=t.seriesInvolved||_;var w=function(t,e){for(var n=e.model,i=e.dim,r=0;r=0;o--){var a=t[o];a&&(a instanceof Wm&&(a=a.get("tooltip",!0)),v(a)&&(a={formatter:a}),a&&(i=new Wm(a,i,r)))}return i}function Vh(t,e){return t.dispatchAction||Sd(e.dispatchAction,e)}function Hh(t){return"center"===t||"middle"===t}function Wh(t){return t+"Axis"}function Gh(t){var e={};return h(["start","end","startValue","endValue","throttle"],function(n){t.hasOwnProperty(n)&&(e[n]=t[n])}),e}function Uh(t,e,n,i,r,o){t=t||0;var a=n[1]-n[0];if(null!=r&&(r=Zh(r,[0,a])),null!=o&&(o=Math.max(o,null!=r?r:0)),"all"===i){var s=Math.abs(e[1]-e[0]);s=Zh(s,[0,a]),r=o=Zh(s,[r,o]),i=0}e[0]=Zh(e[0],n),e[1]=Zh(e[1],n);var l=jh(e,i);e[i]+=t;var u,h=r||0,c=n.slice();return l.sign<0?c[0]+=h:c[1]-=h,e[i]=Zh(e[i],c),u=jh(e,i),null!=r&&(u.sign!==l.sign||u.spano&&(e[1-i]=e[i]+u.sign*o),e}function jh(t,e){var n=t[e]-t[1-e];return{span:Math.abs(n),sign:n>0?-1:n<0?1:e?-1:1}}function Zh(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}function Yh(t){t.registerComponentModel(kT),t.registerComponentView(DT),function(t){NT||(NT=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,RT),function(t){t.registerAction("dataZoom",function(t,e){h(function(t,e){function n(t){!s.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis(function(t,n){var i=o.get(t);i&&i[n]&&(e=!0)}),e}(t)&&(i(t),r=!0)}function i(t){s.set(t.uid,!0),a.push(t),t.eachTargetAxis(function(t,e){(o.get(t)||o.set(t,[]))[e]=!0})}var r,o=E(),a=[],s=E();t.eachComponent({mainType:"dataZoom",query:e},function(t){s.get(t.uid)||i(t)});do{r=!1,t.eachComponent("dataZoom",n)}while(r);return a}(e,t),function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}(t),t.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}(t)}function Xh(t,e){zT[t]=e}function qh(t){return zT[t]}function $h(t,e){var n=av(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),new rm({shape:{x:t.x-n[3],y:t.y-n[0],width:t.width+n[1]+n[3],height:t.height+n[0]+n[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1})}function Kh(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Jh(t,e){return c(t,function(t,n){var i=e&&e[n];if(w(i)&&!y(i)){w(t)&&!y(t)||(t={value:t});var r=null!=i.name&&null==t.name;return t=a(t,i),r&&delete t.name,t}return t})}function Qh(t){var e=QT(t);return e.snapshots||(e.snapshots=[{}]),e.snapshots}function tc(t,e){var n=dI[e.brushType].createCover(t,e);return n.__brushOption=e,ic(n,e),t.group.add(n),n}function ec(t,e){var n=oc(e);return n.endCreating&&(n.endCreating(t,e),ic(e,e.__brushOption)),e}function nc(t,e){var n=e.__brushOption;oc(e).updateCoverShape(t,e,n.range,n)}function ic(t,e){var n=e.z;null==n&&(n=1e4),t.traverse(function(t){t.z=n,t.z2=n})}function rc(t,e){oc(e).updateCommon(t,e),nc(t,e)}function oc(t){return dI[t.__brushOption.brushType]}function ac(t,e,n){var i,r=t._panels;if(!r)return nI;var o=t._transform;return h(r,function(t){t.isTargetByCursor(e,n,o)&&(i=t)}),i}function sc(t,e){var n=t._panels;if(!n)return nI;var i=e.__brushOption.panelId;return null!=i?n[i]:nI}function lc(t){var e=t._covers,n=e.length;return h(e,function(e){t.group.remove(e)},t),e.length=0,!!n}function uc(t,e){var n=c(t._covers,function(t){var e=t.__brushOption,n=i(e.range);return{brushType:e.brushType,panelId:e.panelId,range:n}});t.trigger("brush",{areas:n,isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function hc(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function cc(t,e,n,i){var r=new Ag;return r.add(new rm({name:"main",style:gc(n),silent:!0,draggable:!0,cursor:"move",drift:g(vc,t,e,r,["n","s","w","e"]),ondragend:g(uc,e,{isEnd:!0})})),h(i,function(n){r.add(new rm({name:n.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:g(vc,t,e,r,n),ondragend:g(uc,e,{isEnd:!0})}))}),r}function pc(t,e,n,i){var r=i.brushStyle.lineWidth||0,o=rI(r,6),a=n[0][0],s=n[1][0],l=a-r/2,u=s-r/2,h=n[0][1],c=n[1][1],p=h-o+r/2,d=c-o+r/2,f=h-a,g=c-s,y=f+r,m=g+r;fc(t,e,"main",a,s,f,g),i.transformable&&(fc(t,e,"w",l,u,o,m),fc(t,e,"e",p,u,o,m),fc(t,e,"n",l,u,y,o),fc(t,e,"s",l,d,y,o),fc(t,e,"nw",l,u,o,o),fc(t,e,"ne",p,u,o,o),fc(t,e,"sw",l,d,o,o),fc(t,e,"se",p,d,o,o))}function dc(t,e){var n=e.__brushOption,i=n.transformable,r=e.childAt(0);r.useStyle(gc(n)),r.attr({silent:!i,cursor:i?"move":"default"}),h([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(n){var r=e.childOfName(n.join("")),o=1===n.length?mc(t,n[0]):function(t,e){var n=[mc(t,e[0]),mc(t,e[1])];return("e"===n[0]||"w"===n[0])&&n.reverse(),n.join("")}(t,n);r&&r.attr({silent:!i,invisible:!i,cursor:i?lI[o]+"-resize":null})})}function fc(t,e,n,i,r,o,a){var s=e.childOfName(n);s&&s.setShape(function(t){var e=iI(t[0][0],t[1][0]),n=iI(t[0][1],t[1][1]);return{x:e,y:n,width:rI(t[0][0],t[1][0])-e,height:rI(t[0][1],t[1][1])-n}}(wc(t,e,[[i,r],[i+o,r+a]])))}function gc(t){return a({strokeNoScale:!0},t.brushStyle)}function yc(t,e,n,i){var r=[iI(t,n),iI(e,i)],o=[rI(t,n),rI(e,i)];return[[r[0],o[0]],[r[1],o[1]]]}function mc(t,e){var n=Pa({w:"left",e:"right",n:"top",s:"bottom"}[e],function(t){return La(t.group)}(t));return{left:"w",right:"e",top:"n",bottom:"s"}[n]}function vc(t,e,n,i,r,o){var a=n.__brushOption,s=t.toRectRange(a.range),l=xc(e,r,o);h(i,function(t){var e=sI[t];s[e[0]][e[1]]+=l[e[0]]}),a.range=t.fromRectRange(yc(s[0][0],s[1][0],s[0][1],s[1][1])),rc(e,n),uc(e,{isEnd:!1})}function _c(t,e,n,i){var r=e.__brushOption.range,o=xc(t,n,i);h(r,function(t){t[0]+=o[0],t[1]+=o[1]}),rc(t,e),uc(t,{isEnd:!1})}function xc(t,e,n){var i=t.group,r=i.transformCoordToLocal(e,n),o=i.transformCoordToLocal(0,0);return[r[0]-o[0],r[1]-o[1]]}function wc(t,e,n){var r=sc(t,e);return r&&r!==nI?r.clipPath(n,t._transform):i(n)}function bc(t){var e=t.event;e.preventDefault&&e.preventDefault()}function Sc(t,e,n){return t.childOfName("main").contain(e,n)}function Cc(t,e,n,r){var o,a=t._creatingCover,s=t._creatingPanel,l=t._brushOption;if(t._track.push(n.slice()),function(t){var e=t._track;if(!e.length)return!1;var n=e[e.length-1],i=e[0],r=n[0]-i[0],o=n[1]-i[1];return oI(r*r+o*o,.5)>6}(t)||a){if(s&&!a){"single"===l.brushMode&&lc(t);var u=i(l);u.brushType=Mc(u.brushType,s),u.panelId=s===nI?null:s.panelId,a=t._creatingCover=tc(t,u),t._covers.push(a)}if(a){var h=dI[Mc(t._brushType,s)];a.__brushOption.range=h.getCreatingRange(wc(t,a,t._track)),r&&(ec(t,a),h.updateCommon(t,a)),nc(t,a),o={isEnd:r}}}else r&&"single"===l.brushMode&&l.removeOnClick&&ac(t,e,n)&&lc(t)&&(o={isEnd:r,removeOnClick:!0});return o}function Mc(t,e){return"auto"===t?e.defaultBrushType:t}function Tc(t,e){if(t._dragging){bc(e);var n=t.group.transformCoordToLocal(e.offsetX,e.offsetY),i=Cc(t,e,n,!0);t._dragging=!1,t._track=[],t._creatingCover=null,i&&uc(t,i)}}function Ic(t){return{createCover:function(e,n){return cc({toRectRange:function(e){var n=[e,[0,100]];return t&&n.reverse(),n},fromRectRange:function(e){return e[t]}},e,n,[[["w"],["e"]],[["n"],["s"]]][t])},getCreatingRange:function(e){var n=hc(e);return[iI(n[0][t],n[1][t]),rI(n[0][t],n[1][t])]},updateCoverShape:function(e,n,i,r){var o,a=sc(e,n);if(a!==nI&&a.getLinearBrushOtherExtent)o=a.getLinearBrushOtherExtent(t);else{var s=e._zr;o=[0,[s.getWidth(),s.getHeight()][1-t]]}var l=[i,o];t&&l.reverse(),pc(e,n,l,r)},updateCommon:dc,contain:Sc}}function kc(t){return t=Lc(t),function(e){return Ea(e,t)}}function Dc(t,e){return t=Lc(t),function(n){var i=null!=e?e:n,r=i?t.x:t.y;return[r,r+((i?t.width:t.height)||0)]}}function Ac(t,e,n){var i=Lc(t);return function(t,r){return i.contain(r[0],r[1])&&!Zl(t,e,n)}}function Lc(t){return af.create(t)}function Oc(t){return t[0]>t[1]&&t.reverse(),t}function Pc(t,e){return Cn(t,e,{includeMainTypes:gI})}function Rc(t,e,n,i){var r=n.getAxis(["x","y"][t]),o=Oc(c([0,1],function(t){return e?r.coordToData(r.toLocalCoord(i[t]),!0):r.toGlobalCoord(r.dataToCoord(i[t]))})),a=[];return a[t]=o,a[1-t]=[NaN,NaN],{values:o,xyMinMax:a}}function Nc(t,e,n,i){return[e[0]-i[t]*n[0],e[1]-i[t]*n[1]]}function Ec(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}function zc(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}function Bc(t,e,n,i){Hc(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),Vc(t,e,n,i)}function Fc(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;i0&&(s.during=l?Sd(ep,{el:e,userDuring:l}):null,s.setToFinal=!0,s.scope=t),o(s,n[a]),s}function Jc(t,e,n,i){var r=(i=i||{}).dataIndex,a=i.isInit,l=i.clearStyle,u=n.isAnimationEnabled(),c=YI(t),p=e.style;c.userDuring=e.during;var d={},g={};if(function(t,e,n){for(var i=0;i=0)){var c=t.getAnimationStyleProps(),p=c?c.style:null;if(p){!r&&(r=i.style={});var d=f(n);for(h=0;h0&&t.animateFrom(y,m)}else!function(t,e,n,i,r){if(r){var o=Kc("update",t,e,i,n);o.duration>0&&t.animateFrom(r,o)}}(t,e,r||0,n,d);Qc(t,e),p?t.dirty():t.markRedraw()}function Qc(t,e){for(var n=YI(t).leaveToProps,i=0;i=0){!a&&(a=i[t]={});var d=f(l);for(p=0;p"}(r,e.attrs)+("style"!==r?st(o):o||"")+(i?""+n+c(i,function(e){return t(e)}).join(n)+n:"")+""}(t)}function dp(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function fp(t,e,n,i){return cp("svg","root",{width:t,height:e,xmlns:dk,"xmlns:xlink":fk,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},n)}function gp(){return yk++}function yp(t,e,n){var i=o({},t.shape);o(i,e),t.buildPath(n,i);var r=new ak;return r.reset(me(t)),n.rebuildPath(r,1),r.generateStr(),r.getStr()}function mp(t,e){var n=e.originX,i=e.originY;(n||i)&&(t[vk]=n+"px "+i+"px")}function vp(t,e){var n=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[n]=t,n}function _p(t){return v(t)?mk[t]?"cubic-bezier("+mk[t]+")":Zt(t)?t:"":""}function xp(t,e,n,i){function r(r){function a(t,e,n){for(var i=t.getTracks(),r=t.getMaxTime(),o=0;o0}).length)return vp(p,n)+" "+r[0]+" both"}var a=t.animators,s=a.length,l=[];if(t instanceof Bx){var u=function(t,e,n){var i,r,o={};if(h(t.shape.paths,function(t){var e=dp(n.zrId);e.animation=!0,xp(t,{},e,!0);var a=e.cssAnims,s=e.cssNodes,l=f(a),u=l.length;if(u){var h=a[r=l[u-1]];for(var c in h){var p=h[c];o[c]=o[c]||{d:""},o[c].d+=p.d||""}for(var d in s){var g=s[d].animation;g.indexOf(r)>=0&&(i=g)}}}),i){e.d=!1;var a=vp(o,n);return i.replace(r,a)}}(t,e,n);if(u)l.push(u);else if(!s)return}else if(!s)return;for(var c={},p=0;p=0&&a||o;s&&(r=ae(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&t.transform?t.transform[0]:1);var u={cursor:"pointer"};r&&(u.fill=r),i.stroke&&(u.stroke=i.stroke),l&&(u["stroke-width"]=l),wp(u,e,n,!0)}}(t,o,e),cp(s,t.id+"",o)}function Lp(t,e){return t instanceof Zy?Ap(t,e):t instanceof Qy?function(t,e){var n=t.style,i=n.image;if(i&&!v(i)&&(bp(i)?i=i.src:Sp(i)&&(i=i.toDataURL())),i){var r=n.x||0,o=n.y||0,a={href:i,width:n.width,height:n.height};return r&&(a.x=r),o&&(a.y=o),Ip(a,t.transform),Cp(a,n,t,e),Mp(a,t),e.animation&&xp(t,a,e),cp("image",t.id+"",a)}}(t,e):t instanceof qy?function(t,e){var n=t.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var r=n.font||ld,o=n.x||0,a=function(t,e,n){return"top"===n?t+=e/2:"bottom"===n&&(t-=e/2),t}(n.y||0,We(r),n.textBaseline),s={"dominant-baseline":"central","text-anchor":Hf[n.textAlign]||n.textAlign};if(di(n)){var l="",u=n.fontStyle,h=ci(n.fontSize);if(!parseFloat(h))return;var c=n.fontWeight;l+="font-size:"+h+";font-family:"+(n.fontFamily||sd)+";",u&&"normal"!==u&&(l+="font-style:"+u+";"),c&&"normal"!==c&&(l+="font-weight:"+c+";"),s.style=l}else s.style="font: "+r;return i.match(/\s/)&&(s["xml:space"]="preserve"),o&&(s.x=o),a&&(s.y=a),Ip(s,t.transform),Cp(s,n,t,e),Mp(s,t),e.animation&&xp(t,s,e),cp("text",t.id+"",s,void 0,i)}}(t,e):void 0}function Op(t,e,n,i){var r,o=t[n],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(de(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!fe(o))return;r="radialGradient",a.cx=k(o.x,.5),a.cy=k(o.y,.5),a.r=k(o.r,.5)}for(var s=o.colorStops,l=[],u=0,h=s.length;ul?Yp(t,null==n[c+1]?null:n[c+1].elm,n,s,c):Xp(t,e,a,l))}(n,i,r):Gp(r)?(Gp(t.text)&&Hp(n,""),Yp(n,null,r,0,r.length-1)):Gp(i)?Xp(n,i,0,i.length-1):Gp(t.text)&&Hp(n,""):t.text!==e.text&&(Gp(i)&&Xp(n,i,0,i.length-1),Hp(n,e.text)))}function Kp(t,e,n){var i=hd.createCanvas(),r=e.getWidth(),o=e.getHeight(),a=i.style;return a&&(a.position="absolute",a.left="0",a.top="0",a.width=r+"px",a.height=o+"px",i.setAttribute("data-zr-dom-id",t)),i.width=r*n,i.height=o*n,i}function Jp(){Ks(!0)&&(function(t){var e=gv.extend(t);gv.registerClass(e)}({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:n}=this;return r=n.center,!((i=t)&&r&&i[0]===r[0]&&i[1]===r[1]&&e===n.zoom);var i,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}}),function(t){var e=B_.extend(t);B_.registerClass(e)}({type:"leaflet",render(t,e,n){function i(e){if(s)return;const i=l._mapPane;let r=i.style.transform,o=0,a=0;if(r){r=r.replace("translate3d(","");const t=r.split(",");o=-parseInt(t[0],10),a=-parseInt(t[1],10)}else o=-parseInt(i.style.left,10),a=-parseInt(i.style.top,10);const c=[o,a];u.style.left=`${c[0]}px`,u.style.top=`${c[1]}px`,h.setMapOffset(c),t.__mapOffset=c,n.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function r(){s||n.dispatchAction({type:"leafletRoam"})}function o(){i()}function a(){Hs(n.getDom()).resize()}let s=!0;const l=t.getLeaflet(),u=n.getZr().painter.getViewportRoot().parentNode,h=t.coordinateSystem,{roam:c}=t.get("mapOptions");c&&"scale"!==c?l.dragging.enable():l.dragging.disable(),c&&"move"!==c?(l.scrollWheelZoom.enable(),l.doubleClickZoom.enable(),l.touchZoom.enable()):(l.scrollWheelZoom.disable(),l.doubleClickZoom.disable(),l.touchZoom.disable()),this._oldMoveHandler&&l.off("move",this._oldMoveHandler),this._oldZoomHandler&&l.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&l.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&l.off("resize",this._oldResizeHandler),l.on("move",i),l.on("zoom",o),l.on("zoomend",r),l.on("resize",a),this._oldMoveHandler=i,this._oldZoomHandler=o,this._oldZoomEndHandler=r,this._oldResizeHandler=a,s=!1}}),Ys("leaflet",Nk()),Zs({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},(t,e)=>{e.eachComponent("leaflet",t=>{const e=t.getLeaflet(),n=e.getCenter();t.setCenterAndZoom([n.lng,n.lat],e.getZoom())})}))}var Qp={d:(t,e)=>{for(var n in e)Qp.o(e,n)&&!Qp.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},td={};Qp.r(td),Qp.d(td,{Arc:()=>Ex,BezierCurve:()=>Px,BoundingRect:()=>af,Circle:()=>J_,CompoundPath:()=>Bx,Ellipse:()=>ex,Group:()=>Ag,Image:()=>Qy,IncrementalDisplayable:()=>qx,Line:()=>Dx,LinearGradient:()=>Vx,OrientedBoundingRect:()=>Yx,Path:()=>Zy,Point:()=>qd,Polygon:()=>bx,Polyline:()=>Mx,RadialGradient:()=>Hx,Rect:()=>rm,Ring:()=>vx,Sector:()=>gx,Text:()=>cm,applyTransform:()=>Oa,clipPointsByRect:()=>Ea,clipRectByRect:()=>za,createIcon:()=>Ba,extendPath:()=>ba,extendShape:()=>wa,getShapeClass:()=>Ca,getTransform:()=>La,groupTransition:()=>Na,initProps:()=>ya,isElementRemoved:()=>ma,lineLineIntersect:()=>Va,linePolygonIntersect:()=>Fa,makeImage:()=>Ta,makePath:()=>Ma,mergePath:()=>ew,registerShape:()=>Sa,removeElement:()=>va,removeElementWithFadeOut:()=>xa,resizePath:()=>ka,setTooltipConfig:()=>Wa,subPixelOptimize:()=>nw,subPixelOptimizeLine:()=>Da,subPixelOptimizeRect:()=>Aa,transformDirection:()=>Pa,traverseElements:()=>Ua,updateProps:()=>ga});var ed=function(t,e){return ed=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])},ed(t,e)},nd=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},id=new function(){this.browser=new nd,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(id.wxa=!0,id.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?id.worker=!0:!id.hasGlobalWindow||"Deno"in window?(id.node=!0,id.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]),r&&(n.ie=!0,n.version=r[1]),o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18),a&&(n.weChat=!0),e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,id);const rd=id;var od,ad,sd="sans-serif",ld="12px "+sd,ud=function(){var t={};if("undefined"==typeof JSON)return t;for(var e=0;e<95;e++){var n=String.fromCharCode(e+32),i=("007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N".charCodeAt(e)-20)/100;t[n]=i}return t}(),hd={createCanvas:function(){return"undefined"!=typeof document&&document.createElement("canvas")},measureText:function(t,e){if(!od){var n=hd.createCanvas();od=n&&n.getContext("2d")}if(od)return ad!==e&&(ad=od.font=e||ld),od.measureText(t);t=t||"";var i=/((?:\d+)?\.?\d*)px/.exec(e=e||ld),r=i&&+i[1]||12,o=0;if(e.indexOf("mono")>=0)o=r*t.length;else for(var a=0;a"'])/g,Hd={"&":"&","<":"<",">":">",'"':""","'":"'"},Wd=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Gd=[],Ud=rd.browser.firefox&&+rd.browser.version.split(".")[0]<39,jd=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0},Zd=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;o1&&r&&r.length>1){var a=gt(r)/gt(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((i=r)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}},Xd=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}();const qd=Xd;var $d=Math.min,Kd=Math.max,Jd=new qd,Qd=new qd,tf=new qd,ef=new qd,nf=new qd,rf=new qd,of=function(){function t(t,e,n,i){n<0&&(t+=n,n=-n),i<0&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=$d(t.x,this.x),n=$d(t.y,this.y);this.width=isFinite(this.x)&&isFinite(this.width)?Kd(t.x+t.width,this.x+this.width)-e:t.width,this.height=isFinite(this.y)&&isFinite(this.height)?Kd(t.y+t.height,this.y+this.height)-n:t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=[1,0,0,1,0,0];return _t(r,r,[-e.x,-e.y]),function(t,e,n){var i=n[0],r=n[1];t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r}(r,r,[n,i]),_t(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,p=!(of&&(f=_,qd.set(rf,gf&&(f=x,qd.set(rf,0,m=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[5];return e.x=n.x*r+i[4],e.y=n.y*o+a,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}Jd.x=tf.x=n.x,Jd.y=ef.y=n.y,Qd.x=ef.x=n.x+n.width,Qd.y=tf.y=n.y+n.height,Jd.transform(i),ef.transform(i),Qd.transform(i),tf.transform(i),e.x=$d(Jd.x,Qd.x,tf.x,ef.x),e.y=$d(Jd.y,Qd.y,tf.y,ef.y);var s=Kd(Jd.x,Qd.x,tf.x,ef.x),l=Kd(Jd.y,Qd.y,tf.y,ef.y);e.width=s-e.x,e.height=l-e.y}else e!==n&&t.copy(e,n)},t}();const af=of;var sf="silent",lf=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return W(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Ed),uf=function(t,e){this.x=t,this.y=e},hf=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],cf=new af(0,0,0,0),pf=function(t){function e(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new uf(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new lf,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new Rd(a),a}return W(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(h(hf,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=Mt(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=i?new uf(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new uf(0,0)},e.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,n){var i=(t=t||{}).target;if(!i||!i.silent){for(var r="on"+e,o=function(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:bt}}(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)}))}},e.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new uf(t,e);if(Ct(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new af(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(cf.copy(h.getBoundingRect()),h.transform&&cf.applyTransform(h.transform),cf.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,p=2*Math.PI,d=0;d4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}});const df=pf;var ff=!1,gf=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Ot}return t.prototype.traverse=function(t,e){for(var n=0;n0&&(u.__clipPaths=[]),isNaN(u.z)&&(Lt(),u.z=0),isNaN(u.z2)&&(Lt(),u.z2=0),isNaN(u.zlevel)&&(Lt(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var p=t.getTextContent();p&&this._updateAndAddDisplayable(p,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;e=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const yf=gf,mf=rd.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var vf={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-vf.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*vf.bounceIn(2*t):.5*vf.bounceOut(2*t-1)+.5}};const _f=vf;var xf=Math.pow,wf=Math.sqrt,bf=1e-8,Sf=1e-4,Cf=wf(3),Mf=1/3,Tf=G(),If=G(),kf=G(),Df=/cubic-bezier\(([0-9,\.e ]+)\)/;const Af=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||H,this.ondestroy=t.ondestroy||H,this.onrestart=t.onrestart||H,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;this._startTime=t-i%n,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=m(t)?t:_f[t]||Zt(t)},t}();var Lf=function(t){this.value=t},Of=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new Lf(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),Pf=function(){function t(t){this._list=new Of,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new Lf(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const Rf=Pf;var Nf={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},Ef=new Rf(20),zf=null,Bf=new Rf(100),Ff=Math.round,Vf=1e-4,Hf={left:"start",right:"end",center:"middle",middle:"middle"},Wf=rd.hasGlobalWindow&&m(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},Gf=Array.prototype.slice,Uf=[0,0,0,0],jf=function(){function t(t){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=t}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,a=!1,s=6,l=e;if(u(e)){var h=function(t){return u(t&&t[0])?2:1}(e);s=h,(1===h&&!x(e[0])||2===h&&!x(e[0][0]))&&(a=!0)}else if(x(e)&&!T(e))s=0;else if(v(e))if(isNaN(+e)){var p=ee(e);p&&(l=p,s=3)}else s=0;else if(M(e)){var d=o({},l);d.colorStops=c(e.colorStops,function(t){return{offset:t.offset,color:ee(t.color)}}),de(e)?s=4:fe(e)&&(s=5),l=d}0===r?this.valType=s:s===this.valType&&6!==s||(a=!0),this.discrete=this.discrete||a;var f={time:t,value:l,rawValue:e,percent:0};return n&&(f.easing=n,f.easingFunc=m(n)?n:_f[n]||Zt(n)),i.push(f),f},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort(function(t,e){return t.time-e.time});for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=ke(i),l=Ie(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var g=r.percent-i.percent,y=0===g?1:f((e-i.percent)/g,1);r.easingFunc&&(y=r.easingFunc(y));var m=o?this._additiveValue:p?Uf:t[h];if(!ke(s)&&!p||m||(m=this._additiveValue=[]),this.discrete)t[h]=y<1?i.rawValue:r.rawValue;else if(ke(s))1===s?xe(m,i[a],r[a],y):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,Me(l),i),this._trackKeys.push(a)}s.addKeyframe(t,Me(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const Yf=Zf;var Xf=function(t){function e(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,n.stage=(e=e||{}).stage||{},n}return W(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=De()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next;i.step(e,n)?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,mf(function e(){t._running&&(mf(e),!t._paused&&t.update())})},e.prototype.start=function(){this._running||(this._time=De(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=De(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=De()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var n=new Yf(t,e.loop);return this.addAnimator(n),n},e}(Ed);const qf=Xf;var $f,Kf,Jf=rd.domSupported,Qf=(Kf={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:$f=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:c($f,function(t){var e=t.replace("mouse","pointer");return Kf.hasOwnProperty(e)?e:t})}),tg=["mousemove","mouseup"],eg=["pointermove","pointerup"],ng=!1,ig=function(t,e){this.stopPropagation=H,this.stopImmediatePropagation=H,this.preventDefault=H,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},rg={mousedown:function(t){t=ct(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=ct(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=ct(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){Oe(this,(t=ct(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){ng=!0,t=ct(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){ng||(t=ct(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Le(t=ct(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),rg.mousemove.call(this,t),rg.mousedown.call(this,t)},touchmove:function(t){Le(t=ct(this.dom,t)),this.handler.processGesture(t,"change"),rg.mousemove.call(this,t)},touchend:function(t){Le(t=ct(this.dom,t)),this.handler.processGesture(t,"end"),rg.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&rg.click.call(this,t)},pointerdown:function(t){rg.mousedown.call(this,t)},pointermove:function(t){Ae(t)||rg.mousemove.call(this,t)},pointerup:function(t){rg.mouseup.call(this,t)},pointerout:function(t){Ae(t)||rg.mouseout.call(this,t)}};h(["click","dblclick","contextmenu"],function(t){rg[t]=function(e){e=ct(this.dom,e),this.trigger(t,e)}});var og={pointermove:function(t){Ae(t)||og.mousemove.call(this,t)},pointerup:function(t){og.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}},ag=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const sg=function(t){function e(e,n){var i,r,o,a=t.call(this)||this;return a.__pointerCapturing=!1,a.dom=e,a.painterRoot=n,a._localHandlerScope=new ag(e,rg),Jf&&(a._globalHandlerScope=new ag(document,og)),i=a,o=(r=a._localHandlerScope).domHandlers,rd.pointerEventsSupported?h(Qf.pointer,function(t){Pe(r,t,function(e){o[t].call(i,e)})}):(rd.touchEventsSupported&&h(Qf.touch,function(t){Pe(r,t,function(e){o[t].call(i,e),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}(r)})}),h(Qf.mouse,function(t){Pe(r,t,function(e){e=ht(e),r.touching||o[t].call(i,e)})})),a}return W(e,t),e.prototype.dispose=function(){Re(this._localHandlerScope),Jf&&Re(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Jf&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?function(t,e){function n(n){Pe(e,n,function(i){i=ht(i),Oe(t,i.target)||(i=function(t,e){return ct(t.dom,new ig(t,e),!0)}(t,i),e.domHandlers[n].call(t,i))},{capture:!0})}rd.pointerEventsSupported?h(eg,n):rd.touchEventsSupported||h(tg,n)}(this,e):Re(e)}},e}(Ed);var lg=1;rd.hasGlobalWindow&&(lg=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var ug=lg,hg="#333",cg="#ccc",pg=yt,dg=5e-5,fg=[],gg=[],yg=[1,0,0,1,0,0],mg=Math.abs,vg=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return Ne(this.rotation)||Ne(this.x)||Ne(this.y)||Ne(this.scaleX-1)||Ne(this.scaleY-1)||Ne(this.skewX)||Ne(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),n=this.transform;e||t?(n=n||[1,0,0,1,0,0],e?this.getLocalTransform(n):pg(n),t&&(e?vt(n,t,n):mt(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(pg(n),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(fg);var n=fg[0]<0?-1:1,i=fg[1]<0?-1:1,r=((fg[0]-n)*e+n)/fg[0]||0,o=((fg[1]-i)*e+i)/fg[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||[1,0,0,1,0,0],wt(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),r=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||[1,0,0,1,0,0],vt(gg,t.invTransform,e),e=gg);var n=this.originX,i=this.originY;(n||i)&&(yg[4]=n,yg[5]=i,vt(gg,e,yg),gg[4]-=n,gg[5]-=i,e=gg),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&tt(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&tt(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&mg(t[0]-1)>1e-10&&mg(t[3]-1)>1e-10?Math.sqrt(mg(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){Ee(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,p=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var d=n+a,f=i+s;e[4]=-d*r-c*f*o,e[5]=-f*o-p*d*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=p*r,e[2]=c*o,l&&xt(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),_g=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];const xg=vg;var wg={},bg="__zr_normal__",Sg=_g.concat(["ignore"]),Cg=p(_g,function(t,e){return t[e]=!0,t},{ignore:!1}),Mg={},Tg=new af(0,0,0,0),Ig=function(){function t(t){this.id=e(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,n){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=Tg;u.copy(n.layoutRect?n.layoutRect:this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Mg,n,u):Ue(Mg,n,u),r.x=Mg.x,r.y=Mg.y,o=Mg.align,a=Mg.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,p=void 0;"center"===h?(c=.5*u.width,p=.5*u.height):(c=Ge(h[0],u.width),p=Ge(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+p+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var d=n.offset;d&&(r.x+=d[0],r.y+=d[1],l||(r.originX=-d[0],r.originY=-d[1]));var f=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),y=void 0,m=void 0,v=void 0;f&&this.canBeInsideText()?(m=n.insideStroke,null!=(y=n.insideFill)&&"auto"!==y||(y=this.getInsideTextFill()),null!=m&&"auto"!==m||(m=this.getInsideTextStroke(y),v=!0)):(m=n.outsideStroke,null!=(y=n.outsideFill)&&"auto"!==y||(y=this.getOutsideFill()),null!=m&&"auto"!==m||(m=this.getOutsideStroke(y),v=!0)),(y=y||"#000")===g.fill&&m===g.stroke&&v===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=y,g.stroke=m,g.autoStroke=v,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=1,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?cg:hg},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof e&&ee(e);n||(n=[255,255,255,1]);for(var i=n[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(r?0:255)*(1-i);return n[3]=1,re(n,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},o(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(w(t))for(var n=f(t),i=0;i0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(bg,!1,t)},t.prototype.useState=function(t,e,i,r){var o=t===bg;if(this.hasState()||!o){var a=this.currentStates,l=this.stateTransition;if(!(s(a,t)>=0)||!e&&1!==a.length){var u;if(this.stateProxy&&!o&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),u||o){o||this.saveCurrentToNormalState(u);var h=!!(u&&u.hoverLayer||r);h&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,u,this._normalState,e,!i&&!this.__inHover&&l&&l.duration>0,l);var c=this._textContent,p=this._textGuide;return c&&c.useState(t,e,i,h),p&&p.useState(t,e,i,h),o?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2),u}n("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,d);var f=this._textContent,g=this._textGuide;f&&f.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this.silent,e=this.parent;!t&&e;){if(e.silent){t=!0;break}e=e.parent}return t},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=s(i,t),o=s(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;o=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var n=s(this._children,t);return n>=0&&this.replaceAt(e,n),this},e.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,n=this._children,i=s(n,t);return i<0||(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(this.painter.resize((t=t||{}).width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this._disposed||this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e0&&(this._ux=Ay(n/ug/t)||0,this._uy=Ay(n/ug/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(_y.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=Ay(t-this._xi),i=Ay(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(_y.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(_y.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(_y.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){return this._drawPendingPt(),Ry[0]=i,Ry[1]=r,function(t,e){var n=$n(t[0]);n<0&&(n+=Oy);var i=t[1];i+=n-t[0],!e&&i-n>=Oy?i=n+Oy:e&&n-i>=Oy?i=n-Oy:!e&&n>i?i=n+(Oy-$n(n-i)):e&&nu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){by[0]=by[1]=Cy[0]=Cy[1]=Number.MAX_VALUE,Sy[0]=Sy[1]=My[0]=My[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tn||Ay(y)>i||c===e-1)&&(f=Math.sqrt(D*D+y*y),r=g,o=_);break;case _y.C:var m=t[c++],v=t[c++],_=(g=t[c++],t[c++]),x=t[c++],w=t[c++];f=Vt(r,o,m,v,g,_,x,w,10),r=x,o=w;break;case _y.Q:f=jt(r,o,m=t[c++],v=t[c++],g=t[c++],_=t[c++],10),r=g,o=_;break;case _y.A:var b=t[c++],S=t[c++],C=t[c++],M=t[c++],T=t[c++],I=t[c++],k=I+T;c+=1,d&&(a=ky(T)*C+b,s=Dy(T)*M+S),f=Iy(C,M)*Ty(Oy,Math.abs(I)),r=ky(k)*C+b,o=Dy(k)*M+S;break;case _y.R:a=r=t[c++],s=o=t[c++],f=2*t[c++]+2*t[c++];break;case _y.Z:var D=a-r;y=s-o,f=Math.sqrt(D*D+y*y),r=a,o=s}f>=0&&(l[h++]=f,u+=f)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,p=this.data,d=this._ux,f=this._uy,g=this._len,y=e<1,m=0,v=0,_=0;if(!y||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),_=0),w){case _y.M:n=r=p[x++],i=o=p[x++],t.moveTo(r,o);break;case _y.L:a=p[x++],s=p[x++];var S=Ay(a-r),C=Ay(s-o);if(S>d||C>f){if(y){if(m+(Y=l[v++])>u){t.lineTo(r*(1-(X=(u-m)/Y))+a*X,o*(1-X)+s*X);break t}m+=Y}t.lineTo(a,s),r=a,o=s,_=0}else{var M=S*S+C*C;M>_&&(h=a,c=s,_=M)}break;case _y.C:var T=p[x++],I=p[x++],k=p[x++],D=p[x++],A=p[x++],L=p[x++];if(y){if(m+(Y=l[v++])>u){Ft(r,T,k,A,X=(u-m)/Y,xy),Ft(o,I,D,L,X,wy),t.bezierCurveTo(xy[1],wy[1],xy[2],wy[2],xy[3],wy[3]);break t}m+=Y}t.bezierCurveTo(T,I,k,D,A,L),r=A,o=L;break;case _y.Q:if(T=p[x++],I=p[x++],k=p[x++],D=p[x++],y){if(m+(Y=l[v++])>u){Ut(r,T,k,X=(u-m)/Y,xy),Ut(o,I,D,X,wy),t.quadraticCurveTo(xy[1],wy[1],xy[2],wy[2]);break t}m+=Y}t.quadraticCurveTo(T,I,k,D),r=k,o=D;break;case _y.A:var O=p[x++],P=p[x++],R=p[x++],N=p[x++],E=p[x++],z=p[x++],B=p[x++],F=!p[x++],V=R>N?R:N,H=Ay(R-N)>.001,W=E+z,G=!1;if(y&&(m+(Y=l[v++])>u&&(W=E+z*(u-m)/Y,G=!0),m+=Y),H&&t.ellipse?t.ellipse(O,P,R,N,B,E,W,F):t.arc(O,P,V,E,W,F),G)break t;b&&(n=ky(E)*R+O,i=Dy(E)*N+P),r=ky(W)*R+O,o=Dy(W)*N+P;break;case _y.R:n=r=p[x],i=o=p[x+1],a=p[x++],s=p[x++];var U=p[x++],j=p[x++];if(y){if(m+(Y=l[v++])>u){var Z=u-m;t.moveTo(a,s),t.lineTo(a+Ty(Z,U),s),(Z-=U)>0&&t.lineTo(a+U,s+Ty(Z,j)),(Z-=j)>0&&t.lineTo(a+Iy(U-Z,0),s+j),(Z-=U)>0&&t.lineTo(a,s+Iy(j-Z,0));break t}m+=Y}t.rect(a,s,U,j);break;case _y.Z:if(y){var Y;if(m+(Y=l[v++])>u){var X;t.lineTo(r*(1-(X=(u-m)/Y))+n*X,o*(1-X)+i*X);break t}m+=Y}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=_y,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();const Ey=Ny;var zy=2*Math.PI,By=2*Math.PI,Fy=Ey.CMD,Vy=2*Math.PI,Hy=[-1,-1,-1],Wy=[-1,-1],Gy=a({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},ey),Uy={style:a({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},ny.style)},jy=_g.concat(["invisible","culling","z","z2","zlevel","parent"]);const Zy=function(t){function e(e){return t.call(this,e)||this}var n;return W(e,t),e.prototype.update=function(){var n=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){n.buildPath(t,n.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?hg:e>.2?"#eee":cg}if(t)return cg}return hg},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(v(e)){var n=this.__zr;if(!(!n||!n.isDarkMode())==oe(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,n){},e.prototype.pathUpdated=function(){this.__dirty&=-5},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new Ey(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||4&this.__dirty)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(i.contain(t=n[0],e=n[1])){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,n,i){return si(t,e,!0,n,i)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,n){return si(t,0,!1,e,n)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},e.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:o(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(4&this.__dirty)},e.prototype.createStyle=function(t){return B(Gy,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=o({},this.shape))},e.prototype._applyStateObj=function(e,n,i,r,a,s){t.prototype._applyStateObj.call(this,e,n,i,r,a,s);var l,u=!(n&&r);if(n&&n.shape?a?r?l=n.shape:(l=o({},i.shape),o(l,n.shape)):(l=o({},r?this.shape:i.shape),o(l,n.shape)):u&&(l=i.shape),l)if(a){this.shape=o({},this.shape);for(var h={},c=f(l),p=0;p0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return B(Yy,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=Fe(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(ly);Xy.prototype.type="tspan";const qy=Xy;var $y=a({x:0,y:0},ey),Ky={style:a({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},ny.style)},Jy=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return W(e,t),e.prototype.createStyle=function(t){return B($y,t)},e.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i,r=(i=e.image)&&"string"!=typeof i&&i.width&&i.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Ky},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new af(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(ly);Jy.prototype.type="image";const Qy=Jy;var tm=Math.round,em=function(){this.x=0,this.y=0,this.width=0,this.height=0},nm={},im=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new em},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=ui(nm,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?function(t,e){var n,i,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?n=i=r=o=c:c instanceof Array?1===c.length?n=i=r=o=c[0]:2===c.length?(n=r=c[0],i=o=c[1]):3===c.length?(n=c[0],i=o=c[1],r=c[2]):(n=c[0],i=c[1],r=c[2],o=c[3]):n=i=r=o=0,n+i>u&&(n*=u/(a=n+i),i*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),i+r>h&&(i*=h/(a=i+r),r*=h/a),n+o>h&&(n*=h/(a=n+o),o*=h/a),t.moveTo(s+n,l),t.lineTo(s+u-i,l),0!==i&&t.arc(s+u-i,l+i,i,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+n),0!==n&&t.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(t,e):t.rect(n,i,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Zy);im.prototype.type="rect";const rm=im;var om={fill:"#000"},am={style:a({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},ny.style)},sm=function(t){function e(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=om,n.attr(e),n}return W(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ef&&h){var g=Math.floor(f/l);c=c||n.length>g,n=n.slice(0,g)}if(t&&a&&null!=p)for(var y=Vn(p,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m={},v=0;v0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),T=i.calculatedLineHeight,I=0;Iu&&Gn(i,t.substring(u,h),e,l),Gn(i,r[2],e,l,r[1]),u=qg.lastIndex}ua){var A=i.lines.length;b>0?(_.tokens=_.tokens.slice(0,b),n(_,w,x),i.lines=i.lines.slice(0,v+1)):i.lines=i.lines.slice(0,v),i.isTruncated=i.isTruncated||i.lines.length=0&&"right"===(I=_[T]).align;)this._placeToken(I,t,w,f,M,"right",y),b-=I.width,M-=I.width,T--;for(C+=(n-(C-d)-(g-M)-b)/2;S<=T;)this._placeToken(I=_[S],t,w,f,C+I.width/2,"center",y),C+=I.width,S++;f+=w}},e.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2),!t.isLineHolder&&_i(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=mi(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var p=this._getOrCreateChild(qy),d=p.createStyle();p.useStyle(d);var f=this._defaultStyle,g=!1,y=0,m=yi("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,f.fill)),v=gi("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||f.autoStroke&&!g?null:(y=2,f.stroke)),_=s.textShadowBlur>0||e.textShadowBlur>0;d.text=t.text,d.x=r,d.y=u,_&&(d.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,d.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",d.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,d.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),d.textAlign=o,d.textBaseline="middle",d.font=t.font||ld,d.opacity=D(s.opacity,e.opacity,1),pi(d,s),v&&(d.lineWidth=D(s.lineWidth,e.lineWidth,y),d.lineDash=k(s.lineDash,e.lineDash),d.lineDashOffset=e.lineDashOffset||0,d.stroke=v),m&&(d.fill=m);var x=t.contentWidth,w=t.contentHeight;p.setBoundingRect(new af(Ve(d.x,x,d.textAlign),He(d.y,w,d.textBaseline),x,w))},e.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,p=u&&u.image,d=u&&!p,f=t.borderRadius,g=this;if(d||t.lineHeight||h&&c){(a=this._getOrCreateChild(rm)).useStyle(a.createStyle()),a.style.fill=null;var y=a.shape;y.x=n,y.y=i,y.width=r,y.height=o,y.r=f,a.dirtyShape()}if(d)(l=a.style).fill=u||null,l.fillOpacity=k(t.fillOpacity,1);else if(p){(s=this._getOrCreateChild(Qy)).onload=function(){g.dirtyStyle()};var m=s.style;m.image=u.image,m.x=n,m.y=i,m.width=r,m.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=k(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var v=(a||s).style;v.shadowBlur=t.shadowBlur||0,v.shadowColor=t.shadowColor||"transparent",v.shadowOffsetX=t.shadowOffsetX||0,v.shadowOffsetY=t.shadowOffsetY||0,v.opacity=D(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return di(t)&&(e=[t.fontStyle,t.fontWeight,ci(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&P(e)||t.textFont||t.font},e}(ly),lm={left:!0,right:1,center:1},um={top:1,bottom:1,middle:1},hm=["fontStyle","fontWeight","fontSize","fontFamily"];const cm=sm;var pm=Sn(),dm=1,fm={},gm=Sn(),ym=Sn(),mm=["emphasis","blur","select"],vm=["normal","emphasis","blur","select"],_m="highlight",xm="downplay",wm="select",bm="unselect",Sm="toggleSelect",Cm={},Mm=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],Tm=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],Im=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],km=Sn(),Dm=["textStyle","color"],Am=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],Lm=new cm;const Om=function(){function t(){}return t.prototype.getTextColor=function(t){var e=this.ecModel;return this.getShallow("color")||(!t&&e?e.get(Dm):null)},t.prototype.getFont=function(){return rr({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},t.prototype.getTextRect=function(t){for(var e={text:t,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},n=0;n-1?Um:Zm;ar(jm,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),ar(Um,{time:{month:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"],monthAbbr:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],dayOfWeek:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],dayOfWeekAbbr:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"]},legend:{selector:{all:"\u5168\u9009",inverse:"\u53cd\u9009"}},toolbox:{brush:{title:{rect:"\u77e9\u5f62\u9009\u62e9",polygon:"\u5708\u9009",lineX:"\u6a2a\u5411\u9009\u62e9",lineY:"\u7eb5\u5411\u9009\u62e9",keep:"\u4fdd\u6301\u9009\u62e9",clear:"\u6e05\u9664\u9009\u62e9"}},dataView:{title:"\u6570\u636e\u89c6\u56fe",lang:["\u6570\u636e\u89c6\u56fe","\u5173\u95ed","\u5237\u65b0"]},dataZoom:{title:{zoom:"\u533a\u57df\u7f29\u653e",back:"\u533a\u57df\u7f29\u653e\u8fd8\u539f"}},magicType:{title:{line:"\u5207\u6362\u4e3a\u6298\u7ebf\u56fe",bar:"\u5207\u6362\u4e3a\u67f1\u72b6\u56fe",stack:"\u5207\u6362\u4e3a\u5806\u53e0",tiled:"\u5207\u6362\u4e3a\u5e73\u94fa"}},restore:{title:"\u8fd8\u539f"},saveAsImage:{title:"\u4fdd\u5b58\u4e3a\u56fe\u7247",lang:["\u53f3\u952e\u53e6\u5b58\u4e3a\u56fe\u7247"]}},series:{typeNames:{pie:"\u997c\u56fe",bar:"\u67f1\u72b6\u56fe",line:"\u6298\u7ebf\u56fe",scatter:"\u6563\u70b9\u56fe",effectScatter:"\u6d9f\u6f2a\u6563\u70b9\u56fe",radar:"\u96f7\u8fbe\u56fe",tree:"\u6811\u56fe",treemap:"\u77e9\u5f62\u6811\u56fe",boxplot:"\u7bb1\u578b\u56fe",candlestick:"K\u7ebf\u56fe",k:"K\u7ebf\u56fe",heatmap:"\u70ed\u529b\u56fe",map:"\u5730\u56fe",parallel:"\u5e73\u884c\u5750\u6807\u56fe",lines:"\u7ebf\u56fe",graph:"\u5173\u7cfb\u56fe",sankey:"\u6851\u57fa\u56fe",funnel:"\u6f0f\u6597\u56fe",gauge:"\u4eea\u8868\u76d8\u56fe",pictorialBar:"\u8c61\u5f62\u67f1\u56fe",themeRiver:"\u4e3b\u9898\u6cb3\u6d41\u56fe",sunburst:"\u65ed\u65e5\u56fe",custom:"\u81ea\u5b9a\u4e49\u56fe\u8868",chart:"\u56fe\u8868"}},aria:{general:{withTitle:"\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u201c{title}\u201d\u7684\u56fe\u8868\u3002",withoutTitle:"\u8fd9\u662f\u4e00\u4e2a\u56fe\u8868\uff0c"},series:{single:{prefix:"",withName:"\u56fe\u8868\u7c7b\u578b\u662f{seriesType}\uff0c\u8868\u793a{seriesName}\u3002",withoutName:"\u56fe\u8868\u7c7b\u578b\u662f{seriesType}\u3002"},multiple:{prefix:"\u5b83\u7531{seriesCount}\u4e2a\u56fe\u8868\u7cfb\u5217\u7ec4\u6210\u3002",withName:"\u7b2c{seriesId}\u4e2a\u7cfb\u5217\u662f\u4e00\u4e2a\u8868\u793a{seriesName}\u7684{seriesType}\uff0c",withoutName:"\u7b2c{seriesId}\u4e2a\u7cfb\u5217\u662f\u4e00\u4e2a{seriesType}\uff0c",separator:{middle:"\uff1b",end:"\u3002"}}},data:{allData:"\u5176\u6570\u636e\u662f\u2014\u2014",partialData:"\u5176\u4e2d\uff0c\u524d{displayCnt}\u9879\u662f\u2014\u2014",withName:"{name}\u7684\u6570\u636e\u662f{value}",withoutName:"{value}",separator:{middle:"\uff0c",end:""}}}});var $m=1e3,Km=6e4,Jm=36e5,Qm=864e5,tv=31536e6,ev={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},nv="{yyyy}-{MM}-{dd}",iv={year:"{yyyy}",month:"{yyyy}-{MM}",day:nv,hour:nv+" "+ev.hour,minute:nv+" "+ev.minute,second:nv+" "+ev.second,millisecond:ev.none},rv=["year","month","day","hour","minute","second","millisecond"],ov=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"],av=L,sv=["a","b","c","d","e","f","g"],lv=function(t,e){return"{"+t+(null==e?"":e)+"}"},uv=h,hv=["left","right","top","bottom","width","height"],cv=[["width","left","right"],["height","top","bottom"]],pv=Pr,dv=(g(Pr,"vertical"),g(Pr,"horizontal"),Sn()),fv=function(e){function n(t,n,i){var r=e.call(this,t,n,i)||this;return r.uid=or("ec_cpt_model"),r}return t(n,e),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n)},n.prototype.mergeDefaultAndTheme=function(t,e){var n=Er(this),i=n?Br(t):{};r(t,e.getTheme().get(this.mainType)),r(t,this.getDefaultOption()),n&&zr(t,i,n)},n.prototype.mergeOption=function(t,e){r(this.option,t,!0);var n=Er(this);n&&zr(this.option,t,n)},n.prototype.optionUpdated=function(t,e){},n.prototype.getDefaultOption=function(){var t=this.constructor;if(!function(t){return!(!t||!t[Ug])}(t))return t.defaultOption;var e=dv(this);if(!e.defaultOption){for(var n=[],i=t;i;){var o=i.prototype.defaultOption;o&&n.push(o),i=i.superClass}for(var a={},s=n.length-1;s>=0;s--)a=r(a,n[s],!0);e.defaultOption=a}return e.defaultOption},n.prototype.getReferringComponents=function(t,e){var n=t+"Id";return Tn(this.ecModel,t,{index:this.get(t+"Index",!0),id:this.get(n,!0)},e)},n.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},n.prototype.getZLevelKey=function(){return""},n.prototype.setZLevel=function(t){this.option.zlevel=t},n.protoInitialize=function(){var t=n.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),n}(Wm);An(fv,Wm),Pn(fv),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=kn(t);e[i.main]=n},t.determineSubType=function(n,i){var r=i.type;if(!r){var o=kn(n).main;t.hasSubTypes(n)&&e[o]&&(r=e[o](i))}return r}}(fv),function(t){function e(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,n,i,r){function o(t){u[t].entryCount--,0===u[t].entryCount&&p.push(t)}function a(t){d[t]=!0,o(t)}if(t.length){var l=function(t){var n={},i=[];return h(t,function(r){var o,a,l=e(n,r),u=function(t,e){var n=[];return h(t,function(t){s(e,t)>=0&&n.push(t)}),n}(l.originalDeps=(a=[],h(fv.getClassesByMainType(o=r),function(t){a=a.concat(t.dependencies||t.prototype.dependencies||[])}),a=c(a,function(t){return kn(t).main}),"dataset"!==o&&s(a,"dataset")<=0&&a.unshift("dataset"),a),t);l.entryCount=u.length,0===l.entryCount&&i.push(r),h(u,function(t){s(l.predecessor,t)<0&&l.predecessor.push(t);var i=e(n,t);s(i.successor,t)<0&&i.successor.push(r)})}),{graph:n,noEntryList:i}}(n),u=l.graph,p=l.noEntryList,d={};for(h(t,function(t){d[t]=!0});p.length;){var f=p.pop(),g=u[f],y=!!d[f];y&&(i.call(r,f,g.originalDeps.slice()),delete d[f]),h(g.successor,y?a:o)}h(d,function(){throw new Error("")})}}}(fv);const gv=fv;var yv="";"undefined"!=typeof navigator&&(yv=navigator.platform||"");var mv="rgba(0, 0, 0, 0.2)";const vv={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:mv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:mv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:mv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:mv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:mv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:mv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:yv.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var _v,xv,wv,bv=E(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Sv="original",Cv="arrayRows",Mv="objectRows",Tv="keyedColumns",Iv="typedArray",kv="unknown",Dv="column",Av="row",Lv=1,Ov=2,Pv=3,Rv=Sn(),Nv=E(),Ev=Sn(),zv=(Sn(),function(){function t(){}return t.prototype.getColorFromPalette=function(t,e,n){var i=pn(this.get("color",!0)),r=this.get("colorLayer",!0);return function(t,e,n,i,r,o,a){var s=e(o=o||t),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(r))return u[r];var h=null!=a&&i?function(t,e){for(var n=t.length,i=0;ie)return t[i];return t[n-1]}(i,a):n;if((h=h||n)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}(this,Ev,i,r,t,e,n)},t.prototype.clearColorPalette=function(){!function(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}(this,Ev)},t}()),Bv="\0_ec_inner",Fv=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new Wm(i),this._locale=new Wm(r),this._optionManager=o},n.prototype.setOption=function(t,e,n){var i=jr(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},n.prototype.resetOption=function(t,e){return this._resetOption(t,jr(e))},n.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):wv(this,r),n=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&h(a,function(t){n=!0,this._mergeOption(t,e)},this)}return n},n.prototype.mergeOption=function(t){this._mergeOption(t,null)},n.prototype._mergeOption=function(t,e){var n=this.option,a=this._componentsMap,s=this._componentsCount,l=[],u=E(),c=e&&e.replaceMergeMainTypeMap;Rv(this).datasetMap=E(),h(t,function(t,e){null!=t&&(gv.hasClass(e)?e&&(l.push(e),u.set(e,!0)):n[e]=null==n[e]?i(t):r(n[e],t,!0))}),c&&c.each(function(t,e){gv.hasClass(e)&&!u.get(e)&&(l.push(e),u.set(e,!0))}),gv.topologicalTravel(l,gv.getAllClassMainTypes(),function(e){var i=function(t,e,n){var i=Nv.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}(this,e,pn(t[e])),r=a.get(e),l=yn(r,i,r?c&&c.get(e)?"replaceMerge":"normalMerge":"replaceAll");!function(t,e,n){h(t,function(t){var i=t.newOption;w(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){return e.type?e.type:n?n.subType:i.determineSubType(t,e)}(e,i,t.existing,n))})}(l,e,gv),n[e]=null,a.set(e,null),s.set(e,0);var u,p=[],d=[],f=0;h(l,function(t,n){var i=t.existing,r=t.newOption;if(r){var a=gv.getClass(e,t.keyInfo.subType,!("series"===e));if(!a)return;if("tooltip"===e){if(u)return;u=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=o({componentIndex:n},t.keyInfo);o(i=new a(r,this,this,s),s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(p.push(i.option),d.push(i),f++):(p.push(void 0),d.push(void 0))},this),n[e]=p,a.set(e,d),s.set(e,f),"series"===e&&_v(this)},this),this._seriesIndices||_v(this)},n.prototype.getOption=function(){var t=i(this.option);return h(t,function(e,n){if(gv.hasClass(n)){for(var i=pn(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!wn(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}}),delete t[Bv],t},n.prototype.getTheme=function(){return this._theme},n.prototype.getLocaleModel=function(){return this._locale},n.prototype.setUpdatePayload=function(t){this._payload=t},n.prototype.getUpdatePayload=function(){return this._payload},n.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;ru&&(u=d)}s[0]=l,s[1]=u}},r=function(){return this._data?this._data.length/this._dimSize:0};(e={})[Cv+"_"+Dv]={pure:!0,appendData:t},e[Cv+"_"+Av]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[Mv]={pure:!0,appendData:t},e[Tv]={pure:!0,appendData:function(t){var e=this._data;h(t,function(t,n){for(var i=e[n]||(e[n]=[]),r=0;r<(t||[]).length;r++)i.push(t[r])})}},e[Sv]={appendData:t},e[Iv]={persistent:!1,pure:!0,appendData:function(t){this._data=t},clean:function(){this._offset+=this.count(),this._data=null}},Jv=e}(),t}(),u_=function(t,e,n,i){return t[i]},h_=((qv={})[Cv+"_"+Dv]=function(t,e,n,i){return t[i+e]},qv[Cv+"_"+Av]=function(t,e,n,i,r){i+=e;for(var o=r||[],a=t,s=0;s=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""}):void 0},t.prototype.getRawValue=function(t,e){return _o(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,n){},t}(),m_=function(){function t(t){this._reset=(t=t||{}).reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){function e(t){return!(t>=1)&&(t=1),t}var n,i=this._upstream,r=t&&t.skip;if(this._dirty&&i){var o=this.context;o.data=o.outputData=i.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!r&&(n=this._plan(this.context));var a,s=e(this._modBy),l=this._modDataCount||0,u=e(t&&t.modBy),h=t&&t.modDataCount||0;s===u&&l===h||(n="reset"),(this._dirty||"reset"===n)&&(this._dirty=!1,a=this._doReset(r)),this._modBy=u,this._modDataCount=h;var c=t&&t.step;if(this._dueEnd=i?i._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,d=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!r&&(a||p=n?null:t1&&o>0?e:t}};return s}(),__=("undefined"!=typeof console&&console.warn&&console,E({number:function(t){return parseFloat(t)},time:function(t){return+on(t)},trim:function(t){return v(t)?P(t):t}}),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=x(t)?t:ln(t),i=x(e)?e:ln(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=v(t),s=v(e);a&&(n=s?t:0),s&&(i=a?e:0)}return ni?-this._resultLT:0},t}()),x_=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return So(t,e)},t}(),w_=E(),b_="undefined",S_=typeof Uint32Array===b_?Array:Uint32Array,C_=typeof Uint16Array===b_?Array:Uint16Array,M_=typeof Int32Array===b_?Array:Int32Array,T_=typeof Float64Array===b_?Array:Float64Array,I_={float:T_,int:M_,ordinal:Array,number:Array,time:T_},k_=function(){function t(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=E()}return t.prototype.initData=function(t,e,n){this._provider=t,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var i=t.getSource(),r=this.defaultDimValueGetter=t_[i.sourceFormat];this._dimValueGetter=n||r,this._rawExtent=[],fo(i),this._dimensions=c(e,function(t){return{type:t.type,property:t.property}}),this._initDataFromProvider(0,t.count())},t.prototype.getProvider=function(){return this._provider},t.prototype.getSource=function(){return this._provider.getSource()},t.prototype.ensureCalculationDimension=function(t,e){var n=this._calcDimNameToIdx,i=this._dimensions,r=n.get(t);if(null!=r){if(i[r].type===e)return r}else r=i.length;return i[r]={type:e},n.set(t,r),this._chunks[r]=new I_[e||"float"](this._rawCount),this._rawExtent[r]=[1/0,-1/0],r},t.prototype.collectOrdinalMeta=function(t,e){var n=this._chunks[t],i=this._dimensions[t],r=this._rawExtent,o=i.ordinalOffset||0,a=n.length;0===o&&(r[t]=[1/0,-1/0]);for(var s=r[t],l=o;lf[1]&&(f[1]=d)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=c(o,function(t){return t.property}),u=0;um[1]&&(m[1]=y)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&nt))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],r=[];if(!i)return r;null==n&&(n=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=this._count;if((r=e.constructor)===Array){t=new r(n);for(var i=0;i=u&&C<=h||isNaN(C))&&(a[s++]=d),d++;p=!0}else if(2===r){g=c[i[0]];var m=c[i[1]],v=t[i[1]][0],_=t[i[1]][1];for(y=0;y=u&&C<=h||isNaN(C))&&(x>=v&&x<=_||isNaN(x))&&(a[s++]=d),d++}p=!0}}if(!p)if(1===r)for(y=0;y=u&&C<=h||isNaN(C))&&(a[s++]=w)}else for(y=0;yt[M][1])&&(b=!1)}b&&(a[s++]=e.getRawIndex(y))}return sy[1]&&(y[1]=g)}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(Ao(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var p=1;pn&&(n=i,r=M)}C>0&&Ca&&(f=a-u);for(var g=0;gd&&(d=y,p=u+g)}var m=this.getRawIndex(h),v=this.getRawIndex(p);hu-d&&(a.length=s=u-d);for(var f=0;fh[1]&&(h[1]=y),c[p++]=m}return r._count=p,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();ra&&(a=l)}return this._extent[t]=i=[o,a],i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return So(t[i],this._dimensions[i])}t_={arrayRows:t,objectRows:function(t,e,n,i){return So(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return So(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const D_=k_;var A_=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(Ro(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]}else s=S(a=o.get("data",!0))?Iv:Sv,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},p=k(h.seriesLayoutBy,c.seriesLayoutBy)||null,d=k(h.sourceHeader,c.sourceHeader),f=k(h.dimensions,c.dimensions);t=p!==c.seriesLayoutBy||!!d!=!!c.sourceHeader||f?[lo(a,{seriesLayoutBy:p,sourceHeader:d,dimensions:f},s)]:[]}else{var g=n;if(r){var y=this._applyTransform(i);t=y.sourceList,e=y.upstreamSignList}else t=[lo(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,r=n.get("transform",!0),o=n.get("fromTransformResult",!0);null!=o&&1!==t.length&&No("");var a,s=[],l=[];return h(t,function(t){t.prepareSource();var e=t.getSource(o||0);null==o||e||No(""),s.push(e),l.push(t._getVersionSign())}),r?e=function(t,e){var n=pn(t),i=n.length;i||bo("");for(var r=0,o=i;r':'':{renderMode:o,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}({color:e,type:t,renderMode:n,markerId:i});return v(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};y(e)?h(e,function(t){return o(n,t)}):o(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}(),R_=Sn(),N_=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t(n,e),n.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=wo({count:Ko,reset:Jo}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(R_(this).sourceManager=new A_(this)).prepareSource();var i=this.getInitialData(t,n);ta(i,this),this.dataTask.context.data=i,R_(this).dataBeforeProcessed=i,$o(this),this._initSelectedMapFromData(i)},n.prototype.mergeDefaultAndTheme=function(t,e){var n=Er(this),i=n?Br(t):{},o=this.subType;gv.hasClass(o)&&(o+="Series"),r(t,e.getTheme().get(this.subType)),r(t,this.getDefaultOption()),dn(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&zr(t,i,n)},n.prototype.mergeOption=function(t,e){t=r(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Er(this);n&&zr(this.option,t,n);var i=R_(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(t,e);ta(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,R_(this).dataBeforeProcessed=o,$o(this),this._initSelectedMapFromData(o)},n.prototype.fillDataTextStyle=function(t){if(t&&!S(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},n.prototype.restoreData=function(){this.dataTask.dirty()},n.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=zv.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},n.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},n.prototype.getProgressive=function(){return this.get("progressive")},n.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},n.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},n.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},n.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[qo(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},n.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},n.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){w(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;l0&&this._innerSelect(t,e)}},n.registerClass=function(t){return gv.registerClass(t)},n.protoInitialize=function(){var t=n.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),n}(gv);l(N_,y_),l(N_,zv),An(N_,gv);const E_=N_;var z_=function(){function t(){this.group=new Ag,this.uid=or("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){},t.prototype.updateLayout=function(t,e,n,i){},t.prototype.updateVisual=function(t,e,n,i){},t.prototype.toggleBlurSeries=function(t,e,n){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Dn(z_),Pn(z_);const B_=z_;var F_=Ey.CMD,V_=[[],[],[]],H_=Math.sqrt,W_=Math.atan2,G_=Math.sqrt,U_=Math.sin,j_=Math.cos,Z_=Math.PI,Y_=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,X_=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g,q_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return W(e,t),e.prototype.applyTransform=function(t){},e}(Zy),$_=function(){this.cx=0,this.cy=0,this.r=0},K_=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new $_},e.prototype.buildPath=function(t,e){t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI)},e}(Zy);K_.prototype.type="circle";const J_=K_;var Q_=function(){this.cx=0,this.cy=0,this.rx=0,this.ry=0},tx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new Q_},e.prototype.buildPath=function(t,e){var n=.5522848,i=e.cx,r=e.cy,o=e.rx,a=e.ry,s=o*n,l=a*n;t.moveTo(i-o,r),t.bezierCurveTo(i-o,r-l,i-s,r-a,i,r-a),t.bezierCurveTo(i+s,r-a,i+o,r-l,i+o,r),t.bezierCurveTo(i+o,r+l,i+s,r+a,i,r+a),t.bezierCurveTo(i-s,r+a,i-o,r+l,i-o,r),t.closePath()},e}(Zy);tx.prototype.type="ellipse";const ex=tx;var nx=Math.PI,ix=2*nx,rx=Math.sin,ox=Math.cos,ax=Math.acos,sx=Math.atan2,lx=Math.abs,ux=Math.sqrt,hx=Math.max,cx=Math.min,px=1e-4,dx=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},fx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new dx},e.prototype.buildPath=function(t,e){!function(t,e){var n,i=hx(e.r,0),r=hx(e.r0||0,0),o=i>0;if(o||r>0){if(o||(i=r,r=0),r>i){var a=i;i=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var u=e.cx,h=e.cy,c=!!e.clockwise,p=lx(l-s),d=p>ix&&p%ix;if(d>px&&(p=d),i>px)if(p>ix-px)t.moveTo(u+i*ox(s),h+i*rx(s)),t.arc(u,h,i,s,l,!c),r>px&&(t.moveTo(u+r*ox(l),h+r*rx(l)),t.arc(u,h,r,l,s,c));else{var f=void 0,g=void 0,m=void 0,v=void 0,_=void 0,x=void 0,w=void 0,b=void 0,S=void 0,C=void 0,M=void 0,T=void 0,I=void 0,k=void 0,D=void 0,A=void 0,L=i*ox(s),O=i*rx(s),P=r*ox(l),R=r*rx(l),N=p>px;if(N){var E=e.cornerRadius;E&&(n=function(t){var e;if(y(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}(E),f=n[0],g=n[1],m=n[2],v=n[3]);var z=lx(i-r)/2;if(_=cx(z,m),x=cx(z,v),w=cx(z,f),b=cx(z,g),M=S=hx(_,x),T=C=hx(w,b),(S>px||C>px)&&(I=i*ox(l),k=i*rx(l),D=r*ox(s),A=r*rx(s),ppx){var j=cx(m,M),Z=cx(v,M),Y=ha(D,A,L,O,i,j,c),X=ha(I,k,P,R,i,Z,c);t.moveTo(u+Y.cx+Y.x0,h+Y.cy+Y.y0),M0&&t.arc(u+Y.cx,h+Y.cy,j,sx(Y.y0,Y.x0),sx(Y.y1,Y.x1),!c),t.arc(u,h,i,sx(Y.cy+Y.y1,Y.cx+Y.x1),sx(X.cy+X.y1,X.cx+X.x1),!c),Z>0&&t.arc(u+X.cx,h+X.cy,Z,sx(X.y1,X.x1),sx(X.y0,X.x0),!c))}else t.moveTo(u+L,h+O),t.arc(u,h,i,s,l,!c);else t.moveTo(u+L,h+O);r>px&&N?T>px?(j=cx(f,T),Y=ha(P,R,I,k,r,-(Z=cx(g,T)),c),X=ha(L,O,D,A,r,-j,c),t.lineTo(u+Y.cx+Y.x0,h+Y.cy+Y.y0),T0&&t.arc(u+Y.cx,h+Y.cy,Z,sx(Y.y0,Y.x0),sx(Y.y1,Y.x1),!c),t.arc(u,h,r,sx(Y.cy+Y.y1,Y.cx+Y.x1),sx(X.cy+X.y1,X.cx+X.x1),c),j>0&&t.arc(u+X.cx,h+X.cy,j,sx(X.y1,X.x1),sx(X.y0,X.x0),!c))):(t.lineTo(u+P,h+R),t.arc(u,h,r,l,s,c)):t.lineTo(u+P,h+R)}else t.moveTo(u,h);t.closePath()}}}(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(Zy);fx.prototype.type="sector";const gx=fx;var yx=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},mx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new yx},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},e}(Zy);mx.prototype.type="ring";const vx=mx;var _x=function(){this.points=null,this.smooth=0,this.smoothConstraint=null},xx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultShape=function(){return new _x},e.prototype.buildPath=function(t,e){ca(t,e,!0)},e}(Zy);xx.prototype.type="polygon";const bx=xx;var Sx=function(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null},Cx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Sx},e.prototype.buildPath=function(t,e){ca(t,e,!1)},e}(Zy);Cx.prototype.type="polyline";const Mx=Cx;var Tx={},Ix=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1},kx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ix},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=li(Tx,e,this.style);n=a.x1,i=a.y1,r=a.x2,o=a.y2}else n=e.x1,i=e.y1,r=e.x2,o=e.y2;var s=e.percent;0!==s&&(t.moveTo(n,i),s<1&&(r=n*(1-s)+r*s,o=i*(1-s)+o*s),t.lineTo(r,o))},e.prototype.pointAt=function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]},e}(Zy);kx.prototype.type="line";const Dx=kx;var Ax=[],Lx=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1},Ox=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Lx},e.prototype.buildPath=function(t,e){var n=e.x1,i=e.y1,r=e.x2,o=e.y2,a=e.cpx1,s=e.cpy1,l=e.cpx2,u=e.cpy2,h=e.percent;0!==h&&(t.moveTo(n,i),null==l||null==u?(h<1&&(Ut(n,a,r,h,Ax),a=Ax[1],r=Ax[2],Ut(i,s,o,h,Ax),s=Ax[1],o=Ax[2]),t.quadraticCurveTo(a,s,r,o)):(h<1&&(Ft(n,a,l,r,h,Ax),a=Ax[1],l=Ax[2],r=Ax[3],Ft(i,s,u,o,h,Ax),s=Ax[1],u=Ax[2],o=Ax[3]),t.bezierCurveTo(a,s,l,u,r,o)))},e.prototype.pointAt=function(t){return pa(this.shape,t,!1)},e.prototype.tangentAt=function(t){var e=pa(this.shape,t,!0);return J(e,e)},e}(Zy);Ox.prototype.type="bezier-curve";const Px=Ox;var Rx=function(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},Nx=function(t){function e(e){return t.call(this,e)||this}return W(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Rx},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),u=Math.sin(o);t.moveTo(l*r+n,u*r+i),t.arc(n,i,r,o,a,!s)},e}(Zy);Nx.prototype.type="arc";const Ex=Nx;var zx=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="compound",e}return W(e,t),e.prototype._updatePathDirty=function(){for(var t=this.shape.paths,e=this.shapeChanged(),n=0;nGx[1]){if(a=!1,r)return a;var u=Math.abs(Gx[0]-Wx[1]),h=Math.abs(Wx[0]-Gx[1]);Math.min(u,h)>i.len()&&qd.scale(i,l,un.blockIndex?n.step:null,o=i&&i.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),r=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,o=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=E();t.eachSeries(function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)})},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;h(this._allHandlers,function(i){var r=t.get(i.uid)||t.set(i.uid,{});O(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)},this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){function r(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}i=i||{};var o=!1,a=this;h(t,function(t,s){if(!i.visualType||i.visualType===t.visualType){var l=a._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,p=h.agentStubMap;p.each(function(t){r(i,t)&&(t.dirty(),c=!0)}),c&&h.dirty(),a.updatePayload(h,n);var d=a.getPerformArgs(h,i.block);p.each(function(t){t.perform(d)}),h.perform(d)&&(o=!0)}else u&&u.each(function(s,l){r(i,s)&&s.dirty();var u=a.getPerformArgs(s,i.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(u)&&(o=!0)})}}),this.unfinished=o||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries(function(t){e=t.dataTask.perform()||e}),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)})},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){function r(e){var r=e.uid,l=s.set(r,a&&a.get(r)||wo({plan:rs,reset:os,count:ss}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:o},o._pipe(e,l)}var o=this,a=e.seriesTaskMap,s=e.seriesTaskMap=E(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(r):l?n.eachRawSeriesByType(l,r):u&&u(n,i).each(r)},t.prototype._createOverallStageTask=function(t,e,n,i){function r(t){var e=t.uid,n=l.set(e,s&&s.get(e)||(d=!0,wo({reset:es,onDirty:is})));n.context={model:t,overallProgress:p},n.agent=a,n.__block=p,o._pipe(t,n)}var o=this,a=e.overallTask=e.overallTask||wo({reset:ts});a.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:o};var s=a.agentStubMap,l=a.agentStubMap=E(),u=t.seriesType,c=t.getTargetSeries,p=!0,d=!1;O(!t.createOnAllSeries,""),u?n.eachRawSeriesByType(u,r):c?c(n,i).each(r):(p=!1,h(n.getSeries(),r)),d&&a.dirty()},t.prototype._pipe=function(t,e){var n=this._pipelineMap.get(t.uid);!n.head&&(n.head=e),n.tail&&n.tail.pipe(e),n.tail=e,e.__idxInPipeline=n.count++,e.__pipeline=n},t.wrapStageHandler=function(t,e){return m(t)&&(t={overallReset:t,seriesType:ls(t)}),t.uid=or("stageHandler"),e&&(t.visualType=e),t},t}(),ww=as(0),bw={},Sw={};us(bw,Vv),us(Sw,Wv),bw.eachSeriesByType=bw.eachRawSeriesByType=function(t){lw=t},bw.eachComponent=function(t){"series"===t.mainType&&t.subType&&(lw=t.subType)};const Cw=xw;var Mw=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"];const Tw={color:Mw,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],Mw]};var Iw="#B9B8CE",kw="#100C2A",Dw=function(){return{axisLine:{lineStyle:{color:Iw}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},Aw=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],Lw={darkMode:!0,color:Aw,backgroundColor:kw,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:Iw},pageTextStyle:{color:Iw}},textStyle:{color:Iw},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:Iw}},dataZoom:{borderColor:"#71708A",textStyle:{color:Iw},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:Iw}},timeline:{lineStyle:{color:Iw},label:{color:Iw},controlStyle:{color:Iw,borderColor:Iw}},calendar:{itemStyle:{color:kw},dayLabel:{color:Iw},monthLabel:{color:Iw},yearLabel:{color:Iw}},timeAxis:Dw(),logAxis:Dw(),valueAxis:Dw(),categoryAxis:Dw(),line:{symbol:"circle"},graph:{color:Aw},gauge:{title:{color:Iw},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:Iw},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};Lw.categoryAxis.splitLine.show=!1;const Ow=Lw;var Pw=function(){function t(){}return t.prototype.normalizeQuery=function(t){var e={},n={},i={};if(v(t)){var r=kn(t);e.mainType=r.main||null,e.subType=r.sub||null}else{var o=["Index","Name","Id"],a={name:1,dataIndex:1,dataType:1};h(t,function(t,r){for(var s=!1,l=0;l0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)})}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){function n(t,e,n,i){return null==t[n]||e[i||n]===t[n]}var i=this.eventInfo;if(!i)return!0;var r=i.targetEl,o=i.packedEvent,a=i.model,s=i.view;if(!a||!s)return!0;var l=e.cptQuery,u=e.dataQuery;return n(l,a,"mainType")&&n(l,a,"subType")&&n(l,a,"index","componentIndex")&&n(l,a,"name")&&n(l,a,"id")&&n(u,o,"name")&&n(u,o,"dataIndex")&&n(u,o,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,e.otherQuery,r,o))},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Rw=["symbol","symbolSize","symbolRotate","symbolOffset"],Nw=Rw.concat(["symbolKeepAspect"]),Ew={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},r={},a=!1,s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},n.prototype.getDom=function(){return this._dom},n.prototype.getId=function(){return this.id},n.prototype.getZr=function(){return this._zr},n.prototype.isSSR=function(){return this._ssr},n.prototype.setOption=function(t,e,n){if(!this[Cb])if(this._disposed);else{var i,r,o;if(w(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[Cb]=!0,!this._model||e){var a=new Xv(this._api),s=this._theme,l=this._model=new Vv;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},zb);var u={seriesTransition:o,optionChanged:!0};if(n)this[Mb]={silent:i,updateParams:u},this[Cb]=!1,this.getZr().wakeUp();else{try{nb(this),ob.update.call(this,null,u)}catch(t){throw this[Mb]=null,this[Cb]=!1,t}this._ssr||this._zr.flush(),this[Mb]=null,this[Cb]=!1,ub.call(this,i),hb.call(this,i)}}},n.prototype.setTheme=function(){},n.prototype.getModel=function(){return this._model},n.prototype.getOption=function(){return this._model&&this._model.getOption()},n.prototype.getWidth=function(){return this._zr.getWidth()},n.prototype.getHeight=function(){return this._zr.getHeight()},n.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||rd.hasGlobalWindow&&window.devicePixelRatio||1},n.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},n.prototype.renderToCanvas=function(t){return this._zr.painter.getRenderedCanvas({backgroundColor:(t=t||{}).backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},n.prototype.renderToSVGString=function(t){return this._zr.painter.renderToString({useViewBox:(t=t||{}).useViewBox})},n.prototype.getSvgDataURL=function(){if(rd.svgSupported){var t=this._zr;return h(t.storage.getDisplayList(),function(t){t.stopAnimation(null,!0)}),t.painter.toDataURL()}},n.prototype.getDataURL=function(t){if(!this._disposed){var e=this._model,n=[],i=this;h((t=t||{}).excludeComponents,function(t){e.eachComponent({mainType:t},function(t){var e=i._componentsMap[t.__viewId];e.group.ignore||(n.push(e),e.group.ignore=!0)})});var r="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return h(n,function(t){t.group.ignore=!1}),r}},n.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,r=Math.min,o=Math.max,a=1/0;if(Wb[n]){var s=a,l=a,u=-1/0,c=-1/0,p=[],d=t&&t.pixelRatio||this.getDevicePixelRatio();h(Hb,function(a,h){if(a.group===n){var d=e?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(i(t)),f=a.getDom().getBoundingClientRect();s=r(f.left,s),l=r(f.top,l),u=o(f.right,u),c=o(f.bottom,c),p.push({dom:d,left:f.left,top:f.top})}});var f=(u*=d)-(s*=d),g=(c*=d)-(l*=d),y=hd.createCanvas(),m=qe(y,{renderer:e?"svg":"canvas"});if(m.resize({width:f,height:g}),e){var v="";return h(p,function(t){v+=''+t.dom+""}),m.painter.getSvgRoot().innerHTML=v,t.connectedBackgroundColor&&m.painter.setBackgroundColor(t.connectedBackgroundColor),m.refreshImmediately(),m.painter.toDataURL()}return t.connectedBackgroundColor&&m.add(new rm({shape:{x:0,y:0,width:f,height:g},style:{fill:t.connectedBackgroundColor}})),h(p,function(t){var e=new Qy({style:{x:t.left*d-s,y:t.top*d-l,image:t.dom}});m.add(e)}),m.refreshImmediately(),y.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},n.prototype.convertToPixel=function(t,e){return ab(this,"convertToPixel",t,e)},n.prototype.convertFromPixel=function(t,e){return ab(this,"convertFromPixel",t,e)},n.prototype.containPixel=function(t,e){var n;if(!this._disposed)return h(Cn(this._model,t),function(t,i){i.indexOf("Models")>=0&&h(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}},this)},this),!!n},n.prototype.getVisual=function(t,e){var n=Cn(this._model,t,{defaultMainType:"series"}),i=n.seriesModel.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=r?function(t,e,n){switch(n){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,n)}}(i,r,e):function(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}(i,e)},n.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},n.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},n.prototype._initEvents=function(){var t,e,n=this;h(Pb,function(t){var e=function(e){var i,r=n.getModel(),a=e.target;if("globalout"===t?i={}:a&&cs(a,function(t){var e=pm(t);if(e&&null!=e.dataIndex){var n=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return i=n&&n.getDataParams(e.dataIndex,e.dataType,a)||{},!0}if(e.eventData)return i=o({},e.eventData),!0},!0),i){var s=i.componentType,l=i.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=i.seriesIndex);var u=s&&null!=l&&r.getComponent(s,l),h=u&&n["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];i.event=e,i.type=t,n._$eventProcessor.eventInfo={targetEl:a,packedEvent:i,model:u,view:h},n.trigger(t,i)}};e.zrEventfulCallAtLast=!0,n._zr.on(t,e,n)}),h(Nb,function(t,e){n._messageCenter.on(e,function(t){this.trigger(e,t)},n)}),h(["selectchanged"],function(t){n._messageCenter.on(t,function(e){this.trigger(t,e)},n)}),t=this,e=this._api,this._messageCenter.on("selectchanged",function(n){var i=e.getModel();n.isFromClick?(hs("map","selectchanged",t,i,n),hs("pie","selectchanged",t,i,n)):"select"===n.fromAction?(hs("map","selected",t,i,n),hs("pie","selected",t,i,n)):"unselect"===n.fromAction&&(hs("map","unselected",t,i,n),hs("pie","unselected",t,i,n))})},n.prototype.isDisposed=function(){return this._disposed},n.prototype.clear=function(){this._disposed||this.setOption({series:[]},!0)},n.prototype.dispose=function(){if(this._disposed);else{this._disposed=!0,this.getDom()&&In(this.getDom(),Ub,"");var t=this,e=t._api,n=t._model;h(t._componentsViews,function(t){t.dispose(n,e)}),h(t._chartsViews,function(t){t.dispose(n,e)}),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete Hb[t.id]}},n.prototype.resize=function(t){if(!this[Cb])if(this._disposed);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[Mb]&&(null==i&&(i=this[Mb].silent),n=!0,this[Mb]=null),this[Cb]=!0;try{n&&nb(this),ob.update.call(this,{type:"resize",animation:o({duration:0},t&&t.animation)})}catch(t){throw this[Cb]=!1,t}this[Cb]=!1,ub.call(this,i),hb.call(this,i)}}},n.prototype.showLoading=function(t,e){if(this._disposed);else if(w(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),Vb[t]){var n=Vb[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},n.prototype.hideLoading=function(){this._disposed||(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},n.prototype.makeActionFromEvent=function(t){var e=o({},t);return e.type=Nb[t.type],e},n.prototype.dispatchAction=function(t,e){if(this._disposed);else if(w(e)||(e={silent:!!e}),Rb[t.type]&&this._model)if(this[Cb])this._pendingActions.push(t);else{var n=e.silent;lb.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&rd.browser.weChat&&this._throttledZrFlush(),ub.call(this,n),hb.call(this,n)}},n.prototype.updateLabelLayout=function(){eb.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},n.prototype.appendData=function(t){if(this._disposed);else{var e=t.seriesIndex;this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},n.internalField=function(){function e(t){t.clearColorPalette(),t.eachSeries(function(t){t.clearColorPalette()})}function n(t){for(var e=[],n=t.currentStates,i=0;i0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;e.eachRendered(function(t){if(t.states&&t.states.emphasis){if(ma(t))return;if(t instanceof Zy&&function(t){var e=gm(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var e=t.prevStates;e&&t.useStates(e)}if(r){t.stateTransition=a;var i=t.getTextContent(),o=t.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&n(t)}})}nb=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),ib(t,!0),ib(t,!1),e.plan()},ib=function(t,e){function n(t){var n=t.__requireNewView;t.__requireNewView=!1;var u="_ec_"+t.id+"_"+t.type,h=!n&&a[u];if(!h){var c=kn(t.type);(h=new(e?B_.getClass(c.main,c.sub):sw.getClass(c.sub))).init(i,l),a[u]=h,o.push(h),s.add(h.group)}t.__viewId=h.__id=u,h.__alive=!0,h.__model=t,h.group.__ecComponentInfo={mainType:t.mainType,index:t.componentIndex},!e&&r.prepareView(h,t,i,l)}for(var i=t._model,r=t._scheduler,o=e?t._componentsViews:t._chartsViews,a=e?t._componentsMap:t._chartsMap,s=t._zr,l=t._api,u=0;ue.get("hoverLayerThreshold")&&!rd.node&&!rd.worker&&e.eachSeries(function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered(function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)})}})}(t,e),eb.trigger("series:afterupdate",e,n,a)},vb=function(t){t[Tb]=!0,t.getZr().wakeUp()},_b=function(t){t[Tb]&&(t.getZr().storage.traverse(function(t){ma(t)||n(t)}),t[Tb]=!1)},yb=function(e){return new(function(n){function i(){return null!==n&&n.apply(this,arguments)||this}return t(i,n),i.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},i.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(null!=n)return e._model.getComponent(n.mainType,n.index);t=t.parent}},i.prototype.enterEmphasis=function(t,n){Ri(t,n),vb(e)},i.prototype.leaveEmphasis=function(t,n){Ni(t,n),vb(e)},i.prototype.enterBlur=function(t){!function(t){Di(t,Ci)}(t),vb(e)},i.prototype.leaveBlur=function(t){Ei(t),vb(e)},i.prototype.enterSelect=function(t){zi(t),vb(e)},i.prototype.leaveSelect=function(t){Bi(t),vb(e)},i.prototype.getModel=function(){return e.getModel()},i.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},i.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},i}(Wv))(e)},mb=function(t){function e(t,e){for(var n=0;nOpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[{name:"ok",nodeStyle:{color:"#1ba619"}},{name:"problem",nodeStyle:{color:"#ffa500"}},{name:"critical",nodeStyle:{color:"#c92517"}}],linkCategories:[],bookmarkableActions:{enabled:!1,id:null,zoomOnRestore:!0,zoomLevel:null},prepareData(t){t&&t.nodes&&t.nodes.forEach(t=>{if(t.properties&&t.properties.status){const e=t.properties.status.toLowerCase();"ok"!==e&&"problem"!==e&&"critical"!==e||(t.category=e)}})},onClickElement(t,e){let n;this.utils&&this.utils.isNetJSON(this.data)?(n="node"===t?this.utils.nodeInfo(e):"link"===t?this.utils.linkInfo(e):e,(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):({nodeLinkData:n}={nodeLinkData:e}),this.gui.getNodeLinkInfo(t,n),this.gui.sideBar.classList.remove("hidden")},onReady(){}}};Object.defineProperty(Yb,"crs",{get(){const t=Ks(!0);return t?t.CRS.EPSG3857:null},enumerable:!0,configurable:!0});const Xb=Yb,qb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class $b{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const r=qb[15&n];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new $b(a,o,r,t)}constructor(t,e=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=qb.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Js(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=a){for(let a=c;a<=h;a++){const s=o[2*a],u=o[2*a+1];s>=t&&s<=n&&u>=e&&u<=i&&l.push(r[a])}continue}const p=c+h>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=n&&f>=e&&f<=i&&l.push(r[p]),(0===u?t<=d:e<=f)&&(s.push(c),s.push(p-1),s.push(1-u)),(0===u?n>=d:i>=f)&&(s.push(p+1),s.push(h),s.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:r,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=n*n;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,c=a.pop()||0;if(h-c<=o){for(let n=c;n<=h;n++)nl(r[2*n],r[2*n+1],t,e)<=l&&s.push(i[n]);continue}const p=c+h>>1,d=r[2*p],f=r[2*p+1];nl(d,f,t,e)<=l&&s.push(i[p]),(0===u?t-n<=d:e-n<=f)&&(a.push(c),a.push(p-1),a.push(1-u)),(0===u?t+n>=d:e+n>=f)&&(a.push(p+1),a.push(h),a.push(1-u))}return s}}const Kb=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"}).then(t=>t).catch(t=>{console.error(t)}):Promise.resolve(t)}async paginatedDataParse(t){let e,n;try{let i=await this.utils.JSONParamParse(t);if(i.json)for(e=await i.json(),n=e.results?e.results:e;e.next&&n.nodes.length<=this.config.maxPointsFetched;)i=await this.utils.JSONParamParse(e.next),e=await i.json(),n.nodes=n.nodes.concat(e.results.nodes),n.links=n.links.concat(e.results.links),this.hasMoreData=!!e.next;else n=i}catch(t){console.error(t)}return n}async getBBoxData(t,e){let n;try{const i=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(i);n=await r.json()}catch(t){console.error(t)}return n}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:n=(new Date).getTimezoneOffset()/60}){const i=e.exec(t);if(!i||i.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=new Map([["dateMonth",12],["dateDay",[31,i[1]%4==0&&i[1]%100!=0||i[1]%400==0?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(i[t],10);let s,l=-n;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=l;break}s="dateDay"===r[t-1]?a.get("dateDay")[o.dateMonth-1]:a.get(r[t-1]);let e=o[r[t-1]]+l;l="dateHour"===r[t-1]?e<0?-1:e>=s?1:0:e<=0?-1:e>s?1:0,1===l?e-=s:l<0&&("dateDay"===r[t-1]&&(s=a.get("dateDay")[(o[r[t-1]]+10)%11]),e+=s),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(i[5])}:${this.numberMinDigit(i[6])}${i[7]?`.${this.numberMinDigit(i[7],3)}`:""}`}numberMinDigit(t,e=2,n="0"){return(Array(e).join(n)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links)}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&this.isObject(t)&&this.isArray(t.geometry)}geojsonToNetjson(t){return function(t){const e=[],n=[];if(!t||!Array.isArray(t.features))return{nodes:e,links:n};const i=new Map,r=(t,n={})=>{const r=`${t[0]},${t[1]}`;if(i.has(r))return i.get(r);const o=n.id||n.node_id||null,a=n.label||n.name||o||null,s=o?String(o):`gjn_${e.length}`,l=!o,u={id:s,...a?{label:String(a)}:{},location:{lng:t[0],lat:t[1]},properties:{...n,location:{lng:t[0],lat:t[1]}},_generatedIdentity:l};return e.push(u),i.set(r,s),s},o=(t,e,i={})=>{n.push({source:t,target:e,properties:i})},a=(t,e,n=!1)=>{for(let n=0;n2){const n=r(t[0],e),i=r(t[t.length-1],e);o(i,n,e)}},s=(t,e)=>{if(!t)return;const{type:n,coordinates:i,geometries:o}=t;switch(n){case"Point":r(i,{...e,_featureType:"Point"});break;case"MultiPoint":i.forEach(t=>r(t,{...e,_featureType:"Point"}));break;case"LineString":a(i,{...e,_featureType:"LineString"},!1);break;case"MultiLineString":i.forEach(t=>a(t,{...e,_featureType:"LineString"},!1));break;case"Polygon":case"MultiPolygon":break;case"GeometryCollection":o.forEach(t=>s(t,e));break;default:console.warn(`Unsupported GeoJSON geometry type: ${n}`)}};return t.features.forEach(t=>{const e={...t.properties||{},...null!=t.id?{id:t.id}:{}};s(t.geometry,e)}),{nodes:e,links:n}}(t)}deepCopy(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(t=>this.deepCopy(t));const e={};return Object.keys(t).forEach(n=>{e[n]=this.deepCopy(t[n])}),e}fastDeepCopy(t){return"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t))}deepMergeObj(...t){const e=[...t].reverse(),n=e.length;for(let t=0;t{i[t]&&this.isObject(i[t])&&this.isObject(n[t])?this.deepMergeObj(i[t],n[t]):i[t]=n[t]}):i||(e[t+1]=n)}return e[n-1]}makeCluster(t){const{nodes:e,links:n}=t.data,i=t=>!(t.properties&&t.properties._featureType)||"Point"===t.properties._featureType,r=e.filter(i),o=e.filter(t=>!i(t)),a=[],s=[],l=new Map;o.forEach(t=>l.set(t.id,null));let u=0;r.forEach(e=>{const n=e.properties&&e.properties.location||e.location;if(!n||void 0===n.lat||void 0===n.lng)return;e.location=n,e._origLocation?(n.lat=e._origLocation.lat,n.lng=e._origLocation.lng):e._origLocation={lat:n.lat,lng:n.lng};const i=t.leaflet.latLngToContainerPoint([n.lat,n.lng]);e.x=i.x,e.y=i.y,e.visited=!1,e.cluster=null});const h=new $b(r.length);r.forEach(({x:t,y:e})=>h.add(t,e)),h.finish();const c=t.config&&t.config.mapOptions&&t.config.mapOptions.clusterConfig&&t.config.mapOptions.clusterConfig.symbolSize,p=t=>{if("function"==typeof c)try{return c(t)}catch(t){return 30}return Array.isArray(c)?c[0]||30:"number"==typeof c?c:30},d=new Map;r.forEach(e=>{if(e.visited)return;const n=h.within(e.x,e.y,t.config.clusterRadius).map(t=>r[t]);if(n.length>1){const i=`${Math.round(e.x)},${Math.round(e.y)}`;d.has(i)||d.set(i,new Map);const r=d.get(i);n.forEach(e=>{if(e.visited)return;const n=t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]:"default";r.has(n)||r.set(n,[]),r.get(n).push(e),e.visited=!0})}else e.visited=!0,l.set(e.id,null),o.push(e)}),d.forEach(e=>{const n=Array.from(e.entries()),i=n.length;let r=0;n.forEach(([,t])=>{const e=p(t.length);e>r&&(r=e)});const a="number"==typeof t.config.clusterSeparation?t.config.clusterSeparation:Math.max(10,Math.floor(t.config.clusterRadius/2));let h=0;if(i>1){const t=Math.PI/i,e=Math.sin(t);e>0&&(h=r/(2*e))}const c=Math.max(a,h+4);n.forEach(([,e],n)=>{if(e.length>1){let r=0,o=0;if(e.forEach(t=>{t.cluster=u,l.set(t.id,t.cluster),r+=t.location.lng,o+=t.location.lat}),r/=e.length,o/=e.length,i>1){const e=2*Math.PI*n/i,a=t.leaflet.latLngToContainerPoint([o,r]),s=[a.x+c*Math.cos(e),a.y+c*Math.sin(e)],l=t.leaflet.containerPointToLatLng(s);r=l.lng,o=l.lat}const a={id:u,cluster:!0,name:e.length,value:[r,o],childNodes:e,...t.config.mapOptions.clusterConfig};if(t.config.clusteringAttribute){const n=t.config.nodeCategories.find(n=>n.name===e[0].properties[t.config.clusteringAttribute]);n&&(a.itemStyle={...a.itemStyle,color:n.nodeStyle.color})}s.push(a),u+=1}else if(1===e.length){const t=e[0];l.set(t.id,null),o.push(t)}})}),n.forEach(t=>{null===l.get(t.source)&&null===l.get(t.target)&&a.push(t)});const f=[...s.map(t=>({ref:t,isCluster:!0,count:t.childNodes.length,get value(){return t.value},set value([e,n]){t.value=[e,n]}})),...o.filter(i).map(t=>({ref:t,isCluster:!1,count:1,get value(){return[t.location.lng,t.location.lat]},set value([e,n]){t.location.lng=e,t.location.lat=n}}))];if(f.length>1){const e=f.map(e=>{const[n,i]=e.value,r=t.leaflet.latLngToContainerPoint([i,n]);return{ref:e.ref,isCluster:e.isCluster,x:r.x,y:r.y,r:p(e.count)/2,setValue:([t,n])=>{e.value=[t,n]}}}),n=4,i=5;for(let t=0;t0&&s{const n=t.leaflet.containerPointToLatLng([e.x,e.y]);e.isCluster?e.ref.value=[n.lng,n.lat]:(e.ref.location.lng=n.lng,e.ref.location.lat=n.lat)})}return{clusters:s,nonClusterNodes:o,nonClusterLinks:a}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),n=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=n,o.innerHTML=t[n],i.appendChild(r),i.appendChild(o),e.appendChild(i)})}}getMetadata(t){const e=t,n={};return e.label&&(n.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach(t=>{e[t]&&(n[t]=e[t])}),n.nodes=e.nodes.length,n.links=e.links.length,n}nodeInfo(t){const e={};!t._generatedIdentity&&(e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label)),t.name&&(e.name=t.name),t.location&&(e.location=t.location);let n=null;Array.isArray(t.clients)?n=t.clients:t.properties&&Array.isArray(t.properties.clients)&&(n=t.properties.clients);let i=0;n?i=n.length:"number"==typeof t.clients?i=t.clients:t.properties&&"number"==typeof t.properties.clients&&(i=t.properties.clients),i>0&&(e.clients=i),n&&n.length&&n.forEach((t,n)=>{e[`clients [${n+1}]`]=t});const r=(t,e)=>"location"===t&&e&&"object"==typeof e?{lat:e.lat,lng:e.lng}:"time"===t&&"string"==typeof e?this.dateParse({dateString:e}):e,o=t._source&&this.isObject(t._source)?t._source:t;if(Object.keys(o).forEach(t=>{if("properties"===t||"clients"===t||"_source"===t||"_generatedIdentity"===t||"local_addresses"===t||"linkCount"===t)return;const n=r(t,o[t]);null!=n&&""!==n&&(e[t]=n)}),o.properties&&this.isObject(o.properties)&&Object.keys(o.properties).forEach(t=>{if("clients"===t)return;const n=r(t,o.properties[t]);null==n||"string"==typeof n&&""===n.trim()||(e[t]=n)}),t.linkCount&&(e.links=t.linkCount),Array.isArray(o.local_addresses)){const t=o.local_addresses.map(t=>"string"==typeof t?t:t&&"string"==typeof t.address?t.address:null).filter(t=>t);t.length&&(e.localAddresses=t)}return t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const n=document.createElement("div");n.classList.add("njg-tooltip-item");const i=document.createElement("span");i.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),i.innerHTML=t,r.innerHTML=e,n.appendChild(i),n.appendChild(r),n}getNodeTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=!t._generatedIdentity;return n&&t.id&&e.appendChild(this.createTooltipItem("id",t.id)),n&&t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach(i=>{if("object"!=typeof t.properties[i]&&!i.startsWith("_")&&("id"!==i&&"label"!==i||!n))if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))}),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
"))),e}getLinkTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||e.appendChild(this.createTooltipItem("source",t.source)),n(t.target)||e.appendChild(this.createTooltipItem("target",t.target)),null!=t.cost&&e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach(n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e.appendChild(this.createTooltipItem("time",t))}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e.appendChild(this.createTooltipItem(`${n.replace(/_/g," ")}`,t))}}),e}linkInfo(t){const e={},n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||(e.source=t.source),n(t.target)||(e.target=t.target),null!=t.cost&&(e.cost=t.cost),t.properties&&Object.keys(t.properties).forEach(n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e[n]=t}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e[n.replace(/_/g," ")]=t}}),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,n){let i,r={},o={},a=!1;if(t.category&&e.nodeCategories&&e.nodeCategories.length){const n=e.nodeCategories.find(e=>e.name===t.category);if(n){a=!0,i=this.generateStyle(n.nodeStyle||{},t),r=this.generateStyle(n.nodeSize||{},t);let e={},s={};n.emphasis&&(e=this.generateStyle(n.emphasis.nodeStyle||{},t),s=this.generateStyle(n.emphasis.nodeSize||{},t),o={nodeStyle:e,nodeSize:s})}}if(!a)if("map"===n){const n=e.mapOptions&&e.mapOptions.nodeConfig;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.nodeStyle||{},t),nodeSize:this.generateStyle(a&&a.nodeSize||{},t)})}else{const n=e.graphConfig&&e.graphConfig.series;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.itemStyle||{},t),nodeSize:this.generateStyle(a&&a.symbolSize||r||{},t)})}return{nodeStyleConfig:i,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,n){let i,r={};if(t.category&&e.linkCategories.length){const n=e.linkCategories.find(e=>e.name===t.category);i=this.generateStyle(n.linkStyle||{},t),r={...r,linkStyle:n.emphasis?this.generateStyle(n.emphasis.linkStyle||{},t):{}}}else i=this.generateStyle("map"===n?e.mapOptions.linkConfig.linkStyle:e.graphConfig.series.linkStyle,t);return{linkStyleConfig:i,linkEmphasisConfig:r}}showLoading(){let t=this.el.querySelector(".njg-loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.classList.add("njg-loadingContainer"),t.innerHTML='\n
\n
\n

Loading...

\n
\n ',this.el.appendChild(t)),t}hideLoading(){const t=this.el.querySelector(".njg-loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...n){t.set(e,[...t.get(e)||[],...n])},once(t,...n){e.set(t,[...e.get(t)||[],...n])},emit(n){const i=t.get(n)||[],r=e.get(n)||[],o=i.map(t=>t()),a=r.map(t=>t());return e.delete(n),[...o,...a]},delete(n){t.delete(n),e.delete(n)}}}parseUrlFragments(){let t;try{t=decodeURIComponent(window.location.hash.replace(/^#/,""))}catch(e){t=window.location.hash.replace(/^#/,"")}const e={};return t.split(";").forEach(t=>{const n=new URLSearchParams(t),i=n.get("id");null!=i&&(e[i]=n)}),e}updateUrlFragments(t,e){const n=Object.values(t).map(t=>t.toString()).join(";").replace(/([^&=]+)=([^&;]*)/g,(t,e,n)=>`${e}=${encodeURIComponent(n.replace(/%7E/gi,"~"))}`);window.history.pushState(e,"",`#${n}`)}addActionToUrl(t,e){if(!t.config.bookmarkableActions.enabled||!e.data||e.data.cluster)return;if(!t.nodeLinkIndex)return void console.error("Lookup object for node or link not found.");const n=this.parseUrlFragments(),{id:i}=t.config.bookmarkableActions;let r;if(t.config.render===t.utils.graphRender){if("node"===e.dataType)r=e.data.id;else if("edge"===e.dataType){const{source:t,target:n}=e.data;r=`${t}~${n}`}}else if(t.config.render===t.utils.mapRender)if("scatter"===e.seriesType)r=e.data.node.id;else if("lines"===e.seriesType){const{source:t,target:n}=e.data.link;r=`${t}~${n}`}r&&t.nodeLinkIndex[r]?(n[i]||(n[i]=new URLSearchParams,n[i].set("id",i)),n[i].set("nodeId",r),this.updateUrlFragments(n,t.nodeLinkIndex[r])):console.error("nodeId not found in nodeLinkIndex lookup.")}removeUrlFragment(t){const e=this.parseUrlFragments();e[t]&&delete e[t],this.updateUrlFragments(e,{id:t})}applyUrlFragmentState(t){if(!t.config.bookmarkableActions.enabled)return;const{id:e}=t.config.bookmarkableActions,n=t.utils.parseUrlFragments(),i=n[e]&&n[e].get?n[e]:null,r=i&&i.get?i.get("nodeId"):void 0;if(!r||!t.nodeLinkIndex||null==t.nodeLinkIndex[r])return;const[o,a]=r.split("~"),s=t.nodeLinkIndex[r],l=t.config.graphConfig&&t.config.graphConfig.series&&t.config.graphConfig.series.type||t.config.mapOptions&&t.config.mapOptions.nodeConfig&&t.config.mapOptions.nodeConfig.type,{location:u,cluster:h}=s||{};t.config.bookmarkableActions.zoomOnRestore&&["scatter","effectScatter"].includes(l)&&null==a&&null!=u&&t.leaflet&&t.leaflet.setView([u.lat,u.lng],null!=h?t.config.disableClusteringAtLevel:t.config.bookmarkableActions.zoomLevel||t.config.showLabelsAtZoomLevel),"function"==typeof t.config.onClickElement&&t.config.onClickElement.call(t,o&&a?"link":"node",s)}setupHashChangeHandler(t){return t._popstateHandler&&window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=()=>{this.applyUrlFragmentState(t)},window.addEventListener("popstate",t._popstateHandler),()=>{window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=null}}moveNodeInRealTime(t,e){if(!this.echarts||"function"!=typeof this.echarts.getOption)return void console.warn("moveNodeInRealTime: ECharts instance not ready");const n=this.echarts.getOption();if(!n||!Array.isArray(n.series))return void console.warn("moveNodeInRealTime: No series data available");const i=n.series.find(t=>"scatter"===t.type||"effectScatter"===t.type);if(!i)return void console.warn("moveNodeInRealTime: No scatter series found");const r=i.data.findIndex(e=>e.node.id===t);if(-1===r)return void console.warn(`moveNodeInRealTime: Node with id "${t}" not found`);const o=i.data[r],{node:a}=o;a.location=e,a.properties?(a.properties.location=e,o.value=[e.lng,e.lat],this.nodeLinkIndex[t].location=e,this.nodeLinkIndex[t].properties&&(this.nodeLinkIndex[t].properties.location=e,this.echarts.setOption({series:n.series}))):console.warn("moveNodeInRealTime: Node properties not found")}},Jb=class extends Kb{searchElements(t){const e=this,n={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=i=>{n[i.state.searchValue]?e.utils.JSONDataUpdate.call(e,n[i.state.searchValue].data).then(()=>{e.JSONParam=n[i.state.searchValue].param}):e.utils.JSONDataUpdate.call(e,t+i.state.searchValue)},function(i,r=!0,o=!0){const a=i.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then(()=>{n[a]={data:{...e.data},param:[...e.JSONParam]}})}}JSONDataUpdate(t,e=!0,n=!0){const i=this;return i.config.onUpdate.call(i),i.utils.paginatedDataParse.call(i,t).then(r=>{function o(){e?(i.JSONParam=[t],i.utils.overrideData(r,i)):(i.JSONParam.push(t),i.config.render===i.utils.mapRender?i.utils.appendData(r,i):i.utils.addData(r,i)),i.utils.isNetJSON(i.data)&&i.utils.updateMetadata.call(i)}return n?(i.utils.isNetJSON(i.data)&&i.config.prepareData.call(i,r),i.config.dealDataByWorker?i.utils.dealDataByWorker.call(i,r,i.config.dealDataByWorker,o):o()):o(),r}).catch(t=>{console.error(t)})}dealDataByWorker(t,e,n){const i=new Worker(e),r=this;i.postMessage(t),i.addEventListener("error",t=>{console.error(t),console.error("Error in dealing JSONData!")}),i.addEventListener("message",t=>{n?n():(r.utils.overrideData(t.data,r),r.utils.isNetJSON(r.data)&&r.utils.updateMetadata.call(r))})}overrideData(t,e){e.data=t,e.utils.isNetJSON(e.data)||e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}},Qb=class{constructor(t){this.utils=new Jb,this.config=this.utils.deepCopy(Xb),this.config.crs=Xb.crs,this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){if(this.utils.deepMergeObj(this.config,t),this.el)t&&t.el&&console.error("Can't change el again!");else if(this.el=this.config.el?this.utils.isElement(this.config.el)?this.config.el:document.querySelector(this.config.el):document.body,this.el){if(this.el.classList.add("njg-container"),this.el===document.body){const t=document.documentElement;t.style.width="100%",t.style.height="100%",this.el.classList.add("njg-relativePosition")}}else console.error("NetJSONGraph: The specified element for rendering was not found and could not be set.");return this.config}render(){const[t,...e]=this.JSONParam;this.config.onRender.call(this);const n=new Promise(t=>{this.event.once("onReady",async()=>{try{await this.config.onReady.call(this)}catch(t){console.error("onReady callback failed:",t)}t()})});if(this.event.once("onLoad",this.config.onLoad.bind(this)),this.event.once("applyUrlFragmentState",async()=>{await n,this.utils.applyUrlFragmentState.call(this,this)}),this.utils.paginatedDataParse.call(this,t).then(t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson",this.originalGeoJSON=this.utils.fastDeepCopy(t),t=this.utils.geojsonToNetjson(t)}if(this.utils.isNetJSON(t)){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set;this.nodeLinkIndex={},t.nodes.forEach(t=>{e.add(t.id),this.nodeLinkIndex[t.id]=t}),t.links=t.links.filter(t=>e.has(t.source)&&e.has(t.target)?(this.nodeLinkIndex[`${t.source}~${t.target}`]=t,!0):(e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1))}this.config.prepareData.call(this,t),this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())}).catch(t=>{console.error(t)}),e.length){const n=function(){e.map(t=>this.utils.JSONDataUpdate.call(this,t,!1))};this.JSONParam=[t],this.event.once("renderArray",n.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),"function"==typeof e.utils.moveNodeInRealTime&&(e.utils.moveNodeInRealTime=e.utils.moveNodeInRealTime.bind(e)),e.utils}};var tS,eS=[],nS={registerPreprocessor:Gs,registerProcessor:Us,registerPostInit:function(t){js("afterinit",t)},registerPostUpdate:function(t){js("afterupdate",t)},registerUpdateLifecycle:js,registerAction:Zs,registerCoordinateSystem:Ys,registerLayout:function(t,e){qs(Bb,t,e,1e3,"layout")},registerVisual:Xs,registerTransform:function(t){var e=(t=i(t)).type;e||bo("");var n=e.split(":");2!==n.length&&bo("");var r=!1;"echarts"===n[0]&&(e=n[1],r=!0),t.__isBuiltIn=r,w_.set(e,t)},registerLoading:$s,registerMap:function(t,e,n){var i=xb.registerMap;i&&i(t,e,n)},registerImpl:function(t,e){xb[t]=e},PRIORITY:Sb,ComponentModel:gv,ComponentView:B_,SeriesModel:E_,ChartView:sw,registerComponentModel:function(t){gv.registerClass(t)},registerComponentView:function(t){B_.registerClass(t)},registerSeriesModel:function(t){E_.registerClass(t)},registerChartView:function(t){sw.registerClass(t)},registerSubTypeDefaulter:function(t,e){gv.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){Og[t]=e}},iS=Dx.prototype,rS=Px.prototype,oS=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1};t(function(){return null!==tS&&tS.apply(this,arguments)||this},tS=oS);const aS=function(e){function n(t){var n=e.call(this,t)||this;return n.type="ec-line",n}return t(n,e),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new oS},n.prototype.buildPath=function(t,e){rl(e)?iS.buildPath.call(this,t,e):rS.buildPath.call(this,t,e)},n.prototype.pointAt=function(t){return rl(this.shape)?iS.pointAt.call(this,t):rS.pointAt.call(this,t)},n.prototype.tangentAt=function(t){var e=this.shape,n=rl(e)?[e.x2-e.x1,e.y2-e.y1]:rS.tangentAt.call(this,t);return J(n,n)},n}(Zy);var sS=["fromSymbol","toSymbol"],lS=function(e){function n(t,n,i){var r=e.call(this)||this;return r._createLine(t,n,i),r}return t(n,e),n.prototype._createLine=function(t,e,n){var i=t.hostModel,r=function(t){var e=new aS({name:"line",subPixelOptimize:!0});return ll(e.shape,t),e}(t.getItemLayout(e));r.shape.percent=0,ya(r,{shape:{percent:1}},i,e),this.add(r),h(sS,function(n){var i=sl(n,t,e);this.add(i),this[ol(n)]=al(n,t,e)},this),this._updateCommonStl(t,e,n)},n.prototype.updateData=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=t.getItemLayout(e),a={shape:{}};ll(a.shape,o),ga(r,a,i,e),h(sS,function(n){var i=al(n,t,e),r=ol(n);if(this[r]!==i){this.remove(this.childOfName(n));var o=sl(n,t,e);this.add(o)}this[r]=i},this),this._updateCommonStl(t,e,n)},n.prototype.getLinePath=function(){return this.childAt(0)},n.prototype._updateCommonStl=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=n&&n.emphasisLineStyle,a=n&&n.blurLineStyle,s=n&&n.selectLineStyle,l=n&&n.labelStatesModels,u=n&&n.emphasisDisabled,c=n&&n.focus,p=n&&n.blurScope;if(!n||t.hasItemOption){var d=t.getItemModel(e),f=d.getModel("emphasis");o=f.getModel("lineStyle").getLineStyle(),a=d.getModel(["blur","lineStyle"]).getLineStyle(),s=d.getModel(["select","lineStyle"]).getLineStyle(),u=f.get("disabled"),c=f.get("focus"),p=f.get("blurScope"),l=tr(d)}var g=t.getItemVisual(e,"style"),m=g.stroke;r.useStyle(g),r.style.fill=null,r.style.strokeNoScale=!0,r.ensureState("emphasis").style=o,r.ensureState("blur").style=a,r.ensureState("select").style=s,h(sS,function(t){var e=this.childOfName(t);if(e){e.setColor(m),e.style.opacity=g.opacity;for(var n=0;n0&&(_[0]=-_[0],_[1]=-_[1]);var w=v[0]<0?-1:1;if("start"!==r.__position&&"end"!==r.__position){var b=-Math.atan2(v[1],v[0]);h[0].8?"left":c[0]<-.8?"right":"center",d=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":r.x=-c[0]*g+u[0],r.y=-c[1]*y+u[1],p=c[0]>.8?"right":c[0]<-.8?"left":"center",d=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":r.x=g*w+u[0],r.y=u[1]+S,p=v[0]<0?"right":"left",r.originX=-g*w,r.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":r.x=x[0],r.y=x[1]+S,p="center",r.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":r.x=-g*w+h[0],r.y=h[1]+S,p=v[0]>=0?"right":"left",r.originX=g*w,r.originY=-S}r.scaleX=r.scaleY=o,r.setStyle({verticalAlign:r.__verticalAlign||d,align:r.__align||p})}}}},n}(Ag);const uS=lS,hS=function(){function t(t){this.group=new Ag,this._LineCtor=t||uS}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=ul(t);t.diff(r).add(function(n){e._doAdd(t,n,o)}).update(function(n,i){e._doUpdate(r,t,i,n,o)}).remove(function(t){i.remove(r.getItemGraphicEl(t))}).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(e,n){e.updateLayout(t,n)},this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=ul(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i0&&(o=this._getLineLength(i)/l*1e3),o!==this._period||a!==this._loop||s!==this._roundTrip){i.stopAnimation();var h=void 0;h=m(u)?u(n):u,i.__t>0&&(h=-o*i.__t),this._animateSymbol(i,o,h,a,s)}this._period=o,this._loop=a,this._roundTrip=s}},n.prototype._animateSymbol=function(t,e,n,i,r){if(e>0){t.__t=0;var o=this,a=t.animate("",i).when(r?2*e:e,{__t:r?2:1}).delay(n).during(function(){o._updateSymbolPosition(t)});i||a.done(function(){o.remove(t)}),a.start()}},n.prototype._getLineLength=function(t){return Ad(t.__p1,t.__cp1)+Ad(t.__cp1,t.__p2)},n.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},n.prototype.updateData=function(t,e,n){this.childAt(0).updateData(t,e,n),this._updateEffectSymbol(t,e)},n.prototype._updateSymbolPosition=function(t){var e=t.__p1,n=t.__p2,i=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=Ht,l=Wt;o[0]=s(e[0],i[0],n[0],r),o[1]=s(e[1],i[1],n[1],r);var u=t.__t<1?l(e[0],i[0],n[0],r):l(n[0],i[0],e[0],1-r),h=t.__t<1?l(e[1],i[1],n[1],r):l(n[1],i[1],e[1],1-r);t.rotation=-Math.atan2(h,u)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(i[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-i[o])/(i[o+1]-i[o]),l=n[o],u=n[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1],t.rotation=-Math.atan2(t.__t<1?u[1]-l[1]:l[1]-u[1],t.__t<1?u[0]-l[0]:l[0]-u[0])-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},n}(pS);const yS=gS;var mS=function(){this.polyline=!1,this.curveness=0,this.segs=[]},vS=function(e){function n(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return t(n,e),n.prototype.reset=function(){this.notClear=!1,this._off=0},n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new mS},n.prototype.buildPath=function(t,e){var n,i=e.segs,r=e.curveness;if(e.polyline)for(n=this._off;n0){t.moveTo(i[n++],i[n++]);for(var a=1;a0?t.quadraticCurveTo((s+u)/2-(l-h)*r,(l+h)/2-(u-s)*r,u,h):t.lineTo(u,h)}this.incremental&&(this._off=n,this.notClear=!0)},n.prototype.findDataIndex=function(t,e){var n=this.shape,i=n.segs,r=n.curveness,o=this.style.lineWidth;if(n.polyline)for(var a=0,s=0;s0)for(var u=i[s++],h=i[s++],c=1;c0){if(Qn(u,h,(u+p)/2-(h-d)*r,(h+d)/2-(p-u)*r,p,d,o,t,e))return a}else if(Kn(u,h,p,d,o,t,e))return a;a++}return-1},n.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e);return this.getBoundingRect().contain(t=n[0],e=n[1])?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},n.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,n=1/0,i=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=n+t.__startIndex)})},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();var xS={seriesType:"lines",plan:ia(),reset:function(t){var e=t.coordinateSystem;if(e){var n=t.get("polyline"),i=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(i){var s=void 0,l=r.end-r.start;if(n){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(i);var u=t.get("clip",!0)&&function(t,e,n){return t?"polar"===t.type?function(t){var e=t.getArea(),n=Je(e.r0,1),i=Je(e.r,1),r=new gx({shape:{cx:Je(t.cx,1),cy:Je(t.cy,1),r0:n,r:i,startAngle:e.startAngle,endAngle:e.endAngle,clockwise:e.clockwise}});return r}(t):"cartesian2d"===t.type?function(t,e,n){var i=t.getArea(),r=i.x,o=i.y,a=i.width,s=i.height,l=n.get(["lineStyle","width"])||0;r-=l/2,o-=l/2,a+=l,s+=l,a=Math.ceil(a),r!==Math.floor(r)&&(r=Math.floor(r),a++);var u=new rm({shape:{x:r,y:o,width:a,height:s}});return u}(t,0,n):null:null}(t.coordinateSystem,0,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},n.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateLineDraw(i,t).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},n.prototype.incrementalRender=function(t,e,n){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},n.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},n.prototype.updateTransform=function(t,e,n){var i=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=wS.reset(t,e,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},n.prototype._updateLineDraw=function(t,e){var n=this._lineDraw,i=this._showEffect(e),r=!!e.get("polyline"),o=e.pipelineContext.large;return n&&i===this._hasEffet&&r===this._isPolyline&&o===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=o?new _S:new hS(r?i?yS:fS:i?pS:uS),this._hasEffet=i,this._isPolyline=r,this._isLargeDraw=o),this.group.add(n.group),n},n.prototype._showEffect=function(t){return!!t.get(["effect","show"])},n.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},n.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},n.prototype.dispose=function(t,e){this.remove(t,e)},n.type="lines",n}(sw);var SS=function(){function t(t,e,n,i,r,o){this._old=t,this._new=e,this._oldKeyGetter=n||dl,this._newKeyGetter=i||dl,this.context=r,this._diffModeMultiple="multiple"===o}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),r=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,r,"_newKeyGetter");for(var o=0;o1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._new,e={},n={},i=[],r=[];this._initIndexMap(this._old,e,i,"_oldKeyGetter"),this._initIndexMap(t,n,r,"_newKeyGetter");for(var o=0;o1&&1===h)this._updateManyToOne&&this._updateManyToOne(l,s),n[a]=null;else if(1===u&&h>1)this._updateOneToMany&&this._updateOneToMany(l,s),n[a]=null;else if(1===u&&1===h)this._update&&this._update(l,s),n[a]=null;else if(u>1&&h>1)this._updateManyToMany&&this._updateManyToMany(l,s),n[a]=null;else if(u>1)for(var c=0;c1)for(var a=0;a=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,r=this._idList;if(n.getSource().sourceFormat===Sv&&!n.pure)for(var o=[],a=t;a0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(y(r=this.getVisual(e))?r=r.slice():zS(r)&&(r=o({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,zS(e)?o(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){zS(t)?o(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?o(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){!function(t,e,n,i){if(i){var r=pm(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,r.ssrType="chart","group"===i.type&&i.traverse(function(i){var r=pm(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e,r.ssrType="chart"})}}(this.hostModel&&this.hostModel.seriesIndex,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){h(this._graphicEls,function(n,i){n&&t&&t.call(e,n,i)})},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:BS(this.dimensions,this._getDimInfo,this),this.hostModel)),LS(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];m(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(A(arguments)))})},t.internalField=(IS=function(t){var e=t._invertedIndicesMap;h(e,function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new FS(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),t}();const GS=WS;var US="undefined"==typeof Uint32Array?Array:Uint32Array,jS="undefined"==typeof Float64Array?Array:Float64Array,ZS=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return t(n,e),n.prototype.init=function(t){t.data=t.data||[],_l(t);var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},n.prototype.mergeOption=function(t){if(_l(t),t.data){var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},n.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=z(this._flatCoords,e.flatCoords),this._flatCoordsOffset=z(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},n.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},n.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},n.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*t],i=this._flatCoordsOffset[2*t+1],r=0;r ")})},n.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},n.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},n.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},n.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},n.type="series.lines",n.dependencies=["grid","polar","geo","calendar"],n.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},n}(E_);const YS=ZS,XS={seriesType:"lines",reset:function(t){var e=xl(t.get("symbol")),n=xl(t.get("symbolSize")),i=t.getData();return i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",n&&n[0]),i.setVisual("toSymbolSize",n&&n[1]),{dataEach:i.hasItemOption?function(t,e){var n=t.getItemModel(e),i=xl(n.getShallow("symbol",!0)),r=xl(n.getShallow("symbolSize",!0));i[0]&&t.setItemVisual(e,"fromSymbol",i[0]),i[1]&&t.setItemVisual(e,"toSymbol",i[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};var qS="--\x3e",$S=function(t){return t.get("autoCurveness")||null},KS=function(t,e){var n=$S(t),i=20,r=[];if(x(n))i=n;else if(y(n))return void(t.__curvenessList=n);e>i&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a0?+d:1;I.scaleX=this._sizeX*k,I.scaleY=this._sizeY*k,this.setSymbolScale(1),Yi(this,u,h,c)},n.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},n.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=pm(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&va(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();va(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},n.getSymbolSize=function(t,e){return fs(t.getItemVisual(e,"symbolSize"))},n}(Ag);const uC=lC;var hC=function(){function t(t){this.group=new Ag,this._SymbolCtor=t||uC}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=Fl(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=Vl(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add(function(i){var r=u(i);if(Bl(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}}).update(function(h,c){var p=r.getItemGraphicEl(c),d=u(h);if(Bl(t,d,h,e)){var f=t.getItemVisual(h,"symbol")||"circle",g=p&&p.getSymbolType&&p.getSymbolType();if(!p||g&&g!==f)n.remove(p),(p=new o(t,h,s,l)).setPosition(d);else{p.updateData(t,h,s,l);var y={x:d[0],y:d[1]};a?p.attr(y):ga(p,y,i)}n.add(p),t.setItemGraphicEl(h,p)}else n.remove(p)}).remove(function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut(function(){n.remove(e)},i)}).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl(function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=Vl(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=Fl(n);for(var r=t.start;r3?1.4:r>1?1.2:1.1;Gl(this,"zoom","zoomOnMouseWheel",t,{scale:i>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(n){var l=Math.abs(i);Gl(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},n.prototype._pinchHandler=function(t){Hl(this._zr,"globalPan")||Gl(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},n}(Ed);const fC=dC;var gC={axisPointer:1,tooltip:1,brush:1},yC=[],mC=[],vC=[],_C=Ht,xC=Ld,wC=Math.abs,bC=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.init=function(t,e){var n=new cC,i=new hS,r=this.group;this._controller=new fC(e.getZr()),this._controllerHost={target:r},r.add(n.group),r.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},n.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(ql(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):ga(s,l,t)}Xl(t.getGraph(),Dl(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,p=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,p);var d=t.get("layout");u.graph.eachNode(function(e){var n=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",function(o){switch(d){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,p),c.setFixed(n),u.setItemLayout(n,[r.x,r.y]);break;case"circular":u.setItemLayout(n,[r.x,r.y]),e.setLayout({fixed:!0},!0),Ll(t,"symbolSize",e,[o.offsetX,o.offsetY]),i.updateLayout(t);break;default:u.setItemLayout(n,[r.x,r.y]),Il(t.getGraph(),t),i.updateLayout(t)}}).on("dragend",function(){c&&c.setUnfixed(n)}),r.setDraggable(a,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&(pm(r).focus=e.getAdjacentDataIndices())}}),u.graph.eachEdge(function(t){var e=t.getGraphicEl(),n=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===n&&(pm(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})});var f="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),y=u.getLayout("cy");u.graph.eachNode(function(t){Ol(t,f,g,y)}),this._firstRender=!1},n.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},n.prototype._startForceLayoutIteration=function(t,e){var n=this;!function i(){t.step(function(t){n.updateLayout(n._model),(n._layouting=!t)&&(e?n._layoutTimeout=setTimeout(i,16):i())})}()},n.prototype._updateController=function(t,e,n){var i=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker(function(e,i,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(i,r)&&!Zl(e,n,t)}),ql(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",function(e){!function(t,e,n){var i=t.target;i.x+=e,i.y+=n,i.dirty()}(o,e.dx,e.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})}).on("zoom",function(e){!function(t,e,n,i){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0;a=Math.max(Math.min(o.max||1/0,a),s)}var l=a/t.zoom;t.zoom=a,r.x-=(n-r.x)*(l-1),r.y-=(i-r.y)*(l-1),r.scaleX*=l,r.scaleY*=l,r.dirty()}(o,e.scale,e.originX,e.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),i._updateNodeAndLinkScale(),Xl(t.getGraph(),Dl(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()})):r.disable()},n.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),n=Dl(t);e.eachItemGraphicEl(function(t,e){t&&t.setSymbolScale(n)})},n.prototype.updateLayout=function(t){Xl(t.getGraph(),Dl(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},n.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},n.type="graph",n}(sw);const SC=bC;var CC=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){var n=this._nodesMap;if(!n[$l(t=null==t?""+e:""+t)]){var i=new MC(t,e);return i.hostGraph=this,this.nodes.push(i),n[$l(t)]=i,i}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[$l(t)]},t.prototype.addEdge=function(t,e,n){var i=this._nodesMap,r=this._edgesMap;if(x(t)&&(t=this.nodes[t]),x(e)&&(e=this.nodes[e]),t instanceof MC||(t=i[$l(t)]),e instanceof MC||(e=i[$l(e)]),t&&e){var o=t.id+"-"+e.id,a=new TC(t,e,n);return a.hostGraph=this,this._directed&&(t.outEdges.push(a),e.inEdges.push(a)),t.edges.push(a),t!==e&&e.edges.push(a),this.edges.push(a),r[o]=a,a}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof MC&&(t=t.id),e instanceof MC&&(e=e.id);var n=this._edgesMap;return this._directed?n[t+"-"+e]:n[t+"-"+e]||n[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var n=this.nodes,i=n.length,r=0;r=0&&t.call(e,n[r],r)},t.prototype.eachEdge=function(t,e){for(var n=this.edges,i=n.length,r=0;r=0&&n[r].node1.dataIndex>=0&&n[r].node2.dataIndex>=0&&t.call(e,n[r],r)},t.prototype.breadthFirstTraverse=function(t,e,n,i){if(e instanceof MC||(e=this._nodesMap[$l(e)]),e){for(var r="out"===n?"outEdges":"in"===n?"inEdges":"edges",o=0;o=0&&n.node2.dataIndex>=0}),r=0,o=i.length;r=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}();const PC=OC;var RC=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.hasSymbolVisual=!0,t}return t(n,e),n.prototype.init=function(t){function n(){return i._categoriesData}e.prototype.init.apply(this,arguments);var i=this;this.legendVisualProvider=new PC(n,n),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},n.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},n.prototype.mergeDefaultAndTheme=function(t){e.prototype.mergeDefaultAndTheme.apply(this,arguments),dn(t,"edgeLabel",["show"])},n.prototype.getInitialData=function(t,e){var n,i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i){$S(n=this)&&(n.__curvenessList=[],n.__edgeMap={},KS(n));var a=function(t,e,n,i,r){for(var o=new IC(!0),a=0;a "+f)),c++)}var y,m=n.get("coordinateSystem");if("cartesian2d"===m||"polar"===m)y=LC(t,n);else{var v=jv.get(m),_=v&&v.dimensions||[];s(_,"value")<0&&_.concat(["value"]);var x=ou(t,{coordDimensions:_,encodeDefine:n.getEncode()}).dimensions;(y=new GS(x,n)).initData(t)}var w,b,S,C=new GS(["value"],n);return C.initData(u,l),r&&r(y,C),b=(w={mainData:y,struct:o,structAttr:"graph",datas:{node:y,edge:C},datasAttr:{node:"data",edge:"edgeData"}}).mainData,(S=w.datas)||(S={main:b},w.datasAttr={main:"data"}),w.datas=w.mainData=null,iu(b,S,w),h(S,function(t){h(b.TRANSFERABLE_METHODS,function(e){t.wrapMethod(e,g(Jl,w))})}),b.wrapMethod("cloneShallow",g(tu,w)),h(b.CHANGABLE_METHODS,function(t){b.wrapMethod(t,g(Ql,w))}),O(S[b.dataType]===b),o.update(),o}(r,i,this,0,function(t,e){function n(t,e){var n=r.call(this,t,e);return n.resolveParentPath=i,n}function i(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}t.wrapMethod("getItemModel",function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t});var r=Wm.prototype.getModel;e.wrapMethod("getItemModel",function(t){return t.resolveParentPath=i,t.getModel=n,t})});return h(a.edges,function(t){!function(t,e,n,i){if($S(n)){var r=JS(t,e,n),o=n.__edgeMap,a=o[QS(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(i)}}(t.node1,t.node2,this,t.dataIndex)},this),a.data}},n.prototype.getGraph=function(){return this.getData().graph},n.prototype.getEdgeData=function(){return this.getGraph().edgeData},n.prototype.getCategoriesData=function(){return this._categoriesData},n.prototype.formatTooltip=function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),Bo("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return Xo({series:this,dataIndex:t,multipleSeries:e})},n.prototype._updateCategoriesData=function(){var t=c(this.option.categories||[],function(t){return null!=t.value?t:o({value:0},t)}),e=new GS(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t)})},n.prototype.setZoom=function(t){this.option.zoom=t},n.prototype.setCenter=function(t){this.option.center=t},n.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},n.type="series.graph",n.dependencies=["grid","polar","geo","singleAxis","calendar"],n.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},n}(E_);const NC=RC;var EC={type:"graphRoam",event:"graphRoam",update:"none"};const zC=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.hasSymbolVisual=!0,t}return t(n,e),n.prototype.getInitialData=function(t,e){return LC(null,this,{useEncodeDefaulter:!0})},n.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},n.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},n.prototype.brushSelector=function(t,e,n){return n.point(e.getItemLayout(t))},n.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},n.type="series.scatter",n.dependencies=["grid","polar","geo","singleAxis","calendar"],n.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},n}(E_);var BC=function(){},FC=function(e){function n(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return t(n,e),n.prototype.getDefaultShape=function(){return new BC},n.prototype.reset=function(){this.notClear=!1,this._off=0},n.prototype.buildPath=function(t,e){var n,i=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=this.softClipShape;if(s&&r[0]<4)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,u=i[l]-o/2,h=i[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},n.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e);return this.getBoundingRect().contain(t=n[0],e=n[1])?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},n.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,n=e.points,i=e.size,r=i[0],o=i[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=n+(t.startIndex||0))})},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const HC=VC;var WC="undefined"!=typeof Float32Array,GC=WC?Float32Array:Array;const UC=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.render=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},n.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).incrementalPrepareUpdate(i),this._finished=!1},n.prototype.incrementalRender=function(t,e,n){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},n.prototype.updateTransform=function(t,e,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var r=hu("").reset(t,e,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},n.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},n.prototype._getClipShape=function(t){if(t.get("clip",!0)){var e=t.coordinateSystem;return e&&e.getArea&&e.getArea(.1)}},n.prototype._updateSymbolDraw=function(t,e){var n=this._symbolDraw,i=e.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new HC:new cC,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},n.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},n.prototype.dispose=function(){},n.type="scatter",n}(sw),jC=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.type="grid",n.dependencies=["xAxis","yAxis"],n.layoutMode="box",n.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},n}(gv);var ZC=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}(),YC=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Hg).models[0]},n.type="cartesian2dAxis",n}(gv);l(YC,ZC);var XC={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},qC=r({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},XC),$C=r({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},XC);const KC={category:qC,value:$C,time:r({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},$C),log:a({logBase:10},$C)};var JC=0;const QC=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++JC}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&c(i,cu);return new t({categories:r,needCollect:!r,deduplication:!1!==n.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!v(t)&&!n)return t;if(n&&!this._deduplication)return this.categories[e=this.categories.length]=t,e;var i=this._getOrCreateMap();return null==(e=i.get(t))&&(n?(this.categories[e=this.categories.length]=t,i.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=E(this.categories))},t}();var tM={value:1,category:1,time:1,log:1},eM=function(){function t(t){this._setting=t||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(t){return this._setting[t]},t.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();Pn(eM);const nM=eM;var iM=function(e){function n(t){var n=e.call(this,t)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new QC({})),y(i)&&(i=new QC({categories:c(i,function(t){return w(t)?t.value:t})})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return t(n,e),n.prototype.parse=function(t){return null==t?NaN:v(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},n.prototype.contain=function(t){return vu(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]},n.prototype.normalize=function(t){return _u(t=this._getTickNumber(this.parse(t)),this._extent)},n.prototype.scale=function(t){return t=Math.round(xu(t,this._extent)),this.getRawOrdinalNumber(t)},n.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},n.prototype.getMinorTicks=function(t){},n.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},n.prototype.getOrdinalMeta=function(){return this._ordinalMeta},n.prototype.calcNiceTicks=function(){},n.prototype.calcNiceExtent=function(){},n.type="ordinal",n}(nM);nM.registerClass(iM);const rM=iM;var oM=Je,aM=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="interval",t._interval=0,t._intervalPrecision=2,t}return t(n,e),n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return vu(t,this._extent)},n.prototype.normalize=function(t){return _u(t,this._extent)},n.prototype.scale=function(t){return xu(t,this._extent)},n.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},n.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},n.prototype.getInterval=function(){return this._interval},n.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=yu(t)},n.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;n[0]1e4)return[];var s=o.length?o[o.length-1].value:i[1];return n[1]>s&&o.push(t?{value:oM(s+e,r)}:{value:n[1]}),o},n.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;ri[0]&&ui&&(o=r.interval=i);var a=r.intervalPrecision=yu(o);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),mu(t,0,e),mu(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(r.niceTickExtent=[Je(Math.ceil(t[0]/o)*o,a),Je(Math.floor(t[1]/o)*o,a)],t),r}(i,t,e,n);this._intervalPrecision=o.intervalPrecision,this._interval=o.interval,this._niceExtent=o.niceTickExtent}},n.prototype.calcNiceExtent=function(t){var e=this._extent;if(e[0]===e[1])if(0!==e[0]){var n=Math.abs(e[0]);t.fixMax||(e[1]+=n/2),e[0]-=n/2}else e[1]=1;isFinite(e[1]-e[0])||(e[0]=0,e[1]=1),this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval);var i=this._interval;t.fixMin||(e[0]=oM(Math.floor(e[0]/i)*i)),t.fixMax||(e[1]=oM(Math.ceil(e[1]/i)*i))},n.prototype.setNiceExtent=function(t,e){this._niceExtent=[t,e]},n.type="interval",n}(nM);nM.registerClass(aM);const sM=aM;var lM="__ec_stack_",uM=function(e){function n(t){var n=e.call(this,t)||this;return n.type="time",n}return t(n,e),n.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return hr(t.value,iv[function(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}(lr(this._minLevelUnit))]||iv.second,e,this.getSetting("locale"))},n.prototype.getFormattedLabel=function(t,e,n){var i=this.getSetting("useUTC");return function(t,e,n,i,r){var s=null;if(v(n))s=n;else if(m(n))s=n(t.value,e,{level:t.level});else{var l=o({},ev);if(t.level>0)for(var u=0;u=0;--u)if(h[c]){s=h[c];break}s=s||l.none}if(y(s)){var p=null==t.level?0:t.level>=0?t.level:s.length+t.level;s=s[p=Math.min(p,s.length-1)]}}return hr(new Date(t.value),s,r,i)}(t,e,n,this.getSetting("locale"),i)},n.prototype.getTicks=function(){var t=this._extent,e=[];if(!this._interval)return e;e.push({value:t[0],level:0});var n=this.getSetting("useUTC"),i=function(t,e,n,i){function r(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===u&&a.unshift({value:a[0].value-p})}}for(u=0;u=i[0]&&v<=i[1]&&h++)}var _=(i[1]-i[0])/e;if(h>1.5*_&&p>_/1.5)break;if(l.push(y),h>_||t===a[f])break}u=[]}}var x=d(c(l,function(t){return d(t,function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd})}),function(t){return t.length>0}),w=[],b=x.length-1;for(f=0;fn&&(this._approxInterval=n);var r=hM.length,o=Math.min(function(t,e,n,i){for(;n>>1;t[r][1]0;)i*=10;var r=[Je(yM(e[0]/i)*i),Je(gM(e[1]/i)*i)];this._interval=i,this._niceExtent=r}},n.prototype.calcNiceExtent=function(t){dM.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return vu(t=vM(t)/vM(this.base),this._extent)},n.prototype.normalize=function(t){return _u(t=vM(t)/vM(this.base),this._extent)},n.prototype.scale=function(t){return t=xu(t,this._extent),mM(this.base,t)},n.type="log",n}(nM),xM=_M.prototype;xM.getMinorTicks=dM.getMinorTicks,xM.getLabel=dM.getLabel,nM.registerClass(_M);const wM=_M;var bM=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),a<0&&s<0&&!u&&(s=0));var c=this._determinedMin,p=this._determinedMax;return null!=c&&(a=c,l=!0),null!=p&&(s=p,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[CM[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[SM[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),SM={min:"_determinedMin",max:"_determinedMax"},CM={min:"_dataMin",max:"_dataMax"},MM=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return c(this._dimList,function(t){return this._axes[t]},this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),d(this.getAxes(),function(e){return e.scale.type===t})},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}(),TM=["x","y"],IM=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=TM,t}return t(n,e),n.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(Vu(t)&&Vu(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=this._transform=[l,0,0,u,r[0]-n[0]*l,r[1]-i[0]*u];this._invTransform=wt([],h)}}},n.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},n.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},n.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},n.prototype.containZone=function(t,e){var n=this.dataToPoint(t),i=this.dataToPoint(e),r=this.getArea(),o=new af(n[0],n[1],i[0]-n[0],i[1]-n[1]);return r.intersect(o)},n.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return tt(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i,e)),n[1]=a.toGlobalCoord(a.dataToCoord(r,e)),n},n.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},n.prototype.pointToData=function(t,e){var n=[];if(this._invTransform)return tt(n,t,this._invTransform);var i=this.getAxis("x"),r=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),e),n[1]=r.coordToData(r.toLocalCoord(t[1]),e),n},n.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},n.prototype.getArea=function(t){t=t||0;var e=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(e[0],e[1])-t,r=Math.min(n[0],n[1])-t,o=Math.max(e[0],e[1])-i+t,a=Math.max(n[0],n[1])-r+t;return new af(i,r,o,a)},n}(MM);const kM=IM;var DM=Sn(),AM=[0,1],LM=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return tn(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Xu(n=n.slice(),i.count()),$e(t,AM,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Xu(n=n.slice(),i.count());var r=$e(t,n,AM,e);return this.scale.scale(r)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),n=c(function(t,e){var n=t.getTickModel().get("customValues");if(n){var i=t.scale.getExtent();return{ticks:d(Hu(t,n),function(t){return t>=i[0]&&t<=i[1]})}}return"category"===t.type?function(t,e){var n,i,r=Gu(t,"ticks"),o=zu(e),a=Uu(r,o);if(a)return a;if(e.get("show")&&!t.scale.isBlank()||(n=[]),m(o))n=Yu(t,o,!0);else if("auto"===o){var s=Wu(t,t.getLabelModel());i=s.labelCategoryInterval,n=c(s.labels,function(t){return t.tickValue})}else n=Zu(t,i=o,!0);return ju(r,o,{ticks:n,tickCategoryInterval:i})}(t,e):{ticks:c(t.scale.getTicks(),function(t){return t.value})}}(this,e).ticks,function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}},this);return function(t,e,n,i){function r(t,e){return t=Je(t),e=Je(e),c?t>e:ts[1];r(e[0].coord,s[0])&&(i?e[0].coord=s[0]:e.shift()),i&&r(s[0],e[0].coord)&&e.unshift({coord:s[0]}),r(s[1],a.coord)&&(i?a.coord=s[1]:e.pop()),i&&r(a.coord,s[1])&&e.push({coord:s[1]})}}(this,n,e.get("alignWithLabel"),t.clamp),n},t.prototype.getMinorTicksCoords=function(){if("ordinal"===this.scale.type)return[];var t=this.model.getModel("minorTick").get("splitNumber");return t>0&&t<100||(t=5),c(this.scale.getMinorTicks(t),function(t){return c(t,function(t){return{coord:this.dataToCoord(t),tickValue:t}},this)},this)},t.prototype.getViewLabels=function(){return function(t){var e=t.getLabelModel().get("customValues");if(e){var n=Ru(t),i=t.scale.getExtent();return{labels:c(d(Hu(t,e),function(t){return t>=i[0]&&t<=i[1]}),function(e){var i={value:e};return{formattedLabel:n(i),rawLabel:t.scale.getLabel(i),tickValue:e}})}}return"category"===t.type?function(t){var e=t.getLabelModel(),n=Wu(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),n=Ru(t);return{labels:c(e,function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}})}}(t)}(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=Ru(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,o=r.getExtent(),a=r.count();if(o[1]-o[0]<1)return 0;var s=1;a>40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),p=0,d=0;l<=o[1];l+=s){var f,g=Fe(n({value:l}),e.font,"center","top");f=1.3*g.height,p=Math.max(p,1.3*g.width,7),d=Math.max(d,f,7)}var y=p/h,m=d/c;isNaN(y)&&(y=1/0),isNaN(m)&&(m=1/0);var v=Math.max(0,Math.floor(Math.min(y,m))),_=DM(t.model),x=t.getExtent(),w=_.lastAutoInterval,b=_.lastTickCount;return null!=w&&null!=b&&Math.abs(w-v)<=1&&Math.abs(b-a)<=1&&w>v&&_.axisExtent0===x[0]&&_.axisExtent1===x[1]?v=w:(_.lastTickCount=a,_.lastAutoInterval=v,_.axisExtent0=x[0],_.axisExtent1=x[1]),v}(this)},t}(),OM=function(e){function n(t,n,i,r,o){var a=e.call(this,t,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return t(n,e),n.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},n.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},n.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},n.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},n}(LM);const PM=OM;var RM=Math.log,NM=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=TM,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){function n(t){var e,n=f(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=t[+n[o]],s=a.model,l=a.scale;fu(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):(Pu(l,s),fu(l)&&(e=a))}r.length&&(e||Pu((e=r.pop()).scale,e.model),h(r,function(t){!function(t,e,n){var i=sM.prototype,r=i.getTicks.call(n),o=i.getTicks.call(n,!0),a=r.length-1,s=i.getInterval.call(n),l=Ou(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var p=RM(t.base);u=[RM(u[0])/p,RM(u[1])/p]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var d=i.getExtent.call(t);h&&(u[0]=d[0]),c&&(u[1]=d[1]);var f=i.getInterval.call(t),g=u[0],y=u[1];if(h&&c)f=(y-g)/a;else if(h)for(y=u[0]+f*a;yu[0]&&isFinite(g)&&isFinite(u[0]);)f=gu(f),g=u[1]-f*a;else{t.getTicks().length-1>a&&(f=gu(f));var m=f*a;(g=Je((y=Math.ceil(u[1]/f)*f)-m))<0&&u[0]>=0?(g=0,y=Je(m)):y>0&&u[1]<=0&&(y=0,g=-Je(m))}var v=(r[0].value-o[0].value)/s,_=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+f*v,y+f*_),i.setInterval.call(t,f),(v||_)&&i.setNiceExtent.call(t,g+f,y-f)}(t.scale,t.model,e.scale)}))}}var i=this._axesMap;this._updateScale(t,this.model),n(i.x),n(i.y);var r={};h(i.x,function(t){Qu(i,"y",t,r)}),h(i.y,function(t){Qu(i,"x",t,r)}),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){function i(){h(s,function(t){var e=t.isHorizontal(),n=e?[0,a.width]:[0,a.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),function(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}(t,e?a.x:a.y)})}var r=t.getBoxLayoutParams(),o=!n&&t.get("containLabel"),a=Rr(r,{width:e.getWidth(),height:e.getHeight()});this._rect=a;var s=this._axesList;i(),o&&(h(s,function(t){if(!t.model.get(["axisLabel","inside"])){var e=function(t){var e=t.scale;if(t.model.get(["axisLabel","show"])&&!e.isBlank()){var n,i,r=e.getExtent();i=e instanceof rM?e.count():(n=e.getTicks()).length;var o,a=t.getLabelModel(),s=Ru(t),l=1;i>40&&(l=Math.ceil(i/40));for(var u=0;u0?"top":"bottom",i="center"):rn(o-zM)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&o0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),FM={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var a=e.axis.getExtent(),s=i.transform,l=[a[0],0],u=[a[1],0],c=l[0]>u[0];s&&(tt(l,l,s),tt(u,u,s));var p=o({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new Dx({shape:{x1:l[0],y1:l[1],x2:u[0],y2:u[1]},style:p,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});Da(d.shape,d.style.lineWidth),d.anid="line",n.add(d);var f=e.get(["axisLine","symbol"]);if(null!=f){var g=e.get(["axisLine","symbolSize"]);v(f)&&(f=[f,f]),(v(g)||x(g))&&(g=[g,g]);var y=gs(e.get(["axisLine","symbolOffset"])||0,g),m=g[0],_=g[1];h([{rotate:t.rotation+Math.PI/2,offset:y[0],r:0},{rotate:t.rotation-Math.PI/2,offset:y[1],r:Math.sqrt((l[0]-u[0])*(l[0]-u[0])+(l[1]-u[1])*(l[1]-u[1]))}],function(e,i){if("none"!==f[i]&&null!=f[i]){var r=ds(f[i],-m/2,-_/2,m,_,p.stroke,!0),o=e.r+e.offset,a=c?u:l;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}})}}},axisTickLabel:function(t,e,n,i){var r=function(t,e,n,i){var r=n.axis,o=n.getModel("axisTick"),s=o.get("show");if("auto"===s&&i.handleAutoShown&&(s=i.handleAutoShown("axisTick")),s&&!r.scale.isBlank()){for(var l=o.getModel("lineStyle"),u=i.tickDirection*o.get("length"),h=rh(r.getTicksCoords(),e.transform,u,a(l.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),c=0;cc[1]?-1:1,d=["start"===s?c[0]-p*h:"end"===s?c[1]+p*h:(c[0]+c[1])/2,ih(s)?t.labelOffset+l*h:0],f=e.get("nameRotate");null!=f&&(f=f*zM/180),ih(s)?o=BM.innerTextLayout(t.rotation,null!=f?f:t.rotation,l):(o=function(t,e,n,i){var r,o,a=nn(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;return rn(a-zM/2)?(o=l?"bottom":"top",r="center"):rn(a-1.5*zM)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*zM&&a>zM/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,s,f||0,c),null!=(a=t.axisNameAvailableWidth)&&(a=Math.abs(a/Math.sin(o.rotation)),!isFinite(a)&&(a=null)));var g=u.getFont(),y=e.get("nameTruncate",!0)||{},m=y.ellipsis,v=I(t.nameTruncateMaxWidth,y.maxWidth,a),_=new cm({x:d[0],y:d[1],rotation:o.rotation,silent:BM.isLabelSilent(e),style:er(u,{text:r,font:g,overflow:"truncate",width:v,ellipsis:m,fill:u.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:u.get("align")||o.textAlign,verticalAlign:u.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(Wa({el:_,componentModel:e,itemName:r}),_.__fullText=r,_.anid="name",e.get("triggerEvent")){var x=BM.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,pm(_).eventData=x}i.add(_),_.updateTransform(),n.add(_),_.decomposeTransform()}}};const VM=BM;var HM={},WM=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.render=function(t,n,i,r){this.axisPointerClass&&function(t){var e=ah(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=sh(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),aa)return!0;if(o){var s=ah(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return!0===n},t.prototype.makeElOption=function(t,e,n,i,r){},t.prototype.createPointerEl=function(t,e,n,i){var r=e.pointer;if(r){var o=QM(t).pointerEl=new td[r.type](tT(e.pointer));t.add(o)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=QM(t).labelEl=new cm(tT(e.label));t.add(r),ph(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=QM(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=QM(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),ph(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,n=this._axisPointerModel,i=this._api.getZr(),r=this._handle,o=n.getModel("handle"),a=n.get("status");if(!o.get("show")||!a||"hide"===a)return r&&i.remove(r),void(this._handle=null);this._handle||(e=!0,r=this._handle=Ba(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){jd(t.event)},onmousedown:eT(this._onHandleDragMove,this,0,0),drift:eT(this._onHandleDragMove,this),ondragend:eT(this._onHandleDragEnd,this)}),i.add(r)),fh(r,n,!1),r.setStyle(o.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=o.get("size");y(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,$a(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){hh(this._axisPointerModel,!e&&this._moveAnimation,this._handle,dh(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(dh(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(dh(i)),QM(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),Ka(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return{x:t[n=n||0],y:t[1-n],width:e[n],height:e[1-n]}},t}(),iT=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=mh(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=function(t){var e,n=t.get("type"),i=t.getModel(n+"Style");return"line"===n?(e=i.getLineStyle()).fill=null:"shadow"===n&&((e=i.getAreaStyle()).stroke=null),e}(i),c=rT[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}!function(t,e,n,i,r,o){var a=VM.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=r.get(["label","margin"]),function(t,e,n,i,r){var o=gh(n.get("value"),e.axis,e.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),a=n.getModel("label"),s=av(a.get("padding")||0),l=a.getFont(),u=Fe(o,l),h=r.position,c=u.width+s[1]+s[3],p=u.height+s[0]+s[2],d=r.align;"right"===d&&(h[0]-=c),"center"===d&&(h[0]-=c/2);var f=r.verticalAlign;"bottom"===f&&(h[1]-=p),"middle"===f&&(h[1]-=p/2),function(t,e,n,i){var r=i.getWidth(),o=i.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+n,o)-n,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(h,c,p,i);var g=a.get("backgroundColor");g&&"auto"!==g||(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:er(a,{text:o,font:l,fill:a.getTextColor(),padding:s,backgroundColor:g}),z2:10}}(e,i,r,o,{position:yh(i.axis,t,n),align:a.textAlign,verticalAlign:a.textVerticalAlign})}(e,t,qu(a.model,n),n,i,r)},n.prototype.getHandleTransform=function(t,e,n){var i=qu(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=yh(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},n.prototype.updateHandleTransform=function(t,e,n,i){var r=n.axis,o=r.grid,a=r.getGlobalExtent(!0),s=mh(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,u=[t.x,t.y];u[l]+=e[l],u[l]=Math.min(a[1],u[l]),u[l]=Math.max(a[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];return c[l]=u[l],{x:u[0],y:u[1],rotation:t.rotation,cursorPoint:c,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},n}(nT),rT={line:function(t,e,n){var i,r,o;return{type:"Line",subPixelOptimize:!0,shape:(i=[e,n[0]],r=[e,n[1]],o=vh(t),{x1:i[o=o||0],y1:i[1-o],x2:r[o],y2:r[1-o]})}},shadow:function(t,e,n){var i,r,o,a=Math.max(1,t.getBandWidth());return{type:"Rect",shape:(i=[e-a/2,n[0]],r=[a,n[1]-n[0]],o=vh(t),{x:i[o=o||0],y:i[1-o],width:r[o],height:r[1-o]})}}};const oT=iT,aT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.type="axisPointer",n.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},n}(gv);var sT=Sn(),lT=h,uT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";_h("axisPointer",n,function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},n.prototype.remove=function(t,e){bh("axisPointer",e)},n.prototype.dispose=function(t,e){bh("axisPointer",e)},n.type="axisPointer",n}(B_);const hT=uT;var cT=Sn();const pT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.type="tooltip",n.dependencies=["axisPointer"],n.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},n}(gv);var dT=Oh(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),fT=Ph(Oh(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),"transition"),gT=Ph(dT,"transform"),yT="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(rd.transform3dSupported?"will-change:transform;":""),mT=function(){function t(t,e){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,rd.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var i=this._zr=t.getZr(),r=e.appendTo,o=r&&(v(r)?document.querySelector(r):C(r)?r:m(r)&&r(t.getDom()));Nh(this._styleCoord,i,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var a=this;n.onmouseenter=function(){a._enterable&&(clearTimeout(a._hideTimeout),a._show=!0),a._inContent=!0},n.onmousemove=function(t){if(t=t||window.event,!a._enterable){var e=i.handler;ct(i.painter.getViewportRoot(),t,!0),e.dispatch("mousemove",t)}},n.onmouseleave=function(){a._inContent=!1,a._enterable&&a._show&&a.hideLater(a._hideDelay)}}return t.prototype.update=function(t){if(!this._container){var e=this._api.getDom(),n=(o="position",(a=(r=e).currentStyle||document.defaultView&&document.defaultView.getComputedStyle(r))?o?a[o]:a:null),i=e.style;"absolute"!==i.position&&"absolute"!==n&&(i.position="relative")}var r,o,a,s=t.get("alwaysShowContent");s&&this._moveIfResized(),this._alwaysShowContent=s,this.el.className=t.get("className")||""},t.prototype.show=function(t,e){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,r=this._styleCoord;n.innerHTML?i.cssText=yT+function(t,e,n){var i=[],r=t.get("transitionDuration"),o=t.get("backgroundColor"),a=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),u=t.get("shadowOffsetY"),c=t.getModel("textStyle"),p=Yo(t,"html");return i.push("box-shadow:"+l+"px "+u+"px "+a+"px "+s),e&&r&&i.push(function(t,e){var n="cubic-bezier(0.23,1,0.32,1)",i=" "+t/2+"s "+n,r="opacity"+i+",visibility"+i;return e||(i=" "+t+"s "+n,r+=rd.transformSupported?","+gT+i:",left"+i+",top"+i),fT+":"+r}(r,n)),o&&i.push("background-color:"+o),h(["width","color","radius"],function(e){var n="border-"+e,r=kr(n),o=t.get(r);null!=o&&i.push(n+":"+o+("color"===e?"":"px"))}),i.push(function(t){var e=[],n=t.get("fontSize"),i=t.getTextColor();i&&e.push("color:"+i),e.push("font:"+t.getFont());var r=k(t.get("lineHeight"),Math.round(3*n/2));n&&e.push("line-height:"+r+"px");var o=t.get("textShadowColor"),a=t.get("textShadowBlur")||0,s=t.get("textShadowOffsetX")||0,l=t.get("textShadowOffsetY")||0;return o&&a&&e.push("text-shadow:"+s+"px "+l+"px "+a+"px "+o),h(["decoration","align"],function(n){var i=t.get(n);i&&e.push("text-"+n+":"+i)}),e.join(";")}(c)),null!=p&&i.push("padding:"+av(p).join("px ")+"px"),i.join(";")+";"}(t,!this._firstShow,this._longHide)+Rh(r[0],r[1],!0)+"border-color:"+Lr(e)+";"+(t.get("extraCssText")||"")+";pointer-events:"+(this._enterable?"auto":"none"):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(t,e,n,i,r){var o=this.el;if(null!=t){var a="";if(v(r)&&"item"===n.get("trigger")&&!Lh(n)&&(a=function(t,e,n){if(!v(n)||"inside"===n)return"";var i=t.get("backgroundColor"),r=t.get("borderWidth");e=Lr(e);var o,a,l="left"===(o=n)?"right":"right"===o?"left":"top"===o?"bottom":"top",u=Math.max(1.5*Math.round(r),6),h="",c=gT+":";s(["left","right"],l)>-1?(h+="top:50%",c+="translateY(-50%) rotate("+(a="left"===l?-225:-45)+"deg)"):(h+="left:50%",c+="translateX(-50%) rotate("+(a="top"===l?225:45)+"deg)");var p=a*Math.PI/180,d=u+r,f=d*Math.abs(Math.cos(p))+d*Math.abs(Math.sin(p)),g=e+" solid "+r+"px;";return'
'}(n,i,r)),v(t))o.innerHTML=t+a;else if(t){o.innerHTML="",y(t)||(t=[t]);for(var l=0;l=0?this._tryShow(n,i):"leave"===e&&this._hide(i))},this))},n.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})})}},n.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!rd.node&&n.getDom()){var r=Vh(i,n);this._ticket="";var o=i.dataByCoordSys,a=function(t,e,n){var i=Mn(t).queryOptionMap,r=i.keys()[0];if(r&&"series"!==r){var o,a=Tn(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a)return n.getViewOfComponentModel(a).group.traverse(function(e){var n=pm(e).tooltipConfig;if(n&&n.name===t.name)return o=e,!0}),o?{componentMainType:r,componentIndex:a.componentIndex,el:o}:void 0}}(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=xT;l.x=i.x,l.y=i.y,l.update(),pm(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=Sh(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},n.prototype.manuallyHideTip=function(t,e,n,i){this._tooltipModel&&this._tooltipContent.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(Vh(i,n))},n.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s&&"axis"===Fh([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}},n.prototype._tryShow=function(t,e){var n=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(n){var r,o;if("legend"===pm(n).ssrType)return;this._lastDataByCoordSys=null,cs(n,function(t){return null!=pm(t).dataIndex?(r=t,!0):null!=pm(t).tooltipConfig?(o=t,!0):void 0},!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},n.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=Sd(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},n.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],a=Fh([e.tooltipOption],i),s=this._renderMode,l=[],u=Bo("section",{blocks:[],noHeader:!0}),c=[],p=new P_;h(t,function(t){h(t.dataByAxis,function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var a=gh(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),d=Bo("section",{header:a,noHeader:!P(a),sortBlocks:!0,blocks:[]});u.blocks.push(d),h(t.seriesDataIndices,function(u){var h=n.getSeriesByIndex(u.seriesIndex),f=u.dataIndexInside,g=h.getDataParams(f);if(!(g.dataIndex<0)){g.axisDim=t.axisDim,g.axisIndex=t.axisIndex,g.axisType=t.axisType,g.axisId=t.axisId,g.axisValue=Nu(e.axis,{value:r}),g.axisValueLabel=a,g.marker=p.makeTooltipMarker("item",Lr(g.color),s);var y=xo(h.formatTooltip(f,!0,null)),m=y.frag;if(m){var v=Fh([h],i).get("valueFormatter");d.blocks.push(v?o({valueFormatter:v},m):m)}y.text&&c.push(y.text),l.push(g)}})}})}),u.blocks.reverse(),c.reverse();var d=e.position,f=a.get("order"),g=Uo(u,p,s,f,n.get("useUTC"),a.get("textStyle"));g&&c.unshift(g);var y=c.join("richText"===s?"\n\n":"
");this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(t,l)?this._updatePosition(a,d,r[0],r[1],this._tooltipContent,l):this._showTooltipContent(a,y,l,Math.random()+"",r[0],r[1],d,null,p)})},n.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=pm(e),a=r.seriesIndex,s=i.getSeriesByIndex(a),l=r.dataModel||s,u=r.dataIndex,h=r.dataType,c=l.getData(h),p=this._renderMode,d=t.positionDefault,f=Fh([c.getItemModel(u),l,s&&(s.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),g=f.get("trigger");if(null==g||"item"===g){var y=l.getDataParams(u,h),m=new P_;y.marker=m.makeTooltipMarker("item",Lr(y.color),p);var v=xo(l.formatTooltip(u,!1,h)),_=f.get("order"),x=f.get("valueFormatter"),w=v.frag,b=w?Uo(x?o({valueFormatter:x},w):w,m,p,_,i.get("useUTC"),f.get("textStyle")):v.text,S="item_"+l.name+"_"+u;this._showOrMove(f,function(){this._showTooltipContent(f,b,y,S,t.offsetX,t.offsetY,t.position,t.target,m)}),n({type:"showTip",dataIndexInside:u,dataIndex:c.getRawIndex(u),seriesIndex:a,from:this.uid})}},n.prototype._showComponentItemTooltip=function(t,e,n){var r="html"===this._renderMode,o=pm(e),a=o.tooltipConfig.option||{},s=a.encodeHTMLContent;v(a)&&(a={content:a,formatter:a},s=!0),s&&r&&a.content&&((a=i(a)).content=st(a.content));var l=[a],u=this._ecModel.getComponent(o.componentMainType,o.componentIndex);u&&l.push(u),l.push({formatter:a.content});var h=t.positionDefault,c=Fh(l,this._tooltipModel,h?{position:h}:null),p=c.get("content"),d=Math.random()+"",f=new P_;this._showOrMove(c,function(){var n=i(c.get("formatterParams")||{});this._showTooltipContent(c,p,n,d,t.offsetX,t.offsetY,t.position,e,f)}),n({type:"showTip",from:this.uid})},n.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,p=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h)if(v(h)){var d=t.ecModel.get("useUTC"),f=y(n)?n[0]:n;c=h,f&&f.axisType&&f.axisType.indexOf("time")>=0&&(c=hr(f.axisValue,c,d)),c=Ar(c,n,!0)}else if(m(h)){var g=Sd(function(e,i){e===this._ticket&&(u.setContent(i,l,t,p,a),this._updatePosition(t,a,r,o,u,n,s))},this);this._ticket=i,c=h(n,i,g)}else c=h;u.setContent(c,l,t,p,a),u.show(t,p),this._updatePosition(t,a,r,o,u,n,s)}},n.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||y(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:y(e)?void 0:{color:i||e.color||e.borderColor}},n.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),p=a&&a.getBoundingRect().clone();if(a&&p.applyTransform(a.transform),m(e)&&(e=e([n,i],o,r.el,p,{viewSize:[s,l],contentSize:u.slice()})),y(e))n=Ke(e[0],s),i=Ke(e[1],l);else if(w(e)){var d=e;d.width=u[0],d.height=u[1];var f=Rr(d,{width:s,height:l});n=f.x,i=f.y,h=null,c=null}else if(v(e)&&a){var g=function(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,p,u,t.get("borderWidth"));n=g[0],i=g[1]}else g=function(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];return null!=o&&(t+l+o+2>i?t-=l+o:t+=o),null!=a&&(e+u+a>r?e-=u+a:e+=a),[t,e]}(n,i,r,s,l,h?null:20,c?null:20),n=g[0],i=g[1];h&&(n-=Hh(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=Hh(c)?u[1]/2:"bottom"===c?u[1]:0),Lh(t)&&(g=function(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,[t=Math.max(t,0),e=Math.max(e,0)]}(n,i,r,s,l),n=g[0],i=g[1]),r.moveTo(n,i)},n.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&h(n,function(n,o){var a=n.dataByAxis||[],s=(t[o]||{}).dataByAxis||[];(r=r&&a.length===s.length)&&h(a,function(t,n){var o=s[n]||{},a=t.seriesDataIndices||[],l=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===l.length)&&h(a,function(t,e){var n=l[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex}),i&&h(t.seriesDataIndices,function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},n.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},n.prototype.dispose=function(t,e){!rd.node&&e.getDom()&&(Ka(this,"_updatePosition"),this._tooltipContent.dispose(),bh("itemTooltip",e))},n.type="tooltip",n}(B_);const bT=wT;var ST=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.layoutMode={type:"box",ignoreSize:!0},t}return t(n,e),n.type="title",n.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},n}(gv),CT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.render=function(t,e,n){if(this.group.removeAll(),t.get("show")){var i=this.group,r=t.getModel("textStyle"),o=t.getModel("subtextStyle"),a=t.get("textAlign"),s=k(t.get("textBaseline"),t.get("textVerticalAlign")),l=new cm({style:er(r,{text:t.get("text"),fill:r.getTextColor()},{disableBox:!0}),z2:10}),u=l.getBoundingRect(),h=t.get("subtext"),c=new cm({style:er(o,{text:h,fill:o.getTextColor(),y:u.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),p=t.get("link"),d=t.get("sublink"),f=t.get("triggerEvent",!0);l.silent=!p&&!f,c.silent=!d&&!f,p&&l.on("click",function(){Or(p,"_"+t.get("target"))}),d&&c.on("click",function(){Or(d,"_"+t.get("subtarget"))}),pm(l).eventData=pm(c).eventData=f?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(l),h&&i.add(c);var g=i.getBoundingRect(),y=t.getBoxLayoutParams();y.width=g.width,y.height=g.height;var m=Rr(y,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));a||("middle"===(a=t.get("left")||t.get("right"))&&(a="center"),"right"===a?m.x+=m.width:"center"===a&&(m.x+=m.width/2)),s||("center"===(s=t.get("top")||t.get("bottom"))&&(s="middle"),"bottom"===s?m.y+=m.height:"middle"===s&&(m.y+=m.height/2),s=s||"top"),i.x=m.x,i.y=m.y,i.markRedraw();var v={align:a,verticalAlign:s};l.setStyle(v),c.setStyle(v),g=i.getBoundingRect();var _=m.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var w=new rm({shape:{x:g.x-_[3],y:g.y-_[0],width:g.width+_[1]+_[3],height:g.height+_[0]+_[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(w)}},n.type="title",n}(B_),MT=["x","y","radius","angle","single"],TT=["cartesian2d","polar","singleAxis"],IT=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();const kT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.type="dataZoom.select",n}(function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t._autoThrottle=!0,t._noTarget=!0,t._rangePropMode=["percent","percent"],t}return t(n,e),n.prototype.init=function(t,e,n){var i=Gh(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},n.prototype.mergeOption=function(t){var e=Gh(t);r(this.option,t,!0),r(this.settledOption,e,!0),this._doInit(e)},n.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;h([["start","startValue"],["end","endValue"]],function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=n[t[0]]=null)},this),this._resetTarget()},n.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=E();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each(function(t){t.indexList.length&&(this._noTarget=!1)},this)},n.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return h(MT,function(n){var i=this.getReferringComponents(Wh(n),Wg);if(i.specified){e=!0;var r=new IT;h(i.models,function(t){r.add(t.componentIndex)}),t.set(n,r)}},this),e},n.prototype._fillAutoTargetAxisByOrient=function(t,e){function n(e,n){var i=e[0];if(i){var o=new IT;if(o.add(i.componentIndex),t.set(n,o),r=!1,"x"===n||"y"===n){var a=i.getReferringComponents("grid",Hg).models[0];a&&h(e,function(t){i.componentIndex!==t.componentIndex&&a===t.getReferringComponents("grid",Hg).models[0]&&o.add(t.componentIndex)})}}}var i=this.ecModel,r=!0;if(r){var o="vertical"===e?"y":"x";n(i.findComponents({mainType:o+"Axis"}),o)}r&&n(i.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single"),r&&h(MT,function(e){if(r){var n=i.findComponents({mainType:Wh(e),filter:function(t){return"category"===t.get("type",!0)}});if(n[0]){var o=new IT;o.add(n[0].componentIndex),t.set(e,o),r=!1}}},this)},n.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis(function(e){!t&&(t=e)},this),"y"===t?"vertical":"horizontal"},n.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},n.prototype._updateRangeUse=function(t){var e=this._rangePropMode,n=this.get("rangeMode");h([["start","startValue"],["end","endValue"]],function(i,r){var o=null!=t[i[0]],a=null!=t[i[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":n?e[r]=n[r]:o&&(e[r]="percent")})},n.prototype.noTarget=function(){return this._noTarget},n.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis(function(e,n){null==t&&(t=this.ecModel.getComponent(Wh(e),n))},this),t},n.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each(function(n,i){h(n.indexList,function(n){t.call(e,i,n)})})},n.prototype.getAxisProxy=function(t,e){var n=this.getAxisModel(t,e);if(n)return n.__dzAxisProxy},n.prototype.getAxisModel=function(t,e){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[e])return this.ecModel.getComponent(Wh(t),e)},n.prototype.setRawRange=function(t){var e=this.option,n=this.settledOption;h([["start","startValue"],["end","endValue"]],function(i){null==t[i[0]]&&null==t[i[1]]||(e[i[0]]=n[i[0]]=t[i[0]],e[i[1]]=n[i[1]]=t[i[1]])},this),this._updateRangeUse(t)},n.prototype.setCalculatedRange=function(t){var e=this.option;h(["start","startValue","end","endValue"],function(n){e[n]=t[n]})},n.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},n.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var n=this.findRepresentativeAxisProxy();return n?n.getDataValueWindow():void 0},n.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,n=this._targetAxisInfoMap.keys(),i=0;i=0}(e)){var n=Wh(this._dimName),i=e.getReferringComponents(n,Hg).models[0];i&&this._axisIndex===i.componentIndex&&t.push(e)}},this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return i(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){function e(t,e,n,i,o){var a=o?"Span":"ValueSpan";Uh(0,t,n,"all",u["min"+a],u["max"+a]);for(var s=0;s<2;s++)e[s]=$e(t[s],n,i,!0),o&&(e[s]=r.parse(e[s]))}var n,i=this._dataExtent,r=this.getAxisModel().axis.scale,o=this._dataZoomModel.getRangePropMode(),a=[0,100],s=[],l=[];AT(["start","end"],function(e,u){var h=t[e],c=t[e+"Value"];"percent"===o[u]?(null==h&&(h=a[u]),c=r.parse($e(h,a,i))):(n=!0,h=$e(c=null==c?i[u]:r.parse(c),i,a)),l[u]=null==c||isNaN(c)?i[u]:c,s[u]=null==h||isNaN(h)?a[u]:h}),LT(l),LT(s);var u=this._minMaxSpan;return n?e(l,s,i,a,!1):e(s,l,a,i,!0),{valueWindow:l,percentWindow:s}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,n){var i=[1/0,-1/0];AT(n,function(t){!function(t,e,n){e&&h(Fu(e,n),function(n){var i=e.getApproximateExtent(n);i[0]t[1]&&(t[1]=i[1])})}(i,t.getData(),e)});var r=t.getAxisModel(),o=Au(r.axis.scale,r,i).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var n=this.calculateDataWindow(t.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow;"none"!==r&&AT(i,function(t){var e=t.getData(),i=e.mapDimensionsAll(n);if(i.length){if("weakFilter"===r){var a=e.getStore(),s=c(i,function(t){return e.getDimensionIndex(t)},e);e.filterSelf(function(t){for(var e,n,r,l=0;lo[1];if(h&&!c&&!p)return!0;h&&(r=!0),c&&(e=!0),p&&(n=!0)}return r&&e&&n})}else AT(i,function(n){if("empty"===r)t.setData(e=e.map(n,function(t){return function(t){return t>=o[0]&&t<=o[1]}(t)?t:NaN}));else{var i={};i[n]=o,e.selectRange(i)}});AT(i,function(t){e.setApproximateExtent(o,t)})}})}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,n=this._dataExtent;AT(["min","max"],function(i){var r=e.get(i+"Span"),o=e.get(i+"ValueSpan");null!=o&&(o=this.getAxisModel().axis.scale.parse(o)),null!=o?r=$e(n[0]+o,n,[0,100],!0):null!=r&&(o=$e(r,[0,100],n,!0)-n[0]),t[i+"Span"]=r,t[i+"ValueSpan"]=o},this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,n=this._valueWindow;if(e){var i=tn(n,[0,500]);i=Math.min(i,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==e[1]&&r.setDeterminedMinMax("max",+n[1].toFixed(i)),r.freeze()}},t}();const PT=OT,RT={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",function(n){n.eachTargetAxis(function(i,r){var o=t.getComponent(Wh(i),r);e(i,r,o,n)})})}e(function(t,e,n,i){n.__dzAxisProxy=null});var n=[];e(function(e,i,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new PT(e,i,o,t),n.push(r.__dzAxisProxy))});var i=E();return h(n,function(t){h(t.getTargetSeriesModels(),function(t){i.set(t.uid,t)})}),i},overallReset:function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(e,n){t.getAxisProxy(e,n).reset(t)}),t.eachTargetAxis(function(n,i){t.getAxisProxy(n,i).filterData(t,e)})}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy();if(e){var n=e.getDataPercentWindow(),i=e.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}})}};var NT=!1,ET=function(){},zT={};const BT=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}return t(n,e),n.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;h(this.option.feature,function(e,n){var i=qh(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),r(e,i.defaultOption))})},n.type="toolbox",n.layoutMode={type:"box",ignoreSize:!0},n.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},n}(gv);var FT=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.render=function(t,e,n,i){function r(r,p){var d,f=c[r],g=c[p],y=l[f],m=new Wm(y,t,t.ecModel);if(i&&null!=i.newTitle&&i.featureName===f&&(y.title=i.newTitle),f&&!g){if(function(t){return 0===t.indexOf("my")}(f))d={onclick:m.option.onclick,featureName:f};else{var _=qh(f);if(!_)return;d=new _}u[f]=d}else if(!(d=u[g]))return;d.uid=or("toolbox-feature"),d.model=m,d.ecModel=e,d.api=n;var x=d instanceof ET;f||!g?!m.get("show")||x&&d.unusable?x&&d.remove&&d.remove(e,n):(function(i,r,l){var u,c,p=i.getModel("iconStyle"),d=i.getModel(["emphasis","iconStyle"]),f=r instanceof ET&&r.getIcons?r.getIcons():i.get("icon"),g=i.get("title")||{};v(f)?(u={})[l]=f:u=f,v(g)?(c={})[l]=g:c=g;var y=i.iconPaths={};h(u,function(l,u){var h=Ba(l,{},{x:-a/2,y:-a/2,width:a,height:a});h.setStyle(p.getItemStyle()),h.ensureState("emphasis").style=d.getItemStyle();var f=new cm({style:{text:c[u],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:rr({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},e)},ignore:!0});h.setTextContent(f),Wa({el:h,componentModel:t,itemName:u,formatterParamsExtra:{title:c[u]}}),h.__title=c[u],h.on("mouseover",function(){var e=d.getItemStyle(),i=s?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";f.setStyle({fill:d.get("textFill")||e.fill||e.stroke||"#000",backgroundColor:d.get("textBackgroundColor")}),h.setTextConfig({position:d.get("textPosition")||i}),f.ignore=!t.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){"emphasis"!==i.get(["iconStatus",u])&&n.leaveEmphasis(this),f.hide()}),("emphasis"===i.get(["iconStatus",u])?Ri:Ni)(h),o.add(h),h.on("click",Sd(r.onclick,r,e,n,u)),y[u]=h})}(m,d,f),m.setIconStatus=function(t,e){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[t]=e,i[t]&&("emphasis"===e?Ri:Ni)(i[t])},d instanceof ET&&d.render&&d.render(m,e,n,i)):x&&d.dispose&&d.dispose(e,n)}var o=this.group;if(o.removeAll(),t.get("show")){var a=+t.get("itemSize"),s="vertical"===t.get("orient"),l=t.get("feature")||{},u=this._features||(this._features={}),c=[];h(l,function(t,e){c.push(e)}),new CS(this._featureNames||[],c).add(r).update(r).remove(g(r,null)).execute(),this._featureNames=c,function(t,e,n){var i=e.getBoxLayoutParams(),r=e.get("padding"),o={width:n.getWidth(),height:n.getHeight()},a=Rr(i,o,r);pv(e.get("orient"),t,e.get("itemGap"),a.width,a.height),Nr(t,i,o,r)}(o,t,n),o.add($h(o.getBoundingRect(),t)),s||o.eachChild(function(t){var e=t.__title,i=t.ensureState("emphasis"),r=i.textConfig||(i.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!m(l)&&e){var u=l.style||(l.style={}),h=Fe(e,cm.makeFont(u)),c=t.x+o.x,p=!1;t.y+o.y+a+h.height>n.getHeight()&&(r.position="top",p=!0);var d=p?-5-h.height:a+10;c+h.width/2>n.getWidth()?(r.position=["100%",d],u.align="right"):c-h.width/2<0&&(r.position=[0,d],u.align="left")}})}},n.prototype.updateView=function(t,e,n,i){h(this._features,function(t){t instanceof ET&&t.updateView&&t.updateView(t.model,e,n,i)})},n.prototype.remove=function(t,e){h(this._features,function(n){n instanceof ET&&n.remove&&n.remove(t,e)}),this.group.removeAll()},n.prototype.dispose=function(t,e){h(this._features,function(n){n instanceof ET&&n.dispose&&n.dispose(t,e)})},n.type="toolbox",n}(B_);const VT=FT,HT=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.onclick=function(t,e){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":n.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=rd.browser;if("function"!=typeof MouseEvent||!s.newEdge&&(s.ie||s.edge))if(window.navigator.msSaveOrOpenBlob||r){var l=a.split(","),u=l[0].indexOf("base64")>-1,h=r?decodeURIComponent(l[1]):l[1];u&&(h=window.atob(h));var c=i+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var p=h.length,d=new Uint8Array(p);p--;)d[p]=h.charCodeAt(p);var f=new Blob([d]);window.navigator.msSaveOrOpenBlob(f,c)}else{var g=document.createElement("iframe");document.body.appendChild(g);var y=g.contentWindow,m=y.document;m.open("image/svg+xml","replace"),m.write(h),m.close(),y.focus(),m.execCommand("SaveAs",!0,c),document.body.removeChild(g)}}else{var v=n.get("lang"),_='',x=window.open();x.document.write(_),x.document.title=i}else{var w=document.createElement("a");w.download=i+"."+o,w.target="_blank",w.href=a;var b=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});w.dispatchEvent(b)}},n.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},n}(ET);var WT="__ec_magicType_stack__",GT=[["line","bar"],["stack"]],UT=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return h(t.get("type"),function(t){e[t]&&(n[t]=e[t])}),n},n.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},n.prototype.onclick=function(t,e,n){var i=this.model,o=i.get(["seriesIndex",n]);if(jT[n]){var l,u={series:[]};h(GT,function(t){s(t,n)>=0&&h(t,function(t){i.setIconStatus(t,"normal")})}),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},function(t){var e=jT[n](t.subType,t.id,t,i);e&&(a(e,t.option),u.series.push(e));var r=t.coordinateSystem;if(r&&"cartesian2d"===r.type&&("line"===n||"bar"===n)){var o=r.getAxesByScale("ordinal")[0];if(o){var s=o.dim+"Axis",l=t.getReferringComponents(s,Hg).models[0].componentIndex;u[s]=u[s]||[];for(var h=0;h<=l;h++)u[s][l]=u[s][l]||{};u[s][l].boundaryGap="bar"===n}}});var c=n;"stack"===n&&(l=r({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(c="tiled")),e.dispatchAction({type:"changeMagicType",currentType:c,newOption:u,newTitle:l,featureName:"magicType"})}},n}(ET),jT={line:function(t,e,n,i){if("bar"===t)return r({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return r({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var o=n.get("stack")===WT;if("line"===t||"bar"===t)return i.setIconStatus("stack",o?"normal":"emphasis"),r({id:e,stack:o?"":WT},i.get(["option","stack"])||{},!0)}};Zs({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)});const ZT=UT;var YT=new Array(60).join("-"),XT="\t",qT=new RegExp("[\t]+","g"),$T=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.onclick=function(t,e){function n(){i.removeChild(o),T._dom=null}setTimeout(function(){e.dispatchAction({type:"hideTip"})});var i=e.getDom(),r=this.model;this._dom&&i.removeChild(this._dom);var o=document.createElement("div");o.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;padding:5px",o.style.backgroundColor=r.get("backgroundColor")||"#fff";var a=document.createElement("h4"),s=r.get("lang")||[];a.innerHTML=s[0]||r.get("title"),a.style.cssText="margin:10px 20px",a.style.color=r.get("textColor");var l=document.createElement("div"),u=document.createElement("textarea");l.style.cssText="overflow:auto";var p=r.get("optionToContent"),f=r.get("contentToOption"),g=function(t){var e,n,i,r=function(t){var e={},n=[],i=[];return t.eachRawSeries(function(t){var r=t.coordinateSystem;if(!r||"cartesian2d"!==r.type&&"polar"!==r.type)n.push(t);else{var o=r.getBaseAxis();if("category"===o.type){var a=o.dim+"_"+o.index;e[a]||(e[a]={categoryAxis:o,valueAxis:r.getOtherAxis(o),series:[]},i.push({axisDim:o.dim,axisIndex:o.index})),e[a].series.push(t)}else n.push(t)}}),{seriesGroupByCategoryAxis:e,other:n,meta:i}}(t);return{value:d([(n=r.seriesGroupByCategoryAxis,i=[],h(n,function(t,e){var n=t.categoryAxis,r=t.valueAxis.dim,o=[" "].concat(c(t.series,function(t){return t.name})),a=[n.model.getCategories()];h(t.series,function(t){var e=t.getRawData();a.push(t.getRawData().mapArray(e.mapDimension(r),function(t){return t}))});for(var s=[o.join(XT)],l=0;l=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=[],i=c(Kh(e.shift()).split(qT),function(t){return{name:t,data:[]}}),r=0;ri.getWidth()||n<0||n>i.getHeight()}(t,e.offsetX,e.offsetY)){var i=t._zr,r=t._covers,o=ac(t,e,n);if(!t._dragging)for(var a=0;a=0)&&t(r,i._targetInfoList)})}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,function(t,e,n){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var i=xI[t.brushType](0,n,e);t.__rangeOffset={offset:wI[t.brushType](i.values,t.range,[1,1]),xyMinMax:i.xyMinMax}}}),t},t.prototype.matchOutputRanges=function(t,e,n){h(t,function(t){var i=this.findTargetInfo(t,e);i&&!0!==i&&h(i.coordSyses,function(i){var r=xI[t.brushType](1,i,t.range,!0);n(t,r.values,i,e)})},this)},t.prototype.setInputRanges=function(t,e){h(t,function(t){var n,i,r,o,a=this.findTargetInfo(t,e);if(t.range=t.range||[],a&&!0!==a){t.panelId=a.panelId;var s=xI[t.brushType](0,a.coordSys,t.coordRange),l=t.__rangeOffset;t.range=l?wI[t.brushType](s.values,l.offset,(n=l.xyMinMax,i=Ec(s.xyMinMax),r=Ec(n),o=[i[0]/r[0],i[1]/r[1]],isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o)):s.values}},this)},t.prototype.makePanelOpts=function(t,e){return c(this._targetInfoList,function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:e?e(n):null,clipPath:kc(i),isTargetByCursor:Ac(i,t,n.coordSysModel),getLinearBrushOtherExtent:Dc(i)}})},t.prototype.controlSeries=function(t,e,n){var i=this.findTargetInfo(t,n);return!0===i||i&&s(i.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var n=this._targetInfoList,i=Pc(e,t),r=0;r=0||s(i,t.getAxis("y").model)>=0)&&r.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:r[0],coordSyses:r,getPanelRect:_I.grid,xAxisDeclared:a[t.id],yAxisDeclared:l[t.id]})}))},geo:function(t,e){h(t.geoModels,function(t){var n=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:n,coordSyses:[n],getPanelRect:_I.geo})})}},vI=[function(t,e){var n=t.xAxisModel,i=t.yAxisModel,r=t.gridModel;return!r&&n&&(r=n.axis.grid.model),!r&&i&&(r=i.axis.grid.model),r&&r===e.gridModel},function(t,e){var n=t.geoModel;return n&&n===e.geoModel}],_I={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(La(t)),e}},xI={lineX:g(Rc,0),lineY:g(Rc,1),rect:function(t,e,n,i){var r=t?e.pointToData([n[0][0],n[1][0]],i):e.dataToPoint([n[0][0],n[1][0]],i),o=t?e.pointToData([n[0][1],n[1][1]],i):e.dataToPoint([n[0][1],n[1][1]],i),a=[Oc([r[0],o[0]]),Oc([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,n,i){var r=[[1/0,-1/0],[1/0,-1/0]];return{values:c(n,function(n){var o=t?e.pointToData(n,i):e.dataToPoint(n,i);return r[0][0]=Math.min(r[0][0],o[0]),r[1][0]=Math.min(r[1][0],o[1]),r[0][1]=Math.max(r[0][1],o[0]),r[1][1]=Math.max(r[1][1],o[1]),o}),xyMinMax:r}}},wI={lineX:g(Nc,0),lineY:g(Nc,1),rect:function(t,e,n){return[[t[0][0]-n[0]*e[0][0],t[0][1]-n[0]*e[0][1]],[t[1][0]-n[1]*e[1][0],t[1][1]-n[1]*e[1][1]]]},polygon:function(t,e,n){return c(t,function(t,i){return[t[0]-n[0]*e[i][0],t[1]-n[1]*e[i][1]]})}};const bI=yI;var SI,CI=h,MI=Bg+"toolbox-dataZoom_",TI=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.render=function(t,e,n,i){this._brushController||(this._brushController=new fI(n.getZr()),this._brushController.on("brush",Sd(this._onBrush,this)).mount()),function(t,e,n,i,r){var o=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(o="dataZoomSelect"===i.key&&i.dataZoomSelectActive),n._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new bI(zc(t),e,{include:["grid"]}).makePanelOpts(r,function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"});n._brushController.setPanels(a).enableBrush(!(!o||!a.length)&&{brushType:"auto",brushStyle:t.getModel("brushStyle").getItemStyle()})}(t,e,this,i,n),function(t,e){t.setIconStatus("back",function(t){return Qh(t).length}(e)>1?"emphasis":"normal")}(t,e)},n.prototype.onclick=function(t,e,n){II[n].call(this)},n.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},n.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},n.prototype._onBrush=function(t){function e(t,e,n){var o=e.getAxis(t),a=o.model,s=function(t,e,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},function(n){n.getAxisModel(t,e.componentIndex)&&(i=n)}),i}(t,a,r),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(n=Uh(0,n.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(i[s.id]={dataZoomId:s.id,startValue:n[0],endValue:n[1]})}var n=t.areas;if(t.isEnd&&n.length){var i={},r=this.ecModel;this._brushController.updateCovers([]),new bI(zc(this.model),r,{include:["grid"]}).matchOutputRanges(n,r,function(t,n,i){if("cartesian2d"===i.type){var r=t.brushType;"rect"===r?(e("x",i,n[0]),e("y",i,n[1])):e({lineX:"x",lineY:"y"}[r],i,n)}}),function(t,e){var n=Qh(t);JT(e,function(e,i){for(var r=n.length-1;r>=0&&!n[r][i];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(o){var a=o.getPercentRange();n[0][i]={dataZoomId:i,start:a[0],end:a[1]}}}}),n.push(e)}(r,i),this._dispatchZoomAction(i)}},n.prototype._dispatchZoomAction=function(t){var e=[];CI(t,function(t,n){e.push(i(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},n.getDefaultOption=function(t){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},n}(ET),II={zoom:function(){this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:!this._isZoomActive})},back:function(){this._dispatchZoomAction(function(t){var e=Qh(t),n=e[e.length-1];e.length>1&&e.pop();var i={};return JT(n,function(t,n){for(var r=e.length-1;r>=0;r--)if(t=e[r][n]){i[n]=t;break}}),i}(this.ecModel))}};SI=function(t){function e(t,e,n){var i=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:r.get("filterMode",!0)||"filter",id:MI+e+i};a[n]=i,o.push(a)}var n=t.getComponent("toolbox",0),i=["feature","dataZoom"];if(n&&null!=n.get(i)){var r=n.getModel(i),o=[],a=Cn(t,zc(r));return CI(a.xAxisModels,function(t){return e(t,"xAxis","xAxisIndex")}),CI(a.yAxisModels,function(t){return e(t,"yAxis","yAxisIndex")}),o}},O(null==Nv.get("dataZoom")&&SI),Nv.set("dataZoom",SI);const kI=TI,DI=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.layoutMode={type:"box",ignoreSize:!0},t}return t(n,e),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},n.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},n.prototype._updateSelector=function(t){var e=t.selector,n=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),y(e)&&h(e,function(t,i){v(t)&&(t={type:t}),e[i]=r(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(n,t.type))})},n.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,n=0;n=0},n.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},n.type="legend.plain",n.dependencies=["series"],n.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},n}(gv);var AI=g,LI=h,OI=Ag,PI=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.newlineDisabled=!1,t}return t(n,e),n.prototype.init=function(){this.group.add(this._contentGroup=new OI),this.group.add(this._selectorGroup=new OI),this._isFirstRender=!0},n.prototype.getContentGroup=function(){return this._contentGroup},n.prototype.getSelectorGroup=function(){return this._selectorGroup},n.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var s=t.get("selector",!0),l=t.get("selectorPosition",!0);!s||l&&"auto"!==l||(l="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,s,o,l);var u=t.getBoxLayoutParams(),h={width:n.getWidth(),height:n.getHeight()},c=t.get("padding"),p=Rr(u,h,c),d=this.layoutInner(t,r,p,i,s,l),f=Rr(a({width:d.width,height:d.height},u),h,c);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=$h(d,t))}},n.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},n.prototype.renderInner=function(t,e,n,i,r,a,s){var l=this.getContentGroup(),u=E(),h=e.get("selectedMode"),c=[];n.eachRawSeries(function(t){!t.get("legendHoverLink")&&c.push(t.id)}),LI(e.getData(),function(r,a){var s=r.get("name");if(!this.newlineDisabled&&(""===s||"\n"===s)){var p=new OI;return p.newline=!0,void l.add(p)}var d=n.getSeriesByName(s)[0];if(!u.get(s))if(d){var f=d.getData(),g=f.getVisual("legendLineStyle")||{},y=f.getVisual("legendIcon"),m=f.getVisual("style"),v=this._createItem(d,s,a,r,e,t,g,m,y,h,i);v.on("click",AI(Bc,s,null,i,c)).on("mouseover",AI(Vc,d.name,null,i,c)).on("mouseout",AI(Hc,d.name,null,i,c)),n.ssr&&v.eachChild(function(t){var e=pm(t);e.seriesIndex=d.seriesIndex,e.dataIndex=a,e.ssrType="legend"}),u.set(s,!0)}else n.eachRawSeries(function(l){if(!u.get(s)&&l.legendVisualProvider){var p=l.legendVisualProvider;if(!p.containName(s))return;var d=p.indexOfName(s),f=p.getItemVisual(d,"style"),g=p.getItemVisual(d,"legendIcon"),y=ee(f.fill);y&&0===y[3]&&(y[3]=.2,f=o(o({},f),{fill:re(y,"rgba")}));var m=this._createItem(l,s,a,r,e,t,{},f,g,h,i);m.on("click",AI(Bc,null,s,i,c)).on("mouseover",AI(Vc,null,s,i,c)).on("mouseout",AI(Hc,null,s,i,c)),n.ssr&&m.eachChild(function(t){var e=pm(t);e.seriesIndex=l.seriesIndex,e.dataIndex=a,e.ssrType="legend"}),u.set(s,!0)}},this)},this),r&&this._createSelector(r,e,i,a,s)},n.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();LI(t,function(t){var i=t.type,r=new cm({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect",legendId:e.id})}});o.add(r),Qi(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),Zi(r)})},n.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c,p,d,f=t.visualDrawType,g=r.get("itemWidth"),y=r.get("itemHeight"),_=r.isSelected(e),x=i.get("symbolRotate"),w=i.get("symbolKeepAspect"),b=i.get("icon"),S=function(t,e,n,i,r,o,a){function s(t,e){"auto"===t.lineWidth&&(t.lineWidth=e.lineWidth>0?2:0),LI(t,function(n,i){"inherit"===t[i]&&(t[i]=e[i])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?Rs(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]),"inherit"===u.stroke&&(u.stroke=i[h]),"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity),s(u,i);var p=e.getModel("lineStyle"),d=p.getLineStyle();if(s(d,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===d.stroke&&(d.stroke=i.fill),!o){var f=e.get("inactiveBorderWidth");u.lineWidth="auto"===f?i.lineWidth>0&&u[h]?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),d.stroke=p.get("inactiveColor"),d.lineWidth=p.get("inactiveWidth")}return{itemStyle:u,lineStyle:d}}(l=b||l||"roundRect",i,a,s,f,_,h),C=new OI,M=i.getModel("textStyle");if(!m(t.getLegendIcon)||b&&"inherit"!==b){var T="inherit"===b&&t.getData().getVisual("symbol")?"inherit"===x?t.getData().getVisual("symbolRotate"):x:0;C.add(((d=ds(p=(c={itemWidth:g,itemHeight:y,icon:l,iconRotate:T,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:w}).icon||"roundRect",0,0,c.itemWidth,c.itemHeight,c.itemStyle.fill,c.symbolKeepAspect)).setStyle(c.itemStyle),d.rotation=(c.iconRotate||0)*Math.PI/180,d.setOrigin([c.itemWidth/2,c.itemHeight/2]),p.indexOf("empty")>-1&&(d.style.stroke=d.style.fill,d.style.fill="#fff",d.style.lineWidth=2),d))}else C.add(t.getLegendIcon({itemWidth:g,itemHeight:y,icon:l,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:w}));var I="left"===o?g+5:-5,k=o,D=r.get("formatter"),A=e;v(D)&&D?A=D.replace("{name}",null!=e?e:""):m(D)&&(A=D(e));var L=_?M.getTextColor():i.get("inactiveColor");C.add(new cm({style:er(M,{text:A,x:I,y:y/2,fill:L,align:k,verticalAlign:"middle"},{inheritColor:L})}));var O=new rm({shape:C.getBoundingRect(),style:{fill:"transparent"}}),P=i.getModel("tooltip");return P.get("show")&&Wa({el:O,componentModel:r,itemName:e,itemTooltipOption:P.option}),C.add(O),C.eachChild(function(t){t.silent=!0}),O.silent=!u,this.getContentGroup().add(C),Zi(C),C.__legendDataIndex=n,C},n.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();pv(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){pv("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],p=t.get("selectorButtonGap",!0),d=t.getOrient().index,f=0===d?"width":"height",g=0===d?"height":"width",y=0===d?"y":"x";"end"===o?c[d]+=l[f]+p:u[d]+=h[f]+p,c[1-d]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var m={x:0,y:0};return m[f]=l[f]+p+h[f],m[g]=Math.max(l[g],h[g]),m[y]=Math.min(0,h[y]+c[1-d]),m}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},n.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},n.type="legend.plain",n}(B_);const RI=PI,NI=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t}var i;return t(n,e),n.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},n.prototype.init=function(t,n,i){var r=Br(t);e.prototype.init.call(this,t,n,i),Zc(this,t,r)},n.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),Zc(this,this.option,t)},n.type="legend.scroll",n.defaultOption=(i={scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800},r(r({},DI.defaultOption,!0),i,!0)),n}(DI);var EI=Ag,zI=["width","height"],BI=["x","y"],FI=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=n.type,t.newlineDisabled=!0,t._currentIndex=0,t}return t(n,e),n.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new EI),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new EI)},n.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(t,n,i,r,o,a,s){function l(t,e){var i=t+"DataIndex",o=Ba(n.get("pageIcons",!0)[n.getOrient().name][e],{onclick:Sd(u._pageGo,u,i,n,r)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});o.name=t,h.add(o)}var u=this;e.prototype.renderInner.call(this,t,n,i,r,o,a,s);var h=this._controllerGroup,c=n.get("pageIconSize",!0),p=y(c)?c:[c,c];l("pagePrev",0);var d=n.getModel("pageTextStyle");h.add(new cm({name:"pageText",style:{text:"xx/xx",fill:d.getTextColor(),font:d.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),l("pageNext",1)},n.prototype.layoutInner=function(t,e,n,r,o,a){var s=this.getSelectorGroup(),l=t.getOrient().index,u=zI[l],h=BI[l],c=zI[1-l],p=BI[1-l];o&&pv("horizontal",s,t.get("selectorItemGap",!0));var d=t.get("selectorButtonGap",!0),f=s.getBoundingRect(),g=[-f.x,-f.y],y=i(n);o&&(y[u]=n[u]-f[u]-d);var m=this._layoutContentAndController(t,r,y,l,u,c,p,h);if(o){if("end"===a)g[l]+=m[u]+d;else{var v=f[u]+d;g[l]-=v,m[h]-=v}m[u]+=f[u]+d,g[1-l]+=m[p]+m[c]/2-f[c]/2,m[c]=Math.max(m[c],f[c]),m[p]=Math.min(m[p],f[p]+g[1-l]),s.x=g[0],s.y=g[1],s.markRedraw()}return m},n.prototype._layoutContentAndController=function(t,e,n,i,r,o,a,s){var l=this.getContentGroup(),u=this._containerGroup,h=this._controllerGroup;pv(t.get("orient"),l,t.get("itemGap"),i?n.width:null,i?null:n.height),pv("horizontal",h,t.get("pageButtonItemGap",!0));var c=l.getBoundingRect(),p=h.getBoundingRect(),d=this._showController=c[r]>n[r],f=[-c.x,-c.y];e||(f[i]=l[s]);var g=[0,0],y=[-p.x,-p.y],m=k(t.get("pageButtonGap",!0),t.get("itemGap",!0));d&&("end"===t.get("pageButtonPosition",!0)?y[i]+=n[r]-p[r]:g[i]+=p[r]+m),y[1-i]+=c[o]/2-p[o]/2,l.setPosition(f),u.setPosition(g),h.setPosition(y);var v={x:0,y:0};if(v[r]=d?n[r]:c[r],v[o]=Math.max(c[o],p[o]),v[a]=Math.min(0,p[a]+y[1-i]),u.__rectSize=n[r],d){var _={x:0,y:0};_[r]=Math.max(n[r]-p[r]-m,0),_[o]=v[o],u.setClipPath(new rm({shape:_})),u.__rectSize=_[r]}else h.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var x=this._getPageInfo(t);return null!=x.pageIndex&&ga(l,{x:x.contentPosition[0],y:x.contentPosition[1]},d?t:null),this._updatePageInfoView(t,x),v},n.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},n.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;h(["pagePrev","pageNext"],function(i){var r=null!=e[i+"DataIndex"],o=n.childOfName(i);o&&(o.setStyle("fill",t.get(r?"pageIconColor":"pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")});var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",v(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},n.prototype._getPageInfo=function(t){function e(t){if(t){var e=t.getBoundingRect(),n=e[l]+t[l];return{s:n,e:n+e[s],i:t.__legendDataIndex}}}function n(t,e){return t.e>=e&&t.s<=e+o}var i=t.get("scrollDataIndex",!0),r=this.getContentGroup(),o=this._containerGroup.__rectSize,a=t.getOrient().index,s=zI[a],l=BI[a],u=this._findTargetItemIndex(i),h=r.children(),c=h[u],p=h.length,d=p?1:0,f={contentPosition:[r.x,r.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!c)return f;var g=e(c);f.contentPosition[a]=-g.s;for(var y=u+1,m=g,v=g,_=null;y<=p;++y)(!(_=e(h[y]))&&v.e>m.s+o||_&&!n(_,m.s))&&(m=v.i>m.i?v:_)&&(null==f.pageNextDataIndex&&(f.pageNextDataIndex=m.i),++f.pageCount),v=_;for(y=u-1,m=g,v=g,_=null;y>=-1;--y)(_=e(h[y]))&&n(v,_.s)||!(m.i=0;u--){var d,f,g;if(g=null!=(f=_n((d=n[u]).id,null))?r.get(f):null){p=QI(y=g.parent);var y,m={},v=Nr(g,d,y===i?{width:o,height:a}:{width:p.width,height:p.height},null,{hv:d.hv,boundingMode:d.bounding},m);if(!QI(g).isNew&&v){for(var _=d.transition,x={},w=0;w=0)?x[b]=S:g[b]=S}ga(g,x,t,0)}else g.attr(m)}}},n.prototype._clear=function(){var t=this,e=this._elMap;e.each(function(n){lp(n,QI(n).option,e,t._lastGraphicModel)}),this._elMap=E()},n.prototype.dispose=function(){this._clear()},n.type="graphic",n}(B_),ek=Math.sin,nk=Math.cos,ik=Math.PI,rk=2*Math.PI,ok=180/ik;const ak=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){this._add("C",t,e,n,i,r,o)},t.prototype.quadraticCurveTo=function(t,e,n,i){this._add("Q",t,e,n,i)},t.prototype.arc=function(t,e,n,i,r,o){this.ellipse(t,e,n,n,0,i,r,o)},t.prototype.ellipse=function(t,e,n,i,r,o,a,s){var l,u=a-o,h=!s,c=Math.abs(u),p=le(c-rk)||(h?u>=rk:-u>=rk),d=u>0?u%rk:u%rk+rk;l=!!p||!le(c)&&d>=ik==!!h;var f=t+n*nk(o),g=e+i*ek(o);this._start&&this._add("M",f,g);var y=Math.round(r*ok);if(p){var m=1/this._p,v=(h?1:-1)*(rk-m);this._add("A",n,i,y,1,+h,t+n*nk(o+v),e+i*ek(o+v)),m>.01&&this._add("A",n,i,y,0,+h,f,g)}else{var _=t+n*nk(a),x=e+i*ek(a);this._add("A",n,i,y,+l,+h,_,x)}},t.prototype.rect=function(t,e,n,i){this._add("M",t,e),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,n,i,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"].join(i):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=cp("style","stl",{},[],u);o.push(h)}}return fp(n,i,o,t.useViewBox)},t.prototype.renderToString=function(t){return pp(this.renderToVNode({animation:k((t=t||{}).cssAnimation,!0),emphasis:k(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:k(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,n){for(var i,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[f]!==r[f]);f--);for(var g=d-1;g>f;g--)i=a[--s-1];for(var y=f+1;y=s)}}if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;for(var o,a=[],s=this.maxRepaintRectCount,l=!1,u=new af(0,0,0,0),h=this.__startIndex;h15)break}n.prevElClipPaths&&c.restore()};if(d)if(0===d.length)s=h.__endIndex;else for(var x=p.dpr,w=0;w0&&t>i[0]){for(s=0;st);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?Ak:0),this._needsManuallyCompositing),h.__builtin__||n("ZLevel "+u+" has been used by unkown layer "+h.id),h!==a&&(h.__used=!0,h.__startIndex!==o&&(h.__dirty=!0),h.__startIndex=o,h.__drawIndex=h.incremental?-1:o,e(o),a=h),1&l.__dirty&&!l.__inHover&&(h.__dirty=!0,h.incremental&&h.__drawIndex<0&&(h.__drawIndex=o))}e(o),this.eachBuiltinLayer(function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,h(this._layers,function(t){t.setUnpainted()})},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?r(n[t],e,!0):n[t]=e;for(var i=0;i{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},n.echartsOption);return i.setOption(e.utils.deepMergeObj(r,t)),i.on("click",t=>{const i=n.onClickElement.bind(e);return e.utils.addActionToUrl(e,t),"graph"===t.componentSubType?i("edge"===t.dataType?"link":"node",t.data):"lines"===t.componentSubType?i("link",t.data.link):!t.data.cluster&&i("node",t.data.node)},{passive:!0}),i}generateGraphOption(t,e){const n=[],i=e.config,r=t.nodes.map(t=>{const n=e.utils.fastDeepCopy(t),{nodeStyleConfig:r,nodeSizeConfig:o,nodeEmphasisConfig:a}=e.utils.getNodeStyle(t,i,"graph");n.itemStyle=r,n.symbolSize=o,n.emphasis={itemStyle:a.nodeStyle,symbolSize:a.nodeSize};let s="";return"string"==typeof t.label?s=t.label:"string"==typeof t.name?s=t.name:null!=t.id&&(s=String(t.id)),n.name=s,n._source=e.utils.fastDeepCopy(t),n}),o=t.links.map(t=>{const n=e.utils.fastDeepCopy(t),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,i,"graph");return n.lineStyle=r,n.emphasis={lineStyle:o.linkStyle},n}),a={...i.graphConfig.series},s={...a.label||{}};if("number"==typeof e.config.showGraphLabelsAtZoom&&e.config.showGraphLabelsAtZoom>0){const t=e.config.showGraphLabelsAtZoom;s.formatter=n=>(()=>{try{const t=e.echarts.getOption(),n=(Array.isArray(t.series)?t.series:[]).find(t=>t&&"network-graph"===t.id);return n&&"number"==typeof n.zoom?n.zoom:1}catch(t){return 1}})()>=t&&n&&n.data&&n.data.name||""}a.label=s;const l=[{...a,id:"network-graph",type:"graph",layout:i.graphConfig.series.layout||"force",nodes:r,links:o}];return{legend:n.length?{data:n}:void 0,series:l,...i.graphConfig.baseOptions}}generateMapOption(t,e,n=[]){const i=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];r.forEach(n=>{if(n.properties&&(t.flatNodes||(a[n.id]=e.utils.fastDeepCopy(n))),!n.properties||!n.properties._featureType||"Point"===n.properties._featureType)if(n.properties){const{location:t}=n.properties;if(t&&t.lng&&t.lat){const{nodeEmphasisConfig:r}=e.utils.getNodeStyle(n,i,"map");let o="";"string"==typeof n.label?o=n.label:"string"==typeof n.name?o=n.name:null!=n.id&&(o=String(n.id)),l.push({name:o,value:[t.lng,t.lat],emphasis:{itemStyle:r.nodeStyle,symbolSize:r.nodeSize},node:n,_source:e.utils.fastDeepCopy(n)})}else console.error(`Node ${n.id} position is undefined!`)}else console.error(`Node ${n.id} position is undefined!`)}),o.forEach(t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:n,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,i,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:n,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)}),l=l.concat(n);const u=[{id:"geo-map",type:"scatter",name:"nodes",coordinateSystem:"leaflet",data:l,label:i.mapOptions.nodeConfig.label,itemStyle:{color:t=>{if(t.data&&t.data.cluster&&t.data.itemStyle&&t.data.itemStyle.color)return t.data.itemStyle.color;if(t.data&&t.data.node&&t.data.node.category){const e=i.nodeCategories.find(e=>e.name===t.data.node.category);return e&&e.nodeStyle&&e.nodeStyle.color||i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}},symbolSize:(t,n)=>{if(n.data&&n.data.cluster)return i.mapOptions.clusterConfig&&i.mapOptions.clusterConfig.symbolSize||30;if(n.data&&n.data.node){const{nodeSizeConfig:t}=e.utils.getNodeStyle(n.data.node,i,"map");return"object"==typeof t?i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17:t}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17},emphasis:i.mapOptions.nodeConfig.emphasis},Object.assign(i.mapOptions.linkConfig,{id:"map-links",type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:i.mapTileConfig,mapOptions:i.mapOptions},series:u,...i.mapOptions.baseOptions}}_propagateGraphZoom(t){const e=t.echarts.getDom&&t.echarts.getDom();if(!e)return;const n=e.querySelector("canvas");e.addEventListener("wheel",t=>{if(!n)return;const i=e.getBoundingClientRect();if(t.clientXi.right||t.clientYi.bottom)return;t.preventDefault();const r=n.getBoundingClientRect();n.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,view:window,clientX:r.left+r.width/2,clientY:r.top+r.height/2,deltaY:-t.deltaY,deltaMode:t.deltaMode}))},{passive:!1})}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.utils._propagateGraphZoom(e),e.config.showGraphLabelsAtZoom>0&&e.echarts.on("graphRoam",t=>{if(!t||!t.zoom)return;const n=e.echarts.getOption(),i=n&&n.series&&n.series[0]&&n.series[0].zoom>=e.config.showGraphLabelsAtZoom;i!==e._labelsVisible&&(e.echarts.resize({animation:!1,silent:!0}),e._labelsVisible=i)}),e.utils.setupHashChangeHandler(e),e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray"),e.event.emit("applyUrlFragmentState")}mapRender(t,e){const n=Ks();if(!n)throw new Error("Leaflet api is not loaded");const{circleMarker:i,latLngBounds:r}=n;if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');e.utils.isGeoJSON(t)&&(e.originalGeoJSON=e.utils.fastDeepCopy(t),t=e.utils.geojsonToNetjson(t));const o=e.utils.generateMapOption(t,e);if(e.utils.echartsSetOption(o,e),e.bboxData={nodes:[],links:[]},e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,n)=>i(n,e.config.geoOptions.style),onEachFeature:(t,n)=>{n.on("click",()=>{const n={...t.properties};e.config.onClickElement.call(e,"Feature",n)})}},e.config.geoOptions),e.originalGeoJSON){!function(t){if(!t.originalGeoJSON||!Array.isArray(t.originalGeoJSON.features))return;const e=Ks();if(!e)return;const{geoJSON:n}=e,i=t.leaflet,r=t.originalGeoJSON.features.filter(t=>t&&t.geometry&&("Polygon"===t.geometry.type||"MultiPolygon"===t.geometry.type));if(!r.length)return;let o=i.getPane("njg-polygons");o||(o=i.createPane("njg-polygons"),o.style.zIndex=410);const a={fillColor:"#1566a9",color:"#1566a9",weight:0,fillOpacity:.6},s=n({type:"FeatureCollection",features:r},{pane:"njg-polygons",style:e=>{const n=e.properties&&e.properties.echartsStyle||{},i={...a,...t.config.geoOptions&&t.config.geoOptions.style};return n.areaColor&&(i.fillColor=n.areaColor),n.color&&(i.color=n.color),void 0!==n.opacity&&(i.fillOpacity=n.opacity),void 0!==n.borderWidth&&(i.weight=n.borderWidth),i},onEachFeature:(e,n)=>{n.on("click",()=>{t.config.onClickElement.call(t,"Feature",e.properties||{})})},...t.config.geoOptions}).addTo(i);t.leaflet.polygonGeoJSON=s}(e);let n=null;if(e.leaflet.polygonGeoJSON&&"function"==typeof e.leaflet.polygonGeoJSON.getBounds&&(n=e.leaflet.polygonGeoJSON.getBounds()),t.nodes&&t.nodes.length){const e=t.nodes.map(t=>t.properties.location).map(t=>[t.lat,t.lng]);n?e.forEach(t=>n.extend(t)):n=r(e)}n&&n.isValid()&&e.leaflet.fitBounds(n,{padding:[20,20]})}if(e.leaflet.getZoom(){const t=e.leaflet.getZoom(),n=t>=e.config.showLabelsAtZoomLevel;e.echarts.setOption({series:[{id:"geo-map",label:{show:n},emphasis:{label:{show:n}}}]});const i=e.leaflet.getMinZoom(),r=e.leaflet.getMaxZoom(),o=document.querySelector(".leaflet-control-zoom-in"),a=document.querySelector(".leaflet-control-zoom-out");o&&a&&(Math.round(t)>=r?o.classList.add("leaflet-disabled"):o.classList.remove("leaflet-disabled"),Math.round(t)<=i?a.classList.add("leaflet-disabled"):a.classList.remove("leaflet-disabled"))}),e.leaflet.on("moveend",async()=>{const n=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const i=await e.utils.getBBoxData.call(e,e.JSONParam,n);e.config.prepareData.call(e,i);const r=new Set(e.data.nodes.map(t=>t.id)),o=new Set(e.data.links.map(t=>t.source)),a=new Set(e.data.links.map(t=>t.target)),s=i.nodes.filter(t=>!r.has(t.id)),l=i.links.filter(t=>!o.has(t.source)&&!a.has(t.target)),u=new Set(i.nodes.map(t=>t.id)),h=e.bboxData.nodes.filter(t=>!u.has(t.id)),c=new Set(h.map(t=>t.id));t.nodes=t.nodes.filter(t=>!c.has(t.id)),e.bboxData.nodes=e.bboxData.nodes.concat(s),e.bboxData.links=e.bboxData.links.concat(l),t={...t,nodes:t.nodes.concat(s),links:t.links.concat(l)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{const n=new Set(e.bboxData.nodes),i=new Set(e.bboxData.links);t={...t,nodes:t.nodes.filter(t=>!n.has(t)),links:t.links.filter(t=>!i.has(t))},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]})()}),e.config.clustering&&e.config.clusteringThresholde.config.disableClusteringAtLevel&&(n=[],i=t.nodes,r=t.links),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:i,links:r},e,n)),e.echarts.on("click",t=>{if("scatter"===t.componentSubType&&t.data.cluster){const n=e.leaflet.getZoom(),i=Math.min(n+2,e.leaflet.getMaxZoom());e.leaflet.setView([t.data.value[1],t.data.value[0]],i)}}),e.leaflet.on("zoomend",()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:n,data:t.data})}),e.utils.mergeData(t,e)),e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.data.nodes&&e.data.nodes.length>0&&(e.data.nodes=e.utils.deduplicateNodesById(e.data.nodes)),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){t.nodes||(t.nodes=[]);const n=new Set;e.data.nodes.forEach(t=>{t.id&&n.add(t.id)});const i=t.nodes.filter(t=>!t.id||!n.has(t.id)||(console.warn(`Duplicate node ID ${t.id} detected during merge and skipped.`),!1)),r=e.data.nodes.concat(i),o=e.data.links.concat(t.links||[]);Object.assign(e.data,t,{nodes:r,links:o})}},Rk=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),n=document.createElement("div");n.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const i=document.createElement("span");return i.classList.add("njg-closeButton"),e.innerHTML="Info",i.innerHTML=" ✕",e.appendChild(i),t.appendChild(e),t.appendChild(n),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),i.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const n=document.querySelectorAll(".njg-infoContainer"),i=document.querySelectorAll(".njg-headerContainer");for(let t=0;t"clients"===t?"Clients":/^clients\s*\[\d+\]$/i.test(t)?t.replace(/^clients/i,"Client"):"localAddresses"===t?"Local Addresses":t.replace(/_/g," "),u=(t,e,n,i=0)=>{if(null==n||"string"==typeof n&&(""===n.trim()||/^(undefined|null)$/i.test(n.trim()))&&"0"!==n)return;if(Array.isArray(n)){if(0===n.length){const n=document.createElement("div");n.classList.add("njg-infoItems"),n.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML=l(e),o.innerHTML="[]",n.appendChild(r),n.appendChild(o),void t.appendChild(n)}if(n.every(t=>"object"!=typeof t||null===t)){const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML=n.map(t=>"string"==typeof t?t.replace(/\n/g,"
"):String(t)).join("
"),r.appendChild(o),r.appendChild(a),void t.appendChild(r)}return void n.forEach((n,r)=>{u(t,`${e} [${r+1}]`,n,i)})}if("object"==typeof n){if("location"===e&&"number"==typeof n.lat&&"number"==typeof n.lng){const e=document.createElement("div");e.classList.add("njg-infoItems"),e.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML="Location",o.innerHTML=`${Math.round(1e3*n.lat)/1e3}, ${Math.round(1e3*n.lng)/1e3}`,e.appendChild(r),e.appendChild(o),void t.appendChild(e)}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML="",r.appendChild(o),r.appendChild(a),t.appendChild(r),void Object.keys(n).forEach(e=>{u(t,e,n[e],i+1)})}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e);const s="string"==typeof n?n.replace(/\n/g,"
"):String(n);a.innerHTML=s,r.appendChild(o),r.appendChild(a),t.appendChild(r)};Object.keys(e).forEach(t=>u(o,t,e[t],0)),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}},Nk=function(){function t(t,e){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=o.Mercator}function e(t,e,n,i){const{leafletModel:r,seriesModel:o}=n,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](i):null}const n=Ks();if(!n)throw new Error("Leaflet api is not loaded");const{Layer:i,DomUtil:r,Projection:o,LatLng:a,map:s,control:l,tileLayer:u}=n,h=i.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){r.remove(this._container)},_update(){}});return t.dimensions=["lng","lat"],t.prototype.dimensions=["lng","lat"],t.prototype.setZoom=function(t){this._zoom=t},t.prototype.setCenter=function(t){this._center=this._projection.project(new a(t[1],t[0]))},t.prototype.setMapOffset=function(t){this._mapOffset=t},t.prototype.getLeaflet=function(){return this._map},t.prototype.getViewRect=function(){const t=this._api;return new af(0,0,t.getWidth(),t.getHeight())},t.prototype.getRoamTransform=function(){return[1,0,0,1,0,0]},t.prototype.dataToPoint=function(t){const e=new a(t[1],t[0]),n=this._map.latLngToLayerPoint(e),i=this._mapOffset;return[n.x-i[0],n.y-i[1]]},t.prototype.pointToData=function(t){const e=this._mapOffset,n=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[n.lng,n.lat]},t.prototype.convertToPixel=g(e,"dataToPoint"),t.prototype.convertFromPixel=g(e,"pointToData"),t.create=function(e,n){let i;const r=[],o=n.getDom();return e.eachComponent("leaflet",e=>{const a=n.getZr().painter.getViewportRoot();if(i)throw new Error("Only one leaflet component can exist");if(!e.__map){let t=o.querySelector(".ec-extension-leaflet");t&&(a.style.left="0px",a.style.top="0px",o.removeChild(t)),t=document.createElement("div"),t.style.cssText="width:100%;height:100%",t.classList.add("ec-extension-leaflet"),o.appendChild(t),e.__map=s(t,e.get("mapOptions"));const n=e.__map,i=e.get("tiles"),r={};let c=!1;if(i.forEach(t=>{const e=u(t.urlTemplate,t.options);t.label?(c||(e.addTo(n),c=!0),r[t.label]=e):e.addTo(n)}),i.length>1){const t=e.get("layerControl");l.layers(r,{},t).addTo(n)}const p=document.createElement("div");p.style="position: absolute;left: 0;top: 0;z-index: 100",p.appendChild(a),new h(p).addTo(n)}i=new t(e.__map,n),r.push(i),i.setMapOffset(e.__mapOffset||[0,0]);const{center:c,zoom:p}=e.get("mapOptions");c&&p&&(i.setZoom(p),i.setCenter(c)),e.coordinateSystem=i}),e.eachSeries(t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=i)}),r},t};Jp.version="1.0.0";const Ek=Jp;let zk=!1;window.NetJSONGraph=class{constructor(t,e={}){return this.graph=new Qb(t),this.config=this.initializeConfig(e),this.graph.setConfig(this.config),this.setupGraph(),this.config.onInit.call(this.graph),this.initializeECharts(),this.graph}initializeConfig(t={}){return{...t,render:"map"===t.render?Pk.prototype.mapRender:Pk.prototype.graphRender,onInit:this.onInit,onRender:this.onRender,onUpdate:this.onUpdate,afterUpdate:this.afterUpdate,onLoad:this.onLoad}}setupGraph(){Object.setPrototypeOf(Pk.prototype,this.graph.utils),this.graph.gui=new Rk(this.graph),this.graph.utils=new Pk,this.graph.setUtils(),this.graph.event=this.graph.utils.createEvent()}initializeECharts(){zk||(Ek(),zk=!0),this.graph.echarts=function(t,e,n){var i=!(n&&n.ssr);if(i){var r=Hs(t);if(r)return r}var o=new Lb(t,null,n);return o.id="ec_"+Gb++,Hb[o.id]=o,i&&In(t,Ub,o.id),mb(o),eb.trigger("afterinit",o),o}(this.graph.el,0,{renderer:this.graph.config.svgRender?"svg":"canvas"})}onInit(){return this.config}onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config}onUpdate(){return this.config}afterUpdate(){return this.config}onLoad(){return this.config.metadata&&this.utils.isNetJSON(this.data)?(this.gui.createMetaInfoContainer(this.graph),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&this.utils.isNetJSON(this.data)&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.attachClientsOverlay=t=>function(t,e={}){function n(){u=function(){const t=r.getOption();return t&&t.series&&t.series[0]&&t.series[0].zoom?t.series[0].zoom:1}(),p.attr("invisible",!(u>=l))}function i(){const t=r.getModel().getSeriesByIndex(0);if(!t)return;const e=t.getData();if(!e)return;if(n(),p.removeAll(),u{let o=0;if(0!==n)for(let s=0;ot?"number"==typeof t.clients?t.clients:Array.isArray(t.clients)?t.clients.length:0:0,c=function(){const t=r.getModel().getSeriesByIndex(0);if(!t)return null;const e=(r._chartsViews||[]).find(e=>e&&e.__model&&e.__model.uid===t.uid);return e?e.group:null}();if(!c)return{destroy(){}};const p=new Ag({silent:!0,z:100,zlevel:1});c.add(p);const d=t&&t.config&&t.config.graphConfig&&t.config.graphConfig.series||{},f=("number"==typeof d.nodeSize?d.nodeSize:18)/2,g=[["finished",i],["rendered",i],["graphLayoutEnd",i],["graphRoam",()=>{n(),i()}]];return g.forEach(([t,e])=>r.on(t,e)),i(),{destroy(){g.forEach(([t,e])=>{r&&r.off&&r.off(t,e)}),p&&p.parent&&p.parent.remove(p)},setMinZoomLevel(t){l=t,i()},getMinZoomLevel:()=>l}}(this,t),this.config}}})(); \ No newline at end of file diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js index ebb13a055..4ec08be37 100644 --- a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js +++ b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js @@ -3,7 +3,7 @@ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade */ -!function(t){"use strict";function e(t){for(var e,n,i=1,r=arguments.length;i=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>=e.x&&i.x<=n.x;return t=t.y>=e.y&&i.y<=n.y,r&&t},overlaps:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>e.x&&i.xe.y&&i.y=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>=e.lat&&i.lat<=n.lat;return t=t.lng>=e.lng&&i.lng<=n.lng,r&&t},overlaps:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>e.lat&&i.late.lng&&i.lng","http://www.w3.org/2000/svg"===(Ct.firstChild&&Ct.firstChild.namespaceURI));function Lt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var At={ie:J,ielt9:$,edge:Q,webkit:tt,android:et,android23:nt,androidStock:it,opera:rt,chrome:ot,gecko:at,safari:st,phantom:lt,opera12:ut,win:ht,ie3d:ct,webkit3d:dt,gecko3d:K,any3d:ft,mobile:Kn,mobileWebkit:pt,mobileWebkit3d:gt,msPointer:mt,pointer:vt,touch:yt,touchNative:_t,mobileOpera:xt,mobileGecko:wt,retina:bt,passiveEvents:Tt,canvas:St,svg:Mt,vml:!Mt&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Ct,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},Dt=At.msPointer?"MSPointerDown":"pointerdown",It=At.msPointer?"MSPointerMove":"pointermove",Pt=At.msPointer?"MSPointerUp":"pointerup",Et=At.msPointer?"MSPointerCancel":"pointercancel",Ot={touchstart:Dt,touchmove:It,touchend:Pt,touchcancel:Et},Nt={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ee(e),Gt(t,e)},touchmove:Gt,touchend:Gt,touchcancel:Gt},Rt={},kt=!1;function zt(t,e,n){return"touchstart"!==e||kt||(document.addEventListener(Dt,Bt,!0),document.addEventListener(It,Ft,!0),document.addEventListener(Pt,Vt,!0),document.addEventListener(Et,Vt,!0),kt=!0),Nt[e]?(n=Nt[e].bind(this,n),t.addEventListener(Ot[e],n,!1),n):(console.warn("wrong event specified:",e),u)}function Bt(t){Rt[t.pointerId]=t}function Ft(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Vt(t){delete Rt[t.pointerId]}function Gt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Rt)e.touches.push(Rt[n]);e.changedTouches=[e],t(e)}}var Ht=200;function Ut(t,e){t.addEventListener("dblclick",e);var n,i=0;function r(t){var r;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(r=Ne(t)).some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))&&!r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))||((r=Date.now())-i<=Ht?2==++n&&e(function(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return(t=i).type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}(t)):n=1,i=r)}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}var Wt,jt,Zt,Xt,qt,Yt,Kt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),$t="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function Qt(t){return"string"==typeof t?document.getElementById(t):t}function te(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(n=n&&"auto"!==n||!document.defaultView?n:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:n}function ee(t,e,n){return(t=document.createElement(t)).className=e||"",n&&n.appendChild(t),t}function ne(t){var e=t.parentNode;e&&e.removeChild(t)}function ie(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function oe(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=he(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function se(t,e){var n;if(void 0!==t.classList)for(var i=d(e),r=0,o=i.length;rthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter();return t=this._limitCenter(n,this._zoom,B(t)),n.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=N((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=N(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),o=(t=this.project(t),(n=k([(o=this.getPixelBounds()).min.add(n),o.max.subtract(i)])).getSize());return n.contains(t)||(this._enforcingBounds=!0,i=t.subtract(n.getCenter()),n=n.extend(t).getSize().subtract(o),r.x+=i.x<0?-n.x:n.x,r.y+=i.y<0?-n.y:n.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=n.divideBy(2).round(),a=i.divideBy(2).round();return(o=o.subtract(a)).x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var n,i;return t=this._locateOptions=e({timeout:1e4,watch:!1},t),"geolocation"in navigator?(n=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,i,t):navigator.geolocation.getCurrentPosition(n,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,n,i=new F(t.coords.latitude,t.coords.longitude),r=i.toBounds(2*t.coords.accuracy),o=this._locateOptions,a=(o.setView&&(e=this.getBoundsZoom(r),this.setView(i,o.maxZoom?Math.min(e,o.maxZoom):e)),{latlng:i,bounds:r,timestamp:t.timestamp});for(n in t.coords)"number"==typeof t.coords[n]&&(a[n]=t.coords[n]);this.fire("locationfound",a)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ne(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ne(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){return e=ee("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane),t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=B(t),n=N(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=(t=t.getSouthEast(),n=this.getSize().subtract(n),t=k(this.project(t,i),this.project(a,i)).getSize(),a=At.any3d?this.options.zoomSnap:1,n.x/t.x);return n=n.y/t.y,t=e?Math.max(s,n):Math.min(s,n),i=this.getScaleZoom(t,i),a&&(i=Math.round(i/(a/100))*(a/100),i=e?Math.ceil(i/a)*a:Math.floor(i/a)*a),Math.max(r,Math.min(o,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new E(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){return new R(t=this._getTopLeftPoint(t,e),t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,t=n.zoom(t*n.scale(e)),isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(V(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(N(t),e)},layerPointToLatLng:function(t){return t=N(t).add(this.getPixelOrigin()),this.unproject(t)},latLngToLayerPoint:function(t){return this.project(V(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(V(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(V(t),V(e))},containerPointToLayerPoint:function(t){return N(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return N(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){return t=this.containerPointToLayerPoint(N(t)),this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(t)))},mouseEventToContainerPoint:function(t){return Re(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){if(!(t=this._container=Qt(t)))throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");be(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&At.any3d,se(t,"leaflet-container"+(At.touch?" leaflet-touch":"")+(At.retina?" leaflet-retina":"")+(At.ielt9?" leaflet-oldie":"")+(At.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),te(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),pe(this._mapPane,new E(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(se(t.markerPane,"leaflet-zoom-hide"),se(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){pe(this._mapPane,new E(0,0));var i=!this._loaded,r=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(r,n)._move(t,e)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){pe(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var e=t?Se:be;e((this._targets[a(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),At.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((n=this._targets[a(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!Be(o,t))break;if(i.push(n),r)break}if(o===this._container)break;o=o.parentNode}return i.length||s||r||!this.listens(e,!0)?i:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,n=t.target||t.srcElement;!this._loaded||n._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(n)||("mousedown"===(e=t.type)&&_e(n),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,n,i){"click"===t.type&&((l=e({},t)).type="preclick",this._fireDOMEvent(l,l.type,i));var r=this._findEventTargets(t,n);if(i){for(var o=[],a=0;athis.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e);if(i=this._getCenterOffset(t)._divideBy(1-1/i),!0!==n.animate&&!this.getSize().contains(i))return!1;M((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this)}return!0},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,se(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&le(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ge(t){return new Ue(t)}var He,Ue=D.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition();return t=t._controlCorners[n],se(e,"leaflet-control"),-1!==n.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ne(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",(e=document.createElement("div")).innerHTML=t,e.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer),r=((t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+a(this),i),this._layerControlInputs.push(e),e.layerId=a(t.layer),be(e,"click",this._onInputClick,this),i=document.createElement("span")).innerHTML=" "+t.name,document.createElement("span"));return n.appendChild(r),r.appendChild(e),r.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var o=n.length-1;0<=o;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(o=0;oe.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section,e=(this._preventClick=!0,be(t,"click",Ee),this.expand(),this);setTimeout((function(){Se(t,"click",Ee),e._preventClick=!1}))}})),je=Ue.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=ee("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){return(n=ee("a",n,i)).innerHTML=t,n.href="#",n.title=e,n.setAttribute("role","button"),n.setAttribute("aria-label",e),Pe(n),be(n,"click",Oe),be(n,"click",r,this),be(n,"click",this._refocusOnMap,this),n},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";le(this._zoomInButton,e),le(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(se(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(se(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Ze=(Ve.mergeOptions({zoomControl:!0}),Ve.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new je,this.addControl(this.zoomControl))})),Ue.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=ee("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=ee("div",e,n)),t.imperial&&(this._iScale=ee("div",e,n))},_update:function(){var t=(e=this._map).getSize().y/2,e=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,n;5280<(t*=3.2808399)?(n=this._getRoundNum(e=t/5280),this._updateScale(this._iScale,n+" mi",n/e)):(n=this._getRoundNum(t),this._updateScale(this._iScale,n+" ft",n/t))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1);return e*(10<=(t/=e)?10:5<=t?5:3<=t?3:2<=t?2:1)}})),Xe=Ue.extend({options:{position:"bottomright",prefix:''+(At.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=ee("div","leaflet-control-attribution"),Pe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(", ")),this._container.innerHTML=n.join(' ')}}}),qe=(Ve.mergeOptions({attributionControl:!0}),Ve.addInitHook((function(){this.options.attributionControl&&(new Xe).addTo(this)})),Ue.Layers=We,Ue.Zoom=je,Ue.Scale=Ze,Ue.Attribution=Xe,Ge.layers=function(t,e,n){return new We(t,e,n)},Ge.zoom=function(t){return new je(t)},Ge.scale=function(t){return new Ze(t)},Ge.attribution=function(t){return new Xe(t)},Q=D.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}}),Q.addTo=function(t,e){return t.addHandler(e,this),this},tt={Events:I},At.touch?"touchstart mousedown":"mousedown"),Ye=P.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){f(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(be(this._dragStartTarget,qe,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ye._dragging===this&&this.finishDrag(!0),Se(this._dragStartTarget,qe,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,n;this._enabled&&(this._moved=!1,ae(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Ye._dragging===this&&this.finishDrag():Ye._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Ye._dragging=this)._preventOutline&&_e(this._element),me(),Zt(),this._moving||(this.fire("down"),n=t.touches?t.touches[0]:t,e=xe(this._element),this._startPoint=new E(n.clientX,n.clientY),this._startPos=ge(this._element),this._parentScale=we(e),n="mousedown"===t.type,be(document,n?"mousemove":"touchmove",this._onMove,this),be(document,n?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(n.push(t[i]),r=i);return re.max.x&&(n|=2),t.ye.max.y&&(n|=8),n}function on(t,e,n,i){var r=e.x,o=(e=e.y,n.x-r),a=n.y-e,s=o*o+a*a;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||yn.prototype._containsPoint.call(this,t,!0)}}),wn=cn.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=v(t)?t:t.features;if(r){for(e=0,n=r.length;eo.x&&(a=n.x+s-o.x+r.x),n.x-a-i.x<(s=0)&&(a=n.x-i.x),n.y+e+r.y>o.y&&(s=n.y+e-o.y+r.y),n.y-s-i.y<0&&(s=n.y-i.y),(a||s)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,s]))))},_getAnchor:function(){return N(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),kn=(Ve.mergeOptions({closePopupOnClick:!0}),Ve.include({openPopup:function(t,e,n){return this._initOverlay(Rn,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),ut.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Rn,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof cn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(Oe(t),e=t.layer||t.target,this._popup._source!==e||e instanceof mn?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Nn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Nn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Nn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Nn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ee("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n=this._map,i=this._container,r=n.latLngToContainerPoint(n.getCenter()),o=(n=n.layerPointToContainerPoint(t),this.options.direction),a=i.offsetWidth,s=i.offsetHeight,l=N(this.options.offset),u=this._getAnchor();n="top"===o?(e=a/2,s):"bottom"===o?(e=a/2,0):(e="center"===o?a/2:"right"===o?0:"left"===o?a:n.xthis.options.maxZoom||ithis.options.maxZoom||void 0!==this.options.minZoom&&rn.max.x)||!e.wrapLat&&(t.yn.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),B(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n);return n=i.add(n),[e.unproject(i,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){return t=new z((t=this._tileCoordsToNwSe(t))[0],t[1]),this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=new E(+(t=t.split(":"))[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(ne(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){se(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,At.ielt9&&this.options.opacity<1&&ce(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),pe(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(ce(n.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(se(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),At.ielt9||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new E(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),Fn=Bn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&At.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Zn=(dt={_initContainer:function(){this._container=ee("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Hn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jn("shape");se(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ne(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e=e||(t._stroke=jn("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=v(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n=n||(t._fill=jn("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){re(t._container)},_bringToBack:function(t){oe(t._container)}},At.vml?jn:q),Xn=Hn.extend({_initContainer:function(){this._container=Zn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ne(this._container),Se(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,n;this._map._animatingZoom&&this._bounds||(Hn.prototype._update.call(this),e=(t=this._bounds).getSize(),n=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),pe(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=Zn("path");t.options.className&&se(e,t.options.className),t.options.interactive&&se(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ne(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path;t=t.options,e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ";e=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ",this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){re(t._path)},_bringToBack:function(t){oe(t._path)}});function qn(t){return At.svg||At.vml?new Xn(t):null}At.vml&&Xn.include(dt),Ve.include({getRenderer:function(t){return t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Wn(t)||qn(t)}});var Yn=xn.extend({initialize:function(t,e){xn.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Xn.create=Zn,Xn.pointsToPath=Y,wn.geometryToLayer=bn,wn.coordsToLatLng=Sn,wn.coordsToLatLngs=Mn,wn.latLngToCoords=Cn,wn.latLngsToCoords=Ln,wn.getFeature=An,wn.asFeature=Dn,Ve.mergeOptions({boxZoom:!0}),K=Q.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){be(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Se(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ne(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Zt(),me(),this._startPoint=this._map.mouseEventToContainerPoint(t),be(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ee("div","leaflet-zoom-box",this._container),se(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=(t=new R(this._point,this._startPoint)).getSize();pe(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ne(this._box),le(this._container,"leaflet-crosshair")),Xt(),ve(),Se(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ve.addInitHook("addHandler","boxZoom",K),Ve.mergeOptions({doubleClickZoom:!0}),ft=Q.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta;n=t.originalEvent.shiftKey?n-i:n+i,"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});var Kn=(Ve.addInitHook("addHandler","doubleClickZoom",ft),Ve.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),Q.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Ye(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),se(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){le(this._map._container,"leaflet-grab"),le(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=B(this._map.options.maxBounds),this._offsetLimit=k(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,n;this._map.options.inertia&&(e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(n),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=((r=this._draggable._newPos.x)-e+n)%t+e-n,r=(r+e+n)%t-e-n;t=Math.abs(i+n)e.getMaxZoom()&&1{"use strict";n.r(e),n.d(e,{EPSILON:()=>yt,HashMap:()=>ct,RADIAN_TO_DEGREE:()=>_t,assert:()=>rt,bind:()=>B,clone:()=>b,concatArray:()=>ft,createCanvas:()=>L,createHashMap:()=>dt,createObject:()=>pt,curry:()=>F,defaults:()=>C,disableUserSelect:()=>gt,each:()=>E,eqNaN:()=>$,extend:()=>M,filter:()=>R,find:()=>k,guid:()=>x,hasOwn:()=>mt,indexOf:()=>A,inherits:()=>D,isArray:()=>V,isArrayLike:()=>P,isBuiltInObject:()=>Z,isDom:()=>q,isFunction:()=>G,isGradientObject:()=>Y,isImagePatternObject:()=>K,isNumber:()=>W,isObject:()=>j,isPrimitive:()=>lt,isRegExp:()=>J,isString:()=>H,isStringSafe:()=>U,isTypedArray:()=>X,keys:()=>z,logError:()=>w,map:()=>O,merge:()=>T,mergeAll:()=>S,mixin:()=>I,noop:()=>vt,normalizeCssArray:()=>it,reduce:()=>N,retrieve:()=>Q,retrieve2:()=>tt,retrieve3:()=>et,setAsPrimitive:()=>st,slice:()=>nt,trim:()=>ot});var i="12px sans-serif";var r,o,a=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)h=u*t.length;else for(var c=0;c{"use strict";n.r(e),n.d(e,{fastLerp:()=>T,fastMapToColor:()=>S,lerp:()=>M,lift:()=>w,liftColor:()=>O,lum:()=>I,mapToColor:()=>C,modifyAlpha:()=>A,modifyHSL:()=>L,parse:()=>y,parseCssFloat:()=>c,parseCssInt:()=>h,random:()=>P,stringify:()=>D,toHex:()=>b});var i=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new i(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,r=this._map,o=null;if(null==r[t]){var a=n.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=n.head;n.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new i(e),s.key=t,n.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();var a=n(627),s={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function l(t){return(t=Math.round(t))<0?0:t>255?255:t}function u(t){return t<0?0:t>1?1:t}function h(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?l(parseFloat(e)/100*255):l(parseInt(e,10))}function c(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?u(parseFloat(e)/100):u(parseFloat(e))}function d(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function f(t,e,n){return t+(e-t)*n}function p(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function g(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var m=new o(20),v=null;function _(t,e){v&&g(v,e),v=m.put(t,v||e.slice())}function y(t,e){if(t){e=e||[];var n=m.get(t);if(n)return g(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in s)return g(e,s[i]),_(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(p(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),_(t,e),e):void p(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(p(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),_(t,e),e):void p(e,0,0,0,1):void 0;var a=i.indexOf("("),l=i.indexOf(")");if(-1!==a&&l+1===o){var u=i.substr(0,a),d=i.substr(a+1,l-(a+1)).split(","),f=1;switch(u){case"rgba":if(4!==d.length)return 3===d.length?p(e,+d[0],+d[1],+d[2],1):p(e,0,0,0,1);f=c(d.pop());case"rgb":return d.length>=3?(p(e,h(d[0]),h(d[1]),h(d[2]),3===d.length?f:c(d[3])),_(t,e),e):void p(e,0,0,0,1);case"hsla":return 4!==d.length?void p(e,0,0,0,1):(d[3]=c(d[3]),x(d,e),_(t,e),e);case"hsl":return 3!==d.length?void p(e,0,0,0,1):(x(d,e),_(t,e),e);default:return}}p(e,0,0,0,1)}}function x(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=c(t[1]),r=c(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return p(e=e||[],l(255*d(a,o,n+1/3)),l(255*d(a,o,n)),l(255*d(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function w(t,e){var n=y(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return D(n,4===n.length?"rgba":"rgb")}}function b(t){var e=y(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function T(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],h=i-r;return n[0]=l(f(a[0],s[0],h)),n[1]=l(f(a[1],s[1],h)),n[2]=l(f(a[2],s[2],h)),n[3]=u(f(a[3],s[3],h)),n}}var S=T;function M(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=y(e[r]),s=y(e[o]),h=i-r,c=D([l(f(a[0],s[0],h)),l(f(a[1],s[1],h)),l(f(a[2],s[2],h)),u(f(a[3],s[3],h))],"rgba");return n?{color:c,leftIndex:r,rightIndex:o,value:i}:c}}var C=M;function L(t,e,n,i){var r,o=y(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=(0,a.isFunction)(e)?e(o[0]):e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=c((0,a.isFunction)(n)?n(o[1]):n)),null!=i&&(o[2]=c((0,a.isFunction)(i)?i(o[2]):i)),D(x(o),"rgba")}function A(t,e){var n=y(t);if(n&&null!=e)return n[3]=u(e),D(n,"rgba")}function D(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function I(t,e){var n=y(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function P(){return D([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var E=new o(100);function O(t){if((0,a.isString)(t)){var e=E.get(t);return e||(e=w(t,-.1),E.put(t,e)),e}if((0,a.isGradientObject)(t)){var n=(0,a.extend)({},t);return n.colorStops=(0,a.map)(t.colorStops,(function(t){return{offset:t.offset,color:w(t.color,-.1)}})),n}return t}}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};n.r(t),n.d(t,{HashMap:()=>Wt,RADIAN_TO_DEGREE:()=>Jt,assert:()=>zt,bind:()=>vt,clone:()=>et,concatArray:()=>Zt,createCanvas:()=>at,createHashMap:()=>jt,createObject:()=>Xt,curry:()=>_t,defaults:()=>ot,disableUserSelect:()=>qt,each:()=>ct,eqNaN:()=>Pt,extend:()=>rt,filter:()=>pt,find:()=>gt,guid:()=>Q,hasOwn:()=>Yt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isArrayLike:()=>ht,isBuiltInObject:()=>Mt,isDom:()=>Lt,isFunction:()=>xt,isGradientObject:()=>At,isImagePatternObject:()=>Dt,isNumber:()=>Tt,isObject:()=>St,isPrimitive:()=>Gt,isRegExp:()=>It,isString:()=>wt,isStringSafe:()=>bt,isTypedArray:()=>Ct,keys:()=>mt,logError:()=>tt,map:()=>dt,merge:()=>nt,mergeAll:()=>it,mixin:()=>ut,noop:()=>Kt,normalizeCssArray:()=>kt,reduce:()=>ft,retrieve:()=>Et,retrieve2:()=>Ot,retrieve3:()=>Nt,setAsPrimitive:()=>Vt,slice:()=>Rt,trim:()=>Bt});var e={};n.r(e),n.d(e,{add:()=>ne,applyTransform:()=>xe,clone:()=>te,copy:()=>Qt,create:()=>$t,dist:()=>ge,distSquare:()=>ve,distance:()=>pe,distanceSquare:()=>me,div:()=>he,dot:()=>ce,len:()=>oe,lenSquare:()=>se,length:()=>ae,lengthSquare:()=>le,lerp:()=>ye,max:()=>be,min:()=>we,mul:()=>ue,negate:()=>_e,normalize:()=>fe,scale:()=>de,scaleAndAdd:()=>ie,set:()=>ee,sub:()=>re});var i={};n.r(i),n.d(i,{clone:()=>an,copy:()=>Qe,create:()=>Je,identity:()=>$e,invert:()=>on,mul:()=>tn,rotate:()=>nn,scale:()=>rn,translate:()=>en});var r={};n.r(r),n.d(r,{fastLerp:()=>Fi,fastMapToColor:()=>Vi,lerp:()=>Gi,lift:()=>zi,liftColor:()=>Yi,lum:()=>Zi,mapToColor:()=>Hi,modifyAlpha:()=>Wi,modifyHSL:()=>Ui,parse:()=>Ri,random:()=>Xi,stringify:()=>ji,toHex:()=>Bi});var o={};n.r(o),n.d(o,{dispose:()=>Bo,disposeAll:()=>Fo,getElementSSRData:()=>Ho,getInstance:()=>Vo,init:()=>zo,registerPainter:()=>Go,registerSSRDataGetter:()=>Uo,version:()=>Wo});var a={};n.r(a),n.d(a,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>Qp,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,OrientedBoundingRect:()=>Jg,Path:()=>Sl,Point:()=>ln,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,applyTransform:()=>_m,clipPointsByRect:()=>bm,clipRectByRect:()=>Tm,createIcon:()=>Sm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,groupTransition:()=>wm,initProps:()=>$u,isElementRemoved:()=>Qu,lineLineIntersect:()=>Cm,linePolygonIntersect:()=>Mm,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,removeElement:()=>th,removeElementWithFadeOut:()=>nh,resizePath:()=>fm,setTooltipConfig:()=>Am,subPixelOptimize:()=>mm,subPixelOptimizeLine:()=>pm,subPixelOptimizeRect:()=>gm,transformDirection:()=>ym,traverseElements:()=>Im,updateProps:()=>Ju});var s={};n.r(s),n.d(s,{createDimensions:()=>Lx,createList:()=>Ww,createScale:()=>Zw,createSymbol:()=>jv,createTextStyle:()=>qw,dataStack:()=>jw,enableHoverEmphasis:()=>Hu,getECData:()=>nu,getLayoutRect:()=>Oc,mixinAxisModelCommonMethods:()=>Xw});var l={};n.r(l),n.d(l,{MAX_SAFE_INTEGER:()=>na,asc:()=>Ko,getPercentWithPrecision:()=>ta,getPixelPrecision:()=>Qo,getPrecision:()=>Jo,getPrecisionSafe:()=>$o,isNumeric:()=>fa,isRadianAroundZero:()=>ra,linearMap:()=>Xo,nice:()=>ua,numericToNumber:()=>da,parseDate:()=>aa,quantile:()=>ha,quantity:()=>sa,quantityExponent:()=>la,reformIntervals:()=>ca,remRadian:()=>ia,round:()=>Yo});var u={};n.r(u),n.d(u,{format:()=>Qh,parse:()=>aa});var h={};n.r(h),n.d(h,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>Qp,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,clipPointsByRect:()=>bm,clipRectByRect:()=>Tm,createIcon:()=>Sm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,initProps:()=>$u,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,resizePath:()=>fm,updateProps:()=>Ju});var c={};n.r(c),n.d(c,{addCommas:()=>mc,capitalFirst:()=>Mc,encodeHTML:()=>ze,formatTime:()=>Sc,formatTpl:()=>bc,getTextRect:()=>hb,getTooltipMarker:()=>Tc,normalizeCssArray:()=>_c,toCamelCase:()=>vc,truncateText:()=>rs});var d={};n.r(d),n.d(d,{bind:()=>vt,clone:()=>et,curry:()=>_t,defaults:()=>ot,each:()=>ct,extend:()=>rt,filter:()=>pt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isFunction:()=>xt,isObject:()=>St,isString:()=>wt,map:()=>dt,merge:()=>nt,reduce:()=>ft});var f={};n.r(f),n.d(f,{Axis:()=>Sb,ChartView:()=>Fm,ComponentModel:()=>Gc,ComponentView:()=>Dp,List:()=>Cx,Model:()=>Ih,PRIORITY:()=>k_,SeriesModel:()=>Lp,color:()=>r,connect:()=>Ay,dataTool:()=>$y,dependencies:()=>I_,disConnect:()=>Iy,disconnect:()=>Dy,dispose:()=>Py,env:()=>O,extendChartView:()=>Ab,extendComponentModel:()=>Mb,extendComponentView:()=>Cb,extendSeriesModel:()=>Lb,format:()=>c,getCoordinateSystemDimensions:()=>Hy,getInstanceByDom:()=>Ey,getInstanceById:()=>Oy,getMap:()=>Ky,graphic:()=>h,helper:()=>s,init:()=>Ly,innerDrawElementOnCanvas:()=>v_,matrix:()=>i,number:()=>l,parseGeoJSON:()=>ub,parseGeoJson:()=>ub,registerAction:()=>Vy,registerCoordinateSystem:()=>Gy,registerLayout:()=>Uy,registerLoading:()=>Xy,registerLocale:()=>Fh,registerMap:()=>Yy,registerPostInit:()=>zy,registerPostUpdate:()=>By,registerPreprocessor:()=>Ry,registerProcessor:()=>ky,registerTheme:()=>Ny,registerTransform:()=>Jy,registerUpdateLifecycle:()=>Fy,registerVisual:()=>Wy,setCanvasCreator:()=>qy,setPlatformAPI:()=>V,throttle:()=>Um,time:()=>u,use:()=>Jw,util:()=>d,vector:()=>e,version:()=>D_,zrUtil:()=>t,zrender:()=>o});var p=n(214),g=n.n(p);const m={metadata:!0,svgRender:!1,switchMode:!1,maxPointsFetched:1e4,loadMoreAtZoomLevel:9,clustering:!1,clusteringThreshold:100,disableClusteringAtLevel:8,clusterRadius:80,clusterSeparation:20,showMetaOnNarrowScreens:!1,showLabelsAtZoomLevel:13,showGraphLabelsAtZoom:null,crs:g().CRS.EPSG3857,echartsOption:{aria:{show:!0,description:"This is a force-oriented graph chart that depicts the relationship between ip nodes."},toolbox:{show:!0,iconStyle:{borderColor:"#fff"},feature:{restore:{show:!0,title:"Restore view"},saveAsImage:{show:!0,title:"Save image"}}}},graphConfig:{series:{layout:"force",label:{show:!0,color:"#fff",position:"top"},labelLayout:{hideOverlap:!0},force:{gravity:.1,edgeLength:[20,60],repulsion:120},roam:!0,draggable:!0,legendHoverLink:!0,emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}},nodeStyle:{color:"#ffebc4"},linkStyle:{width:6,color:"#1ba619"},nodeSize:"15"},baseOptions:{backgroundColor:"#282222",media:[{query:{minWidth:320,maxWidth:500},option:{series:[{zoom:.7}],toolbox:{itemSize:18}}},{query:{minWidth:501},option:{series:[{zoom:1}],toolbox:{itemSize:15}}},{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapOptions:{roam:!0,zoomAnimation:!1,worldCopyJump:!0,minZoom:3,maxZoom:18,nodeConfig:{type:"scatter",label:{show:!1,color:"#000000",position:"top",formatter:"{b}",fontSize:13,backgroundColor:"rgba(255, 255, 255, 0.8)",padding:[6,8],borderRadius:5},emphasis:{scale:1},nodeStyle:{color:"#1566a9"},nodeSize:"17"},linkConfig:{linkStyle:{width:5,color:"#1ba619"},emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}}},clusterConfig:{symbolSize:30,itemStyle:{color:"#1566a9"},tooltip:{show:!1},label:{show:!0,position:"inside",color:"#fff",offset:[0,0],backgroundColor:"transparent"}},baseOptions:{toolbox:{show:!1},media:[{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapTileConfig:[{urlTemplate:"MISSING_ENV_VAR".MAPBOX_URL_TEMPLATE||"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[{name:"ok",nodeStyle:{color:"#1ba619"}},{name:"problem",nodeStyle:{color:"#ffa500"}},{name:"critical",nodeStyle:{color:"#c92517"}}],linkCategories:[],bookmarkableActions:{enabled:!1,id:null,zoomOnRestore:!0,zoomLevel:null},prepareData(t){t&&t.nodes&&t.nodes.forEach((t=>{if(t.properties&&t.properties.status){const e=t.properties.status.toLowerCase();"ok"!==e&&"problem"!==e&&"critical"!==e||(t.category=e)}}))},onClickElement(t,e){let n;this.utils&&this.utils.isNetJSON(this.data)?(n="node"===t?this.utils.nodeInfo(e):"link"===t?this.utils.linkInfo(e):e,(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):({nodeLinkData:n}={nodeLinkData:e}),this.gui.getNodeLinkInfo(t,n),this.gui.sideBar.classList.remove("hidden")},onReady(){}},{prepareData:v}=m,_={...m},y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class x{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const r=y[15&n];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new x(a,o,r,t)}constructor(t,e=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=y.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return w(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=a){for(let a=c;a<=h;a++){const s=o[2*a],u=o[2*a+1];s>=t&&s<=n&&u>=e&&u<=i&&l.push(r[a])}continue}const d=c+h>>1,f=o[2*d],p=o[2*d+1];f>=t&&f<=n&&p>=e&&p<=i&&l.push(r[d]),(0===u?t<=f:e<=p)&&(s.push(c),s.push(d-1),s.push(1-u)),(0===u?n>=f:i>=p)&&(s.push(d+1),s.push(h),s.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:r,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=n*n;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,c=a.pop()||0;if(h-c<=o){for(let n=c;n<=h;n++)M(r[2*n],r[2*n+1],t,e)<=l&&s.push(i[n]);continue}const d=c+h>>1,f=r[2*d],p=r[2*d+1];M(f,p,t,e)<=l&&s.push(i[d]),(0===u?t-n<=f:e-n<=p)&&(a.push(c),a.push(d-1),a.push(1-u)),(0===u?t+n>=f:e+n>=p)&&(a.push(d+1),a.push(h),a.push(1-u))}return s}}function w(t,e,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;b(t,e,a,i,r,o),w(t,e,n,i,a-1,1-o),w(t,e,n,a+1,r,1-o)}function b(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);b(t,e,n,Math.max(i,Math.floor(n-s*u/a+h)),Math.min(r,Math.floor(n+(a-s)*u/a+h)),o)}const a=e[2*n+o];let s=i,l=r;for(T(t,e,i,n),e[2*r+o]>a&&T(t,e,i,r);sa;)l--}e[2*i+o]===a?T(t,e,i,l):(l++,T(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function T(t,e,n,i){S(t,n,i),S(e,2*n,2*i),S(e,2*n+1,2*i+1)}function S(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function M(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}const C=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"}).then((t=>t)).catch((t=>{console.error(t)})):Promise.resolve(t)}async paginatedDataParse(t){let e,n;try{let i=await this.utils.JSONParamParse(t);if(i.json)for(e=await i.json(),n=e.results?e.results:e;e.next&&n.nodes.length<=this.config.maxPointsFetched;)i=await this.utils.JSONParamParse(e.next),e=await i.json(),n.nodes=n.nodes.concat(e.results.nodes),n.links=n.links.concat(e.results.links),e.next?this.hasMoreData=!0:this.hasMoreData=!1;else n=i}catch(t){console.error(t)}return n}async getBBoxData(t,e){let n;try{const i=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(i);n=await r.json()}catch(t){console.error(t)}return n}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:n=(new Date).getTimezoneOffset()/60}){const i=e.exec(t);if(!i||i.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=i[1]%4==0&&i[1]%100!=0||i[1]%400==0,s=new Map([["dateMonth",12],["dateDay",[31,a?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(i[t],10);let l,u=-n;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=u;break}l="dateDay"===r[t-1]?s.get("dateDay")[o.dateMonth-1]:s.get(r[t-1]);let e=o[r[t-1]]+u;u="dateHour"===r[t-1]?e<0?-1:e>=l?1:0:e<=0?-1:e>l?1:0,1===u?e-=l:u<0&&("dateDay"===r[t-1]&&(l=s.get("dateDay")[(o[r[t-1]]+10)%11]),e+=l),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(i[5])}:${this.numberMinDigit(i[6])}${i[7]?`.${this.numberMinDigit(i[7],3)}`:""}`}numberMinDigit(t,e=2,n="0"){return(Array(e).join(n)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&(this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links))}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&(this.isObject(t)&&this.isArray(t.geometry))}geojsonToNetjson(t){return function(t){const e=[],n=[];if(!t||!Array.isArray(t.features))return{nodes:e,links:n};const i=new Map,r=(t,n={})=>{const r=`${t[0]},${t[1]}`;if(i.has(r))return i.get(r);const o=n.id||n.node_id||null,a=n.label||n.name||o||null,s=o?String(o):`gjn_${e.length}`,l=!o,u={id:s,...a?{label:String(a)}:{},location:{lng:t[0],lat:t[1]},properties:{...n,location:{lng:t[0],lat:t[1]}},_generatedIdentity:l};return e.push(u),i.set(r,s),s},o=(t,e,i={})=>{n.push({source:t,target:e,properties:i})},a=(t,e,n=!1)=>{for(let n=0;n2){const n=r(t[0],e),i=r(t[t.length-1],e);o(i,n,e)}},s=(t,e)=>{if(!t)return;const{type:n,coordinates:i,geometries:o}=t;switch(n){case"Point":r(i,{...e,_featureType:"Point"});break;case"MultiPoint":i.forEach((t=>r(t,{...e,_featureType:"Point"})));break;case"LineString":a(i,{...e,_featureType:"LineString"},!1);break;case"MultiLineString":i.forEach((t=>a(t,{...e,_featureType:"LineString"},!1)));break;case"Polygon":case"MultiPolygon":break;case"GeometryCollection":o.forEach((t=>s(t,e)));break;default:console.warn(`Unsupported GeoJSON geometry type: ${n}`)}};return t.features.forEach((t=>{const e={...t.properties||{},...void 0!==t.id&&null!==t.id?{id:t.id}:{}};s(t.geometry,e)})),{nodes:e,links:n}}(t)}deepCopy(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>this.deepCopy(t)));const e={};return Object.keys(t).forEach((n=>{e[n]=this.deepCopy(t[n])})),e}fastDeepCopy(t){return"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t))}deepMergeObj(...t){const e=[...t].reverse(),n=e.length;for(let t=0;t{i[t]&&this.isObject(i[t])&&this.isObject(n[t])?this.deepMergeObj(i[t],n[t]):i[t]=n[t]})):i||(e[t+1]=n)}return e[n-1]}makeCluster(t){const{nodes:e,links:n}=t.data,i=t=>!(t.properties&&t.properties._featureType)||"Point"===t.properties._featureType,r=e.filter(i),o=e.filter((t=>!i(t))),a=[],s=[],l=new Map;o.forEach((t=>l.set(t.id,null)));let u=0;r.forEach((e=>{const n=e.properties&&e.properties.location||e.location;if(!n||void 0===n.lat||void 0===n.lng)return;e.location=n,e._origLocation?(n.lat=e._origLocation.lat,n.lng=e._origLocation.lng):e._origLocation={lat:n.lat,lng:n.lng};const i=t.leaflet.latLngToContainerPoint([n.lat,n.lng]);e.x=i.x,e.y=i.y,e.visited=!1,e.cluster=null}));const h=new x(r.length);r.forEach((({x:t,y:e})=>h.add(t,e))),h.finish();const c=t.config&&t.config.mapOptions&&t.config.mapOptions.clusterConfig&&t.config.mapOptions.clusterConfig.symbolSize,d=t=>{if("function"==typeof c)try{return c(t)}catch(t){return 30}return Array.isArray(c)?c[0]||30:"number"==typeof c?c:30},f=new Map;r.forEach((e=>{if(e.visited)return;const n=h.within(e.x,e.y,t.config.clusterRadius).map((t=>r[t]));if(n.length>1){const i=`${Math.round(e.x)},${Math.round(e.y)}`;f.has(i)||f.set(i,new Map);const r=f.get(i);n.forEach((e=>{if(e.visited)return;const n=t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]:"default";r.has(n)||r.set(n,[]),r.get(n).push(e),e.visited=!0}))}else e.visited=!0,l.set(e.id,null),o.push(e)})),f.forEach((e=>{const n=Array.from(e.entries()),i=n.length;let r=0;n.forEach((([,t])=>{const e=d(t.length);e>r&&(r=e)}));const a="number"==typeof t.config.clusterSeparation?t.config.clusterSeparation:Math.max(10,Math.floor(t.config.clusterRadius/2));let h=0;if(i>1){const t=Math.PI/i,e=Math.sin(t);e>0&&(h=r/(2*e))}const c=Math.max(a,h+4);n.forEach((([,e],n)=>{if(e.length>1){let r=0,o=0;if(e.forEach((t=>{t.cluster=u,l.set(t.id,t.cluster),r+=t.location.lng,o+=t.location.lat})),r/=e.length,o/=e.length,i>1){const e=2*Math.PI*n/i,a=t.leaflet.latLngToContainerPoint([o,r]),s=[a.x+c*Math.cos(e),a.y+c*Math.sin(e)],l=t.leaflet.containerPointToLatLng(s);r=l.lng,o=l.lat}const a={id:u,cluster:!0,name:e.length,value:[r,o],childNodes:e,...t.config.mapOptions.clusterConfig};if(t.config.clusteringAttribute){const n=t.config.nodeCategories.find((n=>n.name===e[0].properties[t.config.clusteringAttribute]));n&&(a.itemStyle={...a.itemStyle,color:n.nodeStyle.color})}s.push(a),u+=1}else if(1===e.length){const t=e[0];l.set(t.id,null),o.push(t)}}))})),n.forEach((t=>{null===l.get(t.source)&&null===l.get(t.target)&&a.push(t)}));const p=[...s.map((t=>({ref:t,isCluster:!0,count:t.childNodes.length,get value(){return t.value},set value([e,n]){t.value=[e,n]}}))),...o.filter(i).map((t=>({ref:t,isCluster:!1,count:1,get value(){return[t.location.lng,t.location.lat]},set value([e,n]){t.location.lng=e,t.location.lat=n}})))];if(p.length>1){const e=p.map((e=>{const[n,i]=e.value,r=t.leaflet.latLngToContainerPoint([i,n]);return{ref:e.ref,isCluster:e.isCluster,x:r.x,y:r.y,r:d(e.count)/2,setValue:([t,n])=>{e.value=[t,n]}}})),n=4,i=5;for(let t=0;t0&&s{const n=t.leaflet.containerPointToLatLng([e.x,e.y]);e.isCluster?e.ref.value=[n.lng,n.lat]:(e.ref.location.lng=n.lng,e.ref.location.lat=n.lat)}))}return{clusters:s,nonClusterNodes:o,nonClusterLinks:a}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),n=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=n,o.innerHTML=t[n],i.appendChild(r),i.appendChild(o),e.appendChild(i)}))}}getMetadata(t){const e=t,n={};return e.label&&(n.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach((t=>{e[t]&&(n[t]=e[t])})),n.nodes=e.nodes.length,n.links=e.links.length,n}nodeInfo(t){const e={};!t._generatedIdentity&&(e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label)),t.name&&(e.name=t.name),t.location&&(e.location=t.location);let n=null;Array.isArray(t.clients)?n=t.clients:t.properties&&Array.isArray(t.properties.clients)&&(n=t.properties.clients);let i=0;n?i=n.length:"number"==typeof t.clients?i=t.clients:t.properties&&"number"==typeof t.properties.clients&&(i=t.properties.clients),i>0&&(e.clients=i),n&&n.length&&n.forEach(((t,n)=>{e[`clients [${n+1}]`]=t}));const r=(t,e)=>"location"===t&&e&&"object"==typeof e?{lat:e.lat,lng:e.lng}:"time"===t&&"string"==typeof e?this.dateParse({dateString:e}):e,o=t._source&&this.isObject(t._source)?t._source:t;if(Object.keys(o).forEach((t=>{if("properties"===t||"clients"===t||"_source"===t||"_generatedIdentity"===t||"local_addresses"===t||"linkCount"===t)return;const n=r(t,o[t]);null!=n&&""!==n&&(e[t]=n)})),o.properties&&this.isObject(o.properties)&&Object.keys(o.properties).forEach((t=>{if("clients"===t)return;const n=r(t,o.properties[t]);null==n||"string"==typeof n&&""===n.trim()||(e[t]=n)})),t.linkCount&&(e.links=t.linkCount),Array.isArray(o.local_addresses)){const t=o.local_addresses.map((t=>"string"==typeof t?t:t&&"string"==typeof t.address?t.address:null)).filter((t=>t));t.length&&(e.localAddresses=t)}return t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const n=document.createElement("div");n.classList.add("njg-tooltip-item");const i=document.createElement("span");i.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),i.innerHTML=t,r.innerHTML=e,n.appendChild(i),n.appendChild(r),n}getNodeTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=!t._generatedIdentity;return n&&t.id&&e.appendChild(this.createTooltipItem("id",t.id)),n&&t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach((i=>{if("object"!=typeof t.properties[i]&&!i.startsWith("_")&&("id"!==i&&"label"!==i||!n))if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
"))),e}getLinkTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||e.appendChild(this.createTooltipItem("source",t.source)),n(t.target)||e.appendChild(this.createTooltipItem("target",t.target)),void 0!==t.cost&&null!==t.cost&&e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e.appendChild(this.createTooltipItem("time",t))}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e.appendChild(this.createTooltipItem(`${n.replace(/_/g," ")}`,t))}})),e}linkInfo(t){const e={},n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||(e.source=t.source),n(t.target)||(e.target=t.target),void 0!==t.cost&&null!==t.cost&&(e.cost=t.cost),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e[n]=t}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e[n.replace(/_/g," ")]=t}})),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,n){let i,r={},o={},a=!1;if(t.category&&e.nodeCategories&&e.nodeCategories.length){const n=e.nodeCategories.find((e=>e.name===t.category));if(n){a=!0,i=this.generateStyle(n.nodeStyle||{},t),r=this.generateStyle(n.nodeSize||{},t);let e={},s={};n.emphasis&&(e=this.generateStyle(n.emphasis.nodeStyle||{},t),s=this.generateStyle(n.emphasis.nodeSize||{},t),o={nodeStyle:e,nodeSize:s})}}if(!a)if("map"===n){const n=e.mapOptions&&e.mapOptions.nodeConfig;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.nodeStyle||{},t),nodeSize:this.generateStyle(a&&a.nodeSize||{},t)})}else{const n=e.graphConfig&&e.graphConfig.series;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.itemStyle||{},t),nodeSize:this.generateStyle(a&&a.symbolSize||r||{},t)})}return{nodeStyleConfig:i,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,n){let i,r={};if(t.category&&e.linkCategories.length){const n=e.linkCategories.find((e=>e.name===t.category));i=this.generateStyle(n.linkStyle||{},t),r={...r,linkStyle:n.emphasis?this.generateStyle(n.emphasis.linkStyle||{},t):{}}}else i="map"===n?this.generateStyle(e.mapOptions.linkConfig.linkStyle,t):this.generateStyle(e.graphConfig.series.linkStyle,t);return{linkStyleConfig:i,linkEmphasisConfig:r}}showLoading(){let t=this.el.querySelector(".njg-loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.classList.add("njg-loadingContainer"),t.innerHTML='\n
\n
\n

Loading...

\n
\n ',this.el.appendChild(t)),t}hideLoading(){const t=this.el.querySelector(".njg-loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...n){t.set(e,[...t.get(e)||[],...n])},once(t,...n){e.set(t,[...e.get(t)||[],...n])},emit(n){const i=t.get(n)||[],r=e.get(n)||[],o=i.map((t=>t())),a=r.map((t=>t()));return e.delete(n),[...o,...a]},delete(n){t.delete(n),e.delete(n)}}}parseUrlFragments(){let t;try{t=decodeURIComponent(window.location.hash.replace(/^#/,""))}catch(e){t=window.location.hash.replace(/^#/,"")}const e={};return t.split(";").forEach((t=>{const n=new URLSearchParams(t),i=n.get("id");null!=i&&(e[i]=n)})),e}updateUrlFragments(t,e){const n=Object.values(t).map((t=>t.toString())).join(";").replace(/([^&=]+)=([^&;]*)/g,((t,e,n)=>`${e}=${encodeURIComponent(n.replace(/%7E/gi,"~"))}`));window.history.pushState(e,"",`#${n}`)}addActionToUrl(t,e){if(!t.config.bookmarkableActions.enabled||!e.data||e.data.cluster)return;if(!t.nodeLinkIndex)return void console.error("Lookup object for node or link not found.");const n=this.parseUrlFragments(),{id:i}=t.config.bookmarkableActions;let r;if(t.config.render===t.utils.graphRender){if("node"===e.dataType)r=e.data.id;else if("edge"===e.dataType){const{source:t,target:n}=e.data;r=`${t}~${n}`}}else if(t.config.render===t.utils.mapRender)if("scatter"===e.seriesType)r=e.data.node.id;else if("lines"===e.seriesType){const{source:t,target:n}=e.data.link;r=`${t}~${n}`}if(!r||!t.nodeLinkIndex[r])return void console.error("nodeId not found in nodeLinkIndex lookup.");n[i]||(n[i]=new URLSearchParams,n[i].set("id",i)),n[i].set("nodeId",r);const o=t.nodeLinkIndex[r];this.updateUrlFragments(n,o)}removeUrlFragment(t){const e=this.parseUrlFragments();e[t]&&delete e[t];const n={id:t};this.updateUrlFragments(e,n)}applyUrlFragmentState(t){if(!t.config.bookmarkableActions.enabled)return;const{id:e}=t.config.bookmarkableActions,n=t.utils.parseUrlFragments(),i=n[e]&&n[e].get?n[e]:null,r=i&&i.get?i.get("nodeId"):void 0;if(!r||!t.nodeLinkIndex||null==t.nodeLinkIndex[r])return;const[o,a]=r.split("~"),s=t.nodeLinkIndex[r],l=t.config.graphConfig&&t.config.graphConfig.series&&t.config.graphConfig.series.type||t.config.mapOptions&&t.config.mapOptions.nodeConfig&&t.config.mapOptions.nodeConfig.type,{location:u,cluster:h}=s||{};if(t.config.bookmarkableActions.zoomOnRestore&&["scatter","effectScatter"].includes(l)&&null==a&&null!=u){const e=[u.lat,u.lng],n=null!=h?t.config.disableClusteringAtLevel:t.config.bookmarkableActions.zoomLevel||t.config.showLabelsAtZoomLevel;t.leaflet&&t.leaflet.setView(e,n)}"function"==typeof t.config.onClickElement&&t.config.onClickElement.call(t,o&&a?"link":"node",s)}setupHashChangeHandler(t){return t._popstateHandler&&window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=()=>{this.applyUrlFragmentState(t)},window.addEventListener("popstate",t._popstateHandler),()=>{window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=null}}moveNodeInRealTime(t,e){if(!this.echarts||"function"!=typeof this.echarts.getOption)return void console.warn("moveNodeInRealTime: ECharts instance not ready");const n=this.echarts.getOption();if(!n||!Array.isArray(n.series))return void console.warn("moveNodeInRealTime: No series data available");const i=n.series.find((t=>"scatter"===t.type||"effectScatter"===t.type));if(!i)return void console.warn("moveNodeInRealTime: No scatter series found");const r=i.data.findIndex((e=>e.node.id===t));if(-1===r)return void console.warn(`moveNodeInRealTime: Node with id "${t}" not found`);const o=i.data[r],{node:a}=o;a.location=e,a.properties?(a.properties.location=e,o.value=[e.lng,e.lat],this.nodeLinkIndex[t].location=e,this.nodeLinkIndex[t].properties&&(this.nodeLinkIndex[t].properties.location=e,this.echarts.setOption({series:n.series}))):console.warn("moveNodeInRealTime: Node properties not found")}};const L=class extends C{searchElements(t){const e=this,n={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=i=>{n[i.state.searchValue]?e.utils.JSONDataUpdate.call(e,n[i.state.searchValue].data).then((()=>{e.JSONParam=n[i.state.searchValue].param})):e.utils.JSONDataUpdate.call(e,t+i.state.searchValue)},function(i,r=!0,o=!0){const a=i.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then((()=>{n[a]={data:{...e.data},param:[...e.JSONParam]}}))}}JSONDataUpdate(t,e=!0,n=!0){const i=this;return i.config.onUpdate.call(i),i.utils.paginatedDataParse.call(i,t).then((r=>{function o(){e?(i.JSONParam=[t],i.utils.overrideData(r,i)):(i.JSONParam.push(t),i.config.render===i.utils.mapRender?i.utils.appendData(r,i):i.utils.addData(r,i)),i.utils.isNetJSON(i.data)&&i.utils.updateMetadata.call(i)}return n?(i.utils.isNetJSON(i.data)&&i.config.prepareData.call(i,r),i.config.dealDataByWorker?i.utils.dealDataByWorker.call(i,r,i.config.dealDataByWorker,o):o()):o(),r})).catch((t=>{console.error(t)}))}dealDataByWorker(t,e,n){const i=new Worker(e),r=this;i.postMessage(t),i.addEventListener("error",(t=>{console.error(t),console.error("Error in dealing JSONData!")})),i.addEventListener("message",(t=>{n?n():(r.utils.overrideData(t.data,r),r.utils.isNetJSON(r.data)&&r.utils.updateMetadata.call(r))}))}overrideData(t,e){e.data=t,e.utils.isNetJSON(e.data)||e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}};const A=class{constructor(t){this.utils=new L,this.config=this.utils.deepCopy(_),this.config.crs=_.crs,this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){if(this.utils.deepMergeObj(this.config,t),this.el)t&&t.el&&console.error("Can't change el again!");else if(this.config.el?this.utils.isElement(this.config.el)?this.el=this.config.el:this.el=document.querySelector(this.config.el):this.el=document.body,this.el){if(this.el.classList.add("njg-container"),this.el===document.body){const t=document.documentElement;t.style.width="100%",t.style.height="100%",this.el.classList.add("njg-relativePosition")}}else console.error("NetJSONGraph: The specified element for rendering was not found and could not be set.");return this.config}render(){const[t,...e]=this.JSONParam;this.config.onRender.call(this);const n=new Promise((t=>{this.event.once("onReady",(async()=>{try{await this.config.onReady.call(this)}catch(t){console.error("onReady callback failed:",t)}t()}))}));if(this.event.once("onLoad",this.config.onLoad.bind(this)),this.event.once("applyUrlFragmentState",(async()=>{try{await n}catch(t){console.error("onReady failed:",t)}this.utils.applyUrlFragmentState.call(this,this)})),this.utils.paginatedDataParse.call(this,t).then((t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson",this.originalGeoJSON=this.utils.fastDeepCopy(t),t=this.utils.geojsonToNetjson(t)}if(this.utils.isNetJSON(t)){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set;this.nodeLinkIndex={},t.nodes.forEach((t=>{e.add(t.id),this.nodeLinkIndex[t.id]=t})),t.links=t.links.filter((t=>{if(e.has(t.source)&&e.has(t.target)){const e=`${t.source}~${t.target}`;return this.nodeLinkIndex[e]=t,!0}return e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1}))}this.config.prepareData.call(this,t),this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())})).catch((t=>{console.error(t)})),e.length){const n=function(){e.map((t=>this.utils.JSONDataUpdate.call(this,t,!1)))};this.JSONParam=[t],this.event.once("renderArray",n.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),"function"==typeof e.utils.moveNodeInRealTime&&(e.utils.moveNodeInRealTime=e.utils.moveNodeInRealTime.bind(e)),e.utils}}; +!function(t){"use strict";function e(t){for(var e,n,i=1,r=arguments.length;i=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>=e.x&&i.x<=n.x;return t=t.y>=e.y&&i.y<=n.y,r&&t},overlaps:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>e.x&&i.xe.y&&i.y=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>=e.lat&&i.lat<=n.lat;return t=t.lng>=e.lng&&i.lng<=n.lng,r&&t},overlaps:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>e.lat&&i.late.lng&&i.lng","http://www.w3.org/2000/svg"===(Ct.firstChild&&Ct.firstChild.namespaceURI));function Lt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var At={ie:J,ielt9:$,edge:Q,webkit:tt,android:et,android23:nt,androidStock:it,opera:rt,chrome:ot,gecko:at,safari:st,phantom:lt,opera12:ut,win:ht,ie3d:ct,webkit3d:dt,gecko3d:K,any3d:ft,mobile:Kn,mobileWebkit:pt,mobileWebkit3d:gt,msPointer:mt,pointer:vt,touch:yt,touchNative:_t,mobileOpera:xt,mobileGecko:wt,retina:bt,passiveEvents:Tt,canvas:St,svg:Mt,vml:!Mt&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Ct,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},Dt=At.msPointer?"MSPointerDown":"pointerdown",It=At.msPointer?"MSPointerMove":"pointermove",Pt=At.msPointer?"MSPointerUp":"pointerup",Et=At.msPointer?"MSPointerCancel":"pointercancel",Ot={touchstart:Dt,touchmove:It,touchend:Pt,touchcancel:Et},Nt={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ee(e),Gt(t,e)},touchmove:Gt,touchend:Gt,touchcancel:Gt},Rt={},kt=!1;function zt(t,e,n){return"touchstart"!==e||kt||(document.addEventListener(Dt,Bt,!0),document.addEventListener(It,Ft,!0),document.addEventListener(Pt,Vt,!0),document.addEventListener(Et,Vt,!0),kt=!0),Nt[e]?(n=Nt[e].bind(this,n),t.addEventListener(Ot[e],n,!1),n):(console.warn("wrong event specified:",e),u)}function Bt(t){Rt[t.pointerId]=t}function Ft(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Vt(t){delete Rt[t.pointerId]}function Gt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Rt)e.touches.push(Rt[n]);e.changedTouches=[e],t(e)}}var Ht=200;function Ut(t,e){t.addEventListener("dblclick",e);var n,i=0;function r(t){var r;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(r=Ne(t)).some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))&&!r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))||((r=Date.now())-i<=Ht?2==++n&&e(function(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return(t=i).type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}(t)):n=1,i=r)}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}var Wt,jt,Zt,Xt,qt,Yt,Kt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),$t="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function Qt(t){return"string"==typeof t?document.getElementById(t):t}function te(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(n=n&&"auto"!==n||!document.defaultView?n:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:n}function ee(t,e,n){return(t=document.createElement(t)).className=e||"",n&&n.appendChild(t),t}function ne(t){var e=t.parentNode;e&&e.removeChild(t)}function ie(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function oe(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=he(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function se(t,e){var n;if(void 0!==t.classList)for(var i=d(e),r=0,o=i.length;rthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter();return t=this._limitCenter(n,this._zoom,B(t)),n.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=N((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=N(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),o=(t=this.project(t),(n=k([(o=this.getPixelBounds()).min.add(n),o.max.subtract(i)])).getSize());return n.contains(t)||(this._enforcingBounds=!0,i=t.subtract(n.getCenter()),n=n.extend(t).getSize().subtract(o),r.x+=i.x<0?-n.x:n.x,r.y+=i.y<0?-n.y:n.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=n.divideBy(2).round(),a=i.divideBy(2).round();return(o=o.subtract(a)).x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var n,i;return t=this._locateOptions=e({timeout:1e4,watch:!1},t),"geolocation"in navigator?(n=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,i,t):navigator.geolocation.getCurrentPosition(n,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,n,i=new F(t.coords.latitude,t.coords.longitude),r=i.toBounds(2*t.coords.accuracy),o=this._locateOptions,a=(o.setView&&(e=this.getBoundsZoom(r),this.setView(i,o.maxZoom?Math.min(e,o.maxZoom):e)),{latlng:i,bounds:r,timestamp:t.timestamp});for(n in t.coords)"number"==typeof t.coords[n]&&(a[n]=t.coords[n]);this.fire("locationfound",a)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ne(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ne(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){return e=ee("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane),t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=B(t),n=N(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=(t=t.getSouthEast(),n=this.getSize().subtract(n),t=k(this.project(t,i),this.project(a,i)).getSize(),a=At.any3d?this.options.zoomSnap:1,n.x/t.x);return n=n.y/t.y,t=e?Math.max(s,n):Math.min(s,n),i=this.getScaleZoom(t,i),a&&(i=Math.round(i/(a/100))*(a/100),i=e?Math.ceil(i/a)*a:Math.floor(i/a)*a),Math.max(r,Math.min(o,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new E(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){return new R(t=this._getTopLeftPoint(t,e),t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,t=n.zoom(t*n.scale(e)),isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(V(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(N(t),e)},layerPointToLatLng:function(t){return t=N(t).add(this.getPixelOrigin()),this.unproject(t)},latLngToLayerPoint:function(t){return this.project(V(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(V(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(V(t),V(e))},containerPointToLayerPoint:function(t){return N(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return N(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){return t=this.containerPointToLayerPoint(N(t)),this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(t)))},mouseEventToContainerPoint:function(t){return Re(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){if(!(t=this._container=Qt(t)))throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");be(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&At.any3d,se(t,"leaflet-container"+(At.touch?" leaflet-touch":"")+(At.retina?" leaflet-retina":"")+(At.ielt9?" leaflet-oldie":"")+(At.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),te(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),pe(this._mapPane,new E(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(se(t.markerPane,"leaflet-zoom-hide"),se(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){pe(this._mapPane,new E(0,0));var i=!this._loaded,r=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(r,n)._move(t,e)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){pe(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var e=t?Se:be;e((this._targets[a(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),At.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((n=this._targets[a(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!Be(o,t))break;if(i.push(n),r)break}if(o===this._container)break;o=o.parentNode}return i.length||s||r||!this.listens(e,!0)?i:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,n=t.target||t.srcElement;!this._loaded||n._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(n)||("mousedown"===(e=t.type)&&_e(n),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,n,i){"click"===t.type&&((l=e({},t)).type="preclick",this._fireDOMEvent(l,l.type,i));var r=this._findEventTargets(t,n);if(i){for(var o=[],a=0;athis.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e);if(i=this._getCenterOffset(t)._divideBy(1-1/i),!0!==n.animate&&!this.getSize().contains(i))return!1;M((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this)}return!0},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,se(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&le(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ge(t){return new Ue(t)}var He,Ue=D.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition();return t=t._controlCorners[n],se(e,"leaflet-control"),-1!==n.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ne(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",(e=document.createElement("div")).innerHTML=t,e.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer),r=((t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+a(this),i),this._layerControlInputs.push(e),e.layerId=a(t.layer),be(e,"click",this._onInputClick,this),i=document.createElement("span")).innerHTML=" "+t.name,document.createElement("span"));return n.appendChild(r),r.appendChild(e),r.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var o=n.length-1;0<=o;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(o=0;oe.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section,e=(this._preventClick=!0,be(t,"click",Ee),this.expand(),this);setTimeout((function(){Se(t,"click",Ee),e._preventClick=!1}))}})),je=Ue.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=ee("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){return(n=ee("a",n,i)).innerHTML=t,n.href="#",n.title=e,n.setAttribute("role","button"),n.setAttribute("aria-label",e),Pe(n),be(n,"click",Oe),be(n,"click",r,this),be(n,"click",this._refocusOnMap,this),n},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";le(this._zoomInButton,e),le(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(se(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(se(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Ze=(Ve.mergeOptions({zoomControl:!0}),Ve.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new je,this.addControl(this.zoomControl))})),Ue.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=ee("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=ee("div",e,n)),t.imperial&&(this._iScale=ee("div",e,n))},_update:function(){var t=(e=this._map).getSize().y/2,e=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,n;5280<(t*=3.2808399)?(n=this._getRoundNum(e=t/5280),this._updateScale(this._iScale,n+" mi",n/e)):(n=this._getRoundNum(t),this._updateScale(this._iScale,n+" ft",n/t))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1);return e*(10<=(t/=e)?10:5<=t?5:3<=t?3:2<=t?2:1)}})),Xe=Ue.extend({options:{position:"bottomright",prefix:''+(At.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=ee("div","leaflet-control-attribution"),Pe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(", ")),this._container.innerHTML=n.join(' ')}}}),qe=(Ve.mergeOptions({attributionControl:!0}),Ve.addInitHook((function(){this.options.attributionControl&&(new Xe).addTo(this)})),Ue.Layers=We,Ue.Zoom=je,Ue.Scale=Ze,Ue.Attribution=Xe,Ge.layers=function(t,e,n){return new We(t,e,n)},Ge.zoom=function(t){return new je(t)},Ge.scale=function(t){return new Ze(t)},Ge.attribution=function(t){return new Xe(t)},Q=D.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}}),Q.addTo=function(t,e){return t.addHandler(e,this),this},tt={Events:I},At.touch?"touchstart mousedown":"mousedown"),Ye=P.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){f(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(be(this._dragStartTarget,qe,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ye._dragging===this&&this.finishDrag(!0),Se(this._dragStartTarget,qe,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,n;this._enabled&&(this._moved=!1,ae(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Ye._dragging===this&&this.finishDrag():Ye._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Ye._dragging=this)._preventOutline&&_e(this._element),me(),Zt(),this._moving||(this.fire("down"),n=t.touches?t.touches[0]:t,e=xe(this._element),this._startPoint=new E(n.clientX,n.clientY),this._startPos=ge(this._element),this._parentScale=we(e),n="mousedown"===t.type,be(document,n?"mousemove":"touchmove",this._onMove,this),be(document,n?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(n.push(t[i]),r=i);return re.max.x&&(n|=2),t.ye.max.y&&(n|=8),n}function on(t,e,n,i){var r=e.x,o=(e=e.y,n.x-r),a=n.y-e,s=o*o+a*a;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||yn.prototype._containsPoint.call(this,t,!0)}}),wn=cn.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=v(t)?t:t.features;if(r){for(e=0,n=r.length;eo.x&&(a=n.x+s-o.x+r.x),n.x-a-i.x<(s=0)&&(a=n.x-i.x),n.y+e+r.y>o.y&&(s=n.y+e-o.y+r.y),n.y-s-i.y<0&&(s=n.y-i.y),(a||s)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,s]))))},_getAnchor:function(){return N(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),kn=(Ve.mergeOptions({closePopupOnClick:!0}),Ve.include({openPopup:function(t,e,n){return this._initOverlay(Rn,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),ut.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Rn,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof cn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(Oe(t),e=t.layer||t.target,this._popup._source!==e||e instanceof mn?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Nn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Nn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Nn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Nn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ee("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n=this._map,i=this._container,r=n.latLngToContainerPoint(n.getCenter()),o=(n=n.layerPointToContainerPoint(t),this.options.direction),a=i.offsetWidth,s=i.offsetHeight,l=N(this.options.offset),u=this._getAnchor();n="top"===o?(e=a/2,s):"bottom"===o?(e=a/2,0):(e="center"===o?a/2:"right"===o?0:"left"===o?a:n.xthis.options.maxZoom||ithis.options.maxZoom||void 0!==this.options.minZoom&&rn.max.x)||!e.wrapLat&&(t.yn.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),B(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n);return n=i.add(n),[e.unproject(i,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){return t=new z((t=this._tileCoordsToNwSe(t))[0],t[1]),this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=new E(+(t=t.split(":"))[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(ne(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){se(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,At.ielt9&&this.options.opacity<1&&ce(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),pe(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(ce(n.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(se(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),At.ielt9||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new E(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),Fn=Bn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&At.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Zn=(dt={_initContainer:function(){this._container=ee("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Hn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jn("shape");se(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ne(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e=e||(t._stroke=jn("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=v(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n=n||(t._fill=jn("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){re(t._container)},_bringToBack:function(t){oe(t._container)}},At.vml?jn:q),Xn=Hn.extend({_initContainer:function(){this._container=Zn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ne(this._container),Se(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,n;this._map._animatingZoom&&this._bounds||(Hn.prototype._update.call(this),e=(t=this._bounds).getSize(),n=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),pe(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=Zn("path");t.options.className&&se(e,t.options.className),t.options.interactive&&se(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ne(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path;t=t.options,e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ";e=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ",this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){re(t._path)},_bringToBack:function(t){oe(t._path)}});function qn(t){return At.svg||At.vml?new Xn(t):null}At.vml&&Xn.include(dt),Ve.include({getRenderer:function(t){return t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Wn(t)||qn(t)}});var Yn=xn.extend({initialize:function(t,e){xn.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Xn.create=Zn,Xn.pointsToPath=Y,wn.geometryToLayer=bn,wn.coordsToLatLng=Sn,wn.coordsToLatLngs=Mn,wn.latLngToCoords=Cn,wn.latLngsToCoords=Ln,wn.getFeature=An,wn.asFeature=Dn,Ve.mergeOptions({boxZoom:!0}),K=Q.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){be(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Se(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ne(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Zt(),me(),this._startPoint=this._map.mouseEventToContainerPoint(t),be(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ee("div","leaflet-zoom-box",this._container),se(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=(t=new R(this._point,this._startPoint)).getSize();pe(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ne(this._box),le(this._container,"leaflet-crosshair")),Xt(),ve(),Se(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ve.addInitHook("addHandler","boxZoom",K),Ve.mergeOptions({doubleClickZoom:!0}),ft=Q.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta;n=t.originalEvent.shiftKey?n-i:n+i,"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});var Kn=(Ve.addInitHook("addHandler","doubleClickZoom",ft),Ve.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),Q.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Ye(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),se(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){le(this._map._container,"leaflet-grab"),le(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=B(this._map.options.maxBounds),this._offsetLimit=k(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,n;this._map.options.inertia&&(e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(n),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=((r=this._draggable._newPos.x)-e+n)%t+e-n,r=(r+e+n)%t-e-n;t=Math.abs(i+n)e.getMaxZoom()&&1{"use strict";n.r(e),n.d(e,{EPSILON:()=>yt,HashMap:()=>ct,RADIAN_TO_DEGREE:()=>_t,assert:()=>rt,bind:()=>B,clone:()=>b,concatArray:()=>ft,createCanvas:()=>L,createHashMap:()=>dt,createObject:()=>pt,curry:()=>F,defaults:()=>C,disableUserSelect:()=>gt,each:()=>E,eqNaN:()=>$,extend:()=>M,filter:()=>R,find:()=>k,guid:()=>x,hasOwn:()=>mt,indexOf:()=>A,inherits:()=>D,isArray:()=>V,isArrayLike:()=>P,isBuiltInObject:()=>Z,isDom:()=>q,isFunction:()=>G,isGradientObject:()=>Y,isImagePatternObject:()=>K,isNumber:()=>W,isObject:()=>j,isPrimitive:()=>lt,isRegExp:()=>J,isString:()=>H,isStringSafe:()=>U,isTypedArray:()=>X,keys:()=>z,logError:()=>w,map:()=>O,merge:()=>T,mergeAll:()=>S,mixin:()=>I,noop:()=>vt,normalizeCssArray:()=>it,reduce:()=>N,retrieve:()=>Q,retrieve2:()=>tt,retrieve3:()=>et,setAsPrimitive:()=>st,slice:()=>nt,trim:()=>ot});var i="12px sans-serif";var r,o,a=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)h=u*t.length;else for(var c=0;c{"use strict";n.r(e),n.d(e,{fastLerp:()=>T,fastMapToColor:()=>S,lerp:()=>M,lift:()=>w,liftColor:()=>O,lum:()=>I,mapToColor:()=>C,modifyAlpha:()=>A,modifyHSL:()=>L,parse:()=>y,parseCssFloat:()=>c,parseCssInt:()=>h,random:()=>P,stringify:()=>D,toHex:()=>b});var i=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new i(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,r=this._map,o=null;if(null==r[t]){var a=n.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=n.head;n.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new i(e),s.key=t,n.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();var a=n(627),s={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function l(t){return(t=Math.round(t))<0?0:t>255?255:t}function u(t){return t<0?0:t>1?1:t}function h(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?l(parseFloat(e)/100*255):l(parseInt(e,10))}function c(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?u(parseFloat(e)/100):u(parseFloat(e))}function d(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function f(t,e,n){return t+(e-t)*n}function p(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function g(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var m=new o(20),v=null;function _(t,e){v&&g(v,e),v=m.put(t,v||e.slice())}function y(t,e){if(t){e=e||[];var n=m.get(t);if(n)return g(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in s)return g(e,s[i]),_(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(p(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),_(t,e),e):void p(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(p(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),_(t,e),e):void p(e,0,0,0,1):void 0;var a=i.indexOf("("),l=i.indexOf(")");if(-1!==a&&l+1===o){var u=i.substr(0,a),d=i.substr(a+1,l-(a+1)).split(","),f=1;switch(u){case"rgba":if(4!==d.length)return 3===d.length?p(e,+d[0],+d[1],+d[2],1):p(e,0,0,0,1);f=c(d.pop());case"rgb":return d.length>=3?(p(e,h(d[0]),h(d[1]),h(d[2]),3===d.length?f:c(d[3])),_(t,e),e):void p(e,0,0,0,1);case"hsla":return 4!==d.length?void p(e,0,0,0,1):(d[3]=c(d[3]),x(d,e),_(t,e),e);case"hsl":return 3!==d.length?void p(e,0,0,0,1):(x(d,e),_(t,e),e);default:return}}p(e,0,0,0,1)}}function x(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=c(t[1]),r=c(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return p(e=e||[],l(255*d(a,o,n+1/3)),l(255*d(a,o,n)),l(255*d(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function w(t,e){var n=y(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return D(n,4===n.length?"rgba":"rgb")}}function b(t){var e=y(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function T(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],h=i-r;return n[0]=l(f(a[0],s[0],h)),n[1]=l(f(a[1],s[1],h)),n[2]=l(f(a[2],s[2],h)),n[3]=u(f(a[3],s[3],h)),n}}var S=T;function M(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=y(e[r]),s=y(e[o]),h=i-r,c=D([l(f(a[0],s[0],h)),l(f(a[1],s[1],h)),l(f(a[2],s[2],h)),u(f(a[3],s[3],h))],"rgba");return n?{color:c,leftIndex:r,rightIndex:o,value:i}:c}}var C=M;function L(t,e,n,i){var r,o=y(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=(0,a.isFunction)(e)?e(o[0]):e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=c((0,a.isFunction)(n)?n(o[1]):n)),null!=i&&(o[2]=c((0,a.isFunction)(i)?i(o[2]):i)),D(x(o),"rgba")}function A(t,e){var n=y(t);if(n&&null!=e)return n[3]=u(e),D(n,"rgba")}function D(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function I(t,e){var n=y(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function P(){return D([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var E=new o(100);function O(t){if((0,a.isString)(t)){var e=E.get(t);return e||(e=w(t,-.1),E.put(t,e)),e}if((0,a.isGradientObject)(t)){var n=(0,a.extend)({},t);return n.colorStops=(0,a.map)(t.colorStops,(function(t){return{offset:t.offset,color:w(t.color,-.1)}})),n}return t}}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};n.r(t),n.d(t,{HashMap:()=>Wt,RADIAN_TO_DEGREE:()=>Jt,assert:()=>zt,bind:()=>vt,clone:()=>et,concatArray:()=>Zt,createCanvas:()=>at,createHashMap:()=>jt,createObject:()=>Xt,curry:()=>_t,defaults:()=>ot,disableUserSelect:()=>qt,each:()=>ct,eqNaN:()=>Pt,extend:()=>rt,filter:()=>pt,find:()=>gt,guid:()=>Q,hasOwn:()=>Yt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isArrayLike:()=>ht,isBuiltInObject:()=>Mt,isDom:()=>Lt,isFunction:()=>xt,isGradientObject:()=>At,isImagePatternObject:()=>Dt,isNumber:()=>Tt,isObject:()=>St,isPrimitive:()=>Gt,isRegExp:()=>It,isString:()=>wt,isStringSafe:()=>bt,isTypedArray:()=>Ct,keys:()=>mt,logError:()=>tt,map:()=>dt,merge:()=>nt,mergeAll:()=>it,mixin:()=>ut,noop:()=>Kt,normalizeCssArray:()=>kt,reduce:()=>ft,retrieve:()=>Et,retrieve2:()=>Ot,retrieve3:()=>Nt,setAsPrimitive:()=>Vt,slice:()=>Rt,trim:()=>Bt});var e={};n.r(e),n.d(e,{add:()=>ne,applyTransform:()=>xe,clone:()=>te,copy:()=>Qt,create:()=>$t,dist:()=>ge,distSquare:()=>ve,distance:()=>pe,distanceSquare:()=>me,div:()=>he,dot:()=>ce,len:()=>oe,lenSquare:()=>se,length:()=>ae,lengthSquare:()=>le,lerp:()=>ye,max:()=>be,min:()=>we,mul:()=>ue,negate:()=>_e,normalize:()=>fe,scale:()=>de,scaleAndAdd:()=>ie,set:()=>ee,sub:()=>re});var i={};n.r(i),n.d(i,{clone:()=>an,copy:()=>Qe,create:()=>Je,identity:()=>$e,invert:()=>on,mul:()=>tn,rotate:()=>nn,scale:()=>rn,translate:()=>en});var r={};n.r(r),n.d(r,{fastLerp:()=>Fi,fastMapToColor:()=>Vi,lerp:()=>Gi,lift:()=>zi,liftColor:()=>Yi,lum:()=>Zi,mapToColor:()=>Hi,modifyAlpha:()=>Wi,modifyHSL:()=>Ui,parse:()=>Ri,random:()=>Xi,stringify:()=>ji,toHex:()=>Bi});var o={};n.r(o),n.d(o,{dispose:()=>Bo,disposeAll:()=>Fo,getElementSSRData:()=>Ho,getInstance:()=>Vo,init:()=>zo,registerPainter:()=>Go,registerSSRDataGetter:()=>Uo,version:()=>Wo});var a={};n.r(a),n.d(a,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>Qp,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,OrientedBoundingRect:()=>Jg,Path:()=>Sl,Point:()=>ln,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,applyTransform:()=>_m,clipPointsByRect:()=>bm,clipRectByRect:()=>Tm,createIcon:()=>Sm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,groupTransition:()=>wm,initProps:()=>$u,isElementRemoved:()=>Qu,lineLineIntersect:()=>Cm,linePolygonIntersect:()=>Mm,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,removeElement:()=>th,removeElementWithFadeOut:()=>nh,resizePath:()=>fm,setTooltipConfig:()=>Am,subPixelOptimize:()=>mm,subPixelOptimizeLine:()=>pm,subPixelOptimizeRect:()=>gm,transformDirection:()=>ym,traverseElements:()=>Im,updateProps:()=>Ju});var s={};n.r(s),n.d(s,{createDimensions:()=>Lx,createList:()=>Ww,createScale:()=>Zw,createSymbol:()=>jv,createTextStyle:()=>qw,dataStack:()=>jw,enableHoverEmphasis:()=>Hu,getECData:()=>nu,getLayoutRect:()=>Oc,mixinAxisModelCommonMethods:()=>Xw});var l={};n.r(l),n.d(l,{MAX_SAFE_INTEGER:()=>na,asc:()=>Ko,getPercentWithPrecision:()=>ta,getPixelPrecision:()=>Qo,getPrecision:()=>Jo,getPrecisionSafe:()=>$o,isNumeric:()=>fa,isRadianAroundZero:()=>ra,linearMap:()=>Xo,nice:()=>ua,numericToNumber:()=>da,parseDate:()=>aa,quantile:()=>ha,quantity:()=>sa,quantityExponent:()=>la,reformIntervals:()=>ca,remRadian:()=>ia,round:()=>Yo});var u={};n.r(u),n.d(u,{format:()=>Qh,parse:()=>aa});var h={};n.r(h),n.d(h,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>Qp,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,clipPointsByRect:()=>bm,clipRectByRect:()=>Tm,createIcon:()=>Sm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,initProps:()=>$u,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,resizePath:()=>fm,updateProps:()=>Ju});var c={};n.r(c),n.d(c,{addCommas:()=>mc,capitalFirst:()=>Mc,encodeHTML:()=>ze,formatTime:()=>Sc,formatTpl:()=>bc,getTextRect:()=>hb,getTooltipMarker:()=>Tc,normalizeCssArray:()=>_c,toCamelCase:()=>vc,truncateText:()=>rs});var d={};n.r(d),n.d(d,{bind:()=>vt,clone:()=>et,curry:()=>_t,defaults:()=>ot,each:()=>ct,extend:()=>rt,filter:()=>pt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isFunction:()=>xt,isObject:()=>St,isString:()=>wt,map:()=>dt,merge:()=>nt,reduce:()=>ft});var f={};n.r(f),n.d(f,{Axis:()=>Sb,ChartView:()=>Fm,ComponentModel:()=>Gc,ComponentView:()=>Dp,List:()=>Cx,Model:()=>Ih,PRIORITY:()=>k_,SeriesModel:()=>Lp,color:()=>r,connect:()=>Ay,dataTool:()=>$y,dependencies:()=>I_,disConnect:()=>Iy,disconnect:()=>Dy,dispose:()=>Py,env:()=>O,extendChartView:()=>Ab,extendComponentModel:()=>Mb,extendComponentView:()=>Cb,extendSeriesModel:()=>Lb,format:()=>c,getCoordinateSystemDimensions:()=>Hy,getInstanceByDom:()=>Ey,getInstanceById:()=>Oy,getMap:()=>Ky,graphic:()=>h,helper:()=>s,init:()=>Ly,innerDrawElementOnCanvas:()=>v_,matrix:()=>i,number:()=>l,parseGeoJSON:()=>ub,parseGeoJson:()=>ub,registerAction:()=>Vy,registerCoordinateSystem:()=>Gy,registerLayout:()=>Uy,registerLoading:()=>Xy,registerLocale:()=>Fh,registerMap:()=>Yy,registerPostInit:()=>zy,registerPostUpdate:()=>By,registerPreprocessor:()=>Ry,registerProcessor:()=>ky,registerTheme:()=>Ny,registerTransform:()=>Jy,registerUpdateLifecycle:()=>Fy,registerVisual:()=>Wy,setCanvasCreator:()=>qy,setPlatformAPI:()=>V,throttle:()=>Um,time:()=>u,use:()=>Jw,util:()=>d,vector:()=>e,version:()=>D_,zrUtil:()=>t,zrender:()=>o});var p=n(214),g=n.n(p);const m={metadata:!0,svgRender:!1,switchMode:!1,maxPointsFetched:1e4,loadMoreAtZoomLevel:9,clustering:!1,clusteringThreshold:100,disableClusteringAtLevel:8,clusterRadius:80,clusterSeparation:20,showMetaOnNarrowScreens:!1,showLabelsAtZoomLevel:13,showGraphLabelsAtZoom:null,crs:g().CRS.EPSG3857,echartsOption:{aria:{show:!0,description:"This is a force-oriented graph chart that depicts the relationship between ip nodes."},toolbox:{show:!0,iconStyle:{borderColor:"#fff"},feature:{restore:{show:!0,title:"Restore view"},saveAsImage:{show:!0,title:"Save image"}}}},graphConfig:{series:{layout:"force",label:{show:!0,color:"#fff",position:"top"},labelLayout:{hideOverlap:!0},force:{gravity:.1,edgeLength:[20,60],repulsion:120},roam:!0,draggable:!0,legendHoverLink:!0,emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}},nodeStyle:{color:"#ffebc4"},linkStyle:{width:6,color:"#1ba619"},nodeSize:"15"},baseOptions:{backgroundColor:"#282222",media:[{query:{minWidth:320,maxWidth:500},option:{series:[{zoom:.7}],toolbox:{itemSize:18}}},{query:{minWidth:501},option:{series:[{zoom:1}],toolbox:{itemSize:15}}},{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapOptions:{roam:!0,zoomAnimation:!1,worldCopyJump:!0,minZoom:3,maxZoom:18,nodeConfig:{type:"scatter",label:{show:!1,color:"var(--ow-color-black)000",position:"top",formatter:"{b}",fontSize:13,backgroundColor:"rgba(255, 255, 255, 0.8)",padding:[6,8],borderRadius:5},emphasis:{scale:1},nodeStyle:{color:"#1566a9"},nodeSize:"17"},linkConfig:{linkStyle:{width:5,color:"#1ba619"},emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}}},clusterConfig:{symbolSize:30,itemStyle:{color:"#1566a9"},tooltip:{show:!1},label:{show:!0,position:"inside",color:"#fff",offset:[0,0],backgroundColor:"transparent"}},baseOptions:{toolbox:{show:!1},media:[{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapTileConfig:[{urlTemplate:"MISSING_ENV_VAR".MAPBOX_URL_TEMPLATE||"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[{name:"ok",nodeStyle:{color:"#1ba619"}},{name:"problem",nodeStyle:{color:"#ffa500"}},{name:"critical",nodeStyle:{color:"#c92517"}}],linkCategories:[],bookmarkableActions:{enabled:!1,id:null,zoomOnRestore:!0,zoomLevel:null},prepareData(t){t&&t.nodes&&t.nodes.forEach((t=>{if(t.properties&&t.properties.status){const e=t.properties.status.toLowerCase();"ok"!==e&&"problem"!==e&&"critical"!==e||(t.category=e)}}))},onClickElement(t,e){let n;this.utils&&this.utils.isNetJSON(this.data)?(n="node"===t?this.utils.nodeInfo(e):"link"===t?this.utils.linkInfo(e):e,(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):({nodeLinkData:n}={nodeLinkData:e}),this.gui.getNodeLinkInfo(t,n),this.gui.sideBar.classList.remove("hidden")},onReady(){}},{prepareData:v}=m,_={...m},y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class x{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const r=y[15&n];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new x(a,o,r,t)}constructor(t,e=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=y.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return w(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=a){for(let a=c;a<=h;a++){const s=o[2*a],u=o[2*a+1];s>=t&&s<=n&&u>=e&&u<=i&&l.push(r[a])}continue}const d=c+h>>1,f=o[2*d],p=o[2*d+1];f>=t&&f<=n&&p>=e&&p<=i&&l.push(r[d]),(0===u?t<=f:e<=p)&&(s.push(c),s.push(d-1),s.push(1-u)),(0===u?n>=f:i>=p)&&(s.push(d+1),s.push(h),s.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:r,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=n*n;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,c=a.pop()||0;if(h-c<=o){for(let n=c;n<=h;n++)M(r[2*n],r[2*n+1],t,e)<=l&&s.push(i[n]);continue}const d=c+h>>1,f=r[2*d],p=r[2*d+1];M(f,p,t,e)<=l&&s.push(i[d]),(0===u?t-n<=f:e-n<=p)&&(a.push(c),a.push(d-1),a.push(1-u)),(0===u?t+n>=f:e+n>=p)&&(a.push(d+1),a.push(h),a.push(1-u))}return s}}function w(t,e,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;b(t,e,a,i,r,o),w(t,e,n,i,a-1,1-o),w(t,e,n,a+1,r,1-o)}function b(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);b(t,e,n,Math.max(i,Math.floor(n-s*u/a+h)),Math.min(r,Math.floor(n+(a-s)*u/a+h)),o)}const a=e[2*n+o];let s=i,l=r;for(T(t,e,i,n),e[2*r+o]>a&&T(t,e,i,r);sa;)l--}e[2*i+o]===a?T(t,e,i,l):(l++,T(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function T(t,e,n,i){S(t,n,i),S(e,2*n,2*i),S(e,2*n+1,2*i+1)}function S(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function M(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}const C=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"}).then((t=>t)).catch((t=>{console.error(t)})):Promise.resolve(t)}async paginatedDataParse(t){let e,n;try{let i=await this.utils.JSONParamParse(t);if(i.json)for(e=await i.json(),n=e.results?e.results:e;e.next&&n.nodes.length<=this.config.maxPointsFetched;)i=await this.utils.JSONParamParse(e.next),e=await i.json(),n.nodes=n.nodes.concat(e.results.nodes),n.links=n.links.concat(e.results.links),e.next?this.hasMoreData=!0:this.hasMoreData=!1;else n=i}catch(t){console.error(t)}return n}async getBBoxData(t,e){let n;try{const i=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(i);n=await r.json()}catch(t){console.error(t)}return n}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:n=(new Date).getTimezoneOffset()/60}){const i=e.exec(t);if(!i||i.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=i[1]%4==0&&i[1]%100!=0||i[1]%400==0,s=new Map([["dateMonth",12],["dateDay",[31,a?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(i[t],10);let l,u=-n;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=u;break}l="dateDay"===r[t-1]?s.get("dateDay")[o.dateMonth-1]:s.get(r[t-1]);let e=o[r[t-1]]+u;u="dateHour"===r[t-1]?e<0?-1:e>=l?1:0:e<=0?-1:e>l?1:0,1===u?e-=l:u<0&&("dateDay"===r[t-1]&&(l=s.get("dateDay")[(o[r[t-1]]+10)%11]),e+=l),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(i[5])}:${this.numberMinDigit(i[6])}${i[7]?`.${this.numberMinDigit(i[7],3)}`:""}`}numberMinDigit(t,e=2,n="0"){return(Array(e).join(n)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&(this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links))}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&(this.isObject(t)&&this.isArray(t.geometry))}geojsonToNetjson(t){return function(t){const e=[],n=[];if(!t||!Array.isArray(t.features))return{nodes:e,links:n};const i=new Map,r=(t,n={})=>{const r=`${t[0]},${t[1]}`;if(i.has(r))return i.get(r);const o=n.id||n.node_id||null,a=n.label||n.name||o||null,s=o?String(o):`gjn_${e.length}`,l=!o,u={id:s,...a?{label:String(a)}:{},location:{lng:t[0],lat:t[1]},properties:{...n,location:{lng:t[0],lat:t[1]}},_generatedIdentity:l};return e.push(u),i.set(r,s),s},o=(t,e,i={})=>{n.push({source:t,target:e,properties:i})},a=(t,e,n=!1)=>{for(let n=0;n2){const n=r(t[0],e),i=r(t[t.length-1],e);o(i,n,e)}},s=(t,e)=>{if(!t)return;const{type:n,coordinates:i,geometries:o}=t;switch(n){case"Point":r(i,{...e,_featureType:"Point"});break;case"MultiPoint":i.forEach((t=>r(t,{...e,_featureType:"Point"})));break;case"LineString":a(i,{...e,_featureType:"LineString"},!1);break;case"MultiLineString":i.forEach((t=>a(t,{...e,_featureType:"LineString"},!1)));break;case"Polygon":case"MultiPolygon":break;case"GeometryCollection":o.forEach((t=>s(t,e)));break;default:console.warn(`Unsupported GeoJSON geometry type: ${n}`)}};return t.features.forEach((t=>{const e={...t.properties||{},...void 0!==t.id&&null!==t.id?{id:t.id}:{}};s(t.geometry,e)})),{nodes:e,links:n}}(t)}deepCopy(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>this.deepCopy(t)));const e={};return Object.keys(t).forEach((n=>{e[n]=this.deepCopy(t[n])})),e}fastDeepCopy(t){return"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t))}deepMergeObj(...t){const e=[...t].reverse(),n=e.length;for(let t=0;t{i[t]&&this.isObject(i[t])&&this.isObject(n[t])?this.deepMergeObj(i[t],n[t]):i[t]=n[t]})):i||(e[t+1]=n)}return e[n-1]}makeCluster(t){const{nodes:e,links:n}=t.data,i=t=>!(t.properties&&t.properties._featureType)||"Point"===t.properties._featureType,r=e.filter(i),o=e.filter((t=>!i(t))),a=[],s=[],l=new Map;o.forEach((t=>l.set(t.id,null)));let u=0;r.forEach((e=>{const n=e.properties&&e.properties.location||e.location;if(!n||void 0===n.lat||void 0===n.lng)return;e.location=n,e._origLocation?(n.lat=e._origLocation.lat,n.lng=e._origLocation.lng):e._origLocation={lat:n.lat,lng:n.lng};const i=t.leaflet.latLngToContainerPoint([n.lat,n.lng]);e.x=i.x,e.y=i.y,e.visited=!1,e.cluster=null}));const h=new x(r.length);r.forEach((({x:t,y:e})=>h.add(t,e))),h.finish();const c=t.config&&t.config.mapOptions&&t.config.mapOptions.clusterConfig&&t.config.mapOptions.clusterConfig.symbolSize,d=t=>{if("function"==typeof c)try{return c(t)}catch(t){return 30}return Array.isArray(c)?c[0]||30:"number"==typeof c?c:30},f=new Map;r.forEach((e=>{if(e.visited)return;const n=h.within(e.x,e.y,t.config.clusterRadius).map((t=>r[t]));if(n.length>1){const i=`${Math.round(e.x)},${Math.round(e.y)}`;f.has(i)||f.set(i,new Map);const r=f.get(i);n.forEach((e=>{if(e.visited)return;const n=t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]:"default";r.has(n)||r.set(n,[]),r.get(n).push(e),e.visited=!0}))}else e.visited=!0,l.set(e.id,null),o.push(e)})),f.forEach((e=>{const n=Array.from(e.entries()),i=n.length;let r=0;n.forEach((([,t])=>{const e=d(t.length);e>r&&(r=e)}));const a="number"==typeof t.config.clusterSeparation?t.config.clusterSeparation:Math.max(10,Math.floor(t.config.clusterRadius/2));let h=0;if(i>1){const t=Math.PI/i,e=Math.sin(t);e>0&&(h=r/(2*e))}const c=Math.max(a,h+4);n.forEach((([,e],n)=>{if(e.length>1){let r=0,o=0;if(e.forEach((t=>{t.cluster=u,l.set(t.id,t.cluster),r+=t.location.lng,o+=t.location.lat})),r/=e.length,o/=e.length,i>1){const e=2*Math.PI*n/i,a=t.leaflet.latLngToContainerPoint([o,r]),s=[a.x+c*Math.cos(e),a.y+c*Math.sin(e)],l=t.leaflet.containerPointToLatLng(s);r=l.lng,o=l.lat}const a={id:u,cluster:!0,name:e.length,value:[r,o],childNodes:e,...t.config.mapOptions.clusterConfig};if(t.config.clusteringAttribute){const n=t.config.nodeCategories.find((n=>n.name===e[0].properties[t.config.clusteringAttribute]));n&&(a.itemStyle={...a.itemStyle,color:n.nodeStyle.color})}s.push(a),u+=1}else if(1===e.length){const t=e[0];l.set(t.id,null),o.push(t)}}))})),n.forEach((t=>{null===l.get(t.source)&&null===l.get(t.target)&&a.push(t)}));const p=[...s.map((t=>({ref:t,isCluster:!0,count:t.childNodes.length,get value(){return t.value},set value([e,n]){t.value=[e,n]}}))),...o.filter(i).map((t=>({ref:t,isCluster:!1,count:1,get value(){return[t.location.lng,t.location.lat]},set value([e,n]){t.location.lng=e,t.location.lat=n}})))];if(p.length>1){const e=p.map((e=>{const[n,i]=e.value,r=t.leaflet.latLngToContainerPoint([i,n]);return{ref:e.ref,isCluster:e.isCluster,x:r.x,y:r.y,r:d(e.count)/2,setValue:([t,n])=>{e.value=[t,n]}}})),n=4,i=5;for(let t=0;t0&&s{const n=t.leaflet.containerPointToLatLng([e.x,e.y]);e.isCluster?e.ref.value=[n.lng,n.lat]:(e.ref.location.lng=n.lng,e.ref.location.lat=n.lat)}))}return{clusters:s,nonClusterNodes:o,nonClusterLinks:a}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),n=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=n,o.innerHTML=t[n],i.appendChild(r),i.appendChild(o),e.appendChild(i)}))}}getMetadata(t){const e=t,n={};return e.label&&(n.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach((t=>{e[t]&&(n[t]=e[t])})),n.nodes=e.nodes.length,n.links=e.links.length,n}nodeInfo(t){const e={};!t._generatedIdentity&&(e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label)),t.name&&(e.name=t.name),t.location&&(e.location=t.location);let n=null;Array.isArray(t.clients)?n=t.clients:t.properties&&Array.isArray(t.properties.clients)&&(n=t.properties.clients);let i=0;n?i=n.length:"number"==typeof t.clients?i=t.clients:t.properties&&"number"==typeof t.properties.clients&&(i=t.properties.clients),i>0&&(e.clients=i),n&&n.length&&n.forEach(((t,n)=>{e[`clients [${n+1}]`]=t}));const r=(t,e)=>"location"===t&&e&&"object"==typeof e?{lat:e.lat,lng:e.lng}:"time"===t&&"string"==typeof e?this.dateParse({dateString:e}):e,o=t._source&&this.isObject(t._source)?t._source:t;if(Object.keys(o).forEach((t=>{if("properties"===t||"clients"===t||"_source"===t||"_generatedIdentity"===t||"local_addresses"===t||"linkCount"===t)return;const n=r(t,o[t]);null!=n&&""!==n&&(e[t]=n)})),o.properties&&this.isObject(o.properties)&&Object.keys(o.properties).forEach((t=>{if("clients"===t)return;const n=r(t,o.properties[t]);null==n||"string"==typeof n&&""===n.trim()||(e[t]=n)})),t.linkCount&&(e.links=t.linkCount),Array.isArray(o.local_addresses)){const t=o.local_addresses.map((t=>"string"==typeof t?t:t&&"string"==typeof t.address?t.address:null)).filter((t=>t));t.length&&(e.localAddresses=t)}return t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const n=document.createElement("div");n.classList.add("njg-tooltip-item");const i=document.createElement("span");i.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),i.innerHTML=t,r.innerHTML=e,n.appendChild(i),n.appendChild(r),n}getNodeTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=!t._generatedIdentity;return n&&t.id&&e.appendChild(this.createTooltipItem("id",t.id)),n&&t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach((i=>{if("object"!=typeof t.properties[i]&&!i.startsWith("_")&&("id"!==i&&"label"!==i||!n))if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
"))),e}getLinkTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||e.appendChild(this.createTooltipItem("source",t.source)),n(t.target)||e.appendChild(this.createTooltipItem("target",t.target)),void 0!==t.cost&&null!==t.cost&&e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e.appendChild(this.createTooltipItem("time",t))}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e.appendChild(this.createTooltipItem(`${n.replace(/_/g," ")}`,t))}})),e}linkInfo(t){const e={},n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||(e.source=t.source),n(t.target)||(e.target=t.target),void 0!==t.cost&&null!==t.cost&&(e.cost=t.cost),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e[n]=t}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e[n.replace(/_/g," ")]=t}})),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,n){let i,r={},o={},a=!1;if(t.category&&e.nodeCategories&&e.nodeCategories.length){const n=e.nodeCategories.find((e=>e.name===t.category));if(n){a=!0,i=this.generateStyle(n.nodeStyle||{},t),r=this.generateStyle(n.nodeSize||{},t);let e={},s={};n.emphasis&&(e=this.generateStyle(n.emphasis.nodeStyle||{},t),s=this.generateStyle(n.emphasis.nodeSize||{},t),o={nodeStyle:e,nodeSize:s})}}if(!a)if("map"===n){const n=e.mapOptions&&e.mapOptions.nodeConfig;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.nodeStyle||{},t),nodeSize:this.generateStyle(a&&a.nodeSize||{},t)})}else{const n=e.graphConfig&&e.graphConfig.series;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.itemStyle||{},t),nodeSize:this.generateStyle(a&&a.symbolSize||r||{},t)})}return{nodeStyleConfig:i,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,n){let i,r={};if(t.category&&e.linkCategories.length){const n=e.linkCategories.find((e=>e.name===t.category));i=this.generateStyle(n.linkStyle||{},t),r={...r,linkStyle:n.emphasis?this.generateStyle(n.emphasis.linkStyle||{},t):{}}}else i="map"===n?this.generateStyle(e.mapOptions.linkConfig.linkStyle,t):this.generateStyle(e.graphConfig.series.linkStyle,t);return{linkStyleConfig:i,linkEmphasisConfig:r}}showLoading(){let t=this.el.querySelector(".njg-loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.classList.add("njg-loadingContainer"),t.innerHTML='\n
\n
\n

Loading...

\n
\n ',this.el.appendChild(t)),t}hideLoading(){const t=this.el.querySelector(".njg-loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...n){t.set(e,[...t.get(e)||[],...n])},once(t,...n){e.set(t,[...e.get(t)||[],...n])},emit(n){const i=t.get(n)||[],r=e.get(n)||[],o=i.map((t=>t())),a=r.map((t=>t()));return e.delete(n),[...o,...a]},delete(n){t.delete(n),e.delete(n)}}}parseUrlFragments(){let t;try{t=decodeURIComponent(window.location.hash.replace(/^#/,""))}catch(e){t=window.location.hash.replace(/^#/,"")}const e={};return t.split(";").forEach((t=>{const n=new URLSearchParams(t),i=n.get("id");null!=i&&(e[i]=n)})),e}updateUrlFragments(t,e){const n=Object.values(t).map((t=>t.toString())).join(";").replace(/([^&=]+)=([^&;]*)/g,((t,e,n)=>`${e}=${encodeURIComponent(n.replace(/%7E/gi,"~"))}`));window.history.pushState(e,"",`#${n}`)}addActionToUrl(t,e){if(!t.config.bookmarkableActions.enabled||!e.data||e.data.cluster)return;if(!t.nodeLinkIndex)return void console.error("Lookup object for node or link not found.");const n=this.parseUrlFragments(),{id:i}=t.config.bookmarkableActions;let r;if(t.config.render===t.utils.graphRender){if("node"===e.dataType)r=e.data.id;else if("edge"===e.dataType){const{source:t,target:n}=e.data;r=`${t}~${n}`}}else if(t.config.render===t.utils.mapRender)if("scatter"===e.seriesType)r=e.data.node.id;else if("lines"===e.seriesType){const{source:t,target:n}=e.data.link;r=`${t}~${n}`}if(!r||!t.nodeLinkIndex[r])return void console.error("nodeId not found in nodeLinkIndex lookup.");n[i]||(n[i]=new URLSearchParams,n[i].set("id",i)),n[i].set("nodeId",r);const o=t.nodeLinkIndex[r];this.updateUrlFragments(n,o)}removeUrlFragment(t){const e=this.parseUrlFragments();e[t]&&delete e[t];const n={id:t};this.updateUrlFragments(e,n)}applyUrlFragmentState(t){if(!t.config.bookmarkableActions.enabled)return;const{id:e}=t.config.bookmarkableActions,n=t.utils.parseUrlFragments(),i=n[e]&&n[e].get?n[e]:null,r=i&&i.get?i.get("nodeId"):void 0;if(!r||!t.nodeLinkIndex||null==t.nodeLinkIndex[r])return;const[o,a]=r.split("~"),s=t.nodeLinkIndex[r],l=t.config.graphConfig&&t.config.graphConfig.series&&t.config.graphConfig.series.type||t.config.mapOptions&&t.config.mapOptions.nodeConfig&&t.config.mapOptions.nodeConfig.type,{location:u,cluster:h}=s||{};if(t.config.bookmarkableActions.zoomOnRestore&&["scatter","effectScatter"].includes(l)&&null==a&&null!=u){const e=[u.lat,u.lng],n=null!=h?t.config.disableClusteringAtLevel:t.config.bookmarkableActions.zoomLevel||t.config.showLabelsAtZoomLevel;t.leaflet&&t.leaflet.setView(e,n)}"function"==typeof t.config.onClickElement&&t.config.onClickElement.call(t,o&&a?"link":"node",s)}setupHashChangeHandler(t){return t._popstateHandler&&window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=()=>{this.applyUrlFragmentState(t)},window.addEventListener("popstate",t._popstateHandler),()=>{window.removeEventListener("popstate",t._popstateHandler),t._popstateHandler=null}}moveNodeInRealTime(t,e){if(!this.echarts||"function"!=typeof this.echarts.getOption)return void console.warn("moveNodeInRealTime: ECharts instance not ready");const n=this.echarts.getOption();if(!n||!Array.isArray(n.series))return void console.warn("moveNodeInRealTime: No series data available");const i=n.series.find((t=>"scatter"===t.type||"effectScatter"===t.type));if(!i)return void console.warn("moveNodeInRealTime: No scatter series found");const r=i.data.findIndex((e=>e.node.id===t));if(-1===r)return void console.warn(`moveNodeInRealTime: Node with id "${t}" not found`);const o=i.data[r],{node:a}=o;a.location=e,a.properties?(a.properties.location=e,o.value=[e.lng,e.lat],this.nodeLinkIndex[t].location=e,this.nodeLinkIndex[t].properties&&(this.nodeLinkIndex[t].properties.location=e,this.echarts.setOption({series:n.series}))):console.warn("moveNodeInRealTime: Node properties not found")}};const L=class extends C{searchElements(t){const e=this,n={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=i=>{n[i.state.searchValue]?e.utils.JSONDataUpdate.call(e,n[i.state.searchValue].data).then((()=>{e.JSONParam=n[i.state.searchValue].param})):e.utils.JSONDataUpdate.call(e,t+i.state.searchValue)},function(i,r=!0,o=!0){const a=i.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then((()=>{n[a]={data:{...e.data},param:[...e.JSONParam]}}))}}JSONDataUpdate(t,e=!0,n=!0){const i=this;return i.config.onUpdate.call(i),i.utils.paginatedDataParse.call(i,t).then((r=>{function o(){e?(i.JSONParam=[t],i.utils.overrideData(r,i)):(i.JSONParam.push(t),i.config.render===i.utils.mapRender?i.utils.appendData(r,i):i.utils.addData(r,i)),i.utils.isNetJSON(i.data)&&i.utils.updateMetadata.call(i)}return n?(i.utils.isNetJSON(i.data)&&i.config.prepareData.call(i,r),i.config.dealDataByWorker?i.utils.dealDataByWorker.call(i,r,i.config.dealDataByWorker,o):o()):o(),r})).catch((t=>{console.error(t)}))}dealDataByWorker(t,e,n){const i=new Worker(e),r=this;i.postMessage(t),i.addEventListener("error",(t=>{console.error(t),console.error("Error in dealing JSONData!")})),i.addEventListener("message",(t=>{n?n():(r.utils.overrideData(t.data,r),r.utils.isNetJSON(r.data)&&r.utils.updateMetadata.call(r))}))}overrideData(t,e){e.data=t,e.utils.isNetJSON(e.data)||e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}};const A=class{constructor(t){this.utils=new L,this.config=this.utils.deepCopy(_),this.config.crs=_.crs,this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){if(this.utils.deepMergeObj(this.config,t),this.el)t&&t.el&&console.error("Can't change el again!");else if(this.config.el?this.utils.isElement(this.config.el)?this.el=this.config.el:this.el=document.querySelector(this.config.el):this.el=document.body,this.el){if(this.el.classList.add("njg-container"),this.el===document.body){const t=document.documentElement;t.style.width="100%",t.style.height="100%",this.el.classList.add("njg-relativePosition")}}else console.error("NetJSONGraph: The specified element for rendering was not found and could not be set.");return this.config}render(){const[t,...e]=this.JSONParam;this.config.onRender.call(this);const n=new Promise((t=>{this.event.once("onReady",(async()=>{try{await this.config.onReady.call(this)}catch(t){console.error("onReady callback failed:",t)}t()}))}));if(this.event.once("onLoad",this.config.onLoad.bind(this)),this.event.once("applyUrlFragmentState",(async()=>{try{await n}catch(t){console.error("onReady failed:",t)}this.utils.applyUrlFragmentState.call(this,this)})),this.utils.paginatedDataParse.call(this,t).then((t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson",this.originalGeoJSON=this.utils.fastDeepCopy(t),t=this.utils.geojsonToNetjson(t)}if(this.utils.isNetJSON(t)){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set;this.nodeLinkIndex={},t.nodes.forEach((t=>{e.add(t.id),this.nodeLinkIndex[t.id]=t})),t.links=t.links.filter((t=>{if(e.has(t.source)&&e.has(t.target)){const e=`${t.source}~${t.target}`;return this.nodeLinkIndex[e]=t,!0}return e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1}))}this.config.prepareData.call(this,t),this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())})).catch((t=>{console.error(t)})),e.length){const n=function(){e.map((t=>this.utils.JSONDataUpdate.call(this,t,!1)))};this.JSONParam=[t],this.event.once("renderArray",n.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),"function"==typeof e.utils.moveNodeInRealTime&&(e.utils.moveNodeInRealTime=e.utils.moveNodeInRealTime.bind(e)),e.utils}}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -18,7 +18,7 @@ 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 D=function(t,e){return D=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])},D(t,e)};function I(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}Object.create;Object.create;var P=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},E=new function(){this.browser=new P,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(E.wxa=!0,E.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?E.worker=!0:!E.hasGlobalWindow||"Deno"in window?(E.node=!0,E.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,E);const O=E;var N="sans-serif",R="12px "+N;var k,z,B=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)o=r*t.length;else for(var a=0;a>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",r[l]+":0",i[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}(e,o),s=function(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,d=h.left,f=h.top;a.push(d,f),l=l&&o&&d===o[c]&&f===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?Ie(s,a):Ie(a,s))}(a,o,r);if(s)return s(t,n,i),!0}return!1}function Ne(t){return"CANVAS"===t.nodeName.toUpperCase()}var Re=/([&<>"'])/g,ke={"&":"&","<":"<",">":">",'"':""","'":"'"};function ze(t){return null==t?"":(t+"").replace(Re,(function(t,e){return ke[e]}))}var Be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Fe=[],Ve=O.browser.firefox&&+O.browser.version.split(".")[0]<39;function Ge(t,e,n,i){return n=n||{},i?He(t,e,n):Ve&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):He(t,e,n),n}function He(t,e,n){if(O.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(Ne(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(Oe(Fe,t,i,r))return n.zrX=Fe[0],void(n.zrY=Fe[1])}n.zrX=n.zrY=0}function Ue(t){return t||window.event}function We(t,e,n){if(null!=(e=Ue(e)).zrX)return e;var i=e.type;if(i&&i.indexOf("touch")>=0){var r="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];r&&Ge(t,r,e,n)}else{Ge(t,e,e,n);var o=function(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=0!==i?Math.abs(i):Math.abs(n),o=i>0?-1:i<0?1:n>0?-1:1;return 3*r*o}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&Be.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function je(t,e,n,i){t.addEventListener(e,n,i)}var Ze=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function Xe(t){return 2===t.which||3===t.which}var qe=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;o1&&r&&r.length>1){var a=Ye(r)/Ye(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((i=r)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}};function Je(){return[1,0,0,1,0,0]}function $e(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Qe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function tn(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function en(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function nn(t,e,n,i){void 0===i&&(i=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],u=e[5],h=Math.sin(n),c=Math.cos(n);return t[0]=r*c+s*h,t[1]=-r*h+s*c,t[2]=o*c+l*h,t[3]=-o*h+c*l,t[4]=c*(a-i[0])+h*(u-i[1])+i[0],t[5]=c*(u-i[1])-h*(a-i[0])+i[1],t}function rn(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function on(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function an(t){var e=[1,0,0,1,0,0];return Qe(e,t),e}var sn=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}();const ln=sn;var un=Math.min,hn=Math.max,cn=new ln,dn=new ln,fn=new ln,pn=new ln,gn=new ln,mn=new ln,vn=function(){function t(t,e,n,i){n<0&&(t+=n,n=-n),i<0&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=un(t.x,this.x),n=un(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=hn(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=hn(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=[1,0,0,1,0,0];return en(r,r,[-e.x,-e.y]),rn(r,r,[n,i]),en(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,d=!(op&&(p=y,gp&&(p=x,v<_?ln.set(mn,0,-v):ln.set(mn,0,_)):y=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}cn.x=fn.x=n.x,cn.y=pn.y=n.y,dn.x=pn.x=n.x+n.width,dn.y=fn.y=n.y+n.height,cn.transform(i),pn.transform(i),dn.transform(i),fn.transform(i),e.x=un(cn.x,dn.x,fn.x,pn.x),e.y=un(cn.y,dn.y,fn.y,pn.y);var l=hn(cn.x,dn.x,fn.x,pn.x),u=hn(cn.y,dn.y,fn.y,pn.y);e.width=l-e.x,e.height=u-e.y}else e!==n&&t.copy(e,n)},t}();const _n=vn;var yn="silent";function xn(){Ze(this.event)}var wn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return I(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Le),bn=function(t,e){this.x=t,this.y=e},Tn=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Sn=new _n(0,0,0,0),Mn=function(t){function e(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new bn(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new wn,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new Me(a),a}return I(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(ct(Tn,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=An(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=i?new bn(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new bn(0,0)},e.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,n){var i=(t=t||{}).target;if(!i||!i.silent){for(var r="on"+e,o=function(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:xn}}(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new bn(t,e);if(Ln(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new _n(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(Sn.copy(h.getBoundingRect()),h.transform&&Sn.applyTransform(h.transform),Sn.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,f=0;f=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=Cn(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==yn)){e.target=a;break}}}function An(t,e,n){var i=t.painter;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}ct(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){Mn.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=An(this,r,o);if("mouseup"===t&&a||(i=(n=this.findHover(r,o)).target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||ge(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}}));const Dn=Mn;function In(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function Pn(t,e,n,i,r){for(i===e&&i++;i>>1])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function En(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function On(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function Nn(t,e){var n,i,r=7,o=0,a=[];function s(s){var l=n[s],u=i[s],h=n[s+1],c=i[s+1];i[s]=u+c,s===o-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),o--;var d=On(t[h],t,l,u,0,e);l+=d,0!==(u-=d)&&0!==(c=En(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(n,i,o,s){var l=0;for(l=0;l=7||f>=7);if(p)break;g<0&&(g=0),g+=2}if((r=g)<1&&(r=1),1===i){for(l=0;l=0;l--)t[f+l]=t[d+l];return void(t[c]=a[h])}var p=r;for(;;){var g=0,m=0,v=!1;do{if(e(a[h],t[u])<0){if(t[c--]=t[u--],g++,m=0,0==--i){v=!0;break}}else if(t[c--]=a[h--],m++,g=0,1==--s){v=!0;break}}while((g|m)=0;l--)t[f+l]=t[d+l];if(0===i){v=!0;break}}if(t[c--]=a[h--],1==--s){v=!0;break}if(0!==(m=s-En(t[u],a,0,s,s-1,e))){for(s-=m,f=(c-=m)+1,d=(h-=m)+1,l=0;l=7||m>=7);if(v)break;p<0&&(p=0),p+=2}(r=p)<1&&(r=1);if(1===s){for(f=(c-=i)+1,d=(u-=i)+1,l=i-1;l>=0;l--)t[f+l]=t[d+l];t[c]=a[h]}else{if(0===s)throw new Error;for(d=c-(s-1),l=0;l1;){var t=o-2;if(t>=1&&i[t-1]<=i[t]+i[t+1]||t>=2&&i[t-2]<=i[t]+i[t-1])i[t-1]i[t+1])break;s(t)}},forceMergeRuns:function(){for(;o>1;){var t=o-2;t>0&&i[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=In(t,n,i,e))s&&(l=s),Pn(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}}var kn=1,zn=4,Bn=!1;function Fn(){Bn||(Bn=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function Vn(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var Gn=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Vn}return t.prototype.traverse=function(t,e){for(var n=0;n0&&(u.__clipPaths=[]),isNaN(u.z)&&(Fn(),u.z=0),isNaN(u.z2)&&(Fn(),u.z2=0),isNaN(u.zlevel)&&(Fn(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;e=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const Hn=Gn;const Un=O.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var Wn={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-Wn.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*Wn.bounceIn(2*t):.5*Wn.bounceOut(2*t-1)+.5}};const jn=Wn;var Zn=Math.pow,Xn=Math.sqrt,qn=1e-8,Yn=1e-4,Kn=Xn(3),Jn=1/3,$n=$t(),Qn=$t(),ti=$t();function ei(t){return t>-1e-8&&tqn||t<-1e-8}function ii(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function ri(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function oi(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(ei(h)&&ei(c)){if(ei(s))o[0]=0;else(S=-l/s)>=0&&S<=1&&(o[f++]=S)}else{var p=c*c-4*h*d;if(ei(p)){var g=c/h,m=-g/2;(S=-s/a+g)>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=Xn(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(S=(-s-((_=_<0?-Zn(-_,Jn):Zn(_,Jn))+(y=y<0?-Zn(-y,Jn):Zn(y,Jn))))/(3*a))>=0&&S<=1&&(o[f++]=S)}else{var x=(2*h*s-3*a*c)/(2*Xn(h*h*h)),w=Math.acos(x)/3,b=Xn(h),T=Math.cos(w),S=(-s-2*b*T)/(3*a),M=(m=(-s+b*(T+Kn*Math.sin(w)))/(3*a),(-s+b*(T-Kn*Math.sin(w)))/(3*a));S>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}function ai(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(ei(a)){if(ni(o))(h=-s/o)>=0&&h<=1&&(r[l++]=h)}else{var u=o*o-4*a*s;if(ei(u))r[0]=-o/(2*a);else if(u>0){var h,c=Xn(u),d=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}function si(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function li(t,e,n,i,r,o,a,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;$n[0]=l,$n[1]=u;for(var _=0;_<1;_+=.05)Qn[0]=ii(t,n,r,a,_),Qn[1]=ii(e,i,o,s,_),(p=ve($n,Qn))=0&&p=0&&m=1?1:oi(0,i,o,1,t,s)&&ii(0,r,a,1,s[0])}}}const _i=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||Kt,this.ondestroy=t.ondestroy||Kt,this.onrestart=t.onrestart||Kt,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=xt(t)?t:jn[t]||vi(t)},t}();var yi=function(t){this.value=t},xi=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new yi(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),wi=function(){function t(t){this._list=new xi,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new yi(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const bi=wi;var Ti={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Si(t){return(t=Math.round(t))<0?0:t>255?255:t}function Mi(t){return t<0?0:t>1?1:t}function Ci(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Si(parseFloat(e)/100*255):Si(parseInt(e,10))}function Li(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Mi(parseFloat(e)/100):Mi(parseFloat(e))}function Ai(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function Di(t,e,n){return t+(e-t)*n}function Ii(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Pi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var Ei=new bi(20),Oi=null;function Ni(t,e){Oi&&Pi(Oi,e),Oi=Ei.put(t,Oi||e.slice())}function Ri(t,e){if(t){e=e||[];var n=Ei.get(t);if(n)return Pi(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in Ti)return Pi(e,Ti[i]),Ni(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(Ii(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),Ni(t,e),e):void Ii(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(Ii(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),Ni(t,e),e):void Ii(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?Ii(e,+u[0],+u[1],+u[2],1):Ii(e,0,0,0,1);h=Li(u.pop());case"rgb":return u.length>=3?(Ii(e,Ci(u[0]),Ci(u[1]),Ci(u[2]),3===u.length?h:Li(u[3])),Ni(t,e),e):void Ii(e,0,0,0,1);case"hsla":return 4!==u.length?void Ii(e,0,0,0,1):(u[3]=Li(u[3]),ki(u,e),Ni(t,e),e);case"hsl":return 3!==u.length?void Ii(e,0,0,0,1):(ki(u,e),Ni(t,e),e);default:return}}Ii(e,0,0,0,1)}}function ki(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=Li(t[1]),r=Li(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return Ii(e=e||[],Si(255*Ai(a,o,n+1/3)),Si(255*Ai(a,o,n)),Si(255*Ai(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function zi(t,e){var n=Ri(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return ji(n,4===n.length?"rgba":"rgb")}}function Bi(t){var e=Ri(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Fi(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=Si(Di(a[0],s[0],l)),n[1]=Si(Di(a[1],s[1],l)),n[2]=Si(Di(a[2],s[2],l)),n[3]=Mi(Di(a[3],s[3],l)),n}}var Vi=Fi;function Gi(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=Ri(e[r]),s=Ri(e[o]),l=i-r,u=ji([Si(Di(a[0],s[0],l)),Si(Di(a[1],s[1],l)),Si(Di(a[2],s[2],l)),Mi(Di(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}}var Hi=Gi;function Ui(t,e,n,i){var r,o=Ri(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=Li(n)),null!=i&&(o[2]=Li(i)),ji(ki(o),"rgba")}function Wi(t,e){var n=Ri(t);if(n&&null!=e)return n[3]=Mi(e),ji(n,"rgba")}function ji(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function Zi(t,e){var n=Ri(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function Xi(){return ji([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var qi=new bi(100);function Yi(t){if(wt(t)){var e=qi.get(t);return e||(e=zi(t,-.1),qi.put(t,e)),e}if(At(t)){var n=rt({},t);return n.colorStops=dt(t.colorStops,(function(t){return{offset:t.offset,color:zi(t.color,-.1)}})),n}return t}var Ki=Math.round;function Ji(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var n=Ri(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var $i=1e-4;function Qi(t){return t<$i&&t>-1e-4}function tr(t){return Ki(1e3*t)/1e3}function er(t){return Ki(1e4*t)/1e4}var nr={left:"start",right:"end",center:"middle",middle:"middle"};function ir(t){return t&&!!t.image}function rr(t){return ir(t)||function(t){return t&&!!t.svgElement}(t)}function or(t){return"linear"===t.type}function ar(t){return"radial"===t.type}function sr(t){return t&&("linear"===t.type||"radial"===t.type)}function lr(t){return"url(#"+t+")"}function ur(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function hr(t){var e=t.x||0,n=t.y||0,i=(t.rotation||0)*Jt,r=Ot(t.scaleX,1),o=Ot(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||n)&&l.push("translate("+e+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+Ki(a*Jt)+"deg, "+Ki(s*Jt)+"deg)"),l.join(" ")}var cr=O.hasGlobalWindow&&xt(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},dr=Array.prototype.slice;function fr(t,e,n){return(e-t)*n+t}function pr(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(ht(e)){var l=function(t){return ht(t&&t[0])?2:1}(e);a=l,(1===l&&!Tt(e[0])||2===l&&!Tt(e[0][0]))&&(o=!0)}else if(Tt(e)&&!Pt(e))a=0;else if(wt(e))if(isNaN(+e)){var u=Ri(e);u&&(s=u,a=3)}else a=0;else if(At(e)){var h=rt({},s);h.colorStops=dt(e.colorStops,(function(t){return{offset:t.offset,color:Ri(t.color)}})),or(e)?a=4:ar(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=xt(n)?n:jn[n]||vi(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=br(i),l=wr(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?Tr:t[h];if(!br(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(br(s))1===s?pr(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,yr(l),i),this._trackKeys.push(a)}s.addKeyframe(t,yr(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const Cr=Mr;function Lr(){return(new Date).getTime()}var Ar=function(t){function e(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n}return I(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=Lr()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next;i.step(e,n)?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,Un((function e(){t._running&&(Un(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=Lr(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Lr(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Lr()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var n=new Cr(t,e.loop);return this.addAnimator(n),n},e}(Le);const Dr=Ar;var Ir,Pr,Er=O.domSupported,Or=(Pr={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:Ir=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:dt(Ir,(function(t){var e=t.replace("mouse","pointer");return Pr.hasOwnProperty(e)?e:t}))}),Nr=["mousemove","mouseup"],Rr=["pointermove","pointerup"],kr=!1;function zr(t){var e=t.pointerType;return"pen"===e||"touch"===e}function Br(t){t&&(t.zrByTouch=!0)}function Fr(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}var Vr=function(t,e){this.stopPropagation=Kt,this.stopImmediatePropagation=Kt,this.preventDefault=Kt,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},Gr={mousedown:function(t){t=We(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=We(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=We(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){Fr(this,(t=We(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){kr=!0,t=We(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){kr||(t=We(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Br(t=We(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Gr.mousemove.call(this,t),Gr.mousedown.call(this,t)},touchmove:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"change"),Gr.mousemove.call(this,t)},touchend:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"end"),Gr.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&Gr.click.call(this,t)},pointerdown:function(t){Gr.mousedown.call(this,t)},pointermove:function(t){zr(t)||Gr.mousemove.call(this,t)},pointerup:function(t){Gr.mouseup.call(this,t)},pointerout:function(t){zr(t)||Gr.mouseout.call(this,t)}};ct(["click","dblclick","contextmenu"],(function(t){Gr[t]=function(e){e=We(this.dom,e),this.trigger(t,e)}}));var Hr={pointermove:function(t){zr(t)||Hr.mousemove.call(this,t)},pointerup:function(t){Hr.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Ur(t,e){var n=e.domHandlers;O.pointerEventsSupported?ct(Or.pointer,(function(i){jr(e,i,(function(e){n[i].call(t,e)}))})):(O.touchEventsSupported&&ct(Or.touch,(function(i){jr(e,i,(function(r){n[i].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),ct(Or.mouse,(function(i){jr(e,i,(function(r){r=Ue(r),e.touching||n[i].call(t,r)}))})))}function Wr(t,e){function n(n){jr(e,n,(function(i){i=Ue(i),Fr(t,i.target)||(i=function(t,e){return We(t.dom,new Vr(t,e),!0)}(t,i),e.domHandlers[n].call(t,i))}),{capture:!0})}O.pointerEventsSupported?ct(Rr,n):O.touchEventsSupported||ct(Nr,n)}function jr(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,je(t.domTarget,e,n,i)}function Zr(t){var e,n,i,r,o=t.mounted;for(var a in o)o.hasOwnProperty(a)&&(e=t.domTarget,n=a,i=o[a],r=t.listenerOpts[a],e.removeEventListener(n,i,r));t.mounted={}}var Xr=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const qr=function(t){function e(e,n){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=e,i.painterRoot=n,i._localHandlerScope=new Xr(e,Gr),Er&&(i._globalHandlerScope=new Xr(document,Hr)),Ur(i,i._localHandlerScope),i}return I(e,t),e.prototype.dispose=function(){Zr(this._localHandlerScope),Er&&Zr(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Er&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?Wr(this,e):Zr(e)}},e}(Le);var Yr=1;O.hasGlobalWindow&&(Yr=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var Kr=Yr,Jr="#333",$r="#ccc",Qr=$e,to=5e-5;function eo(t){return t>to||t<-5e-5}var no=[],io=[],ro=[1,0,0,1,0,0],oo=Math.abs,ao=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return eo(this.rotation)||eo(this.x)||eo(this.y)||eo(this.scaleX-1)||eo(this.scaleY-1)||eo(this.skewX)||eo(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),n=this.transform;e||t?(n=n||[1,0,0,1,0,0],e?this.getLocalTransform(n):Qr(n),t&&(e?tn(n,t,n):Qe(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(Qr(n),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(no);var n=no[0]<0?-1:1,i=no[1]<0?-1:1,r=((no[0]-n)*e+n)/no[0]||0,o=((no[1]-i)*e+i)/no[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||[1,0,0,1,0,0],on(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),r=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||[1,0,0,1,0,0],tn(io,t.invTransform,e),e=io);var n=this.originX,i=this.originY;(n||i)&&(ro[4]=n,ro[5]=i,tn(io,e,ro),io[4]-=n,io[5]-=i,e=io),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&xe(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&xe(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&oo(t[0]-1)>1e-10&&oo(t[3]-1)>1e-10?Math.sqrt(oo(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){lo(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,d=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var f=n+a,p=i+s;e[4]=-f*r-c*p*o,e[5]=-p*o-d*f*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=d*r,e[2]=c*o,l&&nn(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),so=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function lo(t,e){for(var n=0;n=0?parseFloat(t)/100*e:parseFloat(t):t}function yo(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=_o(i[0],n.width),u+=_o(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}var xo="__zr_normal__",wo=so.concat(["ignore"]),bo=ft(so,(function(t,e){return t[e]=!0,t}),{ignore:!1}),To={},So=new _n(0,0,0,0),Mo=function(){function t(t){this.id=Q(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,n){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=So;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(To,n,u):yo(To,n,u),r.x=To.x,r.y=To.y,o=To.align,a=To.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,d=void 0;"center"===h?(c=.5*u.width,d=.5*u.height):(c=_o(h[0],u.width),d=_o(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+d+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var f=n.offset;f&&(r.x+=f[0],r.y+=f[1],l||(r.originX=-f[0],r.originY=-f[1]));var p=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,v=void 0,_=void 0;p&&this.canBeInsideText()?(m=n.insideFill,v=n.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=v&&"auto"!==v||(v=this.getInsideTextStroke(m),_=!0)):(m=n.outsideFill,v=n.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=v&&"auto"!==v||(v=this.getOutsideStroke(m),_=!0)),(m=m||"#000")===g.fill&&v===g.stroke&&_===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=v,g.autoStroke=_,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=kn,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?$r:Jr},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof e&&Ri(e);n||(n=[255,255,255,1]);for(var i=n[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(r?0:255)*(1-i);return n[3]=1,ji(n,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},rt(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(St(t))for(var n=mt(t),i=0;i0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(xo,!1,t)},t.prototype.useState=function(t,e,n,i){var r=t===xo;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!(st(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!n&&!this.__inHover&&a&&a.duration>0,a);var u=this._textContent,h=this._textGuide;return u&&u.useState(t,e,n,l),h&&h.useState(t,e,n,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn),s}tt("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,f);var p=this._textContent,g=this._textGuide;p&&p.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this.silent,e=this.parent;!t&&e;){if(e.silent){t=!0;break}e=e.parent}return t},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=st(i,t),o=st(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)})),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;o0&&n.during&&o[0].during((function(t,e){n.during(e)}));for(var d=0;d0||r.force&&!a.length){var b,T=void 0,S=void 0,M=void 0;if(s){S={},d&&(T={});for(x=0;x=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var n=st(this._children,t);return n>=0&&this.replaceAt(e,n),this},e.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,n=this._children,i=st(n,t);return i<0||(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,E);const O=E;var N="sans-serif",R="12px "+N;var k,z,B=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)o=r*t.length;else for(var a=0;a>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",r[l]+":0",i[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}(e,o),s=function(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,d=h.left,f=h.top;a.push(d,f),l=l&&o&&d===o[c]&&f===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?Ie(s,a):Ie(a,s))}(a,o,r);if(s)return s(t,n,i),!0}return!1}function Ne(t){return"CANVAS"===t.nodeName.toUpperCase()}var Re=/([&<>"'])/g,ke={"&":"&","<":"<",">":">",'"':""","'":"'"};function ze(t){return null==t?"":(t+"").replace(Re,(function(t,e){return ke[e]}))}var Be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Fe=[],Ve=O.browser.firefox&&+O.browser.version.split(".")[0]<39;function Ge(t,e,n,i){return n=n||{},i?He(t,e,n):Ve&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):He(t,e,n),n}function He(t,e,n){if(O.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(Ne(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(Oe(Fe,t,i,r))return n.zrX=Fe[0],void(n.zrY=Fe[1])}n.zrX=n.zrY=0}function Ue(t){return t||window.event}function We(t,e,n){if(null!=(e=Ue(e)).zrX)return e;var i=e.type;if(i&&i.indexOf("touch")>=0){var r="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];r&&Ge(t,r,e,n)}else{Ge(t,e,e,n);var o=function(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=0!==i?Math.abs(i):Math.abs(n),o=i>0?-1:i<0?1:n>0?-1:1;return 3*r*o}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&Be.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function je(t,e,n,i){t.addEventListener(e,n,i)}var Ze=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function Xe(t){return 2===t.which||3===t.which}var qe=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;o1&&r&&r.length>1){var a=Ye(r)/Ye(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((i=r)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}};function Je(){return[1,0,0,1,0,0]}function $e(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Qe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function tn(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function en(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function nn(t,e,n,i){void 0===i&&(i=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],u=e[5],h=Math.sin(n),c=Math.cos(n);return t[0]=r*c+s*h,t[1]=-r*h+s*c,t[2]=o*c+l*h,t[3]=-o*h+c*l,t[4]=c*(a-i[0])+h*(u-i[1])+i[0],t[5]=c*(u-i[1])-h*(a-i[0])+i[1],t}function rn(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function on(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function an(t){var e=[1,0,0,1,0,0];return Qe(e,t),e}var sn=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}();const ln=sn;var un=Math.min,hn=Math.max,cn=new ln,dn=new ln,fn=new ln,pn=new ln,gn=new ln,mn=new ln,vn=function(){function t(t,e,n,i){n<0&&(t+=n,n=-n),i<0&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=un(t.x,this.x),n=un(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=hn(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=hn(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=[1,0,0,1,0,0];return en(r,r,[-e.x,-e.y]),rn(r,r,[n,i]),en(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,d=!(op&&(p=y,gp&&(p=x,v<_?ln.set(mn,0,-v):ln.set(mn,0,_)):y=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}cn.x=fn.x=n.x,cn.y=pn.y=n.y,dn.x=pn.x=n.x+n.width,dn.y=fn.y=n.y+n.height,cn.transform(i),pn.transform(i),dn.transform(i),fn.transform(i),e.x=un(cn.x,dn.x,fn.x,pn.x),e.y=un(cn.y,dn.y,fn.y,pn.y);var l=hn(cn.x,dn.x,fn.x,pn.x),u=hn(cn.y,dn.y,fn.y,pn.y);e.width=l-e.x,e.height=u-e.y}else e!==n&&t.copy(e,n)},t}();const _n=vn;var yn="silent";function xn(){Ze(this.event)}var wn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return I(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Le),bn=function(t,e){this.x=t,this.y=e},Tn=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Sn=new _n(0,0,0,0),Mn=function(t){function e(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new bn(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new wn,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new Me(a),a}return I(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(ct(Tn,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=An(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=i?new bn(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new bn(0,0)},e.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,n){var i=(t=t||{}).target;if(!i||!i.silent){for(var r="on"+e,o=function(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:xn}}(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new bn(t,e);if(Ln(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new _n(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(Sn.copy(h.getBoundingRect()),h.transform&&Sn.applyTransform(h.transform),Sn.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,f=0;f=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=Cn(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==yn)){e.target=a;break}}}function An(t,e,n){var i=t.painter;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}ct(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){Mn.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=An(this,r,o);if("mouseup"===t&&a||(i=(n=this.findHover(r,o)).target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||ge(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}}));const Dn=Mn;function In(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function Pn(t,e,n,i,r){for(i===e&&i++;i>>1])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function En(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function On(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function Nn(t,e){var n,i,r=7,o=0,a=[];function s(s){var l=n[s],u=i[s],h=n[s+1],c=i[s+1];i[s]=u+c,s===o-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),o--;var d=On(t[h],t,l,u,0,e);l+=d,0!==(u-=d)&&0!==(c=En(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(n,i,o,s){var l=0;for(l=0;l=7||f>=7);if(p)break;g<0&&(g=0),g+=2}if((r=g)<1&&(r=1),1===i){for(l=0;l=0;l--)t[f+l]=t[d+l];return void(t[c]=a[h])}var p=r;for(;;){var g=0,m=0,v=!1;do{if(e(a[h],t[u])<0){if(t[c--]=t[u--],g++,m=0,0==--i){v=!0;break}}else if(t[c--]=a[h--],m++,g=0,1==--s){v=!0;break}}while((g|m)=0;l--)t[f+l]=t[d+l];if(0===i){v=!0;break}}if(t[c--]=a[h--],1==--s){v=!0;break}if(0!==(m=s-En(t[u],a,0,s,s-1,e))){for(s-=m,f=(c-=m)+1,d=(h-=m)+1,l=0;l=7||m>=7);if(v)break;p<0&&(p=0),p+=2}(r=p)<1&&(r=1);if(1===s){for(f=(c-=i)+1,d=(u-=i)+1,l=i-1;l>=0;l--)t[f+l]=t[d+l];t[c]=a[h]}else{if(0===s)throw new Error;for(d=c-(s-1),l=0;l1;){var t=o-2;if(t>=1&&i[t-1]<=i[t]+i[t+1]||t>=2&&i[t-2]<=i[t]+i[t-1])i[t-1]i[t+1])break;s(t)}},forceMergeRuns:function(){for(;o>1;){var t=o-2;t>0&&i[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=In(t,n,i,e))s&&(l=s),Pn(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}}var kn=1,zn=4,Bn=!1;function Fn(){Bn||(Bn=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function Vn(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var Gn=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Vn}return t.prototype.traverse=function(t,e){for(var n=0;n0&&(u.__clipPaths=[]),isNaN(u.z)&&(Fn(),u.z=0),isNaN(u.z2)&&(Fn(),u.z2=0),isNaN(u.zlevel)&&(Fn(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;e=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const Hn=Gn;const Un=O.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var Wn={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-Wn.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*Wn.bounceIn(2*t):.5*Wn.bounceOut(2*t-1)+.5}};const jn=Wn;var Zn=Math.pow,Xn=Math.sqrt,qn=1e-8,Yn=1e-4,Kn=Xn(3),Jn=1/3,$n=$t(),Qn=$t(),ti=$t();function ei(t){return t>-1e-8&&tqn||t<-1e-8}function ii(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function ri(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function oi(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(ei(h)&&ei(c)){if(ei(s))o[0]=0;else(S=-l/s)>=0&&S<=1&&(o[f++]=S)}else{var p=c*c-4*h*d;if(ei(p)){var g=c/h,m=-g/2;(S=-s/a+g)>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=Xn(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(S=(-s-((_=_<0?-Zn(-_,Jn):Zn(_,Jn))+(y=y<0?-Zn(-y,Jn):Zn(y,Jn))))/(3*a))>=0&&S<=1&&(o[f++]=S)}else{var x=(2*h*s-3*a*c)/(2*Xn(h*h*h)),w=Math.acos(x)/3,b=Xn(h),T=Math.cos(w),S=(-s-2*b*T)/(3*a),M=(m=(-s+b*(T+Kn*Math.sin(w)))/(3*a),(-s+b*(T-Kn*Math.sin(w)))/(3*a));S>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}function ai(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(ei(a)){if(ni(o))(h=-s/o)>=0&&h<=1&&(r[l++]=h)}else{var u=o*o-4*a*s;if(ei(u))r[0]=-o/(2*a);else if(u>0){var h,c=Xn(u),d=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}function si(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function li(t,e,n,i,r,o,a,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;$n[0]=l,$n[1]=u;for(var _=0;_<1;_+=.05)Qn[0]=ii(t,n,r,a,_),Qn[1]=ii(e,i,o,s,_),(p=ve($n,Qn))=0&&p=0&&m=1?1:oi(0,i,o,1,t,s)&&ii(0,r,a,1,s[0])}}}const _i=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||Kt,this.ondestroy=t.ondestroy||Kt,this.onrestart=t.onrestart||Kt,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=xt(t)?t:jn[t]||vi(t)},t}();var yi=function(t){this.value=t},xi=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new yi(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),wi=function(){function t(t){this._list=new xi,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new yi(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const bi=wi;var Ti={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Si(t){return(t=Math.round(t))<0?0:t>255?255:t}function Mi(t){return t<0?0:t>1?1:t}function Ci(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Si(parseFloat(e)/100*255):Si(parseInt(e,10))}function Li(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Mi(parseFloat(e)/100):Mi(parseFloat(e))}function Ai(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function Di(t,e,n){return t+(e-t)*n}function Ii(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Pi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var Ei=new bi(20),Oi=null;function Ni(t,e){Oi&&Pi(Oi,e),Oi=Ei.put(t,Oi||e.slice())}function Ri(t,e){if(t){e=e||[];var n=Ei.get(t);if(n)return Pi(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in Ti)return Pi(e,Ti[i]),Ni(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(Ii(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),Ni(t,e),e):void Ii(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(Ii(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),Ni(t,e),e):void Ii(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?Ii(e,+u[0],+u[1],+u[2],1):Ii(e,0,0,0,1);h=Li(u.pop());case"rgb":return u.length>=3?(Ii(e,Ci(u[0]),Ci(u[1]),Ci(u[2]),3===u.length?h:Li(u[3])),Ni(t,e),e):void Ii(e,0,0,0,1);case"hsla":return 4!==u.length?void Ii(e,0,0,0,1):(u[3]=Li(u[3]),ki(u,e),Ni(t,e),e);case"hsl":return 3!==u.length?void Ii(e,0,0,0,1):(ki(u,e),Ni(t,e),e);default:return}}Ii(e,0,0,0,1)}}function ki(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=Li(t[1]),r=Li(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return Ii(e=e||[],Si(255*Ai(a,o,n+1/3)),Si(255*Ai(a,o,n)),Si(255*Ai(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function zi(t,e){var n=Ri(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return ji(n,4===n.length?"rgba":"rgb")}}function Bi(t){var e=Ri(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Fi(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=Si(Di(a[0],s[0],l)),n[1]=Si(Di(a[1],s[1],l)),n[2]=Si(Di(a[2],s[2],l)),n[3]=Mi(Di(a[3],s[3],l)),n}}var Vi=Fi;function Gi(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=Ri(e[r]),s=Ri(e[o]),l=i-r,u=ji([Si(Di(a[0],s[0],l)),Si(Di(a[1],s[1],l)),Si(Di(a[2],s[2],l)),Mi(Di(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}}var Hi=Gi;function Ui(t,e,n,i){var r,o=Ri(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=Li(n)),null!=i&&(o[2]=Li(i)),ji(ki(o),"rgba")}function Wi(t,e){var n=Ri(t);if(n&&null!=e)return n[3]=Mi(e),ji(n,"rgba")}function ji(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function Zi(t,e){var n=Ri(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function Xi(){return ji([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var qi=new bi(100);function Yi(t){if(wt(t)){var e=qi.get(t);return e||(e=zi(t,-.1),qi.put(t,e)),e}if(At(t)){var n=rt({},t);return n.colorStops=dt(t.colorStops,(function(t){return{offset:t.offset,color:zi(t.color,-.1)}})),n}return t}var Ki=Math.round;function Ji(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var n=Ri(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var $i=1e-4;function Qi(t){return t<$i&&t>-1e-4}function tr(t){return Ki(1e3*t)/1e3}function er(t){return Ki(1e4*t)/1e4}var nr={left:"start",right:"end",center:"middle",middle:"middle"};function ir(t){return t&&!!t.image}function rr(t){return ir(t)||function(t){return t&&!!t.svgElement}(t)}function or(t){return"linear"===t.type}function ar(t){return"radial"===t.type}function sr(t){return t&&("linear"===t.type||"radial"===t.type)}function lr(t){return"url(#"+t+")"}function ur(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function hr(t){var e=t.x||0,n=t.y||0,i=(t.rotation||0)*Jt,r=Ot(t.scaleX,1),o=Ot(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||n)&&l.push("translate("+e+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+Ki(a*Jt)+"deg, "+Ki(s*Jt)+"deg)"),l.join(" ")}var cr=O.hasGlobalWindow&&xt(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},dr=Array.prototype.slice;function fr(t,e,n){return(e-t)*n+t}function pr(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(ht(e)){var l=function(t){return ht(t&&t[0])?2:1}(e);a=l,(1===l&&!Tt(e[0])||2===l&&!Tt(e[0][0]))&&(o=!0)}else if(Tt(e)&&!Pt(e))a=0;else if(wt(e))if(isNaN(+e)){var u=Ri(e);u&&(s=u,a=3)}else a=0;else if(At(e)){var h=rt({},s);h.colorStops=dt(e.colorStops,(function(t){return{offset:t.offset,color:Ri(t.color)}})),or(e)?a=4:ar(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=xt(n)?n:jn[n]||vi(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=br(i),l=wr(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?Tr:t[h];if(!br(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(br(s))1===s?pr(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,yr(l),i),this._trackKeys.push(a)}s.addKeyframe(t,yr(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const Cr=Mr;function Lr(){return(new Date).getTime()}var Ar=function(t){function e(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n}return I(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=Lr()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next;i.step(e,n)?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,Un((function e(){t._running&&(Un(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=Lr(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Lr(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Lr()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var n=new Cr(t,e.loop);return this.addAnimator(n),n},e}(Le);const Dr=Ar;var Ir,Pr,Er=O.domSupported,Or=(Pr={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:Ir=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:dt(Ir,(function(t){var e=t.replace("mouse","pointer");return Pr.hasOwnProperty(e)?e:t}))}),Nr=["mousemove","mouseup"],Rr=["pointermove","pointerup"],kr=!1;function zr(t){var e=t.pointerType;return"pen"===e||"touch"===e}function Br(t){t&&(t.zrByTouch=!0)}function Fr(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}var Vr=function(t,e){this.stopPropagation=Kt,this.stopImmediatePropagation=Kt,this.preventDefault=Kt,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},Gr={mousedown:function(t){t=We(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=We(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=We(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){Fr(this,(t=We(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){kr=!0,t=We(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){kr||(t=We(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Br(t=We(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Gr.mousemove.call(this,t),Gr.mousedown.call(this,t)},touchmove:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"change"),Gr.mousemove.call(this,t)},touchend:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"end"),Gr.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&Gr.click.call(this,t)},pointerdown:function(t){Gr.mousedown.call(this,t)},pointermove:function(t){zr(t)||Gr.mousemove.call(this,t)},pointerup:function(t){Gr.mouseup.call(this,t)},pointerout:function(t){zr(t)||Gr.mouseout.call(this,t)}};ct(["click","dblclick","contextmenu"],(function(t){Gr[t]=function(e){e=We(this.dom,e),this.trigger(t,e)}}));var Hr={pointermove:function(t){zr(t)||Hr.mousemove.call(this,t)},pointerup:function(t){Hr.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Ur(t,e){var n=e.domHandlers;O.pointerEventsSupported?ct(Or.pointer,(function(i){jr(e,i,(function(e){n[i].call(t,e)}))})):(O.touchEventsSupported&&ct(Or.touch,(function(i){jr(e,i,(function(r){n[i].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),ct(Or.mouse,(function(i){jr(e,i,(function(r){r=Ue(r),e.touching||n[i].call(t,r)}))})))}function Wr(t,e){function n(n){jr(e,n,(function(i){i=Ue(i),Fr(t,i.target)||(i=function(t,e){return We(t.dom,new Vr(t,e),!0)}(t,i),e.domHandlers[n].call(t,i))}),{capture:!0})}O.pointerEventsSupported?ct(Rr,n):O.touchEventsSupported||ct(Nr,n)}function jr(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,je(t.domTarget,e,n,i)}function Zr(t){var e,n,i,r,o=t.mounted;for(var a in o)o.hasOwnProperty(a)&&(e=t.domTarget,n=a,i=o[a],r=t.listenerOpts[a],e.removeEventListener(n,i,r));t.mounted={}}var Xr=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const qr=function(t){function e(e,n){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=e,i.painterRoot=n,i._localHandlerScope=new Xr(e,Gr),Er&&(i._globalHandlerScope=new Xr(document,Hr)),Ur(i,i._localHandlerScope),i}return I(e,t),e.prototype.dispose=function(){Zr(this._localHandlerScope),Er&&Zr(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Er&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?Wr(this,e):Zr(e)}},e}(Le);var Yr=1;O.hasGlobalWindow&&(Yr=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var Kr=Yr,Jr="var(--ow-color-fg-darker)",$r="#ccc",Qr=$e,to=5e-5;function eo(t){return t>to||t<-5e-5}var no=[],io=[],ro=[1,0,0,1,0,0],oo=Math.abs,ao=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return eo(this.rotation)||eo(this.x)||eo(this.y)||eo(this.scaleX-1)||eo(this.scaleY-1)||eo(this.skewX)||eo(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),n=this.transform;e||t?(n=n||[1,0,0,1,0,0],e?this.getLocalTransform(n):Qr(n),t&&(e?tn(n,t,n):Qe(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(Qr(n),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(no);var n=no[0]<0?-1:1,i=no[1]<0?-1:1,r=((no[0]-n)*e+n)/no[0]||0,o=((no[1]-i)*e+i)/no[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||[1,0,0,1,0,0],on(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),r=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||[1,0,0,1,0,0],tn(io,t.invTransform,e),e=io);var n=this.originX,i=this.originY;(n||i)&&(ro[4]=n,ro[5]=i,tn(io,e,ro),io[4]-=n,io[5]-=i,e=io),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&xe(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&xe(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&oo(t[0]-1)>1e-10&&oo(t[3]-1)>1e-10?Math.sqrt(oo(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){lo(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,d=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var f=n+a,p=i+s;e[4]=-f*r-c*p*o,e[5]=-p*o-d*f*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=d*r,e[2]=c*o,l&&nn(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),so=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function lo(t,e){for(var n=0;n=0?parseFloat(t)/100*e:parseFloat(t):t}function yo(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=_o(i[0],n.width),u+=_o(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}var xo="__zr_normal__",wo=so.concat(["ignore"]),bo=ft(so,(function(t,e){return t[e]=!0,t}),{ignore:!1}),To={},So=new _n(0,0,0,0),Mo=function(){function t(t){this.id=Q(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,n){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=So;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(To,n,u):yo(To,n,u),r.x=To.x,r.y=To.y,o=To.align,a=To.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,d=void 0;"center"===h?(c=.5*u.width,d=.5*u.height):(c=_o(h[0],u.width),d=_o(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+d+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var f=n.offset;f&&(r.x+=f[0],r.y+=f[1],l||(r.originX=-f[0],r.originY=-f[1]));var p=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,v=void 0,_=void 0;p&&this.canBeInsideText()?(m=n.insideFill,v=n.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=v&&"auto"!==v||(v=this.getInsideTextStroke(m),_=!0)):(m=n.outsideFill,v=n.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=v&&"auto"!==v||(v=this.getOutsideStroke(m),_=!0)),(m=m||"var(--ow-color-black)")===g.fill&&v===g.stroke&&_===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=v,g.autoStroke=_,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=kn,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"var(--ow-color-black)"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?$r:Jr},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof e&&Ri(e);n||(n=[255,255,255,1]);for(var i=n[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(r?0:255)*(1-i);return n[3]=1,ji(n,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},rt(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(St(t))for(var n=mt(t),i=0;i0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(xo,!1,t)},t.prototype.useState=function(t,e,n,i){var r=t===xo;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!(st(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!n&&!this.__inHover&&a&&a.duration>0,a);var u=this._textContent,h=this._textGuide;return u&&u.useState(t,e,n,l),h&&h.useState(t,e,n,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn),s}tt("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,f);var p=this._textContent,g=this._textGuide;p&&p.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this.silent,e=this.parent;!t&&e;){if(e.silent){t=!0;break}e=e.parent}return t},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=st(i,t),o=st(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)})),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;o0&&n.during&&o[0].during((function(t,e){n.during(e)}));for(var d=0;d0||r.force&&!a.length){var b,T=void 0,S=void 0,M=void 0;if(s){S={},d&&(T={});for(x=0;x=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var n=st(this._children,t);return n>=0&&this.replaceAt(e,n),this},e.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,n=this._children,i=st(n,t);return i<0||(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this._disposed||this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function qo(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return wt(t)?(n=t,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var n}function Yo(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),Zo),t=(+t).toFixed(e),n?t:+t}function Ko(t){return t.sort((function(t,e){return t-e})),t}function Jo(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return $o(t)}function $o(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf("."),a=o<0?0:r-1-o;return Math.max(0,a-i)}function Qo(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function ta(t,e,n){if(!t[e])return 0;var i=function(t,e){var n=ft(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===n)return[];var i=Math.pow(10,e),r=dt(t,(function(t){return(isNaN(t)?0:t)/n*i*100})),o=100*i,a=dt(r,(function(t){return Math.floor(t)})),s=ft(a,(function(t,e){return t+e}),0),l=dt(r,(function(t,e){return t-a[e]}));for(;su&&(u=l[c],h=c);++a[h],l[h]=0,++s}return dt(a,(function(t){return t/i}))}(t,n);return i[e]||0}function ea(t,e){var n=Math.max(Jo(t),Jo(e)),i=t+e;return n>Zo?i:Yo(i,n)}var na=9007199254740991;function ia(t){var e=2*Math.PI;return(t%e+e)%e}function ra(t){return t>-jo&&t=10&&e++,e}function ua(t,e){var n=la(t),i=Math.pow(10,n),r=t/i;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t}function ha(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function ca(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-1/0,n=1,i=0;i=0||r&&st(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}var Ka=Ya([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),Ja=function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return Ka(this,t,e)},t}(),$a=new bi(50);function Qa(t){if("string"==typeof t){var e=$a.get(t);return e&&e.image}return t}function ts(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=$a.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?!ns(e=o.image)&&o.pending.push(a):((e=F.loadImage(t,es,es)).__zrImageSrc=t,$a.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function es(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=a;l++)s-=a;var u=co(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function ss(t,e,n){var i=n.containerWidth,r=n.font,o=n.contentWidth;if(!i)return t.textLine="",void(t.isTruncated=!1);var a=co(e,r);if(a<=i)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=o||s>=n.maxIterations){e+=n.ellipsis;break}var l=0===s?ls(e,o,n.ascCharWidth,n.cnCharWidth):a>0?Math.floor(e.length*o/a):0;a=co(e=e.substr(0,l),r)}""===e&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function ls(t,e,n,i){for(var r=0,o=0,a=t.length;o0&&p+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=p}else{var g=gs(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+f,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var m=0;m=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}(t)||!!fs[t]}function gs(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+f>n)?h?(s||l)&&(p?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=d,s="",h=u+=f):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=d,h=f)):p?(o.push(l),a.push(u),l=d,u=f):(o.push(d),a.push(f)):(h+=f,p?(l+=d,u+=f):(l&&(s+=l,l="",u=0),s+=d))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}var ms="__zr_style_"+Math.round(10*Math.random()),vs={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},_s={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};vs[ms]=!0;var ys=["z","z2","invisible"],xs=["invisible"],ws=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype._init=function(e){for(var n=mt(e),i=0;i1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(Is[0]=As(r)*n+t,Is[1]=Ls(r)*i+e,Ps[0]=As(o)*n+t,Ps[1]=Ls(o)*i+e,u(s,Is,Ps),h(l,Is,Ps),(r%=Ds)<0&&(r+=Ds),(o%=Ds)<0&&(o+=Ds),r>o&&!a?o+=Ds:rr&&(Es[0]=As(f)*n+t,Es[1]=Ls(f)*i+e,u(s,Es,s),h(l,Es,l))}var Fs={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Vs=[],Gs=[],Hs=[],Us=[],Ws=[],js=[],Zs=Math.min,Xs=Math.max,qs=Math.cos,Ys=Math.sin,Ks=Math.abs,Js=Math.PI,$s=2*Js,Qs="undefined"!=typeof Float32Array,tl=[];function el(t){return Math.round(t/Js*1e8)/1e8%2*Js}var nl=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,n){(n=n||0)>0&&(this._ux=Ks(n/Kr/t)||0,this._uy=Ks(n/Kr/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Fs.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=Ks(t-this._xi),i=Ks(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(Fs.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(Fs.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(Fs.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){this._drawPendingPt(),tl[0]=i,tl[1]=r,function(t,e){var n=el(t[0]);n<0&&(n+=$s);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=$s?r=n+$s:e&&n-r>=$s?r=n-$s:!e&&n>r?r=n+($s-el(n-r)):e&&nu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){Hs[0]=Hs[1]=Ws[0]=Ws[1]=Number.MAX_VALUE,Us[0]=Us[1]=js[0]=js[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tn||Ks(m)>i||c===e-1)&&(p=Math.sqrt(D*D+m*m),r=g,o=y);break;case Fs.C:var v=t[c++],_=t[c++],y=(g=t[c++],t[c++]),x=t[c++],w=t[c++];p=ui(r,o,v,_,g,y,x,w,10),r=x,o=w;break;case Fs.Q:p=gi(r,o,v=t[c++],_=t[c++],g=t[c++],y=t[c++],10),r=g,o=y;break;case Fs.A:var b=t[c++],T=t[c++],S=t[c++],M=t[c++],C=t[c++],L=t[c++],A=L+C;c+=1,f&&(a=qs(C)*S+b,s=Ys(C)*M+T),p=Xs(S,M)*Zs($s,Math.abs(L)),r=qs(A)*S+b,o=Ys(A)*M+T;break;case Fs.R:a=r=t[c++],s=o=t[c++],p=2*t[c++]+2*t[c++];break;case Fs.Z:var D=a-r;m=s-o;p=Math.sqrt(D*D+m*m),r=a,o=s}p>=0&&(l[h++]=p,u+=p)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,d=this.data,f=this._ux,p=this._uy,g=this._len,m=e<1,v=0,_=0,y=0;if(!m||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),y=0),w){case Fs.M:n=r=d[x++],i=o=d[x++],t.moveTo(r,o);break;case Fs.L:a=d[x++],s=d[x++];var T=Ks(a-r),S=Ks(s-o);if(T>f||S>p){if(m){if(v+(q=l[_++])>u){var M=(u-v)/q;t.lineTo(r*(1-M)+a*M,o*(1-M)+s*M);break t}v+=q}t.lineTo(a,s),r=a,o=s,y=0}else{var C=T*T+S*S;C>y&&(h=a,c=s,y=C)}break;case Fs.C:var L=d[x++],A=d[x++],D=d[x++],I=d[x++],P=d[x++],E=d[x++];if(m){if(v+(q=l[_++])>u){si(r,L,D,P,M=(u-v)/q,Vs),si(o,A,I,E,M,Gs),t.bezierCurveTo(Vs[1],Gs[1],Vs[2],Gs[2],Vs[3],Gs[3]);break t}v+=q}t.bezierCurveTo(L,A,D,I,P,E),r=P,o=E;break;case Fs.Q:L=d[x++],A=d[x++],D=d[x++],I=d[x++];if(m){if(v+(q=l[_++])>u){fi(r,L,D,M=(u-v)/q,Vs),fi(o,A,I,M,Gs),t.quadraticCurveTo(Vs[1],Gs[1],Vs[2],Gs[2]);break t}v+=q}t.quadraticCurveTo(L,A,D,I),r=D,o=I;break;case Fs.A:var O=d[x++],N=d[x++],R=d[x++],k=d[x++],z=d[x++],B=d[x++],F=d[x++],V=!d[x++],G=R>k?R:k,H=Ks(R-k)>.001,U=z+B,W=!1;if(m)v+(q=l[_++])>u&&(U=z+B*(u-v)/q,W=!0),v+=q;if(H&&t.ellipse?t.ellipse(O,N,R,k,F,z,U,V):t.arc(O,N,G,z,U,V),W)break t;b&&(n=qs(z)*R+O,i=Ys(z)*k+N),r=qs(U)*R+O,o=Ys(U)*k+N;break;case Fs.R:n=r=d[x],i=o=d[x+1],a=d[x++],s=d[x++];var j=d[x++],Z=d[x++];if(m){if(v+(q=l[_++])>u){var X=u-v;t.moveTo(a,s),t.lineTo(a+Zs(X,j),s),(X-=j)>0&&t.lineTo(a+j,s+Zs(X,Z)),(X-=Z)>0&&t.lineTo(a+Xs(j-X,0),s+Z),(X-=j)>0&&t.lineTo(a,s+Xs(Z-X,0));break t}v+=q}t.rect(a,s,j,Z);break;case Fs.Z:if(m){var q;if(v+(q=l[_++])>u){M=(u-v)/q;t.lineTo(r*(1-M)+n*M,o*(1-M)+i*M);break t}v+=q}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=Fs,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();const il=nl;function rl(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||oe+c&&h>i+c&&h>o+c&&h>s+c||ht+c&&u>n+c&&u>r+c&&u>a+c||ue+u&&l>i+u&&l>o+u||lt+u&&s>n+u&&s>r+u||sn||h+ur&&(r+=ul);var d=Math.atan2(l,s);return d<0&&(d+=ul),d>=i&&d<=r||d+ul>=i&&d+ul<=r}function cl(t,e,n,i,r,o){if(o>e&&o>i||or?s:0}var dl=il.CMD,fl=2*Math.PI;var pl=[-1,-1,-1],gl=[-1,-1];function ml(t,e,n,i,r,o,a,s,l,u){if(u>e&&u>i&&u>o&&u>s||u1&&(h=void 0,h=gl[0],gl[0]=gl[1],gl[1]=h),p=ii(e,i,o,s,gl[0]),f>1&&(g=ii(e,i,o,s,gl[1]))),2===f?ve&&s>i&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(ei(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=Xn(u),d=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}(e,i,o,s,pl);if(0===l)return 0;var u=di(e,i,o);if(u>=0&&u<=1){for(var h=0,c=hi(e,i,o,u),d=0;dn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);pl[0]=-l,pl[1]=l;var u=Math.abs(i-r);if(u<1e-4)return 0;if(u>=fl-1e-4){i=0,r=fl;var h=o?1:-1;return a>=pl[0]+t&&a<=pl[1]+t?h:0}if(i>r){var c=i;i=r,r=c}i<0&&(i+=fl,r+=fl);for(var d=0,f=0;f<2;f++){var p=pl[f];if(p+t>a){var g=Math.atan2(s,p);h=o?1:-1;g<0&&(g=fl+g),(g>=i&&g<=r||g+fl>=i&&g+fl<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),d+=h)}}return d}function yl(t,e,n,i,r){for(var o,a,s,l,u=t.data,h=t.len(),c=0,d=0,f=0,p=0,g=0,m=0;m1&&(n||(c+=cl(d,f,p,g,i,r))),_&&(p=d=u[m],g=f=u[m+1]),v){case dl.M:d=p=u[m++],f=g=u[m++];break;case dl.L:if(n){if(rl(d,f,u[m],u[m+1],e,i,r))return!0}else c+=cl(d,f,u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.C:if(n){if(ol(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=ml(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.Q:if(n){if(al(d,f,u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=vl(d,f,u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.A:var y=u[m++],x=u[m++],w=u[m++],b=u[m++],T=u[m++],S=u[m++];m+=1;var M=!!(1-u[m++]);o=Math.cos(T)*w+y,a=Math.sin(T)*b+x,_?(p=o,g=a):c+=cl(d,f,o,a,i,r);var C=(i-y)*b/w+y;if(n){if(hl(y,x,b,T,T+S,M,e,C,r))return!0}else c+=_l(y,x,b,T,T+S,M,C,r);d=Math.cos(T+S)*w+y,f=Math.sin(T+S)*b+x;break;case dl.R:if(p=d=u[m++],g=f=u[m++],o=p+u[m++],a=g+u[m++],n){if(rl(p,g,o,g,e,i,r)||rl(o,g,o,a,e,i,r)||rl(o,a,p,a,e,i,r)||rl(p,a,p,g,e,i,r))return!0}else c+=cl(o,g,o,a,i,r),c+=cl(p,a,p,g,i,r);break;case dl.Z:if(n){if(rl(d,f,p,g,e,i,r))return!0}else c+=cl(d,f,p,g,i,r);d=p,f=g}}return n||(s=f,l=g,Math.abs(s-l)<1e-4)||(c+=cl(d,f,p,g,i,r)||0),0!==c}var xl=ot({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},vs),wl={style:ot({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},_s.style)},bl=so.concat(["invisible","culling","z","z2","zlevel","parent"]),Tl=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype.update=function(){var n=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){n.buildPath(t,n.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?Jr:e>.2?"#eee":$r}if(t)return $r}return Jr},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(wt(e)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Zi(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,n){},e.prototype.pathUpdated=function(){this.__dirty&=~zn},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new il(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||this.__dirty&zn)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,n,i){return yl(t,e,!0,n,i)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,n){return yl(t,0,!1,e,n)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=zn,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},e.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:rt(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&zn)},e.prototype.createStyle=function(t){return Xt(xl,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=rt({},this.shape))},e.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=rt({},i.shape),rt(s,n.shape)):(s=rt({},r?this.shape:i.shape),rt(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=rt({},this.shape);for(var u={},h=mt(s),c=0;c0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return Xt(Ml,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=po(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(Ss);Cl.prototype.type="tspan";const Ll=Cl;var Al=ot({x:0,y:0},vs),Dl={style:ot({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},_s.style)};var Il=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.createStyle=function(t){return Xt(Al,t)},e.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i,r=(i=e.image)&&"string"!=typeof i&&i.width&&i.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Dl},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new _n(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Ss);Il.prototype.type="image";const Pl=Il;var El=Math.round;function Ol(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(El(2*i)===El(2*r)&&(t.x1=t.x2=Rl(i,s,!0)),El(2*o)===El(2*a)&&(t.y1=t.y2=Rl(o,s,!0)),t):t}}function Nl(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=Rl(i,s,!0),t.y=Rl(r,s,!0),t.width=Math.max(Rl(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Rl(r+a,s,!1)-t.y,0===a?0:1),t):t}}function Rl(t,e,n){if(!e)return t;var i=El(2*t);return(i+El(e))%2==0?i/2:(i+(n?1:-1))/2}var kl=function(){this.x=0,this.y=0,this.width=0,this.height=0},zl={},Bl=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new kl},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Nl(zl,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?function(t,e){var n,i,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?n=i=r=o=c:c instanceof Array?1===c.length?n=i=r=o=c[0]:2===c.length?(n=r=c[0],i=o=c[1]):3===c.length?(n=c[0],i=o=c[1],r=c[2]):(n=c[0],i=c[1],r=c[2],o=c[3]):n=i=r=o=0,n+i>u&&(n*=u/(a=n+i),i*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),i+r>h&&(i*=h/(a=i+r),r*=h/a),n+o>h&&(n*=h/(a=n+o),o*=h/a),t.moveTo(s+n,l),t.lineTo(s+u-i,l),0!==i&&t.arc(s+u-i,l+i,i,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+n),0!==n&&t.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(t,e):t.rect(n,i,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Sl);Bl.prototype.type="rect";const Fl=Bl;var Vl={fill:"#000"},Gl={style:ot({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},_s.style)},Hl=function(t){function e(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Vl,n.attr(e),n}return I(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ep&&h){var g=Math.floor(p/l);c=c||n.length>g,n=n.slice(0,g)}if(t&&a&&null!=d)for(var m=as(d,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v={},_=0;_0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=i.calculatedLineHeight,L=0;Ll&&ds(n,t.substring(l,u),e,s),ds(n,i[2],e,s,i[1]),l=is.lastIndex}lo){var A=n.lines.length;b>0?(y.tokens=y.tokens.slice(0,b),v(y,w,x),n.lines=n.lines.slice(0,_+1)):n.lines=n.lines.slice(0,_),n.isTruncated=n.isTruncated||n.lines.length=0&&"right"===(L=y[C]).align;)this._placeToken(L,t,w,p,M,"right",m),b-=L.width,M-=L.width,C--;for(S+=(n-(S-f)-(g-M)-b)/2;T<=C;)L=y[T],this._placeToken(L,t,w,p,S+L.width/2,"center",m),S+=L.width,T++;p+=w}},e.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2),!t.isLineHolder&&tu(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=$l(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var d=this._getOrCreateChild(Ll),f=d.createStyle();d.useStyle(f);var p=this._defaultStyle,g=!1,m=0,v=Jl("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,p.fill)),_=Kl("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||p.autoStroke&&!g?null:(m=2,p.stroke)),y=s.textShadowBlur>0||e.textShadowBlur>0;f.text=t.text,f.x=r,f.y=u,y&&(f.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,f.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",f.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,f.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),f.textAlign=o,f.textBaseline="middle",f.font=t.font||R,f.opacity=Nt(s.opacity,e.opacity,1),Xl(f,s),_&&(f.lineWidth=Nt(s.lineWidth,e.lineWidth,m),f.lineDash=Ot(s.lineDash,e.lineDash),f.lineDashOffset=e.lineDashOffset||0,f.stroke=_),v&&(f.fill=v);var x=t.contentWidth,w=t.contentHeight;d.setBoundingRect(new _n(go(f.x,x,f.textAlign),mo(f.y,w,f.textBaseline),x,w))},e.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,d=u&&u.image,f=u&&!d,p=t.borderRadius,g=this;if(f||t.lineHeight||h&&c){(a=this._getOrCreateChild(Fl)).useStyle(a.createStyle()),a.style.fill=null;var m=a.shape;m.x=n,m.y=i,m.width=r,m.height=o,m.r=p,a.dirtyShape()}if(f)(l=a.style).fill=u||null,l.fillOpacity=Ot(t.fillOpacity,1);else if(d){(s=this._getOrCreateChild(Pl)).onload=function(){g.dirtyStyle()};var v=s.style;v.image=u.image,v.x=n,v.y=i,v.width=r,v.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=Ot(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var _=(a||s).style;_.shadowBlur=t.shadowBlur||0,_.shadowColor=t.shadowColor||"transparent",_.shadowOffsetX=t.shadowOffsetX||0,_.shadowOffsetY=t.shadowOffsetY||0,_.opacity=Nt(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return ql(t)&&(e=[t.fontStyle,t.fontWeight,Zl(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&Bt(e)||t.textFont||t.font},e}(Ss),Ul={left:!0,right:1,center:1},Wl={top:1,bottom:1,middle:1},jl=["fontStyle","fontWeight","fontSize","fontFamily"];function Zl(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?"12px":t+"px":t}function Xl(t,e){for(var n=0;n=0,o=!1;if(t instanceof Sl){var a=ou(t),s=r&&a.selectFill||a.normalFill,l=r&&a.selectStroke||a.normalStroke;if(mu(s)||mu(l)){var u=(i=i||{}).style||{};"inherit"===u.fill?(o=!0,i=rt({},i),(u=rt({},u)).fill=s):!mu(u.fill)&&mu(s)?(o=!0,i=rt({},i),(u=rt({},u)).fill=Yi(s)):!mu(u.stroke)&&mu(l)&&(o||(i=rt({},i),u=rt({},u)),u.stroke=Yi(l)),i.style=u}}if(i&&null==i.z2){o||(i=rt({},i));var h=t.z2EmphasisLift;i.z2=t.z2+(null!=h?h:uu)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=st(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:function(t,e,n,i){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}}))})),e}function Hu(t,e,n){Wu(t,!0),Mu(t,Lu),function(t,e,n){var i=nu(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}(t,e,n)}function Uu(t,e,n,i){i?function(t){Wu(t,!1)}(t):Hu(t,e,n)}function Wu(t,e){var n=!1===e,i=t;t.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=t.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function ju(t){return!(!t||!t.__highDownDispatcher)}function Zu(t){var e=t.type;return e===fu||e===pu||e===gu}function Xu(t){var e=t.type;return e===cu||e===du}var qu=Ea();function Yu(t,e,n,i,r){var o;if(e&&e.ecModel){var a=e.ecModel.getUpdatePayload();o=a&&a.animation}var s="update"===t;if(e&&e.isAnimationEnabled()){var l=void 0,u=void 0,h=void 0;return i?(l=Ot(i.duration,200),u=Ot(i.easing,"cubicOut"),h=0):(l=e.getShallow(s?"animationDurationUpdate":"animationDuration"),u=e.getShallow(s?"animationEasingUpdate":"animationEasing"),h=e.getShallow(s?"animationDelayUpdate":"animationDelay")),o&&(null!=o.duration&&(l=o.duration),null!=o.easing&&(u=o.easing),null!=o.delay&&(h=o.delay)),xt(h)&&(h=h(n,r)),xt(l)&&(l=l(n)),{duration:l||0,delay:h,easing:u}}return null}function Ku(t,e,n,i,r,o,a){var s,l=!1;xt(r)?(a=o,o=r,r=null):St(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u="leave"===t;u||e.stopAnimation("leave");var h=Yu(t,i,r,u?s||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null);if(h&&h.duration>0){var c={duration:h.duration,delay:h.delay||0,easing:h.easing,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,c):e.animateTo(n,c)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function Ju(t,e,n,i,r,o){Ku("update",t,e,n,i,r,o)}function $u(t,e,n,i,r,o){Ku("enter",t,e,n,i,r,o)}function Qu(t){if(!t.__zr)return!0;for(var e=0;e-1?Oh:Rh;function Fh(t,e){t=t.toUpperCase(),zh[t]=new Ih(e),kh[t]=e}Fh(Nh,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Fh(Oh,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Vh=1e3,Gh=6e4,Hh=36e5,Uh=864e5,Wh=31536e6,jh={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Zh="{yyyy}-{MM}-{dd}",Xh={year:"{yyyy}",month:"{yyyy}-{MM}",day:Zh,hour:Zh+" "+jh.hour,minute:Zh+" "+jh.minute,second:Zh+" "+jh.second,millisecond:jh.none},qh=["year","month","day","hour","minute","second","millisecond"],Yh=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Kh(t,e){return"0000".substr(0,e-(t+="").length)+t}function Jh(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function $h(t){return t===Jh(t)}function Qh(t,e,n,i){var r=aa(t),o=r[nc(n)](),a=r[ic(n)]()+1,s=Math.floor((a-1)/3)+1,l=r[rc(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[oc(n)](),c=(h-1)%12+1,d=r[ac(n)](),f=r[sc(n)](),p=r[lc(n)](),g=h>=12?"pm":"am",m=g.toUpperCase(),v=i instanceof Ih?i:function(t){return zh[t]}(i||Bh)||zh[Rh],_=v.getModel("time"),y=_.get("month"),x=_.get("monthAbbr"),w=_.get("dayOfWeek"),b=_.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,m+"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,Kh(o%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,y[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,Kh(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,Kh(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[u]).replace(/{ee}/g,b[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Kh(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,Kh(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,Kh(d,2)).replace(/{m}/g,d+"").replace(/{ss}/g,Kh(f,2)).replace(/{s}/g,f+"").replace(/{SSS}/g,Kh(p,3)).replace(/{S}/g,p+"")}function tc(t,e){var n=aa(t),i=n[ic(e)]()+1,r=n[rc(e)](),o=n[oc(e)](),a=n[ac(e)](),s=n[sc(e)](),l=0===n[lc(e)](),u=l&&0===s,h=u&&0===a,c=h&&0===o,d=c&&1===r;return d&&1===i?"year":d?"month":c?"day":h?"hour":u?"minute":l?"second":"millisecond"}function ec(t,e,n){var i=Tt(t)?aa(t):t;switch(e=e||tc(t,n)){case"year":return i[nc(n)]();case"half-year":return i[ic(n)]()>=6?1:0;case"quarter":return Math.floor((i[ic(n)]()+1)/4);case"month":return i[ic(n)]();case"day":return i[rc(n)]();case"half-day":return i[oc(n)]()/24;case"hour":return i[oc(n)]();case"minute":return i[ac(n)]();case"second":return i[sc(n)]();case"millisecond":return i[lc(n)]()}}function nc(t){return t?"getUTCFullYear":"getFullYear"}function ic(t){return t?"getUTCMonth":"getMonth"}function rc(t){return t?"getUTCDate":"getDate"}function oc(t){return t?"getUTCHours":"getHours"}function ac(t){return t?"getUTCMinutes":"getMinutes"}function sc(t){return t?"getUTCSeconds":"getSeconds"}function lc(t){return t?"getUTCMilliseconds":"getMilliseconds"}function uc(t){return t?"setUTCFullYear":"setFullYear"}function hc(t){return t?"setUTCMonth":"setMonth"}function cc(t){return t?"setUTCDate":"setDate"}function dc(t){return t?"setUTCHours":"setHours"}function fc(t){return t?"setUTCMinutes":"setMinutes"}function pc(t){return t?"setUTCSeconds":"setSeconds"}function gc(t){return t?"setUTCMilliseconds":"setMilliseconds"}function mc(t){if(!fa(t))return wt(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function vc(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var _c=kt;function yc(t,e,n){function i(t){return t&&Bt(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="time"===e,a=t instanceof Date;if(o||a){var s=o?aa(t):t;if(!isNaN(+s))return Qh(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(a)return"-"}if("ordinal"===e)return bt(t)?i(t):Tt(t)&&r(t)?t+"":"-";var l=da(t);return r(l)?mc(l):bt(t)?i(t):"boolean"==typeof t?t+"":"-"}var xc=["a","b","c","d","e","f","g"],wc=function(t,e){return"{"+t+(null==e?"":e)+"}"};function bc(t,e,n){yt(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;o':'':{renderMode:o,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function Sc(t,e,n){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var i=aa(e),r=n?"getUTC":"get",o=i[r+"FullYear"](),a=i[r+"Month"]()+1,s=i[r+"Date"](),l=i[r+"Hours"](),u=i[r+"Minutes"](),h=i[r+"Seconds"](),c=i[r+"Milliseconds"]();return t=t.replace("MM",Kh(a,2)).replace("M",a).replace("yyyy",o).replace("yy",Kh(o%100+"",2)).replace("dd",Kh(s,2)).replace("d",s).replace("hh",Kh(l,2)).replace("h",l).replace("mm",Kh(u,2)).replace("m",u).replace("ss",Kh(h,2)).replace("s",h).replace("SSS",Kh(c,3))}function Mc(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Cc(t,e){return e=e||"transparent",wt(t)?t:St(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}function Lc(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}var Ac=ct,Dc=["left","right","top","bottom","width","height"],Ic=[["width","left","right"],["height","top","bottom"]];function Pc(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),f=e.childAt(u+1),p=f&&f.getBoundingRect();if("horizontal"===t){var g=d.width+(p?-p.x+d.x:0);(h=o+g)>i||l.newline?(o=0,h=g,a+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(p?-p.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+n,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)}))}var Ec=Pc;_t(Pc,"vertical"),_t(Pc,"horizontal");function Oc(t,e,n){n=_c(n||0);var i=e.width,r=e.height,o=qo(t.left,i),a=qo(t.top,r),s=qo(t.right,i),l=qo(t.bottom,r),u=qo(t.width,i),h=qo(t.height,r),c=n[2]+n[0],d=n[1]+n[3],f=t.aspect;switch(isNaN(u)&&(u=i-s-d-o),isNaN(h)&&(h=r-l-c-a),null!=f&&(isNaN(u)&&isNaN(h)&&(f>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(o)&&(o=i-s-u-d),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-d}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-d-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var p=new _n(o+n[3],a+n[0],u,h);return p.margin=n,p}function Nc(t,e,n,i,r,o){var a,s=!r||!r.hv||r.hv[0],l=!r||!r.hv||r.hv[1],u=r&&r.boundingMode||"all";if((o=o||t).x=t.x,o.y=t.y,!s&&!l)return!1;if("raw"===u)a="group"===t.type?new _n(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(a=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(a=a.clone()).applyTransform(h)}var c=Oc(ot({width:a.width,height:a.height},e),n,i),d=s?c.x-a.x:0,f=l?c.y-a.y:0;return"raw"===u?(o.x=d,o.y=f):(o.x+=d,o.y+=f),o===t&&t.markRedraw(),!0}function Rc(t){var e=t.layoutMode||t.constructor.layoutMode;return St(e)?e:e?{type:e}:null}function kc(t,e,n){var i=n&&n.ignoreSize;!yt(i)&&(i=[i,i]);var r=a(Ic[0],0),o=a(Ic[1],1);function a(n,r){var o={},a=0,u={},h=0;if(Ac(n,(function(e){u[e]=t[e]})),Ac(n,(function(t){s(e,t)&&(o[t]=u[t]=e[t]),l(o,t)&&a++,l(u,t)&&h++})),i[r])return l(e,n[1])?u[n[2]]=null:l(e,n[2])&&(u[n[1]]=null),u;if(2!==h&&a){if(a>=2)return o;for(var c=0;c=0;a--)o=nt(o,n[a],!0);e.defaultOption=o}return e.defaultOption},e.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return Ba(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Ih);Wa(Vc,Ih),qa(Vc),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=Ha(t);e[i.main]=n},t.determineSubType=function(n,i){var r=i.type;if(!r){var o=Ha(n).main;t.hasSubTypes(n)&&e[o]&&(r=e[o](i))}return r}}(Vc),function(t,e){function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,i,r,o){if(t.length){var a=function(t){var i={},r=[];return ct(t,(function(o){var a=n(i,o),s=function(t,e){var n=[];return ct(t,(function(t){st(e,t)>=0&&n.push(t)})),n}(a.originalDeps=e(o),t);a.entryCount=s.length,0===a.entryCount&&r.push(o),ct(s,(function(t){st(a.predecessor,t)<0&&a.predecessor.push(t);var e=n(i,t);st(e.successor,t)<0&&e.successor.push(o)}))})),{graph:i,noEntryList:r}}(i),s=a.graph,l=a.noEntryList,u={};for(ct(t,(function(t){u[t]=!0}));l.length;){var h=l.pop(),c=s[h],d=!!u[h];d&&(r.call(o,h,c.originalDeps.slice()),delete u[h]),ct(c.successor,d?p:f)}ct(u,(function(){throw new Error("")}))}function f(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}function p(t){u[t]=!0,f(t)}}}(Vc,(function(t){var e=[];ct(Vc.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})),e=dt(e,(function(t){return Ha(t).main})),"dataset"!==t&&st(e,"dataset")<=0&&e.unshift("dataset");return e}));const Gc=Vc;var Hc="";"undefined"!=typeof navigator&&(Hc=navigator.platform||"");var Uc="rgba(0, 0, 0, 0.2)";const Wc={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Uc,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Uc,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Uc,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Uc,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Uc,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Uc,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Hc.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var jc=jt(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Zc="original",Xc="arrayRows",qc="objectRows",Yc="keyedColumns",Kc="typedArray",Jc="unknown",$c="column",Qc="row",td={Must:1,Might:2,Not:3},ed=Ea();function nd(t,e,n){var i={},r=id(e);if(!r||!t)return i;var o,a,s=[],l=[],u=e.ecModel,h=ed(u).datasetMap,c=r.uid+"_"+n.seriesLayoutBy;ct(t=t.slice(),(function(e,n){var r=St(e)?e:t[n]={name:e};"ordinal"===r.type&&null==o&&(o=n,a=p(r)),i[r.name]=[]}));var d=h.get(c)||h.set(c,{categoryWayDim:a,valueWayDim:0});function f(t,e,n){for(var i=0;ie)return t[i];return t[n-1]}(i,a):n;if((h=h||n)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}var fd="\0_ec_inner";var pd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new Ih(i),this._locale=new Ih(r),this._optionManager=o},e.prototype.setOption=function(t,e,n){var i=vd(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},e.prototype.resetOption=function(t,e){return this._resetOption(t,vd(e))},e.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);0,this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):ud(this,r),n=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&ct(a,(function(t){n=!0,this._mergeOption(t,e)}),this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,e){var n=this.option,i=this._componentsMap,r=this._componentsCount,o=[],a=jt(),s=e&&e.replaceMergeMainTypeMap;ed(this).datasetMap=jt(),ct(t,(function(t,e){null!=t&&(Gc.hasClass(e)?e&&(o.push(e),a.set(e,!0)):n[e]=null==n[e]?et(t):nt(n[e],t,!0))})),s&&s.each((function(t,e){Gc.hasClass(e)&&!a.get(e)&&(o.push(e),a.set(e,!0))})),Gc.topologicalTravel(o,Gc.getAllClassMainTypes(),(function(e){var o=function(t,e,n){var i=ad.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}(this,e,xa(t[e])),a=i.get(e),l=a?s&&s.get(e)?"replaceMerge":"normalMerge":"replaceAll",u=Ma(a,o,l);(function(t,e,n){ct(t,(function(t){var i=t.newOption;St(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){return e.type?e.type:n?n.subType:i.determineSubType(t,e)}(e,i,t.existing,n))}))})(u,e,Gc),n[e]=null,i.set(e,null),r.set(e,0);var h,c=[],d=[],f=0;ct(u,(function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=Gc.getClass(e,t.keyInfo.subType,!o);if(!a)return;if("tooltip"===e){if(h)return void 0;h=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=rt({componentIndex:n},t.keyInfo);rt(i=new a(r,this,this,s),s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(c.push(i.option),d.push(i),f++):(c.push(void 0),d.push(void 0))}),this),n[e]=c,i.set(e,d),r.set(e,f),"series"===e&&sd(this)}),this),this._seriesIndices||sd(this)},e.prototype.getOption=function(){var t=et(this.option);return ct(t,(function(e,n){if(Gc.hasClass(n)){for(var i=xa(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!Ia(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}})),delete t[fd],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;r=e:"max"===n?t<=e:t===e})(i[a],t,o)||(r=!1)}})),r}const Ld=Md;var Ad=ct,Dd=St,Id=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Pd(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=Id.length;n=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var v=m.data.getByRawIndex(m.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&v<0||"samesign"===l&&f>=0&&v>0||"samesign"===l&&f<=0&&v<0){f=ea(f,v),p=v;break}}}return i[0]=f,i[1]=p,i}))}))}var Yd,Kd,Jd,$d,Qd,tf=function(t){this.data=t.data||(t.sourceFormat===Yc?{}:[]),this.sourceFormat=t.sourceFormat||Jc,this.seriesLayoutBy=t.seriesLayoutBy||$c,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;nu&&(u=f)}s[0]=l,s[1]=u}},i=function(){return this._data?this._data.length/this._dimSize:0};function r(t){for(var e=0;e=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""})):void 0},t.prototype.getRawValue=function(t,e){return xf(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,n){},t}();function Tf(t){var e,n;return St(t)?t.type&&(n=t):e=t,{text:e,frag:n}}function Sf(t){return new Mf(t)}var Mf=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){var e,n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(e=this._plan(this.context));var o,a=h(this._modBy),s=this._modDataCount||0,l=h(t&&t.modBy),u=t&&t.modDataCount||0;function h(t){return!(t>=1)&&(t=1),t}a===l&&s===u||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,o=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(o||d1&&i>0?s:a}};return o;function a(){return e=t?null:oe},gte:function(t,e){return t>=e}},Pf=(function(){function t(t,e){if(!Tt(e)){0,Af("")}this._opFn=If[t],this._rvalFloat=da(e)}t.prototype.evaluate=function(t){return Tt(t)?this._opFn(t,this._rvalFloat):this._opFn(da(t),this._rvalFloat)}}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=Tt(t)?t:da(t),i=Tt(e)?e:da(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=wt(t),s=wt(e);a&&(n=s?t:0),s&&(i=a?e:0)}return ni?-this._resultLT:0},t}());!function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=da(e)}t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=da(t)===this._rvalFloat)}return this._isEQ?e:!e}}();var Ef=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return Df(t,e)},t}();function Of(t){if(!Ff(t.sourceFormat)){0,Af("")}return t.data}function Nf(t){var e=t.sourceFormat,n=t.data;if(!Ff(e)){0,Af("")}if(e===Xc){for(var i=[],r=0,o=n.length;r65535?Hf:Uf}function qf(t,e,n,i,r){var o=Zf[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;ug[1]&&(g[1]=p)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=dt(o,(function(t){return t.property})),u=0;um[1]&&(m[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&nt))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],r=[];if(!i)return r;null==n&&(n=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;r=u&&y<=h||isNaN(y))&&(a[s++]=f),f++}d=!0}else if(2===r){p=c[i[0]];var m=c[i[1]],v=t[i[1]][0],_=t[i[1]][1];for(g=0;g=u&&y<=h||isNaN(y))&&(x>=v&&x<=_||isNaN(x))&&(a[s++]=f),f++}d=!0}}if(!d)if(1===r)for(g=0;g=u&&y<=h||isNaN(y))&&(a[s++]=w)}else for(g=0;gt[S][1])&&(b=!1)}b&&(a[s++]=e.getRawIndex(g))}return sm[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(Xf(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var d=1;dn&&(n=i,r=M)}S>0&&Sa&&(p=a-u);for(var g=0;gf&&(f=m,d=u+g)}var v=this.getRawIndex(h),_=this.getRawIndex(d);hu-f&&(s=u-f,a.length=s);for(var p=0;ph[1]&&(h[1]=m),c[d++]=v}return r._count=d,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();ra&&(a=l)}return i=[o,a],this._extent[t]=i,i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return Df(t[i],this._dimensions[i])}Vf={arrayRows:t,objectRows:function(t,e,n,i){return Df(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return Df(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const Kf=Yf;var Jf=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(Qf(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]}else s=Ct(a=o.get("data",!0))?Kc:Zc,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},d=Ot(h.seriesLayoutBy,c.seriesLayoutBy)||null,f=Ot(h.sourceHeader,c.sourceHeader),p=Ot(h.dimensions,c.dimensions);t=d!==c.seriesLayoutBy||!!f!=!!c.sourceHeader||p?[nf(a,{seriesLayoutBy:d,sourceHeader:f,dimensions:p},s)]:[]}else{var g=n;if(r){var m=this._applyTransform(i);t=m.sourceList,e=m.upstreamSignList}else{t=[nf(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,i=n.get("transform",!0),r=n.get("fromTransformResult",!0);if(null!=r){1!==t.length&&tp("")}var o,a=[],s=[];return ct(t,(function(t){t.prepareSource();var e=t.getSource(r||0);null==r||e||tp(""),a.push(e),s.push(t._getVersionSign())})),i?e=function(t,e){var n=xa(t),i=n.length;i||Af("");for(var r=0,o=i;r1||n>0&&!t.noHeader;return ct(t.blocks,(function(t){var n=lp(t);n>=e&&(e=n+ +(i&&(!n||ap(t)&&!t.noHeader)))})),e}return 0}function up(t,e,n,i){var r,o=e.noHeader,a=(r=lp(e),{html:ip[r],richText:rp[r]}),s=[],l=e.blocks||[];zt(!l||yt(l)),l=l||[];var u=t.orderMode;if(e.sortBlocks&&u){l=l.slice();var h={valueAsc:"asc",valueDesc:"desc"};if(Yt(h,u)){var c=new Pf(h[u],null);l.sort((function(t,e){return c.evaluate(t.sortParam,e.sortParam)}))}else"seriesDesc"===u&&l.reverse()}ct(l,(function(n,r){var o=e.valueFormatter,l=sp(n)(o?rt(rt({},t),{valueFormatter:o}):t,n,r>0?a.html:0,i);null!=l&&s.push(l)}));var d="richText"===t.renderMode?s.join(a.richText):dp(i,s.join(""),o?n:a.html);if(o)return d;var f=yc(e.header,"ordinal",t.useUTC),p=np(i,t.renderMode).nameStyle,g=ep(i);return"richText"===t.renderMode?fp(t,f,p)+a.richText+d:dp(i,'
'+ze(f)+"
"+d,n)}function hp(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return dt(t=yt(t)?t:[t],(function(t,e){return yc(t,yt(f)?f[e]:f,u)}))};if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),d=o?"":yc(l,"ordinal",u),f=e.valueType,p=a?[]:h(e.value,e.dataIndex),g=!s||!o,m=!s&&o,v=np(i,r),_=v.nameStyle,y=v.valueStyle;return"richText"===r?(s?"":c)+(o?"":fp(t,d,_))+(a?"":function(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(yt(e)?e.join(" "):e,o)}(t,p,g,m,y)):dp(i,(s?"":c)+(o?"":function(t,e,n){return''+ze(t)+""}(d,!s,_))+(a?"":function(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return t=yt(t)?t:[t],''+dt(t,(function(t){return ze(t)})).join("  ")+""}(p,g,m,y)),n)}}function cp(t,e,n,i,r,o){if(t)return sp(t)({useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function dp(t,e,n){return'
'+e+'
'}function fp(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function pp(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}var gp=function(){function t(){this.richTextStyles={},this._nextStyleNameId=pa()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,n){var i="richText"===n?this._generateStyleName():null,r=Tc({color:e,type:t,renderMode:n,markerId:i});return wt(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};yt(e)?ct(e,(function(t){return rt(n,t)})):rt(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}();function mp(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),d=yt(c),f=function(t,e){return Cc(t.getData().getItemVisual(e,"style")[t.visualDrawType])}(o,a);if(h>1||d&&!h){var p=function(t,e,n,i,r){var o=e.getData(),a=ft(t,(function(t,e,n){var i=o.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName}),!1),s=[],l=[],u=[];function h(t,e){var n=o.getDimensionInfo(e);n&&!1!==n.otherDims.tooltip&&(a?u.push(op("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(s.push(t),l.push(n.type)))}return i.length?ct(i,(function(t){h(xf(o,n,t),t)})):ct(t,h),{inlineValues:s,inlineValueTypes:l,blocks:u}}(c,o,a,u,f);e=p.inlineValues,n=p.inlineValueTypes,i=p.blocks,r=p.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=xf(l,a,u[0]),n=g.type}else r=e=d?c[0]:c;var m=Da(o),v=m&&o.name||"",_=l.getName(a),y=s?v:_;return op("section",{header:v,noHeader:s||!m,sortParam:r,blocks:[op("nameValue",{markerType:"item",markerColor:f,name:y,noName:!Bt(y),value:e,valueType:n,dataIndex:a})].concat(i||[])})}var vp=Ea();function _p(t,e){return t.getName(e)||t.getId(e)}var yp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}return I(e,t),e.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=Sf({count:wp,reset:bp}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(vp(this).sourceManager=new Jf(this)).prepareSource();var i=this.getInitialData(t,n);Sp(i,this),this.dataTask.context.data=i,vp(this).dataBeforeProcessed=i,xp(this),this._initSelectedMapFromData(i)},e.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{},r=this.subType;Gc.hasClass(r)&&(r+="Series"),nt(t,e.getTheme().get(this.subType)),nt(t,this.getDefaultOption()),wa(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&kc(t,i,n)},e.prototype.mergeOption=function(t,e){t=nt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Rc(this);n&&kc(this.option,t,n);var i=vp(this).sourceManager;i.dirty(),i.prepareSource();var r=this.getInitialData(t,e);Sp(r,this),this.dataTask.dirty(),this.dataTask.context.data=r,vp(this).dataBeforeProcessed=r,xp(this),this._initSelectedMapFromData(r)},e.prototype.fillDataTextStyle=function(t){if(t&&!Ct(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=cd.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},e.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[_p(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){St(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;l0&&this._innerSelect(t,e)}},e.registerClass=function(t){return Gc.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Gc);function xp(t){var e=t.name;Da(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return ct(n,(function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)})),i.join(" ")}(t)||e)}function wp(t){return t.model.getRawData().count()}function bp(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Tp}function Tp(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Sp(t,e){ct(Zt(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(n){t.wrapMethod(n,_t(Mp,e))}))}function Mp(t,e){var n=Cp(t);return n&&n.setOutputEnd((e||this).count()),e}function Cp(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}ut(yp,bf),ut(yp,cd),Wa(yp,Gc);const Lp=yp;var Ap=function(){function t(){this.group=new Eo,this.uid=Eh("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){},t.prototype.updateLayout=function(t,e,n,i){},t.prototype.updateVisual=function(t,e,n,i){},t.prototype.toggleBlurSeries=function(t,e,n){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Ua(Ap),qa(Ap);const Dp=Ap;function Ip(){var t=Ea();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}var Pp=il.CMD,Ep=[[],[],[]],Op=Math.sqrt,Np=Math.atan2;var Rp=Math.sqrt,kp=Math.sin,zp=Math.cos,Bp=Math.PI;function Fp(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vp(t,e){return(t[0]*e[0]+t[1]*e[1])/(Fp(t)*Fp(e))}function Gp(t,e){return(t[0]*e[1]1&&(a*=Rp(p),s*=Rp(p));var g=(r===o?-1:1)*Rp((a*a*(s*s)-a*a*(f*f)-s*s*(d*d))/(a*a*(f*f)+s*s*(d*d)))||0,m=g*a*f/s,v=g*-s*d/a,_=(t+n)/2+zp(c)*m-kp(c)*v,y=(e+i)/2+kp(c)*m+zp(c)*v,x=Gp([1,0],[(d-m)/a,(f-v)/s]),w=[(d-m)/a,(f-v)/s],b=[(-1*d-m)/a,(-1*f-v)/s],T=Gp(w,b);if(Vp(w,b)<=-1&&(T=Bp),Vp(w,b)>=1&&(T=0),T<0){var S=Math.round(T/Bp*1e6)/1e6;T=2*Bp+S%2*Bp}h.addData(u,_,y,a,s,x,T,c,o)}var Up=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Wp=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var jp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.applyTransform=function(t){},e}(Sl);function Zp(t){return null!=t.setData}function Xp(t,e){var n=function(t){var e=new il;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=il.CMD,l=t.match(Up);if(!l)return e;for(var u=0;uI*I+P*P&&(S=C,M=L),{cx:S,cy:M,x0:-h,y0:-c,x1:S*(r/w-1),y1:M*(r/w-1)}}function dg(t,e){var n,i=lg(e.r,0),r=lg(e.r0||0,0),o=i>0;if(o||r>0){if(o||(i=r,r=0),r>i){var a=i;i=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var u=e.cx,h=e.cy,c=!!e.clockwise,d=ag(l-s),f=d>eg&&d%eg;if(f>hg&&(d=f),i>hg)if(d>eg-hg)t.moveTo(u+i*ig(s),h+i*ng(s)),t.arc(u,h,i,s,l,!c),r>hg&&(t.moveTo(u+r*ig(l),h+r*ng(l)),t.arc(u,h,r,l,s,c));else{var p=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,w=void 0,b=void 0,T=void 0,S=void 0,M=void 0,C=void 0,L=void 0,A=void 0,D=void 0,I=i*ig(s),P=i*ng(s),E=r*ig(l),O=r*ng(l),N=d>hg;if(N){var R=e.cornerRadius;R&&(n=function(t){var e;if(yt(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}(R),p=n[0],g=n[1],m=n[2],v=n[3]);var k=ag(i-r)/2;if(_=ug(k,m),y=ug(k,v),x=ug(k,p),w=ug(k,g),S=b=lg(_,y),M=T=lg(x,w),(b>hg||T>hg)&&(C=i*ig(l),L=i*ng(l),A=r*ig(s),D=r*ng(s),dhg){var W=ug(m,S),j=ug(v,S),Z=cg(A,D,I,P,i,W,c),X=cg(C,L,E,O,i,j,c);t.moveTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),S0&&t.arc(u+Z.cx,h+Z.cy,W,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,i,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),!c),j>0&&t.arc(u+X.cx,h+X.cy,j,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.moveTo(u+I,h+P),t.arc(u,h,i,s,l,!c);else t.moveTo(u+I,h+P);if(r>hg&&N)if(M>hg){W=ug(p,M),Z=cg(E,O,C,L,r,-(j=ug(g,M)),c),X=cg(I,P,A,D,r,-W,c);t.lineTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),M0&&t.arc(u+Z.cx,h+Z.cy,j,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,r,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),c),W>0&&t.arc(u+X.cx,h+X.cy,W,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.lineTo(u+E,h+O),t.arc(u,h,r,l,s,c);else t.lineTo(u+E,h+O)}else t.moveTo(u,h);t.closePath()}}}var fg=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},pg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new fg},e.prototype.buildPath=function(t,e){dg(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(Sl);pg.prototype.type="sector";const gg=pg;var mg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},vg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new mg},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},e}(Sl);vg.prototype.type="ring";const _g=vg;function yg(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=function(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;dXg[1]){if(a=!1,r)return a;var u=Math.abs(Xg[0]-Zg[1]),h=Math.abs(Zg[0]-Xg[1]);Math.min(u,h)>i.len()&&(uMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function xm(t){return!t.isGroup}function wm(t,e,n){if(t&&e){var i=function(t){var e={};return t.traverse((function(t){xm(t)&&t.anid&&(e[t.anid]=t)})),e}(t);e.traverse((function(t){if(xm(t)&&t.anid){var e=i[t.anid];if(e){var o=r(t);t.attr(r(e)),Ju(t,o,n,nu(t).dataIndex)}}}))}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=rt({},t.shape)),e}}function bm(t,e){return dt(t,(function(t){var n=t[0];n=em(n,e.x),n=nm(n,e.x+e.width);var i=t[1];return i=em(i,e.y),[n,i=nm(i,e.y+e.height)]}))}function Tm(t,e){var n=em(t.x,e.x),i=nm(t.x+t.width,e.x+e.width),r=em(t.y,e.y),o=nm(t.y+t.height,e.y+e.height);if(i>=n&&o>=r)return{x:n,y:r,width:i-n,height:o-r}}function Sm(t,e,n){var i=rt({rectHover:!0},e),r=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),ot(r,n),new Pl(i)):um(t.replace("path://",""),i,n,"center")}function Mm(t,e,n,i,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var p=t-r,g=e-o,m=Lm(p,g,u,h)/f;if(m<0||m>1)return!1;var v=Lm(p,g,c,d)/f;return!(v<0||v>1)}function Lm(t,e,n,i){return t*i-n*e}function Am(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=wt(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&ct(mt(l),(function(t){Yt(s,t)||(s[t]=l[t],s.$vars.push(t))}));var u=nu(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:ot({content:i,encodeHTMLContent:!0,formatterParams:s},r)}}function Dm(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Im(t,e){if(t)if(yt(t))for(var n=0;n=0?c():h=setTimeout(c,-r),l=i};return d.clear=function(){h&&(clearTimeout(h),h=null)},d.debounceNextCall=function(t){s=t},d}function Wm(t,e,n,i){var r=t[e];if(r){var o=r[Vm]||r,a=r[Hm];if(r[Gm]!==n||a!==i){if(null==n||!i)return t[e]=o;(r=t[e]=Um(o,n,"debounce"===i))[Vm]=o,r[Hm]=i,r[Gm]=n}return r}}function jm(t,e){var n=t[e];n&&n[Vm]&&(n.clear&&n.clear(),t[e]=n[Vm])}var Zm=Ea(),Xm={itemStyle:Ya(Ch,!0),lineStyle:Ya(Th,!0)},qm={lineStyle:"stroke",itemStyle:"fill"};function Ym(t,e){var n=t.visualStyleMapper||Xm[e];return n||(console.warn("Unknown style type '"+e+"'."),Xm.itemStyle)}function Km(t,e){var n=t.visualDrawType||qm[e];return n||(console.warn("Unknown style type '"+e+"'."),"fill")}var Jm={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=Ym(t,i)(r),a=r.getShallow("decal");a&&(n.setVisual("decal",a),a.dirty=!0);var s=Km(t,i),l=o[s],u=xt(l)?l:null,h="auto"===o.fill||"auto"===o.stroke;if(!o[s]||u||h){var c=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[s]||(o[s]=c,n.setVisual("colorFromPalette",!0)),o.fill="auto"===o.fill||xt(o.fill)?c:o.fill,o.stroke="auto"===o.stroke||xt(o.stroke)?c:o.stroke}if(n.setVisual("style",o),n.setVisual("drawType",s),!e.isSeriesFiltered(t)&&u)return n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=rt({},o);r[s]=u(i),e.setItemVisual(n,"style",r)}}}},$m=new Ih,Qm={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=Ym(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){$m.option=n[i];var a=r($m);rt(t.ensureUniqueItemVisual(e,"style"),a),$m.option.decal&&(t.setItemVisual(e,"decal",$m.option.decal),$m.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},tv={performRawSeries:!0,overallReset:function(t){var e=jt();t.eachSeries((function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,r=e.get(i);r||(r={},e.set(i,r)),Zm(t).scope=r}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=Zm(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Km(e,a);r.each((function(t){var e=r.getRawIndex(t);i[e]=t})),n.each((function(t){var a=i[t];if(r.getItemVisual(a,"colorFromPalette")){var l=r.ensureUniqueItemVisual(a,"style"),u=n.getName(t)||t+"",h=n.count();l[s]=e.getColorFromPalette(u,o,h)}}))}}))}},ev=Math.PI;var nv=function(){function t(t,e,n,i){this._stageTaskMap=jt(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex?n.step:null,o=i&&i.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),r=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,o=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=jt();t.eachSeries((function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;ct(this._allHandlers,(function(i){var r=t.get(i.uid)||t.set(i.uid,{});zt(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)}),this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){i=i||{};var r=!1,o=this;function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}ct(t,(function(t,s){if(!i.visualType||i.visualType===t.visualType){var l=o._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each((function(t){a(i,t)&&(t.dirty(),c=!0)})),c&&h.dirty(),o.updatePayload(h,n);var f=o.getPerformArgs(h,i.block);d.each((function(t){t.perform(f)})),h.perform(f)&&(r=!0)}else u&&u.each((function(s,l){a(i,s)&&s.dirty();var u=o.getPerformArgs(s,i.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),o.updatePayload(s,n),s.perform(u)&&(r=!0)}))}})),this.unfinished=r||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){var r=this,o=e.seriesTaskMap,a=e.seriesTaskMap=jt(),s=t.seriesType,l=t.getTargetSeries;function u(e){var s=e.uid,l=a.set(s,o&&o.get(s)||Sf({plan:sv,reset:lv,count:cv}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:r},r._pipe(e,l)}t.createOnAllSeries?n.eachRawSeries(u):s?n.eachRawSeriesByType(s,u):l&&l(n,i).each(u)},t.prototype._createOverallStageTask=function(t,e,n,i){var r=this,o=e.overallTask=e.overallTask||Sf({reset:iv});o.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:r};var a=o.agentStubMap,s=o.agentStubMap=jt(),l=t.seriesType,u=t.getTargetSeries,h=!0,c=!1;function d(t){var e=t.uid,n=s.set(e,a&&a.get(e)||(c=!0,Sf({reset:rv,onDirty:av})));n.context={model:t,overallProgress:h},n.agent=o,n.__block=h,r._pipe(t,n)}zt(!t.createOnAllSeries,""),l?n.eachRawSeriesByType(l,d):u?u(n,i).each(d):(h=!1,ct(n.getSeries(),d)),c&&o.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return xt(t)&&(t={overallReset:t,seriesType:dv(t)}),t.uid=Eh("stageHandler"),e&&(t.visualType=e),t},t}();function iv(t){t.overallReset(t.ecModel,t.api,t.payload)}function rv(t){return t.overallProgress&&ov}function ov(){this.agent.dirty(),this.getDownstream().dirty()}function av(){this.agent&&this.agent.dirty()}function sv(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function lv(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=xa(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?dt(e,(function(t,e){return hv(e)})):uv}var uv=hv(0);function hv(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)}))}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,r=n.packedEvent,o=n.model,a=n.view;if(!o||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,o,"mainType")&&u(s,o,"subType")&&u(s,o,"index","componentIndex")&&u(s,o,"name")&&u(s,o,"id")&&u(l,r,"name")&&u(l,r,"dataIndex")&&u(l,r,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,i,r));function u(t,e,n,i){return null==t[n]||e[i||n]===t[n]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Lv=["symbol","symbolSize","symbolRotate","symbolOffset"],Av=Lv.concat(["symbolKeepAspect"]),Dv={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},r={},o=!1,a=0;a=0&&qv(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}(t,e,n):function(t,e,n){var i=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(i=i*n.width+n.x,r=r*n.width+n.x,o=o*n.height+n.y,a=a*n.height+n.y),i=qv(i)?i:0,r=qv(r)?r:1,o=qv(o)?o:0,a=qv(a)?a:0,t.createLinearGradient(i,o,r,a)}(t,e,n),r=e.colorStops,o=0;o0&&(e=i.lineDash,n=i.lineWidth,e&&"solid"!==e&&n>0?"dashed"===e?[4*n,2*n]:"dotted"===e?[n]:Tt(e)?[e]:yt(e)?e:null:null),o=i.lineDashOffset;if(r){var a=i.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=dt(r,(function(t){return t/a})),o/=a)}return[r,o]}var Qv=new il(!0);function t_(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function e_(t){return"string"==typeof t&&"none"!==t}function n_(t){var e=t.fill;return null!=e&&"none"!==e}function i_(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function r_(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function o_(t,e,n){var i=ts(e.image,e.__image,n);if(ns(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*Jt),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}var a_=["shadowBlur","shadowOffsetX","shadowOffsetY"],s_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function l_(t,e,n,i,r){var o=!1;if(!i&&e===(n=n||{}))return!1;if(i||e.opacity!==n.opacity){g_(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?vs.opacity:a}(i||e.blend!==n.blend)&&(o||(g_(t,r),o=!0),t.globalCompositeOperation=e.blend||vs.blend);for(var s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,e,n){if(!this[z_])if(this._disposed)py(this.id);else{var i,r,o;if(St(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[z_]=!0,!this._model||e){var a=new Ld(this._api),s=this._theme,l=this._model=new _d;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},_y);var u={seriesTransition:o,optionChanged:!0};if(n)this[B_]={silent:i,updateParams:u},this[z_]=!1,this.getZr().wakeUp();else{try{j_(this),q_.update.call(this,null,u)}catch(t){throw this[B_]=null,this[z_]=!1,t}this._ssr||this._zr.flush(),this[B_]=null,this[z_]=!1,$_.call(this,i),Q_.call(this,i)}}},e.prototype.setTheme=function(){Lf()},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||O.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(O.svgSupported){var t=this._zr;return ct(t.storage.getDisplayList(),(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,n=this._model,i=[],r=this;ct(e,(function(t){n.eachComponent({mainType:t},(function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)}))}));var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return ct(i,(function(t){t.group.ignore=!1})),o}py(this.id)},e.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(Ty[n]){var a=o,s=o,l=-1/0,u=-1/0,h=[],c=t&&t.pixelRatio||this.getDevicePixelRatio();ct(by,(function(o,c){if(o.group===n){var d=e?o.getZr().painter.getSvgDom().innerHTML:o.renderToCanvas(et(t)),f=o.getDom().getBoundingClientRect();a=i(f.left,a),s=i(f.top,s),l=r(f.right,l),u=r(f.bottom,u),h.push({dom:d,left:f.left,top:f.top})}}));var d=(l*=c)-(a*=c),f=(u*=c)-(s*=c),p=F.createCanvas(),g=zo(p,{renderer:e?"svg":"canvas"});if(g.resize({width:d,height:f}),e){var m="";return ct(h,(function(t){var e=t.left-a,n=t.top-s;m+=''+t.dom+""})),g.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&g.painter.setBackgroundColor(t.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return t.connectedBackgroundColor&&g.add(new Fl({shape:{x:0,y:0,width:d,height:f},style:{fill:t.connectedBackgroundColor}})),ct(h,(function(t){var e=new Pl({style:{x:t.left*c-a,y:t.top*c-s,image:t.dom}});g.add(e)})),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}py(this.id)},e.prototype.convertToPixel=function(t,e){return Y_(this,"convertToPixel",t,e)},e.prototype.convertFromPixel=function(t,e){return Y_(this,"convertFromPixel",t,e)},e.prototype.containPixel=function(t,e){var n;if(!this._disposed)return ct(Na(this._model,t),(function(t,i){i.indexOf("Models")>=0&&ct(t,(function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}else 0}),this)}),this),!!n;py(this.id)},e.prototype.getVisual=function(t,e){var n=Na(this._model,t,{defaultMainType:"series"});var i=n.seriesModel.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=r?function(t,e,n){switch(n){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,n)}}(i,r,e):function(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}(i,e)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t,e,n,i=this;ct(fy,(function(t){var e=function(e){var n,r=i.getModel(),o=e.target;if("globalout"===t?n={}:o&&Ev(o,(function(t){var e=nu(t);if(e&&null!=e.dataIndex){var i=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType,o)||{},!0}if(e.eventData)return n=rt({},e.eventData),!0}),!0),n){var a=n.componentType,s=n.componentIndex;"markLine"!==a&&"markPoint"!==a&&"markArea"!==a||(a="series",s=n.seriesIndex);var l=a&&null!=s&&r.getComponent(a,s),u=l&&i["series"===l.mainType?"_chartsMap":"_componentsMap"][l.__viewId];0,n.event=e,n.type=t,i._$eventProcessor.eventInfo={targetEl:o,packedEvent:n,model:l,view:u},i.trigger(t,n)}};e.zrEventfulCallAtLast=!0,i._zr.on(t,e,i)})),ct(my,(function(t,e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})),ct(["selectchanged"],(function(t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),t=this._messageCenter,e=this,n=this._api,t.on("selectchanged",(function(t){var i=n.getModel();t.isFromClick?(Pv("map","selectchanged",e,i,t),Pv("pie","selectchanged",e,i,t)):"select"===t.fromAction?(Pv("map","selected",e,i,t),Pv("pie","selected",e,i,t)):"unselect"===t.fromAction&&(Pv("map","unselected",e,i,t),Pv("pie","unselected",e,i,t))}))},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){this._disposed?py(this.id):this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed)py(this.id);else{this._disposed=!0,this.getDom()&&Fa(this.getDom(),Cy,"");var t=this,e=t._api,n=t._model;ct(t._componentsViews,(function(t){t.dispose(n,e)})),ct(t._chartsViews,(function(t){t.dispose(n,e)})),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete by[t.id]}},e.prototype.resize=function(t){if(!this[z_])if(this._disposed)py(this.id);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[B_]&&(null==i&&(i=this[B_].silent),n=!0,this[B_]=null),this[z_]=!0;try{n&&j_(this),q_.update.call(this,{type:"resize",animation:rt({duration:0},t&&t.animation)})}catch(t){throw this[z_]=!1,t}this[z_]=!1,$_.call(this,i),Q_.call(this,i)}}},e.prototype.showLoading=function(t,e){if(this._disposed)py(this.id);else if(St(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),wy[t]){var n=wy[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},e.prototype.hideLoading=function(){this._disposed?py(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},e.prototype.makeActionFromEvent=function(t){var e=rt({},t);return e.type=my[t.type],e},e.prototype.dispatchAction=function(t,e){if(this._disposed)py(this.id);else if(St(e)||(e={silent:!!e}),gy[t.type]&&this._model)if(this[z_])this._pendingActions.push(t);else{var n=e.silent;J_.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&O.browser.weChat&&this._throttledZrFlush(),$_.call(this,n),Q_.call(this,n)}},e.prototype.updateLabelLayout=function(){C_.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed)py(this.id);else{var e=t.seriesIndex;0,this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},e.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))}function e(t){for(var e=[],n=t.currentStates,i=0;i0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(t){if(t.states&&t.states.emphasis){if(Qu(t))return;if(t instanceof Sl&&function(t){var e=ou(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var n=t.prevStates;n&&t.useStates(n)}if(r){t.stateTransition=a;var i=t.getTextContent(),o=t.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&e(t)}}))}j_=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),Z_(t,!0),Z_(t,!1),e.plan()},Z_=function(t,e){for(var n=t._model,i=t._scheduler,r=e?t._componentsViews:t._chartsViews,o=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!O.node&&!O.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),C_.trigger("series:afterupdate",e,i,s)},sy=function(t){t[F_]=!0,t.getZr().wakeUp()},ly=function(t){t[F_]&&(t.getZr().storage.traverse((function(t){Qu(t)||e(t)})),t[F_]=!1)},oy=function(t){return new(function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return I(n,e),n.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(e){for(;e;){var n=e.__ecComponentInfo;if(null!=n)return t._model.getComponent(n.mainType,n.index);e=e.parent}},n.prototype.enterEmphasis=function(e,n){Iu(e,n),sy(t)},n.prototype.leaveEmphasis=function(e,n){Pu(e,n),sy(t)},n.prototype.enterBlur=function(e){!function(t){Mu(t,xu)}(e),sy(t)},n.prototype.leaveBlur=function(e){Eu(e),sy(t)},n.prototype.enterSelect=function(e){Ou(e),sy(t)},n.prototype.leaveSelect=function(e){Nu(e),sy(t)},n.prototype.getModel=function(){return t.getModel()},n.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},n.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},n}(xd))(t)},ay=function(t){function e(t,e){for(var n=0;n=0)){jy.push(n);var o=vv.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function Xy(t,e){wy[t]=e}function qy(t){V({createCanvas:t})}function Yy(t,e,n){var i=A_("registerMap");i&&i(t,e,n)}function Ky(t){var e=A_("getMap");return e&&e(t)}var Jy=function(t){var e=(t=et(t)).type;e||Af("");var n=e.split(":");2!==n.length&&Af("");var i=!1;"echarts"===n[0]&&(e=n[1],i=!0),t.__isBuiltIn=i,zf.set(e,t)};Wy(O_,Jm),Wy(R_,Qm),Wy(R_,tv),Wy(O_,Dv),Wy(R_,Iv),Wy(7e3,(function(t,e){t.eachRawSeries((function(n){if(!t.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(t){var n=i.getItemVisual(t,"decal");n&&(i.ensureUniqueItemVisual(t,"style").decal=b_(n,e))}));var r=i.getVisual("decal");if(r)i.getVisual("style").decal=b_(r,e)}}))})),Ry(Xd),ky(900,(function(t){var e=jt();t.eachSeries((function(t){var n=t.get("stack");if(n){var i=e.get(n)||e.set(n,[]),r=t.getData(),o={stackResultDimension:r.getCalculationInfo("stackResultDimension"),stackedOverDimension:r.getCalculationInfo("stackedOverDimension"),stackedDimension:r.getCalculationInfo("stackedDimension"),stackedByDimension:r.getCalculationInfo("stackedByDimension"),isStackedByIndex:r.getCalculationInfo("isStackedByIndex"),data:r,seriesModel:t};if(!o.stackedDimension||!o.isStackedByIndex&&!o.stackedByDimension)return;i.length&&r.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(o)}})),e.each(qd)})),Xy("default",(function(t,e){ot(e=e||{},{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Eo,i=new Fl({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r,o=new eu({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Fl({style:{fill:"none"},textContent:o,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return n.add(a),e.showSpinner&&((r=new zg({shape:{startAngle:-ev/2,endAngle:-ev/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*ev/2}).start("circularInOut"),r.animateShape(!0).when(1e3,{startAngle:3*ev/2}).delay(300).start("circularInOut"),n.add(r)),n.resize=function(){var n=o.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&r.setShape({cx:l,cy:u}),a.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n})),Vy({type:cu,event:cu,update:cu},Kt),Vy({type:du,event:du,update:du},Kt),Vy({type:fu,event:fu,update:fu},Kt),Vy({type:pu,event:pu,update:pu},Kt),Vy({type:gu,event:gu,update:gu},Kt),Ny("light",yv),Ny("dark",Mv);var $y={};function Qy(t){return null==t?0:t.length||1}function tx(t){return t}const ex=function(){function t(t,e,n,i,r,o){this._old=t,this._new=e,this._oldKeyGetter=n||tx,this._newKeyGetter=i||tx,this.context=r,this._diffModeMultiple="multiple"===o}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),r=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,r,"_newKeyGetter");for(var o=0;o1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1&&c>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(h>1)for(var d=0;d1)for(var a=0;a30}var dx,fx,px,gx,mx,vx,_x,yx=St,xx=dt,bx="undefined"==typeof Int32Array?Array:Int32Array,Tx=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Sx=["_approximateExtent"],Mx=function(){function t(t,e){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var i=!1;lx(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(i=!0,n=t),n=n||["x","y"];for(var r={},o=[],a={},s=!1,l={},u=0;u=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,r=this._idList;if(n.getSource().sourceFormat===Zc&&!n.pure)for(var o=[],a=t;a0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(yt(r=this.getVisual(e))?r=r.slice():yx(r)&&(r=rt({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,yx(e)?rt(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){yx(t)?rt(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?rt(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){!function(t,e,n,i){if(i){var r=nu(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,r.ssrType="chart","group"===i.type&&i.traverse((function(i){var r=nu(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e,r.ssrType="chart"}))}}(this.hostModel&&this.hostModel.seriesIndex,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){ct(this._graphicEls,(function(n,i){n&&t&&t.call(e,n,i)}))},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:xx(this.dimensions,this._getDimInfo,this),this.hostModel)),mx(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];xt(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(Rt(arguments)))})},t.internalField=(dx=function(t){var e=t._invertedIndicesMap;ct(e,(function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new bx(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),t}();const Cx=Mx;function Lx(t,e){return Ax(t,e).dimensions}function Ax(t,e){ef(t)||(t=rf(t));var n=(e=e||{}).coordDimensions||[],i=e.dimensionsDefine||t.dimensionsDefine||[],r=jt(),o=[],a=function(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return ct(e,(function(t){var e;St(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(t,n,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&cx(a),l=i===t.dimensionsDefine,u=l?hx(t):ux(i),h=e.encodeDefine;!h&&e.encodeDefaulter&&(h=e.encodeDefaulter(t,a));for(var c=jt(h),d=new Wf(a),f=0;f0&&(i.name=r+(o-1)),o++,e.set(r,o)}}(o),new sx({source:t,dimensions:o,fullDimensionCount:a,dimensionOmitted:s})}function Dx(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}var Ix=function(t){this.coordSysDims=[],this.axisMap=jt(),this.categoryAxisMap=jt(),this.coordSysName=t};var Px={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",ka).models[0],o=t.getReferringComponents("yAxis",ka).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),Ex(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),Ex(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",ka).models[0];e.coordSysDims=["single"],n.set("single",r),Ex(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",ka).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),Ex(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),Ex(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,n,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();ct(o.parallelAxisIndex,(function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),Ex(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))}))}};function Ex(t){return"category"===t.get("type")}function Ox(t,e,n){var i,r,o,a=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(t){return!lx(t.schema)}(e)?(r=e.schema,i=r.dimensions,o=e.store):i=e;var l,u,h,c,d=!(!t||!t.get("stack"));if(ct(i,(function(t,e){wt(t)&&(i[e]=t={name:t}),d&&!t.isExtraCoord&&(a||l||!t.ordinalMeta||(l=t),u||"ordinal"===t.type||"time"===t.type||s&&s!==t.coordDim||(u=t))})),!u||a||l||(a=!0),u){h="__\0ecstackresult_"+t.id,c="__\0ecstackedover_"+t.id,l&&(l.createInvertedIndices=!0);var f=u.coordDim,p=u.type,g=0;ct(i,(function(t){t.coordDim===f&&g++}));var m={name:h,coordDim:f,coordDimIndex:g,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:c,coordDim:c,coordDimIndex:g+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};r?(o&&(m.storeDimIndex=o.ensureCalculationDimension(c,p),v.storeDimIndex=o.ensureCalculationDimension(h,p)),r.appendCalculationDimension(m),r.appendCalculationDimension(v)):(i.push(m),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:a,stackedOverDimension:c,stackResultDimension:h}}function Nx(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function Rx(t,e){return Nx(t,e)?t.getCalculationInfo("stackResultDimension"):e}const kx=function(t,e,n){n=n||{};var i,r=e.getSourceManager(),o=!1;t?(o=!0,i=rf(t)):o=(i=r.getSource()).sourceFormat===Zc;var a=function(t){var e=t.get("coordinateSystem"),n=new Ix(e),i=Px[e];if(i)return i(t,n,n.axisMap,n.categoryAxisMap),n}(e),s=function(t,e){var n,i=t.get("coordinateSystem"),r=Td.get(i);return e&&e.coordSysDims&&(n=dt(e.coordSysDims,(function(t){var n={name:t},i=e.axisMap.get(t);if(i){var r=i.get("type");n.type=function(t){return"category"===t?"ordinal":"time"===t?"time":"float"}(r)}return n}))),n||(n=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),n}(e,a),l=n.useEncodeDefaulter,u=xt(l)?l:l?_t(nd,s,e):null,h=Ax(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!o}),c=function(t,e,n){var i,r;return n&&ct(t,(function(t,o){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=o),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(r=!0)})),r||null==i||(t[i].otherDims.itemName=0),i}(h.dimensions,n.createInvertedIndices,a),d=o?null:r.getSharedDataStore(h),f=Ox(e,{schema:h,store:d}),p=new Cx(h,e);p.setCalculationInfo(f);var g=null!=c&&function(t){if(t.sourceFormat===Zc){return!yt(Ta(function(t){var e=0;for(;ee[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();qa(zx);const Bx=zx;var Fx=0;function Vx(t){return St(t)&&null!=t.value?t.value:t+""}const Gx=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++Fx}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&dt(i,Vx);return new t({categories:r,needCollect:!r,deduplication:!1!==n.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!wt(t)&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return null==(e=i.get(t))&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=jt(this.categories))},t}();function Hx(t){return"interval"===t.type||"log"===t.type}function Ux(t,e,n,i){var r={},o=t[1]-t[0],a=r.interval=ua(o/e,!0);null!=n&&ai&&(a=r.interval=i);var s=r.intervalPrecision=jx(a);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Zx(t,0,e),Zx(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(r.niceTickExtent=[Yo(Math.ceil(t[0]/a)*a,s),Yo(Math.floor(t[1]/a)*a,s)],t),r}function Wx(t){var e=Math.pow(10,la(t)),n=t/e;return n?2===n?n=3:3===n?n=5:n*=2:n=1,Yo(n*e)}function jx(t){return Jo(t)+2}function Zx(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function Xx(t,e){return t>=e[0]&&t<=e[1]}function qx(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Yx(t,e){return t*(e[1]-e[0])+e[0]}var Kx=function(t){function e(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new Gx({})),yt(i)&&(i=new Gx({categories:dt(i,(function(t){return St(t)?t.value:t}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return I(e,t),e.prototype.parse=function(t){return null==t?NaN:wt(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return Xx(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]},e.prototype.normalize=function(t){return qx(t=this._getTickNumber(this.parse(t)),this._extent)},e.prototype.scale=function(t){return t=Math.round(Yx(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Bx);Bx.registerClass(Kx);const Jx=Kx;var $x=Yo,Qx=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return I(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t,this._extent)},e.prototype.normalize=function(t){return qx(t,this._extent)},e.prototype.scale=function(t){return Yx(t,this._extent)},e.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=jx(t)},e.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;n[0]1e4)return[];var s=o.length?o[o.length-1].value:i[1];return n[1]>s&&(t?o.push({value:$x(s+e,r)}):o.push({value:n[1]})),o},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;ri[0]&&h0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}(t),n=[];return ct(t,(function(t){var i,r=t.coordinateSystem.getBaseAxis(),o=r.getExtent();if("category"===r.type)i=r.getBandWidth();else if("value"===r.type||"time"===r.type){var a=r.dim+"_"+r.index,s=e[a],l=Math.abs(o[1]-o[0]),u=r.scale.getExtent(),h=Math.abs(u[1]-u[0]);i=s?l/h*s:l}else{var c=t.getData();i=Math.abs(o[1]-o[0])/c.count()}var d=qo(t.get("barWidth"),i),f=qo(t.get("barMaxWidth"),i),p=qo(t.get("barMinWidth")||(lw(t)?.5:1),i),g=t.get("barGap"),m=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:d,barMaxWidth:f,barMinWidth:p,barGap:g,barCategoryGap:m,axisKey:iw(r),stackId:nw(t)})})),aw(n)}function aw(t){var e={};ct(t,(function(t,n){var i=t.axisKey,r=t.bandWidth,o=e[i]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[i]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var d=t.barCategoryGap;null!=d&&(o.categoryGap=d)}));var n={};return ct(e,(function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=mt(i).length;o=Math.max(35-4*a,15)+"%"}var s=qo(o,r),l=qo(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),ct(i,(function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&ei&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}})),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var d,f=0;ct(i,(function(t,e){t.width||(t.width=c),d=t,f+=t.width*(1+l)})),d&&(f-=d.width*l);var p=-f/2;ct(i,(function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:p,width:t.width},p+=t.width*(1+l)}))})),n}function sw(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function lw(t){return t.pipelineContext&&t.pipelineContext.large}var uw=function(t){function e(e){var n=t.call(this,e)||this;return n.type="time",n}return I(e,t),e.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return Qh(t.value,Xh[function(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}(Jh(this._minLevelUnit))]||Xh.second,e,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,e,n){var i=this.getSetting("useUTC");return function(t,e,n,i,r){var o=null;if(wt(n))o=n;else if(xt(n))o=n(t.value,e,{level:t.level});else{var a=rt({},jh);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(yt(o)){var h=null==t.level?0:t.level>=0?t.level:o.length+t.level;o=o[h=Math.min(h,o.length-1)]}}return Qh(new Date(t.value),o,r,i)}(t,e,n,this.getSetting("locale"),i)},e.prototype.getTicks=function(){var t=this._interval,e=this._extent,n=[];if(!t)return n;n.push({value:e[0],level:0});var i=this.getSetting("useUTC"),r=function(t,e,n,i){var r=1e4,o=Yh,a=0;function s(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===u&&o.unshift({value:o[0].value-d})}}for(u=0;u=i[0]&&v<=i[1]&&c++)}var _=(i[1]-i[0])/e;if(c>1.5*_&&d>_/1.5)break;if(u.push(g),c>_||t===o[f])break}h=[]}}0;var y=pt(dt(u,(function(t){return pt(t,(function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd}))})),(function(t){return t.length>0})),x=[],w=y.length-1;for(f=0;fn&&(this._approxInterval=n);var o=hw.length,a=Math.min(function(t,e,n,i){for(;n>>1;t[r][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function dw(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function fw(t){return(t/=Hh)>12?12:t>6?6:t>3.5?4:t>2?2:1}function pw(t,e){return(t/=e?Gh:Vh)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function gw(t){return ua(t,!0)}function mw(t,e,n){var i=new Date(t);switch(Jh(e)){case"year":case"month":i[hc(n)](0);case"day":i[cc(n)](1);case"hour":i[dc(n)](0);case"minute":i[fc(n)](0);case"second":i[pc(n)](0),i[gc(n)](0)}return i.getTime()}Bx.registerClass(uw);const vw=uw;var _w=Bx.prototype,yw=tw.prototype,xw=Yo,ww=Math.floor,bw=Math.ceil,Tw=Math.pow,Sw=Math.log,Mw=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new tw,e._interval=0,e}return I(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent();return dt(yw.getTicks.call(this,t),(function(t){var e=t.value,r=Yo(Tw(this.base,e));return r=e===n[0]&&this._fixMin?Lw(r,i[0]):r,{value:r=e===n[1]&&this._fixMax?Lw(r,i[1]):r}}),this)},e.prototype.setExtent=function(t,e){var n=Sw(this.base);t=Sw(Math.max(0,t))/n,e=Sw(Math.max(0,e))/n,yw.setExtent.call(this,t,e)},e.prototype.getExtent=function(){var t=this.base,e=_w.getExtent.call(this);e[0]=Tw(t,e[0]),e[1]=Tw(t,e[1]);var n=this._originalScale.getExtent();return this._fixMin&&(e[0]=Lw(e[0],n[0])),this._fixMax&&(e[1]=Lw(e[1],n[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=Sw(t[0])/Sw(e),t[1]=Sw(t[1])/Sw(e),_w.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=sa(n);for(t/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var r=[Yo(bw(e[0]/i)*i),Yo(ww(e[1]/i)*i)];this._interval=i,this._niceExtent=r}},e.prototype.calcNiceExtent=function(t){yw.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t=Sw(t)/Sw(this.base),this._extent)},e.prototype.normalize=function(t){return qx(t=Sw(t)/Sw(this.base),this._extent)},e.prototype.scale=function(t){return t=Yx(t,this._extent),Tw(this.base,t)},e.type="log",e}(Bx),Cw=Mw.prototype;function Lw(t,e){return xw(t,Jo(e))}Cw.getMinorTicks=yw.getMinorTicks,Cw.getLabel=yw.getLabel,Bx.registerClass(Mw);const Aw=Mw;var Dw=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),a<0&&s<0&&!u&&(s=0));var c=this._determinedMin,d=this._determinedMax;return null!=c&&(a=c,l=!0),null!=d&&(s=d,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[Pw[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[Iw[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),Iw={min:"_determinedMin",max:"_determinedMax"},Pw={min:"_dataMin",max:"_dataMax"};function Ew(t,e,n){var i=t.rawExtentInfo;return i||(i=new Dw(t,e,n),t.rawExtentInfo=i,i)}function Ow(t,e){return null==e?null:Pt(e)?NaN:t.parse(e)}function Nw(t,e){var n=t.type,i=Ew(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var r=i.min,o=i.max,a=e.ecModel;if(a&&"time"===n){var s=rw("bar",a),l=!1;if(ct(s,(function(t){l=l||t.getBaseAxis()===e.axis})),l){var u=ow(s),h=function(t,e,n,i){var r=n.axis.getExtent(),o=Math.abs(r[1]-r[0]),a=function(t,e,n){if(t&&e){var i=t[iw(e)];return null!=i&&null!=n?i[nw(n)]:i}}(i,n.axis);if(void 0===a)return{min:t,max:e};var s=1/0;ct(a,(function(t){s=Math.min(t.offset,s)}));var l=-1/0;ct(a,(function(t){l=Math.max(t.offset+t.width,l)})),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/o)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}(r,o,e,u);r=h.min,o=h.max}}return{extent:[r,o],fixMin:i.minFixed,fixMax:i.maxFixed}}function Rw(t,e){var n=e,i=Nw(t,n),r=i.extent,o=n.get("splitNumber");t instanceof Aw&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function kw(t,e){if(e=e||t.get("type"))switch(e){case"category":return new Jx({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new vw({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(Bx.getClass(e)||tw)}}function zw(t){var e,n,i=t.getLabelModel().get("formatter"),r="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(n=i,function(e,i){return t.scale.getFormattedLabel(e,i,n)}):wt(i)?function(e){return function(n){var i=t.scale.getLabel(n);return e.replace("{value}",null!=i?i:"")}}(i):xt(i)?(e=i,function(n,i){return null!=r&&(i=n.value-r),e(Bw(t,n),i,null!=n.level?{level:n.level}:null)}):function(e){return t.scale.getLabel(e)}}function Bw(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Fw(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n));return new _n(t.x,t.y,o,a)}function Vw(t){var e=t.get("interval");return null==e?"auto":e}function Gw(t){return"category"===t.type&&0===Vw(t.getLabelModel())}function Hw(t,e){var n={};return ct(t.mapDimensionsAll(e),(function(e){n[Rx(t,e)]=!0})),mt(n)}var Uw=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}();function Ww(t){return kx(null,t)}var jw={isDimensionStacked:Nx,enableDataStack:Ox,getStackedDimension:Rx};function Zw(t,e){var n=e;e instanceof Ih||(n=new Ih(e));var i=kw(n);return i.setExtent(t[0],t[1]),Rw(i,n),i}function Xw(t){ut(t,Uw)}function qw(t,e){return lh(t,null,null,"normal"!==(e=e||{}).state)}var Yw=[],Kw={registerPreprocessor:Ry,registerProcessor:ky,registerPostInit:zy,registerPostUpdate:By,registerUpdateLifecycle:Fy,registerAction:Vy,registerCoordinateSystem:Gy,registerLayout:Uy,registerVisual:Wy,registerTransform:Jy,registerLoading:Xy,registerMap:Yy,registerImpl:function(t,e){L_[t]=e},PRIORITY:k_,ComponentModel:Gc,ComponentView:Dp,SeriesModel:Lp,ChartView:Fm,registerComponentModel:function(t){Gc.registerClass(t)},registerComponentView:function(t){Dp.registerClass(t)},registerSeriesModel:function(t){Lp.registerClass(t)},registerChartView:function(t){Fm.registerClass(t)},registerSubTypeDefaulter:function(t,e){Gc.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){Go(t,e)}};function Jw(t){yt(t)?ct(t,(function(t){Jw(t)})):st(Yw,t)>=0||(Yw.push(t),xt(t)&&(t={install:t}),t.install(Kw))}function $w(t,e){return Math.abs(t-e)<1e-8}function Qw(t,e,n){var i=0,r=t[0];if(!r)return!1;for(var o=1;on&&(t=r,n=a)}if(t)return function(t){for(var e=0,n=0,i=0,r=t.length,o=t[r-1][0],a=t[r-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),r=s+=r,o=l+=o,i.push([s/n,l/n])}return i}function ub(t,e){return dt(pt((t=function(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;return null==n&&(n=1024),ct(e.features,(function(t){var e=t.geometry,i=e.encodeOffsets,r=e.coordinates;if(i)switch(e.type){case"LineString":e.coordinates=lb(r,i,n);break;case"Polygon":case"MultiLineString":sb(r,i,n);break;case"MultiPolygon":ct(r,(function(t,e){return sb(t,i[e],n)}))}})),e.UTF8Encoding=!1,e}(t)).features,(function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var n=t.properties,i=t.geometry,r=[];switch(i.type){case"Polygon":var o=i.coordinates;r.push(new rb(o[0],o.slice(1)));break;case"MultiPolygon":ct(i.coordinates,(function(t){t[0]&&r.push(new rb(t[0],t.slice(1)))}));break;case"LineString":r.push(new ob([i.coordinates]));break;case"MultiLineString":r.push(new ob(i.coordinates))}var a=new ab(n[e||"name"],r,n.cp);return a.properties=n,a}))}function hb(t,e,n,i,r,o,a,s){return new eu({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()}var cb=Ea();function db(t,e){var n=dt(e,(function(e){return t.scale.parse(e)}));return"time"===t.type&&n.length>0&&(n.sort(),n.unshift(n[0]),n.push(n[n.length-1])),n}function fb(t){var e=t.getLabelModel().get("customValues");if(e){var n=zw(t),i=t.scale.getExtent();return{labels:dt(pt(db(t,e),(function(t){return t>=i[0]&&t<=i[1]})),(function(e){var i={value:e};return{formattedLabel:n(i),rawLabel:t.scale.getLabel(i),tickValue:e}}))}}return"category"===t.type?function(t){var e=t.getLabelModel(),n=gb(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),n=zw(t);return{labels:dt(e,(function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)}function pb(t,e){var n=t.getTickModel().get("customValues");if(n){var i=t.scale.getExtent();return{ticks:pt(db(t,n),(function(t){return t>=i[0]&&t<=i[1]}))}}return"category"===t.type?function(t,e){var n,i,r=mb(t,"ticks"),o=Vw(e),a=vb(r,o);if(a)return a;e.get("show")&&!t.scale.isBlank()||(n=[]);if(xt(o))n=xb(t,o,!0);else if("auto"===o){var s=gb(t,t.getLabelModel());i=s.labelCategoryInterval,n=dt(s.labels,(function(t){return t.tickValue}))}else n=yb(t,i=o,!0);return _b(r,o,{ticks:n,tickCategoryInterval:i})}(t,e):{ticks:dt(t.scale.getTicks(),(function(t){return t.value}))}}function gb(t,e){var n,i,r=mb(t,"labels"),o=Vw(e),a=vb(r,o);return a||(xt(o)?n=xb(t,o):(i="auto"===o?function(t){var e=cb(t).autoInterval;return null!=e?e:cb(t).autoInterval=t.calculateCategoryInterval()}(t):o,n=yb(t,i)),_b(r,o,{labels:n,labelCategoryInterval:i}))}function mb(t,e){return cb(t)[e]||(cb(t)[e]=[])}function vb(t,e){for(var n=0;n1&&h/l>2&&(u=Math.round(Math.ceil(u/l)*l));var c=Gw(t),d=a.get("showMinLabel")||c,f=a.get("showMaxLabel")||c;d&&u!==o[0]&&g(o[0]);for(var p=u;p<=o[1];p+=l)g(p);function g(t){var e={value:t};s.push(n?t:{formattedLabel:i(e),rawLabel:r.getLabel(e),tickValue:t})}return f&&p-l!==o[1]&&g(o[1]),s}function xb(t,e,n){var i=t.scale,r=zw(t),o=[];return ct(i.getTicks(),(function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})})),o}var wb=[0,1],bb=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return Qo(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Tb(n=n.slice(),i.count()),Xo(t,wb,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Tb(n=n.slice(),i.count());var r=Xo(t,n,wb,e);return this.scale.scale(r)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),n=dt(pb(this,e).ticks,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this);return function(t,e,n,i){var r=e.length;if(!t.onBand||n||!r)return;var o,a,s=t.getExtent();if(1===r)e[0].coord=s[0],o=e[1]={coord:s[1],tickValue:e[0].tickValue};else{var l=e[r-1].tickValue-e[0].tickValue,u=(e[r-1].coord-e[0].coord)/l;ct(e,(function(t){t.coord-=u/2}));var h=t.scale.getExtent();a=1+h[1]-e[r-1].tickValue,o={coord:e[r-1].coord+u*a,tickValue:h[1]+1},e.push(o)}var c=s[0]>s[1];d(e[0].coord,s[0])&&(i?e[0].coord=s[0]:e.shift());i&&d(s[0],e[0].coord)&&e.unshift({coord:s[0]});d(s[1],o.coord)&&(i?o.coord=s[1]:e.pop());i&&d(o.coord,s[1])&&e.push({coord:s[1]});function d(t,e){return t=Yo(t),e=Yo(e),c?t>e:t0&&t<100||(t=5),dt(this.scale.getMinorTicks(t),(function(t){return dt(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return fb(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=zw(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,o=r.getExtent(),a=r.count();if(o[1]-o[0]<1)return 0;var s=1;a>40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),d=0,f=0;l<=o[1];l+=s){var p,g,m=po(n({value:l}),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,_=f/c;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=cb(t.model),w=t.getExtent(),b=x.lastAutoInterval,T=x.lastTickCount;return null!=b&&null!=T&&Math.abs(b-y)<=1&&Math.abs(T-a)<=1&&b>y&&x.axisExtent0===w[0]&&x.axisExtent1===w[1]?y=b:(x.lastTickCount=a,x.lastAutoInterval=y,x.axisExtent0=w[0],x.axisExtent1=w[1]),y}(this)},t}();function Tb(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}const Sb=bb;function Mb(t){var e=Gc.extend(t);return Gc.registerClass(e),e}function Cb(t){var e=Dp.extend(t);return Dp.registerClass(e),e}function Lb(t){var e=Lp.extend(t);return Lp.registerClass(e),e}function Ab(t){var e=Fm.extend(t);return Fm.registerClass(e),e}var Db=2*Math.PI,Ib=il.CMD,Pb=["top","right","bottom","left"];function Eb(t,e,n,i,r){var o=n.width,a=n.height;switch(t){case"top":i.set(n.x+o/2,n.y-e),r.set(0,-1);break;case"bottom":i.set(n.x+o/2,n.y+a+e),r.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),r.set(-1,0);break;case"right":i.set(n.x+o+e,n.y+a/2),r.set(1,0)}}function Ob(t,e,n,i,r,o,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s),h=(a/=u)*n+t,c=(s/=u)*n+e;if(Math.abs(i-r)%Db<1e-4)return l[0]=h,l[1]=c,u-n;if(o){var d=i;i=ll(r),r=ll(d)}else i=ll(i),r=ll(r);i>r&&(r+=Db);var f=Math.atan2(s,a);if(f<0&&(f+=Db),f>=i&&f<=r||f+Db>=i&&f+Db<=r)return l[0]=h,l[1]=c,u-n;var p=n*Math.cos(i)+t,g=n*Math.sin(i)+e,m=n*Math.cos(r)+t,v=n*Math.sin(r)+e,_=(p-a)*(p-a)+(g-s)*(g-s),y=(m-a)*(m-a)+(v-s)*(v-s);return _0))return;e=e/180*Math.PI,Fb.fromArray(t[0]),Vb.fromArray(t[1]),Gb.fromArray(t[2]),ln.sub(Hb,Fb,Vb),ln.sub(Ub,Gb,Vb);var n=Hb.len(),i=Ub.len();if(n<.001||i<.001)return;Hb.scale(1/n),Ub.scale(1/i);var r=Hb.dot(Ub);if(Math.cos(e)1&&ln.copy(Zb,Gb),Zb.toArray(t[1])}}(o,e.get("minTurnAngle")),n.setShape({points:o})}}}var jb=[],Zb=new ln;function Xb(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&!0===a&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function qb(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=ge(i[0],i[1]),o=ge(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=ye([],i[1],i[0],a/r),l=ye([],i[1],i[2],a/o),u=ye([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;h0&&o&&b(-c/a,0,a);var m,v,_=t[0],y=t[a-1];return x(),m<0&&T(-m,.8),v<0&&T(v,.8),x(),w(m,v,1),w(v,m,-1),x(),m<0&&S(-m),v<0&&S(v),u}function x(){m=_.rect[e]-i,v=r-y.rect[e]-y.rect[n]}function w(t,e,n){if(t<0){var i=Math.min(e,-t);if(i>0){b(i*n,0,a);var r=i+t;r<0&&T(-r*n,1)}else T(-t*n,1)}}function b(n,i,r){0!==n&&(u=!0);for(var o=i;o0)for(l=0;l0;l--){b(-(o[l-1]*c),l,a)}}}function S(t){var e=t<0?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(a-1)),i=0;i0?b(n,0,i+1):b(-n,a-i-1,a),(t-=n)<=0)return}}function Jb(t){var e=[];t.sort((function(t,e){return e.priority-t.priority}));var n=new _n(0,0,0,0);function i(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var r=0;r=0&&n.attr(f.oldLayoutSelect),st(u,"emphasis")>=0&&n.attr(f.oldLayoutEmphasis)),Ju(n,s,e,a)}else if(n.attr(s),!gh(n).valueAnimation){var h=Ot(n.style.opacity,1);n.style.opacity=0,$u(n,{style:{opacity:h}},e,a)}if(f.oldLayout=s,n.states.select){var c=f.oldLayoutSelect={};rT(c,s,oT),rT(c,n.states.select,oT)}if(n.states.emphasis){var d=f.oldLayoutEmphasis={};rT(d,s,oT),rT(d,n.states.emphasis,oT)}mh(n,a,l,e,e)}if(i&&!i.ignore&&!i.invisible){r=(f=iT(i)).oldLayout;var f,p={points:i.shape.points};r?(i.attr({shape:r}),Ju(i,{shape:p},e)):(i.setShape(p),i.style.strokePercent=0,$u(i,{style:{strokePercent:1}},e)),f.oldLayout=p}},t}();var sT=Ea();function lT(t){t.registerUpdateLifecycle("series:beforeupdate",(function(t,e,n){var i=sT(e).labelManager;i||(i=sT(e).labelManager=new aT),i.clearLabels()})),t.registerUpdateLifecycle("series:layoutlabels",(function(t,e,n){var i=sT(e).labelManager;n.updatedSeries.forEach((function(t){i.addLabelsOfSeries(e.getViewOfSeriesModel(t))})),i.updateLayoutConfig(e),i.layout(e),i.processLabelsOverall()}))}function uT(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",(function(t){var n=t.getCategoriesData(),i=t.getGraph().data,r=n.mapArray(n.getName);i.filterSelf((function(t){var n=i.getItemModel(t).getShallow("category");if(null!=n){Tt(n)&&(n=r[n]);for(var o=0;oi&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a0?+d:1;C.scaleX=this._sizeX*L,C.scaleY=this._sizeY*L,this.setSymbolScale(1),Uu(this,l,u,h)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=nu(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&th(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();th(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},e.getSymbolSize=function(t,e){return Zv(t.getItemVisual(e,"symbolSize"))},e}(Eo);function FT(t,e){this.parent.drift(t,e)}const VT=BT;function GT(t,e,n,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&"none"!==t.getItemVisual(n,"symbol")}function HT(t){return null==t||St(t)||(t={isIgnore:t}),t||{}}function UT(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:sh(e),cursorStyle:e.get("cursor")}}var WT=function(){function t(t){this.group=new Eo,this._SymbolCtor=t||VT}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=HT(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=UT(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add((function(i){var r=u(i);if(GT(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}})).update((function(h,c){var d=r.getItemGraphicEl(c),f=u(h);if(GT(t,f,h,e)){var p=t.getItemVisual(h,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==p)n.remove(d),(d=new o(t,h,s,l)).setPosition(f);else{d.updateData(t,h,s,l);var m={x:f[0],y:f[1]};a?d.attr(m):Ju(d,m,i)}n.add(d),t.setItemGraphicEl(h,d)}else n.remove(d)})).remove((function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut((function(){n.remove(e)}),i)})).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl((function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()}))},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=UT(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=HT(n);for(var r=t.start;r0&&(_[0]=-_[0],_[1]=-_[1]);var x=v[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var w=-Math.atan2(v[1],v[0]);u[0].8?"left":h[0]<-.8?"right":"center",d=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":i.x=-h[0]*p+l[0],i.y=-h[1]*g+l[1],c=h[0]>.8?"right":h[0]<-.8?"left":"center",d=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=p*x+l[0],i.y=l[1]+b,c=v[0]<0?"right":"left",i.originX=-p*x,i.originY=-b;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=y[0],i.y=y[1]+b,c="center",i.originY=-b;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-p*x+u[0],i.y=u[1]+b,c=v[0]>=0?"right":"left",i.originX=p*x,i.originY=-b}i.scaleX=i.scaleY=r,i.setStyle({verticalAlign:i.__verticalAlign||d,align:i.__align||c})}}}function T(t,e){var n=t.__specifiedRotation;if(null==n){var i=a.tangentAt(e);t.attr("rotation",(1===e?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else t.attr("rotation",n)}},e}(Eo);const iS=nS;function rS(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:sh(e)}}function oS(t){return isNaN(t[0])||isNaN(t[1])}function aS(t){return t&&!oS(t[0])&&!oS(t[1])}const sS=function(){function t(t){this.group=new Eo,this._LineCtor=t||iS}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=rS(t);t.diff(r).add((function(n){e._doAdd(t,n,o)})).update((function(n,i){e._doUpdate(r,t,i,n,o)})).remove((function(t){i.remove(r.getItemGraphicEl(t))})).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl((function(e,n){e.updateLayout(t,n)}),this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=rS(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i3?1.4:r>1?1.2:1.1;dS(this,"zoom","zoomOnMouseWheel",t,{scale:i>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(n){var l=Math.abs(i);dS(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){uS(this._zr,"globalPan")||dS(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},e}(Le);function dS(t,e,n,i,r){t.pointerChecker&&t.pointerChecker(i,r.originX,r.originY)&&(Ze(i.event),fS(t,e,n,i,r))}function fS(t,e,n,i,r){r.isAvailableBehavior=vt(pS,null,n,i),t.trigger(e,r)}function pS(t,e,n){var i=n[t];return!t||i&&(!wt(i)||e.event[i+"Key"])}const gS=cS;var mS={axisPointer:1,tooltip:1,brush:1};function vS(t,e,n){var i=e.getComponentByElement(t.topTarget),r=i&&i.coordinateSystem;return i&&i!==n&&!mS.hasOwnProperty(i.mainType)&&r&&r.model!==n}var _S=[],yS=[],xS=[],wS=hi,bS=ve,TS=Math.abs;function SS(t,e,n){for(var i,r=t[0],o=t[1],a=t[2],s=1/0,l=n*n,u=.1,h=.1;h<=.9;h+=.1){_S[0]=wS(r[0],o[0],a[0],h),_S[1]=wS(r[1],o[1],a[1],h),(f=TS(bS(_S,e)-l))=0?i+=u:i-=u:p>=0?i-=u:i+=u}return i}function MS(t,e){var n=[],i=fi,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge((function(t,s){var l=t.getLayout(),u=t.getVisual("fromSymbol"),h=t.getVisual("toSymbol");l.__original||(l.__original=[te(l[0]),te(l[1])],l[2]&&l.__original.push(te(l[2])));var c=l.__original;if(null!=l[2]){if(Qt(r[0],c[0]),Qt(r[1],c[2]),Qt(r[2],c[1]),u&&"none"!==u){var d=ST(t.node1),f=SS(r,c[0],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[0][0]=n[3],r[1][0]=n[4],i(r[0][1],r[1][1],r[2][1],f,n),r[0][1]=n[3],r[1][1]=n[4]}if(h&&"none"!==h){d=ST(t.node2),f=SS(r,c[1],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[1][0]=n[1],r[2][0]=n[2],i(r[0][1],r[1][1],r[2][1],f,n),r[1][1]=n[1],r[2][1]=n[2]}Qt(l[0],r[0]),Qt(l[1],r[2]),Qt(l[2],r[1])}else{if(Qt(o[0],c[0]),Qt(o[1],c[1]),re(a,o[1],o[0]),fe(a,a),u&&"none"!==u){d=ST(t.node1);ie(o[0],o[0],a,d*e)}if(h&&"none"!==h){d=ST(t.node2);ie(o[1],o[1],a,-d*e)}Qt(l[0],o[0]),Qt(l[1],o[1])}}))}function CS(t){return"view"===t.type}var LS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.init=function(t,e){var n=new jT,i=new sS,r=this.group;this._controller=new gS(e.getZr()),this._controllerHost={target:r},r.add(n.group),r.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},e.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(CS(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):Ju(s,l,t)}MS(t.getGraph(),TT(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,d=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,d);var f=t.get("layout");u.graph.eachNode((function(e){var n=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",(function(o){switch(f){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,d),c.setFixed(n),u.setItemLayout(n,[r.x,r.y]);break;case"circular":u.setItemLayout(n,[r.x,r.y]),e.setLayout({fixed:!0},!0),LT(t,"symbolSize",e,[o.offsetX,o.offsetY]),i.updateLayout(t);break;default:u.setItemLayout(n,[r.x,r.y]),wT(t.getGraph(),t),i.updateLayout(t)}})).on("dragend",(function(){c&&c.setUnfixed(n)})),r.setDraggable(a,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&(nu(r).focus=e.getAdjacentDataIndices())}})),u.graph.eachEdge((function(t){var e=t.getGraphicEl(),n=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===n&&(nu(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})}));var p="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),m=u.getLayout("cy");u.graph.eachNode((function(t){DT(t,p,g,m)})),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,e){var n=this;!function i(){t.step((function(t){n.updateLayout(n._model),(n._layouting=!t)&&(e?n._layoutTimeout=setTimeout(i,16):i())}))}()},e.prototype._updateController=function(t,e,n){var i=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker((function(e,i,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(i,r)&&!vS(e,n,t)})),CS(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",(function(e){!function(t,e,n){var i=t.target;i.x+=e,i.y+=n,i.dirty()}(o,e.dx,e.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})})).on("zoom",(function(e){!function(t,e,n,i){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0,l=o.max||1/0;a=Math.max(Math.min(l,a),s)}var u=a/t.zoom;t.zoom=a,r.x-=(n-r.x)*(u-1),r.y-=(i-r.y)*(u-1),r.scaleX*=u,r.scaleY*=u,r.dirty()}(o,e.scale,e.originX,e.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),i._updateNodeAndLinkScale(),MS(t.getGraph(),TT(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):r.disable()},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),n=TT(t);e.eachItemGraphicEl((function(t,e){t&&t.setSymbolScale(n)}))},e.prototype.updateLayout=function(t){MS(t.getGraph(),TT(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Fm);const AS=LS;function DS(t){return"_EC_"+t}var IS=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){t=null==t?""+e:""+t;var n=this._nodesMap;if(!n[DS(t)]){var i=new PS(t,e);return i.hostGraph=this,this.nodes.push(i),n[DS(t)]=i,i}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[DS(t)]},t.prototype.addEdge=function(t,e,n){var i=this._nodesMap,r=this._edgesMap;if(Tt(t)&&(t=this.nodes[t]),Tt(e)&&(e=this.nodes[e]),t instanceof PS||(t=i[DS(t)]),e instanceof PS||(e=i[DS(e)]),t&&e){var o=t.id+"-"+e.id,a=new ES(t,e,n);return a.hostGraph=this,this._directed&&(t.outEdges.push(a),e.inEdges.push(a)),t.edges.push(a),t!==e&&e.edges.push(a),this.edges.push(a),r[o]=a,a}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof PS&&(t=t.id),e instanceof PS&&(e=e.id);var n=this._edgesMap;return this._directed?n[t+"-"+e]:n[t+"-"+e]||n[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var n=this.nodes,i=n.length,r=0;r=0&&t.call(e,n[r],r)},t.prototype.eachEdge=function(t,e){for(var n=this.edges,i=n.length,r=0;r=0&&n[r].node1.dataIndex>=0&&n[r].node2.dataIndex>=0&&t.call(e,n[r],r)},t.prototype.breadthFirstTraverse=function(t,e,n,i){if(e instanceof PS||(e=this._nodesMap[DS(e)]),e){for(var r="out"===n?"outEdges":"in"===n?"inEdges":"edges",o=0;o=0&&n.node2.dataIndex>=0}));for(r=0,o=i.length;r=0&&this[t][e].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[t][e].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}ut(PS,OS("hostGraph","data")),ut(ES,OS("hostGraph","edgeData"));const NS=IS;var RS=Ea();function kS(t,e){if(RS(i=this).mainData===i){var n=rt({},RS(this).datas);n[this.dataType]=e,GS(e,n,t)}else HS(e,this.dataType,RS(this).mainData,t);var i;return e}function zS(t,e){return t.struct&&t.struct.update(),e}function BS(t,e){return ct(RS(e).datas,(function(n,i){n!==e&&HS(n.cloneShallow(),i,e,t)})),e}function FS(t){var e=RS(this).mainData;return null==t||null==e?e:RS(e).datas[t]}function VS(){var t=RS(this).mainData;return null==t?[{data:t}]:dt(mt(RS(t).datas),(function(e){return{type:e,data:RS(t).datas[e]}}))}function GS(t,e,n){RS(t).datas={},ct(e,(function(e,i){HS(e,i,t,n)}))}function HS(t,e,n,i){RS(n).datas[e]=t,RS(t).mainData=n,t.dataType=e,i.struct&&(t[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=t),t.getLinkedData=FS,t.getLinkedDataAll=VS}const US=function(t){var e=t.mainData,n=t.datas;n||(n={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,GS(e,n,t),ct(n,(function(n){ct(e.TRANSFERABLE_METHODS,(function(e){n.wrapMethod(e,_t(kS,t))}))})),e.wrapMethod("cloneShallow",_t(BS,t)),ct(e.CHANGABLE_METHODS,(function(n){e.wrapMethod(n,_t(zS,t))})),zt(n[e.dataType]===e)};var WS=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){return this._getRawData().indexOfName(t)>=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}();const jS=WS;var ZS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new jS(i,i),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(e){t.prototype.mergeDefaultAndTheme.apply(this,arguments),wa(e,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,e){var n,i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i){pT(n=this)&&(n.__curvenessList=[],n.__edgeMap={},gT(n));var a=function(t,e,n,i,r){for(var o=new NS(i),a=0;a "+d)),u++)}var f,p=n.get("coordinateSystem");if("cartesian2d"===p||"polar"===p)f=kx(t,n);else{var g=Td.get(p),m=g&&g.dimensions||[];st(m,"value")<0&&m.concat(["value"]);var v=Ax(t,{coordDimensions:m,encodeDefine:n.getEncode()}).dimensions;(f=new Cx(v,n)).initData(t)}var _=new Cx(["value"],n);return _.initData(l,s),r&&r(f,_),US({mainData:f,struct:o,structAttr:"graph",datas:{node:f,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(r,i,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));var n=Ih.prototype.getModel;function i(t,e){var i=n.call(this,t,e);return i.resolveParentPath=r,i}function r(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}e.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=r,t.getModel=i,t}))}));return ct(a.edges,(function(t){!function(t,e,n,i){if(pT(n)){var r=mT(t,e,n),o=n.__edgeMap,a=o[vT(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(i)}}(t.node1,t.node2,this,t.dataIndex)}),this),a.data}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),op("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return mp({series:this,dataIndex:t,multipleSeries:e})},e.prototype._updateCategoriesData=function(){var t=dt(this.option.categories||[],(function(t){return null!=t.value?t:rt({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t)}))},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return t.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Lp);const XS=ZS;function qS(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}var YS={type:"graphRoam",event:"graphRoam",update:"none"};function KS(t,e){var n=e.rippleEffectColor||e.color;t.eachChild((function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?n:null,fill:"fill"===e.brushType?n:null}})}))}var JS=function(t){function e(e,n){var i=t.call(this)||this,r=new VT(e,n),o=new Eo;return i.add(r),i.add(o),i.updateData(e,n),i}return I(e,t),e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var e=t.symbolType,n=t.color,i=t.rippleNumber,r=this.childAt(1),o=0;o0&&(o=this._getLineLength(i)/l*1e3),o!==this._period||a!==this._loop||s!==this._roundTrip){i.stopAnimation();var h=void 0;h=xt(u)?u(n):u,i.__t>0&&(h=-o*i.__t),this._animateSymbol(i,o,h,a,s)}this._period=o,this._loop=a,this._roundTrip=s}},e.prototype._animateSymbol=function(t,e,n,i,r){if(e>0){t.__t=0;var o=this,a=t.animate("",i).when(r?2*e:e,{__t:r?2:1}).delay(n).during((function(){o._updateSymbolPosition(t)}));i||a.done((function(){o.remove(t)})),a.start()}},e.prototype._getLineLength=function(t){return ge(t.__p1,t.__cp1)+ge(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},e.prototype.updateData=function(t,e,n){this.childAt(0).updateData(t,e,n),this._updateEffectSymbol(t,e)},e.prototype._updateSymbolPosition=function(t){var e=t.__p1,n=t.__p2,i=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=hi,l=ci;o[0]=s(e[0],i[0],n[0],r),o[1]=s(e[1],i[1],n[1],r);var u=t.__t<1?l(e[0],i[0],n[0],r):l(n[0],i[0],e[0],1-r),h=t.__t<1?l(e[1],i[1],n[1],r):l(n[1],i[1],e[1],1-r);t.rotation=-Math.atan2(h,u)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(i[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-i[o])/(i[o+1]-i[o]),l=n[o],u=n[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1];var h=t.__t<1?u[0]-l[0]:l[0]-u[0],c=t.__t<1?u[1]-l[1]:l[1]-u[1];t.rotation=-Math.atan2(c,h)-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},e}(oM);const uM=lM;var hM=function(){this.polyline=!1,this.curveness=0,this.segs=[]},cM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new hM},e.prototype.buildPath=function(t,e){var n,i=e.segs,r=e.curveness;if(e.polyline)for(n=this._off;n0){t.moveTo(i[n++],i[n++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*r,d=(l+h)/2-(u-s)*r;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}this.incremental&&(this._off=n,this.notClear=!0)},e.prototype.findDataIndex=function(t,e){var n=this.shape,i=n.segs,r=n.curveness,o=this.style.lineWidth;if(n.polyline)for(var a=0,s=0;s0)for(var u=i[s++],h=i[s++],c=1;c0){if(al(u,h,(u+d)/2-(h-f)*r,(h+f)/2-(d-u)*r,d,f,o,t,e))return a}else if(rl(u,h,d,f,o,t,e))return a;a++}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,n=1/0,i=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=n+t.__startIndex)}))},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();var fM={seriesType:"lines",plan:Ip(),reset:function(t){var e=t.coordinateSystem;if(e){var n=t.get("polyline"),i=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(i){var s=void 0,l=r.end-r.start;if(n){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(i);var u=t.get("clip",!0)&&gM(t.coordinateSystem,!1,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateLineDraw(i,t).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,e,n){var i=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=pM.reset(t,e,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,e){var n=this._lineDraw,i=this._showEffect(e),r=!!e.get("polyline"),o=e.pipelineContext.large;return n&&i===this._hasEffet&&r===this._isPolyline&&o===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=o?new dM:new sS(r?i?uM:sM:i?oM:iS),this._hasEffet=i,this._isPolyline=r,this._isLargeDraw=o),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},e.prototype.dispose=function(t,e){this.remove(t,e)},e.type="lines",e}(Fm);var vM="undefined"==typeof Uint32Array?Array:Uint32Array,_M="undefined"==typeof Float64Array?Array:Float64Array;function yM(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=dt(e,(function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),it([e,t[0],t[1]])})))}var xM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}return I(e,t),e.prototype.init=function(e){e.data=e.data||[],yM(e);var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count)),t.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(e){if(yM(e),e.data){var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count))}t.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=Zt(this._flatCoords,e.flatCoords),this._flatCoordsOffset=Zt(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*t],i=this._flatCoordsOffset[2*t+1],r=0;r ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(Lp);const wM=xM;function bM(t){return t instanceof Array||(t=[t,t]),t}const TM={seriesType:"lines",reset:function(t){var e=bM(t.get("symbol")),n=bM(t.get("symbolSize")),i=t.getData();return i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",n&&n[0]),i.setVisual("toSymbolSize",n&&n[1]),{dataEach:i.hasItemOption?function(t,e){var n=t.getItemModel(e),i=bM(n.getShallow("symbol",!0)),r=bM(n.getShallow("symbolSize",!0));i[0]&&t.setItemVisual(e,"fromSymbol",i[0]),i[1]&&t.setItemVisual(e,"toSymbol",i[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};const SM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.getInitialData=function(t,e){return kx(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,e,n){return n.point(e.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Lp);var MM=function(){},CM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.getDefaultShape=function(){return new MM},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,e){var n,i=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=s&&r[0]<4,u=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,u=i[l]-o/2,h=i[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,n=e.points,i=e.size,r=i[0],o=i[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=n+(t.startIndex||0))}))},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const AM=LM;const DM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).incrementalPrepareUpdate(i),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},e.prototype.updateTransform=function(t,e,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var r=eM("").reset(t,e,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var e=t.coordinateSystem;return e&&e.getArea&&e.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,e){var n=this._symbolDraw,i=e.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new AM:new jT,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Fm);const IM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Gc);var PM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",ka).models[0]},e.type="cartesian2dAxis",e}(Gc);ut(PM,Uw);var EM={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},OM=nt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},EM),NM=nt({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},EM);const RM={category:OM,value:NM,time:nt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},NM),log:ot({logBase:10},NM)};var kM={value:1,category:1,time:1,log:1};function zM(t,e,n,i){ct(kM,(function(r,o){var a=nt(nt({},RM[o],!0),i,!0),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e+"Axis."+o,n}return I(n,t),n.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{};nt(t,e.getTheme().get(o+"Axis")),nt(t,this.getDefaultOption()),t.type=BM(t),n&&kc(t,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=Gx.createByAxisModel(this))},n.prototype.getCategories=function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.type=e+"Axis."+o,n.defaultOption=a,n}(n);t.registerComponentModel(s)})),t.registerSubTypeDefaulter(e+"Axis",BM)}function BM(t){return t.type||(t.data?"category":"value")}const FM=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return dt(this._dimList,(function(t){return this._axes[t]}),this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),pt(this.getAxes(),(function(e){return e.scale.type===t}))},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}();var VM=["x","y"];function GM(t){return"interval"===t.type||"time"===t.type}var HM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=VM,e}return I(e,t),e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(GM(t)&&GM(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-n[0]*l,c=r[1]-i[0]*u,d=this._transform=[l,0,0,u,h,c];this._invTransform=on([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,e){var n=this.dataToPoint(t),i=this.dataToPoint(e),r=this.getArea(),o=new _n(n[0],n[1],i[0]-n[0],i[1]-n[1]);return r.intersect(o)},e.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return xe(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i,e)),n[1]=a.toGlobalCoord(a.dataToCoord(r,e)),n},e.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},e.prototype.pointToData=function(t,e){var n=[];if(this._invTransform)return xe(n,t,this._invTransform);var i=this.getAxis("x"),r=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),e),n[1]=r.coordToData(r.toLocalCoord(t[1]),e),n},e.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},e.prototype.getArea=function(t){t=t||0;var e=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(e[0],e[1])-t,r=Math.min(n[0],n[1])-t,o=Math.max(e[0],e[1])-i+t,a=Math.max(n[0],n[1])-r+t;return new _n(i,r,o,a)},e}(FM);const UM=HM;var WM=function(t){function e(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return I(e,t),e.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},e.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},e.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},e.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(Sb);const jM=WM;function ZM(t,e,n){n=n||{};var i=t.coordinateSystem,r=e.axis,o={},a=r.getAxesOnZeroOf()[0],s=r.position,l=a?"onZero":s,u=r.dim,h=i.getRect(),c=[h.x,h.x+h.width,h.y,h.y+h.height],d={left:0,right:1,top:0,bottom:1,onZero:2},f=e.get("offset")||0,p="x"===u?[c[2]-f,c[3]+f]:[c[0]-f,c[1]+f];if(a){var g=a.toGlobalCoord(a.dataToCoord(0));p[d.onZero]=Math.max(Math.min(g,p[1]),p[0])}o.position=["y"===u?p[d[l]]:c[0],"x"===u?p[d[l]]:c[3]],o.rotation=Math.PI/2*("x"===u?0:1);o.labelDirection=o.tickDirection=o.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],o.labelOffset=a?p[d[s]]-p[d.onZero]:0,e.get(["axisTick","inside"])&&(o.tickDirection=-o.tickDirection),Et(n.labelInside,e.get(["axisLabel","inside"]))&&(o.labelDirection=-o.labelDirection);var m=e.get(["axisLabel","rotate"]);return o.labelRotate="top"===l?-m:m,o.z2=1,o}function XM(t){return"cartesian2d"===t.get("coordinateSystem")}function qM(t){var e={xAxisModel:null,yAxisModel:null};return ct(e,(function(n,i){var r=i.replace(/Model$/,""),o=t.getReferringComponents(r,ka).models[0];e[i]=o})),e}var YM=Math.log;var KM=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=VM,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var n=this._axesMap;function i(t){var e,n=mt(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=t[+n[o]],s=a.model,l=a.scale;Hx(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):(Rw(l,s),Hx(l)&&(e=a))}r.length&&(e||Rw((e=r.pop()).scale,e.model),ct(r,(function(t){!function(t,e,n){var i=tw.prototype,r=i.getTicks.call(n),o=i.getTicks.call(n,!0),a=r.length-1,s=i.getInterval.call(n),l=Nw(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var d=YM(t.base);u=[YM(u[0])/d,YM(u[1])/d]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var f=i.getExtent.call(t);h&&(u[0]=f[0]),c&&(u[1]=f[1]);var p=i.getInterval.call(t),g=u[0],m=u[1];if(h&&c)p=(m-g)/a;else if(h)for(m=u[0]+p*a;mu[0]&&isFinite(g)&&isFinite(u[0]);)p=Wx(p),g=u[1]-p*a;else{t.getTicks().length-1>a&&(p=Wx(p));var v=p*a;(g=Yo((m=Math.ceil(u[1]/p)*p)-v))<0&&u[0]>=0?(g=0,m=Yo(v)):m>0&&u[1]<=0&&(m=0,g=-Yo(v))}var _=(r[0].value-o[0].value)/s,y=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+p*_,m+p*y),i.setInterval.call(t,p),(_||y)&&i.setNiceExtent.call(t,g+p,m-p)}(t.scale,t.model,e.scale)})))}}this._updateScale(t,this.model),i(n.x),i(n.y);var r={};ct(n.x,(function(t){$M(n,"y",t,r)})),ct(n.y,(function(t){$M(n,"x",t,r)})),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){var i=t.getBoxLayoutParams(),r=!n&&t.get("containLabel"),o=Oc(i,{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;function s(){ct(a,(function(t){var e=t.isHorizontal(),n=e?[0,o.width]:[0,o.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),function(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}(t,e?o.x:o.y)}))}s(),r&&(ct(a,(function(t){if(!t.model.get(["axisLabel","inside"])){var e=function(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();r=n instanceof Jx?n.count():(i=n.getTicks()).length;var a,s=t.getLabelModel(),l=zw(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;h0&&i>0||n<0&&i<0)}(t)}const tC=KM;var eC=Math.PI,nC=function(){function t(t,e){this.group=new Eo,this.opt=e,this.axisModel=t,ot(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Eo({x:e.position[0],y:e.position[1],rotation:e.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(t){return!!iC[t]},t.prototype.add=function(t){iC[t](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(t,e,n){var i,r,o=ia(e-t);return ra(o)?(r=n>0?"top":"bottom",i="center"):ra(o-eC)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&o0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),iC={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0],u=s[0]>l[0];a&&(xe(s,s,a),xe(l,l,a));var h=rt({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),c=new Dg({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:h,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});pm(c.shape,c.style.lineWidth),c.anid="line",n.add(c);var d=e.get(["axisLine","symbol"]);if(null!=d){var f=e.get(["axisLine","symbolSize"]);wt(d)&&(d=[d,d]),(wt(f)||Tt(f))&&(f=[f,f]);var p=Xv(e.get(["axisLine","symbolOffset"])||0,f),g=f[0],m=f[1];ct([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],(function(e,i){if("none"!==d[i]&&null!=d[i]){var r=jv(d[i],-g/2,-m/2,g,m,h.stroke,!0),o=e.r+e.offset,a=u?l:s;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}}))}}},axisTickLabel:function(t,e,n,i){var r=function(t,e,n,i){var r=n.axis,o=n.getModel("axisTick"),a=o.get("show");"auto"===a&&i.handleAutoShown&&(a=i.handleAutoShown("axisTick"));if(!a||r.scale.isBlank())return;for(var s=o.getModel("lineStyle"),l=i.tickDirection*o.get("length"),u=sC(r.getTicksCoords(),e.transform,l,ot(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),h=0;hc[1]?-1:1,f=["start"===s?c[0]-d*h:"end"===s?c[1]+d*h:(c[0]+c[1])/2,aC(s)?t.labelOffset+l*h:0],p=e.get("nameRotate");null!=p&&(p=p*eC/180),aC(s)?o=nC.innerTextLayout(t.rotation,null!=p?p:t.rotation,l):(o=function(t,e,n,i){var r,o,a=ia(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;ra(a-eC/2)?(o=l?"bottom":"top",r="center"):ra(a-1.5*eC)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*eC&&a>eC/2?l?"left":"right":l?"right":"left");return{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,s,p||0,c),null!=(a=t.axisNameAvailableWidth)&&(a=Math.abs(a/Math.sin(o.rotation)),!isFinite(a)&&(a=null)));var g=u.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Et(t.nameTruncateMaxWidth,m.maxWidth,a),y=new eu({x:f[0],y:f[1],rotation:o.rotation,silent:nC.isLabelSilent(e),style:lh(u,{text:r,font:g,overflow:"truncate",width:_,ellipsis:v,fill:u.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:u.get("align")||o.textAlign,verticalAlign:u.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(Am({el:y,componentModel:e,itemName:r}),y.__fullText=r,y.anid="name",e.get("triggerEvent")){var x=nC.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,nu(y).eventData=x}i.add(y),y.updateTransform(),n.add(y),y.decomposeTransform()}}};function rC(t){t&&(t.ignore=!0)}function oC(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=$e([]);return nn(r,r,-t.rotation),n.applyTransform(tn([],r,t.getLocalTransform())),i.applyTransform(tn([],r,e.getLocalTransform())),n.intersect(i)}}function aC(t){return"middle"===t||"center"===t}function sC(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function cC(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[fC(t)]}function dC(t){return!!t.get(["handle","show"])}function fC(t){return t.type+"||"+t.id}var pC={},gC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(e,n,i,r){this.axisPointerClass&&function(t){var e=cC(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=dC(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),aa)return!0;if(o){var s=cC(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return!0===n},t.prototype.makeElOption=function(t,e,n,i,r){},t.prototype.createPointerEl=function(t,e,n,i){var r=e.pointer;if(r){var o=LC(t).pointerEl=new a[r.type](AC(e.pointer));t.add(o)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=LC(t).labelEl=new eu(AC(e.label));t.add(r),OC(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=LC(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=LC(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),OC(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,n=this._axisPointerModel,i=this._api.getZr(),r=this._handle,o=n.getModel("handle"),a=n.get("status");if(!o.get("show")||!a||"hide"===a)return r&&i.remove(r),void(this._handle=null);this._handle||(e=!0,r=this._handle=Sm(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){Ze(t.event)},onmousedown:DC(this._onHandleDragMove,this,0,0),drift:DC(this._onHandleDragMove,this),ondragend:DC(this._onHandleDragEnd,this)}),i.add(r)),RC(r,n,!1),r.setStyle(o.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=o.get("size");yt(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,Wm(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){PC(this._axisPointerModel,!e&&this._moveAnimation,this._handle,NC(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(NC(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(NC(i)),LC(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),jm(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return{x:t[n=n||0],y:t[1-n],width:e[n],height:e[1-n]}},t}();function PC(t,e,n,i){EC(LC(n).lastProp,i)||(LC(n).lastProp=i,e?Ju(n,i,t):(n.stopAnimation(),n.attr(i)))}function EC(t,e){if(St(t)&&St(e)){var n=!0;return ct(e,(function(e,i){n=n&&EC(t[i],e)})),!!n}return t===e}function OC(t,e){t[e.get(["label","show"])?"show":"hide"]()}function NC(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function RC(t,e,n){var i=e.get("z"),r=e.get("zlevel");t&&t.traverse((function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=r&&(t.zlevel=r),t.silent=n)}))}function kC(t,e,n,i,r){var o=zC(n.get("value"),e.axis,e.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),a=n.getModel("label"),s=_c(a.get("padding")||0),l=a.getFont(),u=po(o,l),h=r.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=r.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=r.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),function(t,e,n,i){var r=i.getWidth(),o=i.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+n,o)-n,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(h,c,d,i);var g=a.get("backgroundColor");g&&"auto"!==g||(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:lh(a,{text:o,font:l,fill:a.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function zC(t,e,n,i,r){t=e.scale.parse(t);var o=e.scale.getLabel({value:t},{precision:r.precision}),a=r.formatter;if(a){var s={value:Bw(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};ct(i,(function(t){var e=n.getSeriesByIndex(t.seriesIndex),i=t.dataIndexInside,r=e&&e.getDataParams(i);r&&s.seriesData.push(r)})),wt(a)?o=a.replace("{value}",o):xt(a)&&(o=a(s))}return o}function BC(t,e,n){var i=[1,0,0,1,0,0];return nn(i,i,n.rotation),en(i,i,n.position),_m([t.dataToCoord(e),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}var FC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=VC(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=function(t){var e,n=t.get("type"),i=t.getModel(n+"Style");return"line"===n?(e=i.getLineStyle()).fill=null:"shadow"===n&&((e=i.getAreaStyle()).stroke=null),e}(i),c=GC[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}!function(t,e,n,i,r,o){var a=lC.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=r.get(["label","margin"]),kC(e,i,r,o,{position:BC(i.axis,t,n),align:a.textAlign,verticalAlign:a.textVerticalAlign})}(e,t,ZM(a.model,n),n,i,r)},e.prototype.getHandleTransform=function(t,e,n){var i=ZM(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=BC(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,n,i){var r=n.axis,o=r.grid,a=r.getGlobalExtent(!0),s=VC(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,u=[t.x,t.y];u[l]+=e[l],u[l]=Math.min(a[1],u[l]),u[l]=Math.max(a[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];return{x:u[0],y:u[1],rotation:t.rotation,cursorPoint:c,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},e}(IC);function VC(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}var GC={line:function(t,e,n){var i=function(t,e,n){return{x1:t[n=n||0],y1:t[1-n],x2:e[n],y2:e[1-n]}}([e,n[0]],[e,n[1]],HC(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i,r,o,a=Math.max(1,t.getBandWidth()),s=n[1]-n[0];return{type:"Rect",shape:(i=[e-a/2,n[0]],r=[a,s],o=HC(t),{x:i[o=o||0],y:i[1-o],width:r[o],height:r[1-o]})}}};function HC(t){return"x"===t.dim?0:1}const UC=FC;const WC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Gc);var jC=Ea(),ZC=ct;function XC(t,e,n){if(!O.node){var i=e.getZr();jC(i).records||(jC(i).records={}),function(t,e){if(jC(t).initialized)return;function n(n,i){t.on(n,(function(n){var r=function(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}(e);ZC(jC(t).records,(function(t){t&&i(t,n,r.dispatchAction)})),function(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]);n&&(n.dispatchAction=null,e.dispatchAction(n))}(r.pendings,e)}))}jC(t).initialized=!0,n("click",_t(YC,"click")),n("mousemove",_t(YC,"mousemove")),n("globalout",qC)}(i,e),(jC(i).records[t]||(jC(i).records[t]={})).handler=n}}function qC(t,e,n){t.handler("leave",null,n)}function YC(t,e,n,i){e.handler(t,n,i)}function KC(t,e){if(!O.node){var n=e.getZr();(jC(n).records||{})[t]&&(jC(n).records[t]=null)}}var JC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";XC("axisPointer",n,(function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})}))},e.prototype.remove=function(t,e){KC("axisPointer",e)},e.prototype.dispose=function(t,e){KC("axisPointer",e)},e.type="axisPointer",e}(Dp);const $C=JC;function QC(t,e){var n,i=[],r=t.seriesIndex;if(null==r||!(n=e.getSeriesByIndex(r)))return{point:[]};var o=n.getData(),a=Pa(o,t);if(null==a||a<0||yt(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u).dim,c=u.dim,d="x"===h||"radius"===h?1:0,f=o.mapDimension(c),p=[];p[d]=o.get(f,a),p[1-d]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(p)||[]}else i=l.dataToPoint(o.getValues(dt(l.dimensions,(function(t){return o.mapDimension(t)})),a))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var tL=Ea();function eL(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||vt(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){aL(r)&&(r=QC({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=aL(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||aL(r),d={},f={},p={list:[],map:{}},g={showPointer:_t(iL,f),showTooltip:_t(rL,p)};ct(s.coordSysMap,(function(t,e){var n=l||t.containPoint(r);ct(s.coordSysAxesInfo[e],(function(t,e){var i=t.axis,o=function(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}(u,t);if(!c&&n&&(!u||o)){var a=o&&o.value;null!=a||l||(a=i.pointToData(r)),null!=a&&nL(t,a,g,!1,d)}}))}));var m={};return ct(h,(function(t,e){var n=t.linkGroup;n&&!f[e]&&ct(n.axesInfo,(function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,oL(e),oL(t)))),m[t.key]=o}}))})),ct(m,(function(t,e){nL(h[e],t,g,!0,d)})),function(t,e,n){var i=n.axesInfo=[];ct(e,(function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})}))}(f,h,d),function(t,e,n,i){if(aL(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}(p,r,t,a),function(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=tL(i)[r]||{},a=tL(i)[r]={};ct(t,(function(t,e){var n=t.axisPointerModel.option;"show"===n.status&&t.triggerEmphasis&&ct(n.seriesDataIndices,(function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t}))}));var s=[],l=[];ct(o,(function(t,e){!a[e]&&l.push(t)})),ct(a,(function(t,e){!o[e]&&s.push(t)})),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(h,0,n),d}}function nL(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e))if(t.involveSeries){var a=function(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return ct(e.seriesModels,(function(e,l){var u,h,c=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,n);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===n.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=a&&((p=0&&s<0)&&(a=p,s=f,r=u,o.length=0),ct(h,(function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})})))}})),{payloadBatch:o,snapToValue:r}}(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&rt(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}else n.showPointer(t,e)}function iL(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function rL(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=fC(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function oL(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function aL(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function sL(t){mC.registerAxisPointerClass("CartesianAxisPointer",UC),t.registerComponentModel(WC),t.registerComponentView($C),t.registerPreprocessor((function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!yt(e)&&(t.axisPointer.link=[e])}})),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,(function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=uC(t,e)})),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},eL)}const lL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Gc);function uL(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function hL(t){if(O.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;n-1?(u+="top:50%",h+="translateY(-50%) rotate("+(a="left"===s?-225:-45)+"deg)"):(u+="left:50%",h+="translateX(-50%) rotate("+(a="top"===s?225:45)+"deg)");var c=a*Math.PI/180,d=l+r,f=d*Math.abs(Math.cos(c))+d*Math.abs(Math.sin(c)),p=e+" solid "+r+"px;";return'
'}(n,i,r)),wt(t))o.innerHTML=t+a;else if(t){o.innerHTML="",yt(t)||(t=[t]);for(var s=0;s=0?this._tryShow(n,i):"leave"===e&&this._hide(i))}),this))},e.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})}))}},e.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!O.node&&n.getDom()){var r=DL(i,n);this._ticket="";var o=i.dataByCoordSys,a=function(t,e,n){var i=Ra(t).queryOptionMap,r=i.keys()[0];if(!r||"series"===r)return;var o=Ba(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(!a)return;var s,l=n.getViewOfComponentModel(a);if(l.group.traverse((function(e){var n=nu(e).tooltipConfig;if(n&&n.name===t.name)return s=e,!0})),s)return{componentMainType:r,componentIndex:a.componentIndex,el:s}}(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=CL;l.x=i.x,l.y=i.y,l.update(),nu(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=QC(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},e.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(DL(i,n))},e.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s)if("axis"===AL([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}},e.prototype._tryShow=function(t,e){var n=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(n){var r,o;if("legend"===nu(n).ssrType)return;this._lastDataByCoordSys=null,Ev(n,(function(t){return null!=nu(t).dataIndex?(r=t,!0):null!=nu(t).tooltipConfig?(o=t,!0):void 0}),!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},e.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=vt(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},e.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=AL([e.tooltipOption],i),a=this._renderMode,s=[],l=op("section",{blocks:[],noHeader:!0}),u=[],h=new gp;ct(t,(function(t){ct(t.dataByAxis,(function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=zC(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),c=op("section",{header:o,noHeader:!Bt(o),sortBlocks:!0,blocks:[]});l.blocks.push(c),ct(t.seriesDataIndices,(function(l){var d=n.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,p=d.getDataParams(f);if(!(p.dataIndex<0)){p.axisDim=t.axisDim,p.axisIndex=t.axisIndex,p.axisType=t.axisType,p.axisId=t.axisId,p.axisValue=Bw(e.axis,{value:r}),p.axisValueLabel=o,p.marker=h.makeTooltipMarker("item",Cc(p.color),a);var g=Tf(d.formatTooltip(f,!0,null)),m=g.frag;if(m){var v=AL([d],i).get("valueFormatter");c.blocks.push(v?rt({valueFormatter:v},m):m)}g.text&&u.push(g.text),s.push(p)}}))}}))})),l.blocks.reverse(),u.reverse();var c=e.position,d=o.get("order"),f=cp(l,h,a,d,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var p="richText"===a?"\n\n":"
",g=u.join(p);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t,s)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)}))},e.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=nu(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,d=t.positionDefault,f=AL([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),p=f.get("trigger");if(null==p||"item"===p){var g=s.getDataParams(l,u),m=new gp;g.marker=m.makeTooltipMarker("item",Cc(g.color),c);var v=Tf(s.formatTooltip(l,!1,u)),_=f.get("order"),y=f.get("valueFormatter"),x=v.frag,w=x?cp(y?rt({valueFormatter:y},x):x,m,c,_,i.get("useUTC"),f.get("textStyle")):v.text,b="item_"+s.name+"_"+l;this._showOrMove(f,(function(){this._showTooltipContent(f,w,g,b,t.offsetX,t.offsetY,t.position,t.target,m)})),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,n){var i="html"===this._renderMode,r=nu(e),o=r.tooltipConfig.option||{},a=o.encodeHTMLContent;if(wt(o)){o={content:o,formatter:o},a=!0}a&&i&&o.content&&((o=et(o)).content=ze(o.content));var s=[o],l=this._ecModel.getComponent(r.componentMainType,r.componentIndex);l&&s.push(l),s.push({formatter:o.content});var u=t.positionDefault,h=AL(s,this._tooltipModel,u?{position:u}:null),c=h.get("content"),d=Math.random()+"",f=new gp;this._showOrMove(h,(function(){var n=et(h.get("formatterParams")||{});this._showTooltipContent(h,c,n,d,t.offsetX,t.offsetY,t.position,e,f)})),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,d=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h)if(wt(h)){var f=t.ecModel.get("useUTC"),p=yt(n)?n[0]:n;c=h,p&&p.axisType&&p.axisType.indexOf("time")>=0&&(c=Qh(p.axisValue,c,f)),c=bc(c,n,!0)}else if(xt(h)){var g=vt((function(e,i){e===this._ticket&&(u.setContent(i,l,t,d,a),this._updatePosition(t,a,r,o,u,n,s))}),this);this._ticket=i,c=h(n,i,g)}else c=h;u.setContent(c,l,t,d,a),u.show(t,d),this._updatePosition(t,a,r,o,u,n,s)}},e.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||yt(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:yt(e)?void 0:{color:i||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=a&&a.getBoundingRect().clone();if(a&&d.applyTransform(a.transform),xt(e)&&(e=e([n,i],o,r.el,d,{viewSize:[s,l],contentSize:u.slice()})),yt(e))n=qo(e[0],s),i=qo(e[1],l);else if(St(e)){var f=e;f.width=u[0],f.height=u[1];var p=Oc(f,{width:s,height:l});n=p.x,i=p.y,h=null,c=null}else if(wt(e)&&a){var g=function(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,d,u,t.get("borderWidth"));n=g[0],i=g[1]}else{g=function(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];null!=o&&(t+l+o+2>i?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=IL(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=IL(c)?u[1]/2:"bottom"===c?u[1]:0),uL(t)){g=function(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&ct(n,(function(n,o){var a=n.dataByAxis||[],s=(t[o]||{}).dataByAxis||[];(r=r&&a.length===s.length)&&ct(a,(function(t,n){var o=s[n]||{},a=t.seriesDataIndices||[],l=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===l.length)&&ct(a,(function(t,e){var n=l[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})),i&&ct(t.seriesDataIndices,(function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){!O.node&&e.getDom()&&(jm(this,"_updatePosition"),this._tooltipContent.dispose(),KC("itemTooltip",e))},e.type="tooltip",e}(Dp);function AL(t,e,n){var i,r=e.ecModel;n?(i=new Ih(n,r,r),i=new Ih(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof Ih&&(a=a.get("tooltip",!0)),wt(a)&&(a={formatter:a}),a&&(i=new Ih(a,i,r)))}return i}function DL(t,e){return t.dispatchAction||vt(e.dispatchAction,e)}function IL(t){return"center"===t||"middle"===t}const PL=LL;var EL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Gc),OL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){if(this.group.removeAll(),t.get("show")){var i=this.group,r=t.getModel("textStyle"),o=t.getModel("subtextStyle"),a=t.get("textAlign"),s=Ot(t.get("textBaseline"),t.get("textVerticalAlign")),l=new eu({style:lh(r,{text:t.get("text"),fill:r.getTextColor()},{disableBox:!0}),z2:10}),u=l.getBoundingRect(),h=t.get("subtext"),c=new eu({style:lh(o,{text:h,fill:o.getTextColor(),y:u.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),f=t.get("sublink"),p=t.get("triggerEvent",!0);l.silent=!d&&!p,c.silent=!f&&!p,d&&l.on("click",(function(){Lc(d,"_"+t.get("target"))})),f&&c.on("click",(function(){Lc(f,"_"+t.get("subtarget"))})),nu(l).eventData=nu(c).eventData=p?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(l),h&&i.add(c);var g=i.getBoundingRect(),m=t.getBoxLayoutParams();m.width=g.width,m.height=g.height;var v=Oc(m,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));a||("middle"===(a=t.get("left")||t.get("right"))&&(a="center"),"right"===a?v.x+=v.width:"center"===a&&(v.x+=v.width/2)),s||("center"===(s=t.get("top")||t.get("bottom"))&&(s="middle"),"bottom"===s?v.y+=v.height:"middle"===s&&(v.y+=v.height/2),s=s||"top"),i.x=v.x,i.y=v.y,i.markRedraw();var _={align:a,verticalAlign:s};l.setStyle(_),c.setStyle(_),g=i.getBoundingRect();var y=v.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var w=new Fl({shape:{x:g.x-y[3],y:g.y-y[0],width:g.width+y[1]+y[3],height:g.height+y[0]+y[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(w)}},e.type="title",e}(Dp);var NL=["x","y","radius","angle","single"],RL=["cartesian2d","polar","singleAxis"];function kL(t){return t+"Axis"}function zL(t,e){var n,i=jt(),r=[],o=jt();t.eachComponent({mainType:"dataZoom",query:e},(function(t){o.get(t.uid)||s(t)}));do{n=!1,t.eachComponent("dataZoom",a)}while(n);function a(t){!o.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis((function(t,n){var r=i.get(t);r&&r[n]&&(e=!0)})),e}(t)&&(s(t),n=!0)}function s(t){o.set(t.uid,!0),r.push(t),t.eachTargetAxis((function(t,e){(i.get(t)||i.set(t,[]))[e]=!0}))}return r}var BL=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();function FL(t){var e={};return ct(["start","end","startValue","endValue","throttle"],(function(n){t.hasOwnProperty(n)&&(e[n]=t[n])})),e}const VL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="dataZoom.select",e}(function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return I(e,t),e.prototype.init=function(t,e,n){var i=FL(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},e.prototype.mergeOption=function(t){var e=FL(t);nt(this.option,t,!0),nt(this.settledOption,e,!0),this._doInit(e)},e.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=n[t[0]]=null)}),this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=jt();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each((function(t){t.indexList.length&&(this._noTarget=!1)}),this)},e.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return ct(NL,(function(n){var i=this.getReferringComponents(kL(n),za);if(i.specified){e=!0;var r=new BL;ct(i.models,(function(t){r.add(t.componentIndex)})),t.set(n,r)}}),this),e},e.prototype._fillAutoTargetAxisByOrient=function(t,e){var n=this.ecModel,i=!0;if(i){var r="vertical"===e?"y":"x";o(n.findComponents({mainType:r+"Axis"}),r)}i&&o(n.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single");function o(e,n){var r=e[0];if(r){var o=new BL;if(o.add(r.componentIndex),t.set(n,o),i=!1,"x"===n||"y"===n){var a=r.getReferringComponents("grid",ka).models[0];a&&ct(e,(function(t){r.componentIndex!==t.componentIndex&&a===t.getReferringComponents("grid",ka).models[0]&&o.add(t.componentIndex)}))}}}i&&ct(NL,(function(e){if(i){var r=n.findComponents({mainType:kL(e),filter:function(t){return"category"===t.get("type",!0)}});if(r[0]){var o=new BL;o.add(r[0].componentIndex),t.set(e,o),i=!1}}}),this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis((function(e){!t&&(t=e)}),this),"y"===t?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var e=this._rangePropMode,n=this.get("rangeMode");ct([["start","startValue"],["end","endValue"]],(function(i,r){var o=null!=t[i[0]],a=null!=t[i[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":n?e[r]=n[r]:o&&(e[r]="percent")}))},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis((function(e,n){null==t&&(t=this.ecModel.getComponent(kL(e),n))}),this),t},e.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each((function(n,i){ct(n.indexList,(function(n){t.call(e,i,n)}))}))},e.prototype.getAxisProxy=function(t,e){var n=this.getAxisModel(t,e);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,e){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[e])return this.ecModel.getComponent(kL(t),e)},e.prototype.setRawRange=function(t){var e=this.option,n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(i){null==t[i[0]]&&null==t[i[1]]||(e[i[0]]=n[i[0]]=t[i[0]],e[i[1]]=n[i[1]]=t[i[1]])}),this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var e=this.option;ct(["start","startValue","end","endValue"],(function(n){e[n]=t[n]}))},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var n=this.findRepresentativeAxisProxy();return n?n.getDataValueWindow():void 0},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,n=this._targetAxisInfoMap.keys(),i=0;io&&(e[1-i]=e[i]+u.sign*o),e}function UL(t,e){var n=t[e]-t[1-e];return{span:Math.abs(n),sign:n>0?-1:n<0?1:e?-1:1}}function WL(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}var jL=ct,ZL=Ko,XL=function(){function t(t,e,n,i){this._dimName=t,this._axisIndex=e,this.ecModel=i,this._dataZoomModel=n}return t.prototype.hostedBy=function(t){return this._dataZoomModel===t},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var t=[];return this.ecModel.eachSeries((function(e){if(function(t){var e=t.get("coordinateSystem");return st(RL,e)>=0}(e)){var n=kL(this._dimName),i=e.getReferringComponents(n,ka).models[0];i&&this._axisIndex===i.componentIndex&&t.push(e)}}),this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return et(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){var e,n=this._dataExtent,i=this.getAxisModel().axis.scale,r=this._dataZoomModel.getRangePropMode(),o=[0,100],a=[],s=[];jL(["start","end"],(function(l,u){var h=t[l],c=t[l+"Value"];"percent"===r[u]?(null==h&&(h=o[u]),c=i.parse(Xo(h,o,n))):(e=!0,h=Xo(c=null==c?n[u]:i.parse(c),n,o)),s[u]=null==c||isNaN(c)?n[u]:c,a[u]=null==h||isNaN(h)?o[u]:h})),ZL(s),ZL(a);var l=this._minMaxSpan;function u(t,e,n,r,o){var a=o?"Span":"ValueSpan";HL(0,t,n,"all",l["min"+a],l["max"+a]);for(var s=0;s<2;s++)e[s]=Xo(t[s],n,r,!0),o&&(e[s]=i.parse(e[s]))}return e?u(s,a,n,o,!1):u(a,s,o,n,!0),{valueWindow:s,percentWindow:a}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,n){var i=[1/0,-1/0];jL(n,(function(t){!function(t,e,n){e&&ct(Hw(e,n),(function(n){var i=e.getApproximateExtent(n);i[0]t[1]&&(t[1]=i[1])}))}(i,t.getData(),e)}));var r=t.getAxisModel(),o=Ew(r.axis.scale,r,i).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var n=this.calculateDataWindow(t.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow;"none"!==r&&jL(i,(function(t){var e=t.getData(),i=e.mapDimensionsAll(n);if(i.length){if("weakFilter"===r){var a=e.getStore(),s=dt(i,(function(t){return e.getDimensionIndex(t)}),e);e.filterSelf((function(t){for(var e,n,r,l=0;lo[1];if(h&&!c&&!d)return!0;h&&(r=!0),c&&(e=!0),d&&(n=!0)}return r&&e&&n}))}else jL(i,(function(n){if("empty"===r)t.setData(e=e.map(n,(function(t){return function(t){return t>=o[0]&&t<=o[1]}(t)?t:NaN})));else{var i={};i[n]=o,e.selectRange(i)}}));jL(i,(function(t){e.setApproximateExtent(o,t)}))}}))}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,n=this._dataExtent;jL(["min","max"],(function(i){var r=e.get(i+"Span"),o=e.get(i+"ValueSpan");null!=o&&(o=this.getAxisModel().axis.scale.parse(o)),null!=o?r=Xo(n[0]+o,n,[0,100],!0):null!=r&&(o=Xo(r,[0,100],n,!0)-n[0]),t[i+"Span"]=r,t[i+"ValueSpan"]=o}),this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,n=this._valueWindow;if(e){var i=Qo(n,[0,500]);i=Math.min(i,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==e[1]&&r.setDeterminedMinMax("max",+n[1].toFixed(i)),r.freeze()}},t}();const qL=XL;const YL={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,r){var o=t.getComponent(kL(i),r);e(i,r,o,n)}))}))}e((function(t,e,n,i){n.__dzAxisProxy=null}));var n=[];e((function(e,i,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new qL(e,i,o,t),n.push(r.__dzAxisProxy))}));var i=jt();return ct(n,(function(t){ct(t.getTargetSeriesModels(),(function(t){i.set(t.uid,t)}))})),i},overallReset:function(t,e){t.eachComponent("dataZoom",(function(t){t.eachTargetAxis((function(e,n){t.getAxisProxy(e,n).reset(t)})),t.eachTargetAxis((function(n,i){t.getAxisProxy(n,i).filterData(t,e)}))})),t.eachComponent("dataZoom",(function(t){var e=t.findRepresentativeAxisProxy();if(e){var n=e.getDataPercentWindow(),i=e.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}}))}};var KL=!1;function JL(t){KL||(KL=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,YL),function(t){t.registerAction("dataZoom",(function(t,e){ct(zL(e,t),(function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})}))}))}(t),t.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}function $L(t){t.registerComponentModel(VL),t.registerComponentView(GL),JL(t)}var QL=function(){},tA={};function eA(t,e){tA[t]=e}function nA(t){return tA[t]}const iA=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.optionUpdated=function(){t.prototype.optionUpdated.apply(this,arguments);var e=this.ecModel;ct(this.option.feature,(function(t,n){var i=nA(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(e)),nt(t,i.defaultOption))}))},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Gc);function rA(t,e){var n=_c(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),t=new Fl({shape:{x:t.x-n[3],y:t.y-n[0],width:t.width+n[1]+n[3],height:t.height+n[0]+n[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1})}var oA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){var r=this.group;if(r.removeAll(),t.get("show")){var o=+t.get("itemSize"),a="vertical"===t.get("orient"),s=t.get("feature")||{},l=this._features||(this._features={}),u=[];ct(s,(function(t,e){u.push(e)})),new ex(this._featureNames||[],u).add(h).update(h).remove(_t(h,null)).execute(),this._featureNames=u,function(t,e,n){var i=e.getBoxLayoutParams(),r=e.get("padding"),o={width:n.getWidth(),height:n.getHeight()},a=Oc(i,o,r);Ec(e.get("orient"),t,e.get("itemGap"),a.width,a.height),Nc(t,i,o,r)}(r,t,n),r.add(rA(r.getBoundingRect(),t)),a||r.eachChild((function(t){var e=t.__title,i=t.ensureState("emphasis"),a=i.textConfig||(i.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!xt(l)&&e){var u=l.style||(l.style={}),h=po(e,eu.makeFont(u)),c=t.x+r.x,d=!1;t.y+r.y+o+h.height>n.getHeight()&&(a.position="top",d=!0);var f=d?-5-h.height:o+10;c+h.width/2>n.getWidth()?(a.position=["100%",f],u.align="right"):c-h.width/2<0&&(a.position=[0,f],u.align="left")}}))}function h(h,c){var d,f=u[h],p=u[c],g=s[f],m=new Ih(g,t,t.ecModel);if(i&&null!=i.newTitle&&i.featureName===f&&(g.title=i.newTitle),f&&!p){if(function(t){return 0===t.indexOf("my")}(f))d={onclick:m.option.onclick,featureName:f};else{var v=nA(f);if(!v)return;d=new v}l[f]=d}else if(!(d=l[p]))return;d.uid=Eh("toolbox-feature"),d.model=m,d.ecModel=e,d.api=n;var _=d instanceof QL;f||!p?!m.get("show")||_&&d.unusable?_&&d.remove&&d.remove(e,n):(!function(i,s,l){var u,h,c=i.getModel("iconStyle"),d=i.getModel(["emphasis","iconStyle"]),f=s instanceof QL&&s.getIcons?s.getIcons():i.get("icon"),p=i.get("title")||{};wt(f)?(u={})[l]=f:u=f;wt(p)?(h={})[l]=p:h=p;var g=i.iconPaths={};ct(u,(function(l,u){var f=Sm(l,{},{x:-o/2,y:-o/2,width:o,height:o});f.setStyle(c.getItemStyle()),f.ensureState("emphasis").style=d.getItemStyle();var p=new eu({style:{text:h[u],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:ph({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},e)},ignore:!0});f.setTextContent(p),Am({el:f,componentModel:t,itemName:u,formatterParamsExtra:{title:h[u]}}),f.__title=h[u],f.on("mouseover",(function(){var e=d.getItemStyle(),i=a?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";p.setStyle({fill:d.get("textFill")||e.fill||e.stroke||"#000",backgroundColor:d.get("textBackgroundColor")}),f.setTextConfig({position:d.get("textPosition")||i}),p.ignore=!t.get("showTitle"),n.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==i.get(["iconStatus",u])&&n.leaveEmphasis(this),p.hide()})),("emphasis"===i.get(["iconStatus",u])?Iu:Pu)(f),r.add(f),f.on("click",vt(s.onclick,s,e,n,u)),g[u]=f}))}(m,d,f),m.setIconStatus=function(t,e){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[t]=e,i[t]&&("emphasis"===e?Iu:Pu)(i[t])},d instanceof QL&&d.render&&d.render(m,e,n,i)):_&&d.dispose&&d.dispose(e,n)}},e.prototype.updateView=function(t,e,n,i){ct(this._features,(function(t){t instanceof QL&&t.updateView&&t.updateView(t.model,e,n,i)}))},e.prototype.remove=function(t,e){ct(this._features,(function(n){n instanceof QL&&n.remove&&n.remove(t,e)})),this.group.removeAll()},e.prototype.dispose=function(t,e){ct(this._features,(function(n){n instanceof QL&&n.dispose&&n.dispose(t,e)}))},e.type="toolbox",e}(Dp);const aA=oA;const sA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.onclick=function(t,e){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":n.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=O.browser;if("function"!=typeof MouseEvent||!s.newEdge&&(s.ie||s.edge))if(window.navigator.msSaveOrOpenBlob||r){var l=a.split(","),u=l[0].indexOf("base64")>-1,h=r?decodeURIComponent(l[1]):l[1];u&&(h=window.atob(h));var c=i+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var d=h.length,f=new Uint8Array(d);d--;)f[d]=h.charCodeAt(d);var p=new Blob([f]);window.navigator.msSaveOrOpenBlob(p,c)}else{var g=document.createElement("iframe");document.body.appendChild(g);var m=g.contentWindow,v=m.document;v.open("image/svg+xml","replace"),v.write(h),v.close(),m.focus(),v.execCommand("SaveAs",!0,c),document.body.removeChild(g)}}else{var _=n.get("lang"),y='',x=window.open();x.document.write(y),x.document.title=i}else{var w=document.createElement("a");w.download=i+"."+o,w.target="_blank",w.href=a;var b=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});w.dispatchEvent(b)}},e.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},e}(QL);var lA="__ec_magicType_stack__",uA=[["line","bar"],["stack"]],hA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return ct(t.get("type"),(function(t){e[t]&&(n[t]=e[t])})),n},e.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,n){var i=this.model,r=i.get(["seriesIndex",n]);if(cA[n]){var o,a={series:[]};ct(uA,(function(t){st(t,n)>=0&&ct(t,(function(t){i.setIconStatus(t,"normal")}))})),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=cA[n](e,r,t,i);o&&(ot(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var u=l.dim+"Axis",h=t.getReferringComponents(u,ka).models[0].componentIndex;a[u]=a[u]||[];for(var c=0;c<=h;c++)a[u][h]=a[u][h]||{};a[u][h].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(o=nt({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}(QL),cA={line:function(t,e,n,i){if("bar"===t)return nt({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return nt({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var r=n.get("stack")===lA;if("line"===t||"bar"===t)return i.setIconStatus("stack",r?"normal":"emphasis"),nt({id:e,stack:r?"":lA},i.get(["option","stack"])||{},!0)}};Vy({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));const dA=hA;var fA=new Array(60).join("-"),pA="\t";function gA(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var mA=new RegExp("[\t]+","g");function vA(t,e){var n=t.split(new RegExp("\n*"+fA+"\n*","g")),i={series:[]};return ct(n,(function(t,n){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(pA)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=[],i=dt(gA(e.shift()).split(mA),(function(t){return{name:t,data:[]}})),r=0;r6}(t)||o){if(a&&!o){"single"===s.brushMode&&WA(t);var l=et(s);l.brushType=sD(l.brushType,a),l.panelId=a===CA?null:a.panelId,o=t._creatingCover=kA(t,l),t._covers.push(o)}if(o){var u=hD[sD(t._brushType,a)];o.__brushOption.range=u.getCreatingRange(iD(t,o,t._track)),i&&(zA(t,o),u.updateCommon(t,o)),BA(t,o),r={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&HA(t,e,n)&&WA(t)&&(r={isEnd:i,removeOnClick:!0});return r}function sD(t,e){return"auto"===t?e.defaultBrushType:t}var lD={mousedown:function(t){if(this._dragging)uD(this,t);else if(!t.target||!t.target.draggable){rD(t);var e=this.group.transformCoordToLocal(t.offsetX,t.offsetY);this._creatingCover=null,(this._creatingPanel=HA(this,t,e))&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(t){var e=t.offsetX,n=t.offsetY,i=this.group.transformCoordToLocal(e,n);if(function(t,e,n){if(t._brushType&&!function(t,e,n){var i=t._zr;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}(t,e.offsetX,e.offsetY)){var i=t._zr,r=t._covers,o=HA(t,e,n);if(!t._dragging)for(var a=0;a=0)&&t(r,i._targetInfoList)}))}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,(function(t,e,n){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var i=SD[t.brushType](0,n,e);t.__rangeOffset={offset:CD[t.brushType](i.values,t.range,[1,1]),xyMinMax:i.xyMinMax}}})),t},t.prototype.matchOutputRanges=function(t,e,n){ct(t,(function(t){var i=this.findTargetInfo(t,e);i&&!0!==i&&ct(i.coordSyses,(function(i){var r=SD[t.brushType](1,i,t.range,!0);n(t,r.values,i,e)}))}),this)},t.prototype.setInputRanges=function(t,e){ct(t,(function(t){var n,i,r,o,a,s=this.findTargetInfo(t,e);if(t.range=t.range||[],s&&!0!==s){t.panelId=s.panelId;var l=SD[t.brushType](0,s.coordSys,t.coordRange),u=t.__rangeOffset;t.range=u?CD[t.brushType](l.values,u.offset,(n=l.xyMinMax,i=u.xyMinMax,r=AD(n),o=AD(i),a=[r[0]/o[0],r[1]/o[1]],isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a)):l.values}}),this)},t.prototype.makePanelOpts=function(t,e){return dt(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:e?e(n):null,clipPath:fD(i),isTargetByCursor:gD(i,t,n.coordSysModel),getLinearBrushOtherExtent:pD(i)}}))},t.prototype.controlSeries=function(t,e,n){var i=this.findTargetInfo(t,n);return!0===i||i&&st(i.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var n=this._targetInfoList,i=xD(e,t),r=0;rt[1]&&t.reverse(),t}function xD(t,e){return Na(t,e,{includeMainTypes:vD})}var wD={grid:function(t,e){var n=t.xAxisModels,i=t.yAxisModels,r=t.gridModels,o=jt(),a={},s={};(n||i||r)&&(ct(n,(function(t){var e=t.axis.grid.model;o.set(e.id,e),a[e.id]=!0})),ct(i,(function(t){var e=t.axis.grid.model;o.set(e.id,e),s[e.id]=!0})),ct(r,(function(t){o.set(t.id,t),a[t.id]=!0,s[t.id]=!0})),o.each((function(t){var r=t.coordinateSystem,o=[];ct(r.getCartesians(),(function(t,e){(st(n,t.getAxis("x").model)>=0||st(i,t.getAxis("y").model)>=0)&&o.push(t)})),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:o[0],coordSyses:o,getPanelRect:TD.grid,xAxisDeclared:a[t.id],yAxisDeclared:s[t.id]})})))},geo:function(t,e){ct(t.geoModels,(function(t){var n=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:n,coordSyses:[n],getPanelRect:TD.geo})}))}},bD=[function(t,e){var n=t.xAxisModel,i=t.yAxisModel,r=t.gridModel;return!r&&n&&(r=n.axis.grid.model),!r&&i&&(r=i.axis.grid.model),r&&r===e.gridModel},function(t,e){var n=t.geoModel;return n&&n===e.geoModel}],TD={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(vm(t)),e}},SD={lineX:_t(MD,0),lineY:_t(MD,1),rect:function(t,e,n,i){var r=t?e.pointToData([n[0][0],n[1][0]],i):e.dataToPoint([n[0][0],n[1][0]],i),o=t?e.pointToData([n[0][1],n[1][1]],i):e.dataToPoint([n[0][1],n[1][1]],i),a=[yD([r[0],o[0]]),yD([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,n,i){var r=[[1/0,-1/0],[1/0,-1/0]];return{values:dt(n,(function(n){var o=t?e.pointToData(n,i):e.dataToPoint(n,i);return r[0][0]=Math.min(r[0][0],o[0]),r[1][0]=Math.min(r[1][0],o[1]),r[0][1]=Math.max(r[0][1],o[0]),r[1][1]=Math.max(r[1][1],o[1]),o})),xyMinMax:r}}};function MD(t,e,n,i){var r=n.getAxis(["x","y"][t]),o=yD(dt([0,1],(function(t){return e?r.coordToData(r.toLocalCoord(i[t]),!0):r.toGlobalCoord(r.dataToCoord(i[t]))}))),a=[];return a[t]=o,a[1-t]=[NaN,NaN],{values:o,xyMinMax:a}}var CD={lineX:_t(LD,0),lineY:_t(LD,1),rect:function(t,e,n){return[[t[0][0]-n[0]*e[0][0],t[0][1]-n[0]*e[0][1]],[t[1][0]-n[1]*e[1][0],t[1][1]-n[1]*e[1][1]]]},polygon:function(t,e,n){return dt(t,(function(t,i){return[t[0]-n[0]*e[i][0],t[1]-n[1]*e[i][1]]}))}};function LD(t,e,n,i){return[e[0]-i[t]*n[0],e[1]-i[t]*n[1]]}function AD(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}const DD=_D;var ID,PD,ED=ct,OD=ya+"toolbox-dataZoom_",ND=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){this._brushController||(this._brushController=new dD(n.getZr()),this._brushController.on("brush",vt(this._onBrush,this)).mount()),function(t,e,n,i,r){var o=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(o="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new DD(kD(t),e,{include:["grid"]}),s=a.makePanelOpts(r,(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"}));n._brushController.setPanels(s).enableBrush(!(!o||!s.length)&&{brushType:"auto",brushStyle:t.getModel("brushStyle").getItemStyle()})}(t,e,this,i,n),function(t,e){t.setIconStatus("back",function(t){return TA(t).length}(e)>1?"emphasis":"normal")}(t,e)},e.prototype.onclick=function(t,e,n){RD[n].call(this)},e.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var e=t.areas;if(t.isEnd&&e.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new DD(kD(this.model),i,{include:["grid"]}).matchOutputRanges(e,i,(function(t,e,n){if("cartesian2d"===n.type){var i=t.brushType;"rect"===i?(r("x",n,e[0]),r("y",n,e[1])):r({lineX:"x",lineY:"y"}[i],n,e)}})),function(t,e){var n=TA(t);wA(e,(function(e,i){for(var r=n.length-1;r>=0&&!n[r][i];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(o){var a=o.getPercentRange();n[0][i]={dataZoomId:i,start:a[0],end:a[1]}}}})),n.push(e)}(i,n),this._dispatchZoomAction(n)}function r(t,e,r){var o=e.getAxis(t),a=o.model,s=function(t,e,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},(function(n){n.getAxisModel(t,e.componentIndex)&&(i=n)})),i}(t,a,i),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(r=HL(0,r.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(n[s.id]={dataZoomId:s.id,startValue:r[0],endValue:r[1]})}},e.prototype._dispatchZoomAction=function(t){var e=[];ED(t,(function(t,n){e.push(et(t))})),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},e.getDefaultOption=function(t){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},e}(QL),RD={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(function(t){var e=TA(t),n=e[e.length-1];e.length>1&&e.pop();var i={};return wA(n,(function(t,n){for(var r=e.length-1;r>=0;r--)if(t=e[r][n]){i[n]=t;break}})),i}(this.ecModel))}};function kD(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}ID="dataZoom",PD=function(t){var e=t.getComponent("toolbox",0),n=["feature","dataZoom"];if(e&&null!=e.get(n)){var i=e.getModel(n),r=[],o=Na(t,kD(i));return ED(o.xAxisModels,(function(t){return a(t,"xAxis","xAxisIndex")})),ED(o.yAxisModels,(function(t){return a(t,"yAxis","yAxisIndex")})),r}function a(t,e,n){var o=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:OD+e+o};a[n]=o,r.push(a)}},zt(null==ad.get(ID)&&PD),ad.set(ID,PD);const zD=ND;const BD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),this._updateSelector(e)},e.prototype._updateSelector=function(t){var e=t.selector,n=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),yt(e)&&ct(e,(function(t,i){wt(t)&&(t={type:t}),e[i]=nt(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(n,t.type))}))},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,n=0;n=0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Gc);var FD=_t,VD=ct,GD=Eo,HD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.newlineDisabled=!1,n}return I(e,t),e.prototype.init=function(){this.group.add(this._contentGroup=new GD),this.group.add(this._selectorGroup=new GD),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),c=Oc(l,u,h),d=this.layoutInner(t,r,c,i,a,s),f=Oc(ot({width:d.width,height:d.height},l),u,h);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=rA(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=jt(),u=e.get("selectedMode"),h=[];n.eachRawSeries((function(t){!t.get("legendHoverLink")&&h.push(t.id)})),VD(e.getData(),(function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new GD;return c.newline=!0,void s.add(c)}var d=n.getSeriesByName(a)[0];if(!l.get(a)){if(d){var f=d.getData(),p=f.getVisual("legendLineStyle")||{},g=f.getVisual("legendIcon"),m=f.getVisual("style"),v=this._createItem(d,a,o,r,e,t,p,m,g,u,i);v.on("click",FD(UD,a,null,i,h)).on("mouseover",FD(jD,d.name,null,i,h)).on("mouseout",FD(ZD,d.name,null,i,h)),n.ssr&&v.eachChild((function(t){var e=nu(t);e.seriesIndex=d.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}else n.eachRawSeries((function(s){if(!l.get(a)&&s.legendVisualProvider){var c=s.legendVisualProvider;if(!c.containName(a))return;var d=c.indexOfName(a),f=c.getItemVisual(d,"style"),p=c.getItemVisual(d,"legendIcon"),g=Ri(f.fill);g&&0===g[3]&&(g[3]=.2,f=rt(rt({},f),{fill:ji(g,"rgba")}));var m=this._createItem(s,a,o,r,e,t,{},f,p,u,i);m.on("click",FD(UD,null,a,i,h)).on("mouseover",FD(jD,null,a,i,h)).on("mouseout",FD(ZD,null,a,i,h)),n.ssr&&m.eachChild((function(t){var e=nu(t);e.seriesIndex=s.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}}),this);0}}),this),r&&this._createSelector(r,e,i,o,a)},e.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();VD(t,(function(t){var i=t.type,r=new eu({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect",legendId:e.id})}});o.add(r),ah(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),Hu(r)}))},e.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c=t.visualDrawType,d=r.get("itemWidth"),f=r.get("itemHeight"),p=r.isSelected(e),g=i.get("symbolRotate"),m=i.get("symbolKeepAspect"),v=i.get("icon"),_=function(t,e,n,i,r,o,a){function s(t,e){"auto"===t.lineWidth&&(t.lineWidth=e.lineWidth>0?2:0),VD(t,(function(n,i){"inherit"===t[i]&&(t[i]=e[i])}))}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?b_(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]);"inherit"===u.stroke&&(u.stroke=i[h]);"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity);s(u,i);var d=e.getModel("lineStyle"),f=d.getLineStyle();if(s(f,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===f.stroke&&(f.stroke=i.fill),!o){var p=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===p?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),f.stroke=d.get("inactiveColor"),f.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:f}}(l=v||l||"roundRect",i,a,s,c,p,h),y=new GD,x=i.getModel("textStyle");if(!xt(t.getLegendIcon)||v&&"inherit"!==v){var w="inherit"===v&&t.getData().getVisual("symbol")?"inherit"===g?t.getData().getVisual("symbolRotate"):g:0;y.add(function(t){var e=t.icon||"roundRect",n=jv(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);n.setStyle(t.itemStyle),n.rotation=(t.iconRotate||0)*Math.PI/180,n.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:d,itemHeight:f,icon:l,iconRotate:w,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}))}else y.add(t.getLegendIcon({itemWidth:d,itemHeight:f,icon:l,iconRotate:g,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}));var b="left"===o?d+5:-5,T=o,S=r.get("formatter"),M=e;wt(S)&&S?M=S.replace("{name}",null!=e?e:""):xt(S)&&(M=S(e));var C=p?x.getTextColor():i.get("inactiveColor");y.add(new eu({style:lh(x,{text:M,x:b,y:f/2,fill:C,align:T,verticalAlign:"middle"},{inheritColor:C})}));var L=new Fl({shape:y.getBoundingRect(),style:{fill:"transparent"}}),A=i.getModel("tooltip");return A.get("show")&&Am({el:L,componentModel:r,itemName:e,itemTooltipOption:A.option}),y.add(L),y.eachChild((function(t){t.silent=!0})),L.silent=!u,this.getContentGroup().add(y),Hu(y),y.__legendDataIndex=n,y},e.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();Ec(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){Ec("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),f=t.getOrient().index,p=0===f?"width":"height",g=0===f?"height":"width",m=0===f?"y":"x";"end"===o?c[f]+=l[p]+d:u[f]+=h[p]+d,c[1-f]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[p]=l[p]+d+h[p],v[g]=Math.max(l[g],h[g]),v[m]=Math.min(0,h[m]+c[1-f]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Dp);function UD(t,e,n,i){ZD(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),jD(t,e,n,i)}function WD(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;in[r],p=[-c.x,-c.y];e||(p[i]=l[s]);var g=[0,0],m=[-d.x,-d.y],v=Ot(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[i]+=n[r]-d[r]:g[i]+=d[r]+v);m[1-i]+=c[o]/2-d[o]/2,l.setPosition(p),u.setPosition(g),h.setPosition(m);var _={x:0,y:0};if(_[r]=f?n[r]:c[r],_[o]=Math.max(c[o],d[o]),_[a]=Math.min(0,d[a]+m[1-i]),u.__rectSize=n[r],f){var y={x:0,y:0};y[r]=Math.max(n[r]-d[r]-v,0),y[o]=_[o],u.setClipPath(new Fl({shape:y})),u.__rectSize=y[r]}else h.eachChild((function(t){t.attr({invisible:!0,silent:!0})}));var x=this._getPageInfo(t);return null!=x.pageIndex&&Ju(l,{x:x.contentPosition[0],y:x.contentPosition[1]},f?t:null),this._updatePageInfoView(t,x),_},e.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},e.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;ct(["pagePrev","pageNext"],(function(i){var r=null!=e[i+"DataIndex"],o=n.childOfName(i);o&&(o.setStyle("fill",r?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")}));var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",wt(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},e.prototype._getPageInfo=function(t){var e=t.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,r=t.getOrient().index,o=eI[r],a=nI[r],s=this._findTargetItemIndex(e),l=n.children(),u=l[s],h=l.length,c=h?1:0,d={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!u)return d;var f=_(u);d.contentPosition[r]=-f.s;for(var p=s+1,g=f,m=f,v=null;p<=h;++p)(!(v=_(l[p]))&&m.e>g.s+i||v&&!y(v,g.s))&&(g=m.i>g.i?m:v)&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=g.i),++d.pageCount),m=v;for(p=s-1,g=f,m=f,v=null;p>=-1;--p)(v=_(l[p]))&&y(m,v.s)||!(g.i=e&&t.s<=e+i}},e.prototype._findTargetItemIndex=function(t){return this._showController?(this.getContentGroup().eachChild((function(i,r){var o=i.__legendDataIndex;null==n&&null!=o&&(n=r),o===t&&(e=r)})),null!=e?e:n):0;var e,n},e.type="legend.scroll",e}(XD);const rI=iI;function oI(t){Jw(JD),t.registerComponentModel(QD),t.registerComponentView(rI),function(t){t.registerAction("legendScroll","legendscroll",(function(t,e){var n=t.scrollDataIndex;null!=n&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},(function(t){t.setScrollDataIndex(n)}))}))}(t)}function aI(t,e){var n;return ct(e,(function(e){null!=t[e]&&"auto"!==t[e]&&(n=!0)})),n}var sI=["transition","enterFrom","leaveTo"],lI=sI.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function uI(t,e,n){if(n&&(!t[n]&&e[n]&&(t[n]={}),t=t[n],e=e[n]),t&&e)for(var i=n?sI:lI,r=0;r0&&(a.during=s?vt(bI,{el:e,userDuring:s}):null,a.setToFinal=!0,a.scope=t),rt(a,n[o]),a}function vI(t,e,n,i){var r=(i=i||{}).dataIndex,o=i.isInit,a=i.clearStyle,s=n.isAnimationEnabled(),l=gI(t),u=e.style;l.userDuring=e.during;var h={},c={};if(function(t,e,n){for(var i=0;i=0)){var c=t.getAnimationStyleProps(),d=c?c.style:null;if(d){!r&&(r=i.style={});var f=mt(n);for(u=0;u0&&t.animateFrom(d,f)}else!function(t,e,n,i,r){if(r){var o=mI("update",t,e,i,n);o.duration>0&&t.animateFrom(r,o)}}(t,e,r||0,n,h);_I(t,e),u?t.dirty():t.markRedraw()}function _I(t,e){for(var n=gI(t).leaveToProps,i=0;i=0){!o&&(o=i[t]={});var d=mt(a);for(h=0;h=0;l--){var d,f,p;if(p=null!=(f=Aa((d=n[l]).id,null))?r.get(f):null){var g=p.parent,m=(c=II(g),{}),v=Nc(p,d,g===i?{width:o,height:a}:{width:c.width,height:c.height},null,{hv:d.hv,boundingMode:d.bounding},m);if(!II(p).isNew&&v){for(var _=d.transition,y={},x=0;x=0)?y[w]=b:p[w]=b}Ju(p,y,t,0)}else p.attr(m)}}},e.prototype._clear=function(){var t=this,e=this._elMap;e.each((function(n){NI(n,II(n).option,e,t._lastGraphicModel)})),this._elMap=jt()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(Dp);function EI(t){var e=new(Yt(DI,t)?DI[t]:lm(t))({});return II(e).type=t,e}function OI(t,e,n,i){var r=EI(n);return e.add(r),i.set(t,r),II(r).id=t,II(r).isNew=!0,r}function NI(t,e,n,i){t&&t.parent&&("group"===t.type&&t.traverse((function(t){NI(t,e,n,i)})),function(t,e,n,i){if(t){var r=t.parent,o=gI(t).leaveToProps;if(o){var a=mI("update",t,e,n,0);a.done=function(){r.remove(t),i&&i()},t.animateTo(o,a)}else r.remove(t),i&&i()}}(t,e,i),n.removeKey(II(t).id))}function RI(t,e,n,i){t.isGroup||ct([["cursor",Ss.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];Yt(e,i)?t[i]=Ot(e[i],n[1]):null==t[i]&&(t[i]=n[1])})),ct(mt(e),(function(n){if(0===n.indexOf("on")){var i=e[n];t[n]=xt(i)?i:null}})),Yt(e,"draggable")&&(t.draggable=e.draggable),null!=e.name&&(t.name=e.name),null!=e.id&&(t.id=e.id)}var kI=Math.sin,zI=Math.cos,BI=Math.PI,FI=2*Math.PI,VI=180/BI,GI=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){this._add("C",t,e,n,i,r,o)},t.prototype.quadraticCurveTo=function(t,e,n,i){this._add("Q",t,e,n,i)},t.prototype.arc=function(t,e,n,i,r,o){this.ellipse(t,e,n,n,0,i,r,o)},t.prototype.ellipse=function(t,e,n,i,r,o,a,s){var l=a-o,u=!s,h=Math.abs(l),c=Qi(h-FI)||(u?l>=FI:-l>=FI),d=l>0?l%FI:l%FI+FI,f=!1;f=!!c||!Qi(h)&&d>=BI==!!u;var p=t+n*zI(o),g=e+i*kI(o);this._start&&this._add("M",p,g);var m=Math.round(r*VI);if(c){var v=1/this._p,_=(u?1:-1)*(FI-v);this._add("A",n,i,m,1,+u,t+n*zI(o+_),e+i*kI(o+_)),v>.01&&this._add("A",n,i,m,0,+u,p,g)}else{var y=t+n*zI(a),x=e+i*kI(a);this._add("A",n,i,m,+f,+u,y,x)}},t.prototype.rect=function(t,e,n,i){this._add("M",t,e),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,n,i,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"}(r,o)+("style"!==r?ze(a):a||"")+(i?""+n+dt(i,(function(e){return t(e)})).join(n)+n:"")+("")}(t)}function tP(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function eP(t,e,n,i){return $I("svg","root",{width:t,height:e,xmlns:qI,"xmlns:xlink":YI,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},n)}var nP=0;function iP(){return nP++}var rP={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},oP="transform-origin";function aP(t,e,n){var i=rt({},t.shape);rt(i,e),t.buildPath(n,i);var r=new HI;return r.reset(ur(t)),n.rebuildPath(r,1),r.generateStr(),r.getStr()}function sP(t,e){var n=e.originX,i=e.originY;(n||i)&&(t[oP]=n+"px "+i+"px")}var lP={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function uP(t,e){var n=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[n]=t,n}function hP(t){return wt(t)?rP[t]?"cubic-bezier("+rP[t]+")":vi(t)?t:"":""}function cP(t,e,n,i){var r=t.animators,o=r.length,a=[];if(t instanceof Fg){var s=function(t,e,n){var i,r,o=t.shape.paths,a={};if(ct(o,(function(t){var e=tP(n.zrId);e.animation=!0,cP(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=mt(o),u=l.length;if(u){var h=o[r=l[u-1]];for(var c in h){var d=h[c];a[c]=a[c]||{d:""},a[c].d+=d.d||""}for(var f in s){var p=s[f].animation;p.indexOf(r)>=0&&(i=p)}}})),i){e.d=!1;var s=uP(a,n);return i.replace(r,s)}}(t,e,n);if(s)a.push(s);else if(!o)return}else if(!o)return;for(var l={},u=0;u0})).length)return uP(h,n)+" "+r[0]+" both"}for(var m in l){(s=g(l[m]))&&a.push(s)}if(a.length){var v=n.zrId+"-cls-"+iP();n.cssNodes["."+v]={animation:a.join(",")},e.class=v}}function dP(t,e,n,i){var r=JSON.stringify(t),o=n.cssStyleCache[r];o||(o=n.zrId+"-cls-"+iP(),n.cssStyleCache[r]=o,n.cssNodes["."+o+(i?":hover":"")]=t),e.class=e.class?e.class+" "+o:o}var fP=Math.round;function pP(t){return t&&wt(t.src)}function gP(t){return t&&xt(t.toDataURL)}function mP(t,e,n,i){XI((function(r,o){var a="fill"===r||"stroke"===r;a&&sr(o)?LP(e,t,r,i):a&&rr(o)?AP(n,t,r,i):t[r]=o,a&&i.ssr&&"none"===o&&(t["pointer-events"]="visible")}),e,n,!1),function(t,e,n){var i=t.style;if(function(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}(i)){var r=function(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(t),o=n.shadowCache,a=o[r];if(!a){var s=t.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var h=i.shadowOffsetX||0,c=i.shadowOffsetY||0,d=i.shadowBlur,f=Ji(i.shadowColor),p=f.opacity,g=f.color,m=d/2/l+" "+d/2/u;a=n.zrId+"-s"+n.shadowIdx++,n.defs[a]=$I("filter",a,{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},[$I("feDropShadow","",{dx:h/l,dy:c/u,stdDeviation:m,"flood-color":g,"flood-opacity":p})]),o[r]=a}e.filter=lr(a)}}(n,t,i)}function vP(t,e){var n=Ho(e);n&&(n.each((function(e,n){null!=e&&(t[(KI+n).toLowerCase()]=e+"")})),e.isSilent()&&(t[KI+"silent"]="true"))}function _P(t){return Qi(t[0]-1)&&Qi(t[1])&&Qi(t[2])&&Qi(t[3]-1)}function yP(t,e,n){if(e&&(!function(t){return Qi(t[4])&&Qi(t[5])}(e)||!_P(e))){var i=n?10:1e4;t.transform=_P(e)?"translate("+fP(e[4]*i)/i+" "+fP(e[5]*i)/i+")":function(t){return"matrix("+tr(t[0])+","+tr(t[1])+","+tr(t[2])+","+tr(t[3])+","+er(t[4])+","+er(t[5])+")"}(e)}}function xP(t,e,n){for(var i=t.points,r=[],o=0;o=0&&a||o;s&&(r=Yi(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&t.transform?t.transform[0]:1);var u={cursor:"pointer"};r&&(u.fill=r),i.stroke&&(u.stroke=i.stroke),l&&(u["stroke-width"]=l),dP(u,e,n,!0)}}(t,o,e),$I(s,t.id+"",o)}function CP(t,e){return t instanceof Sl?MP(t,e):t instanceof Pl?function(t,e){var n=t.style,i=n.image;if(i&&!wt(i)&&(pP(i)?i=i.src:gP(i)&&(i=i.toDataURL())),i){var r=n.x||0,o=n.y||0,a={href:i,width:n.width,height:n.height};return r&&(a.x=r),o&&(a.y=o),yP(a,t.transform),mP(a,n,t,e),vP(a,t),e.animation&&cP(t,a,e),$I("image",t.id+"",a)}}(t,e):t instanceof Ll?function(t,e){var n=t.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var r=n.font||R,o=n.x||0,a=function(t,e,n){return"top"===n?t+=e/2:"bottom"===n&&(t-=e/2),t}(n.y||0,vo(r),n.textBaseline),s={"dominant-baseline":"central","text-anchor":nr[n.textAlign]||n.textAlign};if(ql(n)){var l="",u=n.fontStyle,h=Zl(n.fontSize);if(!parseFloat(h))return;var c=n.fontFamily||N,d=n.fontWeight;l+="font-size:"+h+";font-family:"+c+";",u&&"normal"!==u&&(l+="font-style:"+u+";"),d&&"normal"!==d&&(l+="font-weight:"+d+";"),s.style=l}else s.style="font: "+r;return i.match(/\s/)&&(s["xml:space"]="preserve"),o&&(s.x=o),a&&(s.y=a),yP(s,t.transform),mP(s,n,t,e),vP(s,t),e.animation&&cP(t,s,e),$I("text",t.id+"",s,void 0,i)}}(t,e):void 0}function LP(t,e,n,i){var r,o=t[n],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(or(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!ar(o))return void 0;r="radialGradient",a.cx=Ot(o.x,.5),a.cy=Ot(o.y,.5),a.r=Ot(o.r,.5)}for(var s=o.colorStops,l=[],u=0,h=s.length;ul?UP(t,null==n[c+1]?null:n[c+1].elm,n,s,c):WP(t,e,a,l))}(n,i,r):FP(r)?(FP(t.text)&&kP(n,""),UP(n,null,r,0,r.length-1)):FP(i)?WP(n,i,0,i.length-1):FP(t.text)&&kP(n,""):t.text!==e.text&&(FP(i)&&WP(n,i,0,i.length-1),kP(n,e.text)))}var XP=0,qP=function(){function t(t,e,n){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=n=rt({},n),this.root=t,this._id="zr"+XP++,this._oldVNode=eP(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=JI("svg");jP(null,this._oldVNode),i.appendChild(r),t.appendChild(i)}this.resize(n.width,n.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(GP(t,e))ZP(t,e);else{var n=t.elm,i=NP(n);HP(e),null!==i&&(PP(i,e.elm,RP(n)),WP(i,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return CP(t,tP(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),n=this._width,i=this._height,r=tP(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress,r.emphasis=t.emphasis,r.ssr=this._opts.ssr;var o=[],a=this._bgVNode=function(t,e,n,i){var r;if(n&&"none"!==n)if(r=$I("rect","bg",{width:t,height:e,x:"0",y:"0"}),sr(n))LP({fill:n},r.attrs,"fill",i);else if(rr(n))AP({style:{fill:n},dirty:Kt,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",i);else{var o=Ji(n),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}(n,i,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=$I("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=dt(mt(r.defs),(function(t){return r.defs[t]}));if(l.length&&o.push($I("defs","defs",{},l)),t.animation){var u=function(t,e,n){var i=(n=n||{}).newline?"\n":"",r=" {"+i,o=i+"}",a=dt(mt(t),(function(e){return e+r+dt(mt(t[e]),(function(n){return n+":"+t[e][n]+";"})).join(i)+o})).join(i),s=dt(mt(e),(function(t){return"@keyframes "+t+r+dt(mt(e[t]),(function(n){return n+r+dt(mt(e[t][n]),(function(i){var r=e[t][n][i];return"d"===i&&(r='path("'+r+'")'),i+":"+r+";"})).join(i)+o})).join(i)+o})).join(i);return a||s?[""].join(i):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=$I("style","stl",{},[],u);o.push(h)}}return eP(n,i,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},QI(this.renderToVNode({animation:Ot(t.cssAnimation,!0),emphasis:Ot(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Ot(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,n){for(var i,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[p]!==r[p]);p--);for(var g=f-1;g>p;g--)i=a[--s-1];for(var m=p+1;m=a)}}for(var h=this.__startIndex;h15)break}n.prevElClipPaths&&c.restore()};if(f)if(0===f.length)s=l.__endIndex;else for(var x=d.dpr,w=0;w0&&t>i[0]){for(s=0;st);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?eE:0),this._needsManuallyCompositing),u.__builtin__||tt("ZLevel "+l+" has been used by unkown layer "+u.id),u!==o&&(u.__used=!0,u.__startIndex!==r&&(u.__dirty=!0),u.__startIndex=r,u.incremental?u.__drawIndex=-1:u.__drawIndex=r,e(r),o=u),s.__dirty&kn&&!s.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=r))}e(r),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,ct(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?nt(n[t],e,!0):n[t]=e;for(var i=0;i=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}};var vO,_O={supportWebGL:function(){if(null==vO)try{var t=document.createElement("canvas");if(!(t.getContext("webgl")||t.getContext("experimental-webgl")))throw new Error}catch(t){vO=!1}return vO}};_O.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,_O.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,_O.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,_O.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,_O.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,_O.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,_O.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var yO={};"undefined"!=typeof window?yO=window:void 0!==n.g&&(yO=n.g),_O.requestAnimationFrame=yO.requestAnimationFrame||yO.msRequestAnimationFrame||yO.mozRequestAnimationFrame||yO.webkitRequestAnimationFrame||function(t){setTimeout(t,16)},_O.createCanvas=function(){return document.createElement("canvas")},_O.createImage=function(){return new yO.Image},_O.request={get:mO.get},_O.addEventListener=function(t,e,n,i){t.addEventListener(e,n,i)},_O.removeEventListener=function(t,e,n){t.removeEventListener(e,n)};const xO=_O;var wO=function(){this.head=null,this.tail=null,this._length=0};wO.prototype.insert=function(t){var e=new wO.Entry(t);return this.insertEntry(e),e},wO.prototype.insertAt=function(t,e){if(!(t<0)){for(var n=this.head,i=0;n&&i!=t;)n=n.next,i++;if(n){var r=new wO.Entry(e),o=n.prev;o?(o.next=r,r.prev=o):this.head=r,r.next=n,n.prev=r}else this.insert(e)}},wO.prototype.insertBeforeEntry=function(t,e){var n=new wO.Entry(t),i=e.prev;i?(i.next=n,n.prev=i):this.head=n,n.next=e,e.prev=n,this._length++},wO.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++},wO.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._length--},wO.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e?(this.remove(e),e.value):void 0}},wO.prototype.getHead=function(){if(this.head)return this.head.value},wO.prototype.getTail=function(){if(this.tail)return this.tail.value},wO.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e.value}},wO.prototype.indexOf=function(t){for(var e=this.head,n=0;e;){if(e.value===t)return n;e=e.next,n++}},wO.prototype.length=function(){return this._length},wO.prototype.isEmpty=function(){return 0===this._length},wO.prototype.forEach=function(t,e){for(var n=this.head,i=0,r=void 0!==e;n;)r?t.call(e,n.value,i):t(n.value,i),n=n.next,i++},wO.prototype.clear=function(){this.tail=this.head=null,this._length=0},wO.Entry=function(t){this.value=t,this.next=null,this.prev=null};const bO=wO;var TO=function(t){this._list=new bO,this._map={},this._maxSize=t||10};TO.prototype.setMaxSize=function(t){this._maxSize=t},TO.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var n=this._list.length();if(n>=this._maxSize&&n>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var r=this._list.insert(e);r.key=t,this._map[t]=r}},TO.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value},TO.prototype.remove=function(t){var e=this._map[t];void 0!==e&&(delete this._map[t],this._list.remove(e))},TO.prototype.clear=function(){this._list.clear(),this._map={}};const SO=TO;var MO={},CO={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function LO(t){return(t=Math.round(t))<0?0:t>255?255:t}function AO(t){return t<0?0:t>1?1:t}function DO(t){return t.length&&"%"===t.charAt(t.length-1)?LO(parseFloat(t)/100*255):LO(parseInt(t,10))}function IO(t){return t.length&&"%"===t.charAt(t.length-1)?AO(parseFloat(t)/100):AO(parseFloat(t))}function PO(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function EO(t,e,n){return t+(e-t)*n}function OO(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function NO(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var RO=new SO(20),kO=null;function zO(t,e){kO&&NO(kO,e),kO=RO.put(t,kO||e.slice())}function BO(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=IO(t[1]),r=IO(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return OO(e=e||[],LO(255*PO(a,o,n+1/3)),LO(255*PO(a,o,n)),LO(255*PO(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}MO.parse=function(t,e){if(t){e=e||[];var n=RO.get(t);if(n)return NO(e,n);var i,r=(t+="").replace(/ /g,"").toLowerCase();if(r in CO)return NO(e,CO[r]),zO(t,e),e;if("#"===r.charAt(0))return 4===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=4095?(OO(e,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),zO(t,e),e):void OO(e,0,0,0,1):7===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=16777215?(OO(e,(16711680&i)>>16,(65280&i)>>8,255&i,1),zO(t,e),e):void OO(e,0,0,0,1):void 0;var o=r.indexOf("("),a=r.indexOf(")");if(-1!==o&&a+1===r.length){var s=r.substr(0,o),l=r.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return void OO(e,0,0,0,1);u=IO(l.pop());case"rgb":return 3!==l.length?void OO(e,0,0,0,1):(OO(e,DO(l[0]),DO(l[1]),DO(l[2]),u),zO(t,e),e);case"hsla":return 4!==l.length?void OO(e,0,0,0,1):(l[3]=IO(l[3]),BO(l,e),zO(t,e),e);case"hsl":return 3!==l.length?void OO(e,0,0,0,1):(BO(l,e),zO(t,e),e);default:return}}OO(e,0,0,0,1)}},MO.parseToFloat=function(t,e){if(e=MO.parse(t,e))return e[0]/=255,e[1]/=255,e[2]/=255,e},MO.lift=function(t,e){var n=MO.parse(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0;return MO.stringify(n,4===n.length?"rgba":"rgb")}},MO.toHex=function(t){var e=MO.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)},MO.fastLerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=LO(EO(a[0],s[0],l)),n[1]=LO(EO(a[1],s[1],l)),n[2]=LO(EO(a[2],s[2],l)),n[3]=AO(EO(a[3],s[3],l)),n}},MO.fastMapToColor=MO.fastLerp,MO.lerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=MO.parse(e[r]),s=MO.parse(e[o]),l=i-r,u=MO.stringify([LO(EO(a[0],s[0],l)),LO(EO(a[1],s[1],l)),LO(EO(a[2],s[2],l)),AO(EO(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}},MO.mapToColor=MO.lerp,MO.modifyHSL=function(t,e,n,i){if(t=MO.parse(t))return t=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(t),null!=e&&(t[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(t[1]=IO(n)),null!=i&&(t[2]=IO(i)),MO.stringify(BO(t),"rgba");var r},MO.modifyAlpha=function(t,e){if((t=MO.parse(t))&&null!=e)return t[3]=AO(e),MO.stringify(t,"rgba")},MO.stringify=function(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}};var FO=MO.parseToFloat,VO={};function GO(t){var e=Object.keys(t);e.sort();for(var n=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if("object"==typeof t)for(var n in t){var i=t[n];this.setUniform(n,i)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var n=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(t){var e=this.uniforms[t].type;return"t"===e||"tv"===e}),this);var r=this.vertexDefines,o=this.fragmentDefines;if(this.vertexDefines=gE.clone(t.vertexDefines),this.fragmentDefines=gE.clone(t.fragmentDefines),e){for(var a in n)i[a]&&(i[a].value=n[a].value);gE.defaults(this.vertexDefines,r),gE.defaults(this.fragmentDefines,o)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:!(!e||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=gE.clone(this.vertexDefines),t.fragmentDefines=gE.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,n){var i=this.vertexDefines,r=this.fragmentDefines;"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<3&&(n=e,e=t,t="both"),n=null!=n?n:null,"vertex"!==t&&"both"!==t||i[e]!==n&&(i[e]=n,this._programKey=""),"fragment"!==t&&"both"!==t||r[e]!==n&&(r[e]=n,"both"!==t&&(this._programKey=""))},undefine:function(t,e){"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<2&&(e=t,t="both"),"vertex"!==t&&"both"!==t||this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),"fragment"!==t&&"both"!==t||this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],"both"!==t&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return void 0!==this.vertexDefines[e];case"fragment":return void 0!==this.fragmentDefines[e]}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t))for(var e=0;e0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},XO.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},XO.cross=function(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t},XO.lerp=function(t,e,n,i){var r=e[0],o=e[1];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t},XO.random=function(t,e){e=e||1;var n=2*GLMAT_RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},XO.transformMat2=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t},XO.transformMat2d=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},XO.transformMat3=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t},XO.transformMat4=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t},XO.forEach=(UO=XO.create(),function(t,e,n,i,r,o){var a,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,a=n;a0&&i.push("#define "+r.toUpperCase()+"_COUNT "+o)}if(n)for(var a=0;al.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+aN(d)+"\n"}o&&(c+="\n#define INSTANCING\n");var f=c+aN(e.vertexDefines,s,h),p=c+aN(e.fragmentDefines,s,h),g=f+"\n"+e.shader.vertex,m=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(t){return null!=l.getGLExtension(t)}));m.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),m.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var v,_,y=function(t){for(var e=[],n=0;n=0){if(1!==s&&4!==s){bN();break}s=2,u=[]}else if(1!==s)if(4!==s)h(c),s=0;else{var d=c;gN.indexOf(d)>=0||mN.indexOf(d)>=0||vN.indexOf(d)>=0?l[a].semantic=d:"ignore"===d||"unconfigurable"===d?l[a].ignore=!0:l[a].value="bool"===t?"true"===d:parseFloat(d)}else l[a].value="bool"===t?"true"===c:parseFloat(c),u=null;else{if(2!==s){bN();break}if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else l[a].value=new xO.Float32Array(u),u=null,s=5;else if(2===s){if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else s=5;else s=4;else{if(0!==s&&3!==s){bN();break}s=1}}return l}function SN(t,e){"object"==typeof t&&(e=t.fragment,t=t.vertex),t=wN(t),e=wN(e),this._shaderID=function(t,e){var n="vertex:"+t+"fragment:"+e;if(yN[n])return yN[n];var i=gE.genGUID();return yN[n]=i,xN[i]={vertex:t,fragment:e},i}(t,e),this._vertexCode=SN.parseImport(t),this._fragmentCode=SN.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}SN.prototype={constructor:SN,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var n=this.uniformTemplates[e];t[e]={type:n.type,value:n.value()}}return t},_parseImport:function(){this._vertexCode=SN.parseImport(this.vertex),this._fragmentCode=SN.parseImport(this.fragment)},_addSemanticUniform:function(t,e,n){if(gN.indexOf(n)>=0)this.attributeSemantics[n]={symbol:t,type:e};else if(vN.indexOf(n)>=0){var i=!1,r=n;n.match(/TRANSPOSE$/)&&(i=!0,r=n.slice(0,-9)),this.matrixSemantics[n]={symbol:t,type:e,isTranspose:i,semanticNoTranspose:r}}else mN.indexOf(n)>=0&&(this.uniformSemantics[n]={symbol:t,type:e})},_addMaterialUniform:function(t,e,n,i,r,o){o[t]={type:n,value:r?pN.array:i||pN[e],semantic:null}},_parseUniforms:function(){var t={},e=this,n="vertex";function i(t){return null!=t?function(){return t}:null}function r(r,o,a){var s=TN(o,a),l=[];for(var u in s){var h=s[u],c=h.semantic,d=u,f=dN[o],p=i(s[u].value);s[u].isArray&&(d+="["+s[u].arraySize+"]",f+="v"),l.push(d),e._uniformList.push(u),h.ignore||("sampler2D"!==o&&"samplerCube"!==o||(e.textures[u]={shaderType:n,type:o}),c?e._addSemanticUniform(u,f,c):e._addMaterialUniform(u,o,f,p,s[u].isArray,t))}return l.length>0?"uniform "+o+" "+l.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(uN,r),n="fragment",this._fragmentCode=this._fragmentCode.replace(uN,r),e.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(hN,(function(n,i,r){var o=TN(i,r),a=_N[i]||1,s=[];for(var l in o){var u=o[l].semantic;if(t[l]={type:"float",size:a,semantic:u||null},u){if(gN.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');e.attributeSemantics[u]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=t},_parseDefines:function(){var t=this,e="vertex";function n(n,i,r){var o="vertex"===e?t.vertexDefines:t.fragmentDefines;return o[i]||(o[i]="false"!==r&&("true"===r||(r?isNaN(parseFloat(r))?r.trim():parseFloat(r):null))),""}this._vertexCode=this._vertexCode.replace(cN,n),e="fragment",this._fragmentCode=this._fragmentCode.replace(cN,n)},clone:function(){var t=xN[this._shaderID];return new SN(t.vertex,t.fragment)}},Object.defineProperty&&(Object.defineProperty(SN.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(SN.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(SN.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(SN.prototype,"uniforms",{get:function(){return this._uniformList}}));var MN=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;SN.parseImport=function(t){return t=t.replace(MN,(function(t,e,n){return(t=SN.source(n))?SN.parseImport(t):(console.error('Shader chunk "'+n+'" not existed in library'),"")}))};var CN=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;SN.import=function(t){t.replace(CN,(function(t,e,n,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var r,o=n.split("."),a=SN.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var DN={create:function(){var t=new jO(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var e=new jO(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=r,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},invert:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],_=n*s-i*a,y=n*l-r*a,x=n*u-o*a,w=i*l-r*s,b=i*u-o*s,T=r*u-o*l,S=h*g-c*p,M=h*m-d*p,C=h*v-f*p,L=c*m-d*g,A=c*v-f*g,D=d*v-f*m,I=_*D-y*A+x*L+w*C-b*M+T*S;return I?(I=1/I,t[0]=(s*D-l*A+u*L)*I,t[1]=(r*A-i*D-o*L)*I,t[2]=(g*T-m*b+v*w)*I,t[3]=(d*b-c*T-f*w)*I,t[4]=(l*C-a*D-u*M)*I,t[5]=(n*D-r*C+o*M)*I,t[6]=(m*x-p*T-v*y)*I,t[7]=(h*T-d*x+f*y)*I,t[8]=(a*A-s*C+u*S)*I,t[9]=(i*C-n*A-o*S)*I,t[10]=(p*b-g*x+v*_)*I,t[11]=(c*x-h*b-f*_)*I,t[12]=(s*M-a*L-l*S)*I,t[13]=(n*L-i*M+r*S)*I,t[14]=(g*y-p*w-m*_)*I,t[15]=(h*w-c*y+d*_)*I,t):null},adjoint:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-c*(l*v-u*m)+g*(l*f-u*d),t[1]=-(i*(d*v-f*m)-c*(r*v-o*m)+g*(r*f-o*d)),t[2]=i*(l*v-u*m)-s*(r*v-o*m)+g*(r*u-o*l),t[3]=-(i*(l*f-u*d)-s*(r*f-o*d)+c*(r*u-o*l)),t[4]=-(a*(d*v-f*m)-h*(l*v-u*m)+p*(l*f-u*d)),t[5]=n*(d*v-f*m)-h*(r*v-o*m)+p*(r*f-o*d),t[6]=-(n*(l*v-u*m)-a*(r*v-o*m)+p*(r*u-o*l)),t[7]=n*(l*f-u*d)-a*(r*f-o*d)+h*(r*u-o*l),t[8]=a*(c*v-f*g)-h*(s*v-u*g)+p*(s*f-u*c),t[9]=-(n*(c*v-f*g)-h*(i*v-o*g)+p*(i*f-o*c)),t[10]=n*(s*v-u*g)-a*(i*v-o*g)+p*(i*u-o*s),t[11]=-(n*(s*f-u*c)-a*(i*f-o*c)+h*(i*u-o*s)),t[12]=-(a*(c*m-d*g)-h*(s*m-l*g)+p*(s*d-l*c)),t[13]=n*(c*m-d*g)-h*(i*m-r*g)+p*(i*d-r*c),t[14]=-(n*(s*m-l*g)-a*(i*m-r*g)+p*(i*l-r*s)),t[15]=n*(s*d-l*c)-a*(i*d-r*c)+h*(i*l-r*s),t},determinant:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(c*m-d*g)-(e*s-i*o)*(h*m-d*p)+(e*l-r*o)*(h*g-c*p)+(n*s-i*a)*(u*m-d*f)-(n*l-r*a)*(u*g-c*f)+(i*l-r*s)*(u*p-h*f)},multiply:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],_=e[15],y=n[0],x=n[1],w=n[2],b=n[3];return t[0]=y*i+x*s+w*c+b*g,t[1]=y*r+x*l+w*d+b*m,t[2]=y*o+x*u+w*f+b*v,t[3]=y*a+x*h+w*p+b*_,y=n[4],x=n[5],w=n[6],b=n[7],t[4]=y*i+x*s+w*c+b*g,t[5]=y*r+x*l+w*d+b*m,t[6]=y*o+x*u+w*f+b*v,t[7]=y*a+x*h+w*p+b*_,y=n[8],x=n[9],w=n[10],b=n[11],t[8]=y*i+x*s+w*c+b*g,t[9]=y*r+x*l+w*d+b*m,t[10]=y*o+x*u+w*f+b*v,t[11]=y*a+x*h+w*p+b*_,y=n[12],x=n[13],w=n[14],b=n[15],t[12]=y*i+x*s+w*c+b*g,t[13]=y*r+x*l+w*d+b*m,t[14]=y*o+x*u+w*f+b*v,t[15]=y*a+x*h+w*p+b*_,t},multiplyAffine:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],h=e[9],c=e[10],d=e[12],f=e[13],p=e[14],g=n[0],m=n[1],v=n[2];return t[0]=g*i+m*a+v*u,t[1]=g*r+m*s+v*h,t[2]=g*o+m*l+v*c,g=n[4],m=n[5],v=n[6],t[4]=g*i+m*a+v*u,t[5]=g*r+m*s+v*h,t[6]=g*o+m*l+v*c,g=n[8],m=n[9],v=n[10],t[8]=g*i+m*a+v*u,t[9]=g*r+m*s+v*h,t[10]=g*o+m*l+v*c,g=n[12],m=n[13],v=n[14],t[12]=g*i+m*a+v*u+d,t[13]=g*r+m*s+v*h+f,t[14]=g*o+m*l+v*c+p,t}};DN.mul=DN.multiply,DN.mulAffine=DN.multiplyAffine,DN.translate=function(t,e,n){var i,r,o,a,s,l,u,h,c,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=i*g+s*m+c*v+e[12],t[13]=r*g+l*m+d*v+e[13],t[14]=o*g+u*m+f*v+e[14],t[15]=a*g+h*m+p*v+e[15]),t},DN.scale=function(t,e,n){var i=n[0],r=n[1],o=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},DN.rotate=function(t,e,n,i){var r,o,a,s,l,u,h,c,d,f,p,g,m,v,_,y,x,w,b,T,S,M,C,L,A=i[0],D=i[1],I=i[2],P=Math.sqrt(A*A+D*D+I*I);return Math.abs(P)0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},PN.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},PN.cross=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t},PN.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t},PN.random=function(t,e){e=e||1;var n=2*ZO()*Math.PI,i=2*ZO()-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t},PN.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,t},PN.transformMat3=function(t,e,n){var i=e[0],r=e[1],o=e[2];return t[0]=i*n[0]+r*n[3]+o*n[6],t[1]=i*n[1]+r*n[4]+o*n[7],t[2]=i*n[2]+r*n[5]+o*n[8],t},PN.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},PN.rotateX=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0],o[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),o[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateY=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),o[1]=r[1],o[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateZ=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),o[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),o[2]=r[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.forEach=function(){var t=PN.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=3),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s1?0:Math.acos(r)};const EN=PN;LN.import(AN);var ON=IN.create,NN={};function RN(t){return t.material}function kN(t,e,n){return e.uniforms[n].value}function zN(t,e,n,i){return n!==i}function BN(t){return!0}function FN(){}var VN={float:jE,byte:FE,ubyte:VE,short:GE,ushort:HE};function GN(t,e,n){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=n,this.vao=null}function HN(t){var e,n;this.bind=function(t){e||((e=xO.createCanvas()).width=e.height=1,e.getContext("2d"));var i=t.gl,r=!n;r&&(n=i.createTexture()),i.bindTexture(i.TEXTURE_2D,n),r&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e)},this.unbind=function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var UN=vE.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=xO.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new xE(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(t){throw"Error creating WebGL Context "+t}this._programMgr=new lN(this),this._placeholderTexture=new HN(this)}),{resize:function(t,e){var n=this.canvas,i=this.devicePixelRatio;null!=t?(n.style&&(n.style.width=t+"px",n.style.height=e+"px"),n.width=t*i,n.height=e*i,this._width=t,this._height=e):(this._width=n.width/i,this._height=n.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,n,i,r){if("object"==typeof t){var o=t;t=o.x,e=o.y,n=o.width,i=o.height,r=o.devicePixelRatio}r=r||this.devicePixelRatio,this.gl.viewport(t*r,e*r,n*r,i*r),this.viewport={x:t,y:e,width:n,height:i,devicePixelRatio:r}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,n,i){var r=this.gl,o=this.clearColor;if(this.clearBit){r.colorMask(!0,!0,!0,!0),r.depthMask(!0);var a=this.viewport,s=!1,l=a.devicePixelRatio;(a.width!==this._width||a.height!==this._height||l&&l!==this.devicePixelRatio||a.x||a.y)&&(s=!0,r.enable(r.SCISSOR_TEST),r.scissor(a.x*l,a.y*l,a.width*l,a.height*l)),r.clearColor(o[0],o[1],o[2],o[3]),r.clear(this.clearBit),s&&r.disable(r.SCISSOR_TEST)}if(n||t.update(!1),t.updateLights(),e=e||t.getMainCamera()){e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var h=u.opaque,c=u.transparent,d=t.material;t.trigger("beforerender",this,t,e,u),i?(this.renderPreZ(h,t,e),r.depthFunc(r.LEQUAL)):r.depthFunc(r.LESS);for(var f=ON(),p=EN.create(),g=0;g0){var s=t[r-1],l=s.joints?s.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===s.material&&o.lightGroup===s.lightGroup){o.__program=s.__program;continue}}var u=this._programMgr.getProgram(o,a,e);this.validateProgram(u),o.__program=u}},renderPass:function(t,e,n){this.trigger("beforerenderpass",this,t,e,n),(n=n||{}).getMaterial=n.getMaterial||RN,n.getUniform=n.getUniform||kN,n.isMaterialChanged=n.isMaterialChanged||zN,n.beforeRender=n.beforeRender||FN,n.afterRender=n.afterRender||FN;var i=n.ifRender||BN;this.updatePrograms(t,this._sceneRendering,n),n.sortCompare&&t.sort(n.sortCompare);var r=this.viewport,o=r.devicePixelRatio,a=[r.x*o,r.y*o,r.width*o,r.height*o],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[a[2],a[3]],h=Date.now();e?(IN.copy(WN.VIEW,e.viewMatrix.array),IN.copy(WN.PROJECTION,e.projectionMatrix.array),IN.copy(WN.VIEWINVERSE,e.worldTransform.array)):(IN.identity(WN.VIEW),IN.identity(WN.PROJECTION),IN.identity(WN.VIEWINVERSE)),IN.multiply(WN.VIEWPROJECTION,WN.PROJECTION,WN.VIEW),IN.invert(WN.PROJECTIONINVERSE,WN.PROJECTION),IN.invert(WN.VIEWPROJECTIONINVERSE,WN.VIEWPROJECTION);for(var c,d,f,p,g,m,v,_,y,x,w,b,T=this.gl,S=this._sceneRendering,M=null,C=0;Cthis.getMaxJointNumber()){var o=r.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,o,n),e.setUniform(i,"1i","skinMatricesTexture",n),e.setUniform(i,"1f","skinMatricesTextureSize",o.width)}else{var a=r.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(i,"SKIN_MATRIX",a)}},_renderObject:function(t,e,n){var i=this.gl,r=t.geometry,o=t.mode;null==o&&(o=4);var a=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(!s||(a=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(t,n,a)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint")&&r.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?a.drawElementsInstancedANGLE(o,e.indicesBuffer.count,u,0,t.getInstanceCount()):i.drawElements(o,e.indicesBuffer.count,u,0)}else s?a.drawArraysInstancedANGLE(o,0,r.vertexCount,t.getInstanceCount()):i.drawArrays(o,0,r.vertexCount);if(s)for(var h=0;hn?n:t}ZN.add=function(t,e,n){return EN.add(t.array,e.array,n.array),t._dirty=!0,t},ZN.set=function(t,e,n,i){EN.set(t.array,e,n,i),t._dirty=!0},ZN.copy=function(t,e){return EN.copy(t.array,e.array),t._dirty=!0,t},ZN.cross=function(t,e,n){return EN.cross(t.array,e.array,n.array),t._dirty=!0,t},ZN.distance=ZN.dist=function(t,e){return EN.distance(t.array,e.array)},ZN.div=function(t,e,n){return EN.divide(t.array,e.array,n.array),t._dirty=!0,t},ZN.divide=ZN.div,ZN.dot=function(t,e){return EN.dot(t.array,e.array)},ZN.len=function(t){return EN.length(t.array)},ZN.lerp=function(t,e,n,i){return EN.lerp(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.min=function(t,e,n){return EN.min(t.array,e.array,n.array),t._dirty=!0,t},ZN.max=function(t,e,n){return EN.max(t.array,e.array,n.array),t._dirty=!0,t},ZN.mul=function(t,e,n){return EN.multiply(t.array,e.array,n.array),t._dirty=!0,t},ZN.multiply=ZN.mul,ZN.negate=function(t,e){return EN.negate(t.array,e.array),t._dirty=!0,t},ZN.normalize=function(t,e){return EN.normalize(t.array,e.array),t._dirty=!0,t},ZN.random=function(t,e){return EN.random(t.array,e),t._dirty=!0,t},ZN.scale=function(t,e,n){return EN.scale(t.array,e.array,n),t._dirty=!0,t},ZN.scaleAndAdd=function(t,e,n,i){return EN.scaleAndAdd(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.squaredDistance=ZN.sqrDist=function(t,e){return EN.sqrDist(t.array,e.array)},ZN.squaredLength=ZN.sqrLen=function(t){return EN.sqrLen(t.array)},ZN.sub=function(t,e,n){return EN.subtract(t.array,e.array,n.array),t._dirty=!0,t},ZN.subtract=ZN.sub,ZN.transformMat3=function(t,e,n){return EN.transformMat3(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformMat4=function(t,e,n){return EN.transformMat4(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformQuat=function(t,e,n){return EN.transformQuat(t.array,e.array,n.array),t._dirty=!0,t};var KN=Math.atan2,JN=Math.asin,$N=Math.abs;ZN.eulerFromQuat=function(t,e,n){t._dirty=!0,e=e.array;var i=t.array,r=e[0],o=e[1],a=e[2],s=e[3],l=r*r,u=o*o,h=a*a,c=s*s;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":i[0]=KN(2*(r*s-o*a),c-l-u+h),i[1]=JN(YN(2*(r*a+o*s),-1,1)),i[2]=KN(2*(a*s-r*o),c+l-u-h);break;case"YXZ":i[0]=JN(YN(2*(r*s-o*a),-1,1)),i[1]=KN(2*(r*a+o*s),c-l-u+h),i[2]=KN(2*(r*o+a*s),c-l+u-h);break;case"ZXY":i[0]=JN(YN(2*(r*s+o*a),-1,1)),i[1]=KN(2*(o*s-a*r),c-l-u+h),i[2]=KN(2*(a*s-r*o),c-l+u-h);break;case"ZYX":i[0]=KN(2*(r*s+a*o),c-l-u+h),i[1]=JN(YN(2*(o*s-r*a),-1,1)),i[2]=KN(2*(r*o+a*s),c+l-u-h);break;case"YZX":i[0]=KN(2*(r*s-a*o),c-l+u-h),i[1]=KN(2*(o*s-r*a),c+l-u-h),i[2]=JN(YN(2*(r*o+a*s),-1,1));break;case"XZY":i[0]=KN(2*(r*s+o*a),c-l+u-h),i[1]=KN(2*(r*a+o*s),c+l-u-h),i[2]=JN(YN(2*(a*s-r*o),-1,1));break;default:console.warn("Unkown order: "+n)}return t},ZN.eulerFromMat3=function(t,e,n){var i=e.array,r=i[0],o=i[3],a=i[6],s=i[1],l=i[4],u=i[7],h=i[2],c=i[5],d=i[8],f=t.array;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":f[1]=JN(YN(a,-1,1)),$N(a)<.99999?(f[0]=KN(-u,d),f[2]=KN(-o,r)):(f[0]=KN(c,l),f[2]=0);break;case"YXZ":f[0]=JN(-YN(u,-1,1)),$N(u)<.99999?(f[1]=KN(a,d),f[2]=KN(s,l)):(f[1]=KN(-h,r),f[2]=0);break;case"ZXY":f[0]=JN(YN(c,-1,1)),$N(c)<.99999?(f[1]=KN(-h,d),f[2]=KN(-o,l)):(f[1]=0,f[2]=KN(s,r));break;case"ZYX":f[1]=JN(-YN(h,-1,1)),$N(h)<.99999?(f[0]=KN(c,d),f[2]=KN(s,r)):(f[0]=0,f[2]=KN(-o,l));break;case"YZX":f[2]=JN(YN(s,-1,1)),$N(s)<.99999?(f[0]=KN(-u,l),f[1]=KN(-h,r)):(f[0]=0,f[1]=KN(a,d));break;case"XZY":f[2]=JN(-YN(o,-1,1)),$N(o)<.99999?(f[0]=KN(c,l),f[1]=KN(a,r)):(f[0]=KN(-u,d),f[1]=0);break;default:console.warn("Unkown order: "+n)}return t._dirty=!0,t},Object.defineProperties(ZN,{POSITIVE_X:{get:function(){return new ZN(1,0,0)}},NEGATIVE_X:{get:function(){return new ZN(-1,0,0)}},POSITIVE_Y:{get:function(){return new ZN(0,1,0)}},NEGATIVE_Y:{get:function(){return new ZN(0,-1,0)}},POSITIVE_Z:{get:function(){return new ZN(0,0,1)}},NEGATIVE_Z:{get:function(){return new ZN(0,0,-1)}},UP:{get:function(){return new ZN(0,1,0)}},ZERO:{get:function(){return new ZN}}});const QN=ZN;var tR,eR,nR,iR,rR,oR=1e-5,aR=function(t,e){this.origin=t||new QN,this.direction=e||new QN};aR.prototype={constructor:aR,intersectPlane:function(t,e){var n=t.normal.array,i=t.distance,r=this.origin.array,o=this.direction.array,a=EN.dot(n,o);if(0===a)return null;e||(e=new QN);var s=(EN.dot(n,r)-i)/a;return EN.scaleAndAdd(e.array,r,o,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=EN.dot(t.normal.array,this.direction.array);EN.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,2*-e),this.direction._dirty=!0},distanceToPoint:(rR=EN.create(),function(t){EN.sub(rR,t,this.origin.array);var e=EN.dot(rR,this.direction.array);if(e<0)return EN.distance(this.origin.array,t);var n=EN.lenSquared(rR);return Math.sqrt(n-e*e)}),intersectSphere:function(){var t=EN.create();return function(e,n,i){var r=this.origin.array,o=this.direction.array;e=e.array,EN.sub(t,e,r);var a=EN.dot(t,o),s=EN.squaredLength(t)-a*a,l=n*n;if(!(s>l)){var u=Math.sqrt(l-s),h=a-u,c=a+u;return i||(i=new QN),h<0?c<0?null:(EN.scaleAndAdd(i.array,r,o,c),i):(EN.scaleAndAdd(i.array,r,o,h),i)}}}(),intersectBoundingBox:function(t,e){var n,i,r,o,a,s,l=this.direction.array,u=this.origin.array,h=t.min.array,c=t.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(n=(h[0]-u[0])*d,i=(c[0]-u[0])*d):(i=(h[0]-u[0])*d,n=(c[0]-u[0])*d),f>=0?(r=(h[1]-u[1])*f,o=(c[1]-u[1])*f):(o=(h[1]-u[1])*f,r=(c[1]-u[1])*f),n>o||r>i)return null;if((r>n||n!=n)&&(n=r),(o=0?(a=(h[2]-u[2])*p,s=(c[2]-u[2])*p):(s=(h[2]-u[2])*p,a=(c[2]-u[2])*p),n>s||a>i)return null;if((a>n||n!=n)&&(n=a),(s=0?n:i;return e||(e=new QN),EN.scaleAndAdd(e.array,u,l,g),e},intersectTriangle:(tR=EN.create(),eR=EN.create(),nR=EN.create(),iR=EN.create(),function(t,e,n,i,r,o){var a=this.direction.array,s=this.origin.array;t=t.array,e=e.array,n=n.array,EN.sub(tR,e,t),EN.sub(eR,n,t),EN.cross(iR,eR,a);var l=EN.dot(tR,iR);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l1)return null;EN.cross(iR,tR,nR);var h=EN.dot(a,iR)/l;if(h<0||h>1||u+h>1)return null;EN.cross(iR,tR,eR);var c=-EN.dot(nR,iR)/l;return c<0?null:(r||(r=new QN),o&&QN.set(o,1-u-h,u,h),EN.scaleAndAdd(r.array,s,a,c),r)}),applyTransform:function(t){QN.add(this.direction,this.direction,this.origin),QN.transformMat4(this.origin,this.origin,t),QN.transformMat4(this.direction,this.direction,t),QN.sub(this.direction,this.direction,this.origin),QN.normalize(this.direction,this.direction)},copy:function(t){QN.copy(this.origin,t.origin),QN.copy(this.direction,t.direction)},clone:function(){var t=new aR;return t.copy(this),t}};const sR=aR;var lR={create:function(){var t=new jO(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var e=new jO(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},fromValues:function(t,e,n,i){var r=new jO(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},set:function(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},subtract:function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}};lR.sub=lR.subtract,lR.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},lR.mul=lR.multiply,lR.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},lR.div=lR.divide,lR.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},lR.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},lR.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},lR.scaleAndAdd=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t},lR.distance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+o*o)},lR.dist=lR.distance,lR.squaredDistance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return n*n+i*i+r*r+o*o},lR.sqrDist=lR.squaredDistance,lR.length=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)},lR.len=lR.length,lR.squaredLength=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r},lR.sqrLen=lR.squaredLength,lR.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},lR.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},lR.normalize=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a),t},lR.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},lR.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t[3]=s+i*(n[3]-s),t},lR.random=function(t,e){return e=e||1,t[0]=ZO(),t[1]=ZO(),t[2]=ZO(),t[3]=ZO(),lR.normalize(t,t),lR.scale(t,t,e),t},lR.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t},lR.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},lR.forEach=function(){var t=lR.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=4),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(EN.cross(dR,e,n),t[0]=dR[0],t[1]=dR[1],t[2]=dR[2],t[3]=1+i,mR.normalize(t,t))}),mR.setAxes=(gR=cR.create(),function(t,e,n,i){return gR[0]=n[0],gR[3]=n[1],gR[6]=n[2],gR[1]=i[0],gR[4]=i[1],gR[7]=i[2],gR[2]=-e[0],gR[5]=-e[1],gR[8]=-e[2],mR.normalize(t,mR.fromMat3(t,gR))}),mR.clone=uR.clone,mR.fromValues=uR.fromValues,mR.copy=uR.copy,mR.set=uR.set,mR.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},mR.setAxisAngle=function(t,e,n){n*=.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t},mR.add=uR.add,mR.multiply=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=n[0],l=n[1],u=n[2],h=n[3];return t[0]=i*h+a*s+r*u-o*l,t[1]=r*h+a*l+o*s-i*u,t[2]=o*h+a*u+i*l-r*s,t[3]=a*h-i*s-r*l-o*u,t},mR.mul=mR.multiply,mR.scale=uR.scale,mR.rotateX=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t},mR.rotateY=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s,t},mR.rotateZ=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+r*s,t[1]=r*l-i*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},mR.calculateW=function(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t},mR.dot=uR.dot,mR.lerp=uR.lerp,mR.slerp=function(t,e,n,i){var r,o,a,s,l,u=e[0],h=e[1],c=e[2],d=e[3],f=n[0],p=n[1],g=n[2],m=n[3];return(o=u*f+h*p+c*g+d*m)<0&&(o=-o,f=-f,p=-p,g=-g,m=-m),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-i)*r)/a,l=Math.sin(i*r)/a):(s=1-i,l=i),t[0]=s*u+l*f,t[1]=s*h+l*p,t[2]=s*c+l*g,t[3]=s*d+l*m,t},mR.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-i*s,t[2]=-r*s,t[3]=o*s,t},mR.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},mR.length=uR.length,mR.len=mR.length,mR.squaredLength=uR.squaredLength,mR.sqrLen=mR.squaredLength,mR.normalize=uR.normalize,mR.fromMat3=function(t,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+r]+e[3*r+o])*n,t[a]=(e[3*a+r]+e[3*r+a])*n}return t};const vR=mR;var _R,yR,xR,wR,bR=function(){this._axisX=new QN,this._axisY=new QN,this._axisZ=new QN,this.array=IN.create(),this._dirty=!0};bR.prototype={constructor:bR,setArray:function(t){for(var e=0;e0){var e=this.min,n=this.max,i=e.array,r=n.array;zR(i,t[0]),zR(r,t[0]);for(var o=1;or[0]&&(r[0]=a[0]),a[1]>r[1]&&(r[1]=a[1]),a[2]>r[2]&&(r[2]=a[2])}e._dirty=!0,n._dirty=!0}},union:function(t){var e=this.min,n=this.max;return EN.min(e.array,e.array,t.min.array),EN.max(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersection:function(t){var e=this.min,n=this.max;return EN.max(e.array,e.array,t.min.array),EN.min(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,n=this.max.array,i=t.min.array,r=t.max.array;return!(e[0]>r[0]||e[1]>r[1]||e[2]>r[2]||n[0]=r[0]&&n[1]>=r[1]&&n[2]>=r[2]},containPoint:function(t){var e=this.min.array,n=this.max.array,i=t.array;return e[0]<=i[0]&&e[1]<=i[1]&&e[2]<=i[2]&&n[0]>=i[0]&&n[1]>=i[1]&&n[2]>=i[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:(IR=EN.create(),PR=EN.create(),ER=EN.create(),OR=EN.create(),NR=EN.create(),RR=EN.create(),function(t,e){var n=t.min.array,i=t.max.array,r=e.array;return IR[0]=r[0]*n[0],IR[1]=r[1]*n[0],IR[2]=r[2]*n[0],PR[0]=r[0]*i[0],PR[1]=r[1]*i[0],PR[2]=r[2]*i[0],ER[0]=r[4]*n[1],ER[1]=r[5]*n[1],ER[2]=r[6]*n[1],OR[0]=r[4]*i[1],OR[1]=r[5]*i[1],OR[2]=r[6]*i[1],NR[0]=r[8]*n[2],NR[1]=r[9]*n[2],NR[2]=r[10]*n[2],RR[0]=r[8]*i[2],RR[1]=r[9]*i[2],RR[2]=r[10]*i[2],n=this.min.array,i=this.max.array,n[0]=Math.min(IR[0],PR[0])+Math.min(ER[0],OR[0])+Math.min(NR[0],RR[0])+r[12],n[1]=Math.min(IR[1],PR[1])+Math.min(ER[1],OR[1])+Math.min(NR[1],RR[1])+r[13],n[2]=Math.min(IR[2],PR[2])+Math.min(ER[2],OR[2])+Math.min(NR[2],RR[2])+r[14],i[0]=Math.max(IR[0],PR[0])+Math.max(ER[0],OR[0])+Math.max(NR[0],RR[0])+r[12],i[1]=Math.max(IR[1],PR[1])+Math.max(ER[1],OR[1])+Math.max(NR[1],RR[1])+r[13],i[2]=Math.max(IR[2],PR[2])+Math.max(ER[2],OR[2])+Math.max(NR[2],RR[2])+r[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(t){var e=this.min.array,n=this.max.array,i=t.array,r=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=e[2],h=n[0],c=n[1],d=n[2];if(1===i[15])e[0]=i[0]*r+i[12],e[1]=i[5]*o+i[13],n[2]=i[10]*a+i[14],n[0]=i[0]*h+i[12],n[1]=i[5]*c+i[13],e[2]=i[10]*d+i[14];else{var f=-1/a;e[0]=i[0]*r*f,e[1]=i[5]*o*f,n[2]=(i[10]*a+i[14])*f,f=-1/u,n[0]=i[0]*s*f,n[1]=i[5]*l*f,f=-1/d,e[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=EN.fromValues(0,0,0);this.vertices=t}var n=this.min.array,i=this.max.array;return kR(t[0],n[0],n[1],n[2]),kR(t[1],n[0],i[1],n[2]),kR(t[2],i[0],n[1],n[2]),kR(t[3],i[0],i[1],n[2]),kR(t[4],n[0],n[1],i[2]),kR(t[5],n[0],i[1],i[2]),kR(t[6],i[0],n[1],i[2]),kR(t[7],i[0],i[1],i[2]),this},copy:function(t){var e=this.min,n=this.max;return zR(e.array,t.min.array),zR(n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},clone:function(){var t=new BR;return t.copy(this),t}};const FR=BR;var VR,GR=0,HR=vE.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+GR++),this.position||(this.position=new QN),this.rotation||(this.rotation=new DR),this.scale||(this.scale=new QN(1,1,1)),this.worldTransform=new MR,this.localTransform=new MR,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var n=e._nodeRepository;delete n[this.name],n[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var n=this._scene;n&&n!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,n=e.indexOf(t);n<0||(e.splice(n,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=UR.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:(WR=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var t=UR.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var e=0;e=0&&w[y]>1e-4&&(EN.transformMat4(S,x,v[b[y]]),EN.scaleAndAdd(T,T,S,w[y]));M.set(_,T)}}for(_=0;_>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var n=e.get("webgl_texture");n&&t.gl.deleteTexture(n),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty($R.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty($R.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),$R.BYTE=FE,$R.UNSIGNED_BYTE=VE,$R.SHORT=GE,$R.UNSIGNED_SHORT=HE,$R.INT=UE,$R.UNSIGNED_INT=WE,$R.FLOAT=jE,$R.HALF_FLOAT=36193,$R.UNSIGNED_INT_24_8_WEBGL=34042,$R.DEPTH_COMPONENT=ZE,$R.DEPTH_STENCIL=cO,$R.ALPHA=XE,$R.RGB=qE,$R.RGBA=YE,$R.LUMINANCE=KE,$R.LUMINANCE_ALPHA=JE,$R.SRGB=35904,$R.SRGB_ALPHA=35906,$R.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,$R.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,$R.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,$R.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,$R.NEAREST=$E,$R.LINEAR=QE,$R.NEAREST_MIPMAP_NEAREST=tO,$R.LINEAR_MIPMAP_NEAREST=eO,$R.NEAREST_MIPMAP_LINEAR=nO,$R.LINEAR_MIPMAP_LINEAR=iO,$R.REPEAT=aO,$R.CLAMP_TO_EDGE=sO,$R.MIRRORED_REPEAT=lO;const QR=$R;var tk=ZR.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=ZR.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});tk.POINTS=SE,tk.LINES=ME,tk.LINE_LOOP=CE,tk.LINE_STRIP=LE,tk.TRIANGLES=AE,tk.TRIANGLE_STRIP=DE,tk.TRIANGLE_FAN=IE,tk.BACK=RE,tk.FRONT=NE,tk.FRONT_AND_BACK=kE,tk.CW=zE,tk.CCW=BE;const ek=tk;var nk={isPowerOfTwo:function(t){return!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}};const ik=nk;var rk=ik.isPowerOfTwo;function ok(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}var ak=QR.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type,r=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==QR.REPEAT&&this.wrapT!==QR.REPEAT||!this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,r?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,r?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r?this.minFilter:this.getAvailableMinFilter());var o=t.getGLExtension("EXT_texture_filter_anisotropic");(o&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var a=this.width,s=this.height,l=0;l=QR.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,n,o,i,r,0,e.pixels):t.texImage2D(t.TEXTURE_2D,n,o,i,r,0,o,a,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return rk(this.width)&&rk(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var n=xO.createImage();e&&(n.crossOrigin=e);var i=this;return n.onload=function(){i.dirty(),i.trigger("success",i)},n.onerror=function(){i.trigger("error",i)},n.src=t,this.image=n,this}});Object.defineProperty(ak.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(ak.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const sk=ak;function lk(t){return{byte:xO.Int8Array,ubyte:xO.Uint8Array,short:xO.Int16Array,ushort:xO.Uint16Array}[t]||xO.Float32Array}function uk(t){return"attr_"+t}function hk(t,e,n,i){switch(this.name=t,this.type=e,this.size=n,this.semantic=i||"",this.value=null,n){case 1:this.get=function(t){return this.value[t]},this.set=function(t,e){this.value[t]=e},this.copy=function(t,e){this.value[t]=this.value[t]};break;case 2:this.get=function(t,e){var n=this.value;return e[0]=n[2*t],e[1]=n[2*t+1],e},this.set=function(t,e){var n=this.value;n[2*t]=e[0],n[2*t+1]=e[1]},this.copy=function(t,e){var n=this.value;e*=2,n[t*=2]=n[e],n[t+1]=n[e+1]};break;case 3:this.get=function(t,e){var n=3*t,i=this.value;return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e},this.set=function(t,e){var n=3*t,i=this.value;i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2]},this.copy=function(t,e){var n=this.value;e*=3,n[t*=3]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2]};break;case 4:this.get=function(t,e){var n=this.value,i=4*t;return e[0]=n[i],e[1]=n[i+1],e[2]=n[i+2],e[3]=n[i+3],e},this.set=function(t,e){var n=this.value,i=4*t;n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3]},this.copy=function(t,e){var n=this.value;e*=4,n[t*=4]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2],n[t+3]=n[e+3]}}}function ck(t,e,n,i,r){this.name=t,this.type=e,this.buffer=n,this.size=i,this.semantic=r,this.symbol="",this.needsRemove=!1}function dk(t){this.buffer=t,this.count=0}hk.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=lk(this.type);this.value=new e(t*this.size)}},hk.prototype.fromArray=function(t){var e,n=lk(this.type);if(t[0]&&t[0].length){var i=0,r=this.size;e=new n(t.length*r);for(var o=0;o=0){e||(e=[]);var n=this.indices;return e[0]=n[3*t],e[1]=n[3*t+1],e[2]=n[3*t+2],e}},setTriangleIndices:function(t,e){var n=this.indices;n[3*t]=e[0],n[3*t+1]=e[1],n[3*t+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,n=this.vertexCount>65535?xO.Uint32Array:xO.Uint16Array;if(t[0]&&t[0].length){var i=0;e=new n(3*t.length);for(var r=0;r=0&&(e.splice(n,1),delete this.attributes[t],!0)},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var n=[],i=this.vertexCount,r=0;ro[0]&&(o[0]=s),l>o[1]&&(o[1]=l),u>o[2]&&(o[2]=u)}n._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,n=e.position.value,i=e.normal.value;if(i&&i.length===n.length)for(var r=0;r65535&&(this.indices=new xO.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,n=this.getEnabledAttributes(),i={},r=0;rthis.distance,r=1;r<8;r++)if(EN.dot(e[r].array,n)>this.distance!=i)return!0},intersectLine:(Ek=EN.create(),function(t,e,n){var i=this.distanceToPoint(t),r=this.distanceToPoint(e);if(i>0&&r>0||i<0&&r<0)return null;var o=this.normal.array,a=this.distance,s=t.array;EN.sub(Ek,e.array,t.array),EN.normalize(Ek,Ek);var l=EN.dot(o,Ek);if(0===l)return null;n||(n=new QN);var u=(EN.dot(o,s)-a)/l;return EN.scaleAndAdd(n.array,s,Ek,-u),n._dirty=!0,n}),applyTransform:(Dk=IN.create(),Ik=uR.create(),Pk=uR.create(),Pk[3]=1,function(t){t=t.array,EN.scale(Pk,this.normal.array,this.distance),uR.transformMat4(Pk,Pk,t),this.distance=EN.dot(Pk,this.normal.array),IN.invert(Dk,t),IN.transpose(Dk,Dk),Ik[3]=0,EN.copy(Ik,this.normal.array),uR.transformMat4(Ik,Ik,Dk),EN.copy(this.normal.array,Ik)}),copy:function(t){EN.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new Ok;return t.copy(this),t}};const Nk=Ok;var Rk,kk=EN.set,zk=EN.copy,Bk=EN.transformMat4,Fk=Math.min,Vk=Math.max,Gk=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new Nk);this.boundingBox=new FR,this.vertices=[];for(t=0;t<8;t++)this.vertices[t]=EN.fromValues(0,0,0)};Gk.prototype={setFromProjection:function(t){var e=this.planes,n=t.array,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],f=n[10],p=n[11],g=n[12],m=n[13],v=n[14],_=n[15];kk(e[0].normal.array,a-i,h-s,p-c),e[0].distance=-(_-g),e[0].normalize(),kk(e[1].normal.array,a+i,h+s,p+c),e[1].distance=-(_+g),e[1].normalize(),kk(e[2].normal.array,a+r,h+l,p+d),e[2].distance=-(_+m),e[2].normalize(),kk(e[3].normal.array,a-r,h-l,p-d),e[3].distance=-(_-m),e[3].normalize(),kk(e[4].normal.array,a-o,h-u,p-f),e[4].distance=-(_-v),e[4].normalize(),kk(e[5].normal.array,a+o,h+u,p+f),e[5].distance=-(_+v),e[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===_){var w=l/i,b=-v/(f-1),T=-v/(f+1),S=-T/l,M=-b/l;y.min.set(-S*w,-S,T),y.max.set(S*w,S,b),kk(x[0],-S*w,-S,T),kk(x[1],-S*w,S,T),kk(x[2],S*w,-S,T),kk(x[3],S*w,S,T),kk(x[4],-M*w,-M,b),kk(x[5],-M*w,M,b),kk(x[6],M*w,-M,b),kk(x[7],M*w,M,b)}else{var C=(-1-g)/i,L=(1-g)/i,A=(1-m)/l,D=(-1-m)/l,I=(-1-v)/f,P=(1-v)/f;y.min.set(Math.min(C,L),Math.min(D,A),Math.min(P,I)),y.max.set(Math.max(L,C),Math.max(A,D),Math.max(I,P));var E=y.min.array,O=y.max.array;kk(x[0],E[0],E[1],E[2]),kk(x[1],E[0],O[1],E[2]),kk(x[2],O[0],E[1],E[2]),kk(x[3],O[0],O[1],E[2]),kk(x[4],E[0],E[1],O[2]),kk(x[5],E[0],O[1],O[2]),kk(x[6],O[0],E[1],O[2]),kk(x[7],O[0],O[1],O[2])}},getTransformedBoundingBox:(Rk=EN.create(),function(t,e){var n=this.vertices,i=e.array,r=t.min,o=t.max,a=r.array,s=o.array,l=n[0];Bk(Rk,l,i),zk(a,Rk),zk(s,Rk);for(var u=1;u<8;u++)l=n[u],Bk(Rk,l,i),a[0]=Fk(Rk[0],a[0]),a[1]=Fk(Rk[1],a[1]),a[2]=Fk(Rk[2],a[2]),s[0]=Vk(Rk[0],s[0]),s[1]=Vk(Rk[1],s[1]),s[2]=Vk(Rk[2],s[2]);return r._dirty=!0,o._dirty=!0,t})};const Hk=Gk;var Uk,Wk=UR.extend((function(){return{projectionMatrix:new MR,invProjectionMatrix:new MR,viewMatrix:new MR,frustum:new Hk}}),(function(){this.update(!0)}),{update:function(t){UR.prototype.update.call(this,t),MR.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),MR.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){MR.copy(this.viewMatrix,t),MR.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){MR.copy(this.projectionMatrix,t),MR.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(Uk=uR.create(),function(t,e){var n=void 0!==e?e:new sR,i=t.array[0],r=t.array[1];return uR.set(Uk,i,r,-1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(n.origin.array,Uk,1/Uk[3]),uR.set(Uk,i,r,1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(Uk,Uk,1/Uk[3]),EN.sub(n.direction.array,Uk,n.origin.array),EN.normalize(n.direction.array,n.direction.array),n.direction._dirty=!0,n.origin._dirty=!0,n})});const jk=Wk;var Zk=IN.create(),Xk=IN.create(),qk={};function Yk(t){var e=[],n=Object.keys(t);n.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof Ak&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof jk?(e=this._cameraList.indexOf(t))>=0&&this._cameraList.splice(e,1):t instanceof Ak&&(e=this.lights.indexOf(t))>=0&&this.lights.splice(e,1),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},n=0;n0&&this._doUpdateRenderList(a,e,n,i,r)}},isFrustumCulled:(Jk=new FR,$k=new MR,function(t,e,n){var i=t.boundingBox;if(i||(i=t.skeleton&&t.skeleton.boundingBox?t.skeleton.boundingBox:t.geometry.boundingBox),!i)return!1;if($k.array=n,Jk.transformFrom(i,$k),t.castShadow&&this.viewBoundingBoxLastFrame.union(Jk),t.frustumCulling){if(!Jk.intersectBoundingBox(e.frustum.boundingBox))return!0;$k.array=e.projectionMatrix.array,Jk.max.array[2]>0&&Jk.min.array[2]<0&&(Jk.max.array[2]=-1e-20),Jk.applyProjection($k);var r=Jk.min.array,o=Jk.max.array;if(o[0]<-1||r[0]>1||o[1]<-1||r[1]>1||o[2]<-1||r[2]>1)return!0}return!1}),_updateLightUniforms:function(){var t=this.lights;t.sort(tz);var e=this._lightUniforms;for(var n in e)for(var i in e[n])e[n][i].value.length=0;for(var r=0;r=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new nz(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const oz=rz;var az=ik.isPowerOfTwo,sz=["px","nx","py","ny","pz","nz"],lz=QR.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type;e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var r=t.getGLExtension("EXT_texture_filter_anisotropic");(r&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var o=this.width,a=this.height,s=0;s0&&t.height>0}Object.defineProperty(lz.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(lz.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const hz=lz;var cz=jk.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=2*Math.atan(1/t[5]);this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=jk.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}});const dz=cz;var fz="framebuffer",pz="renderbuffer",gz=pz+"_width",mz=pz+"_height",vz=pz+"_attached",_z="depthtexture_attached",yz=uO,xz=hO,wz=fO,bz=dO,Tz=vE.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new JR,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(yz,this._getFrameBufferGL(t)),this._boundRenderer=t;var n=this._cache;n.put("viewport",t.viewport);var i,r,o=!1;for(var a in this._textures){o=!0;var s=this._textures[a];s&&(i=s.texture.width,r=s.texture.height,this._doAttach(t,s.texture,a,s.target))}this._width=i,this._height=r,!o&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,i,r,1);var l=n.get("attached_textures");if(l)for(var a in l)if(!this._textures[a]){var u=l[a];this._doDetach(e,a,u)}if(!n.get(_z)&&this.depthBuffer){n.miss(pz)&&n.put(pz,e.createRenderbuffer());var h=n.get(pz);i===n.get(gz)&&r===n.get(mz)||(e.bindRenderbuffer(xz,h),e.renderbufferStorage(xz,e.DEPTH_COMPONENT16,i,r),n.put(gz,i),n.put(mz,r),e.bindRenderbuffer(xz,null)),n.get(vz)||(e.framebufferRenderbuffer(yz,wz,xz,h),n.put(vz,!0))}},unbind:function(t){t.__currentFrameBuffer=null,t.gl.bindFramebuffer(yz,null),this._boundRenderer=null,this._cache.use(t.__uid__);var e=this._cache.get("viewport");e&&t.setViewport(e),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var n in this._textures){var i=this._textures[n];if(i){var r=i.texture;if(!r.NPOT&&r.useMipmap&&r.minFilter===QR.LINEAR_MIPMAP_LINEAR){var o="textureCube"===r.textureType?oO:rO;e.bindTexture(o,r.getWebGLTexture(t)),e.generateMipmap(o),e.bindTexture(o,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(yz)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(fz)&&e.put(fz,t.gl.createFramebuffer()),e.get(fz)},attach:function(t,e,n){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||bz,n=n||rO;var i,r=this._boundRenderer;if(r&&r.gl){var o=this._cache;o.use(r.__uid__),i=o.get("attached_textures")}var a=this._textures[e];if(!a||a.target!==n||a.texture!==t||!i||null==i[e]){var s=!0;r&&(s=this._doAttach(r,t,e,n),this.viewport||r.setViewport(0,0,t.width,t.height,1)),s&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=n)}},_doAttach:function(t,e,n,i){var r=t.gl,o=e.getWebGLTexture(t),a=this._cache.get("attached_textures");if(a&&a[n]){var s=a[n];if(s.texture===e&&s.target===i)return}var l=!0;if(((n=+n)===wz||n===gO)&&(t.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==ZE&&e.format!==cO&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var u=this._cache.get(pz);u&&(r.framebufferRenderbuffer(yz,wz,xz,null),r.deleteRenderbuffer(u),this._cache.put(pz,!1)),this._cache.put(vz,!1),this._cache.put(_z,!0)}return r.framebufferTexture2D(yz,n,i,o,0),a||(a={},this._cache.put("attached_textures",a)),a[n]=a[n]||{},a[n].texture=e,a[n].target=i,l},_doDetach:function(t,e,n){t.framebufferTexture2D(yz,e,n,null,0);var i=this._cache.get("attached_textures");i&&i[e]&&(i[e]=null),e!==wz&&e!==gO||this._cache.put(_z,!1)},detach:function(t,e){(this._textures[t]=null,this._boundRenderer)&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e))},dispose:function(t){var e=t.gl,n=this._cache;n.use(t.__uid__);var i=n.get(pz);i&&e.deleteRenderbuffer(i);var r=n.get(fz);r&&e.deleteFramebuffer(r),n.deleteContext(t.__uid__),this._textures={}}});Tz.DEPTH_ATTACHMENT=wz,Tz.COLOR_ATTACHMENT0=bz,Tz.STENCIL_ATTACHMENT=pO,Tz.DEPTH_STENCIL_ATTACHMENT=gO;const Sz=Tz;var Mz=["px","nx","py","ny","pz","nz"],Cz=vE.extend((function(){var t={position:new QN,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new dz({fov:90}),nx:new dz({fov:90}),py:new dz({fov:90}),ny:new dz({fov:90}),pz:new dz({fov:90}),nz:new dz({fov:90})};return e.px.lookAt(QN.POSITIVE_X,QN.NEGATIVE_Y),e.nx.lookAt(QN.NEGATIVE_X,QN.NEGATIVE_Y),e.py.lookAt(QN.POSITIVE_Y,QN.POSITIVE_Z),e.ny.lookAt(QN.NEGATIVE_Y,QN.NEGATIVE_Z),e.pz.lookAt(QN.POSITIVE_Z,QN.NEGATIVE_Y),e.nz.lookAt(QN.NEGATIVE_Z,QN.NEGATIVE_Y),t._frameBuffer=new Sz,t}),{getCamera:function(t){return this._cameras[t]},render:function(t,e,n){var i=t.gl;n||e.update();for(var r=this.texture.width,o=2*Math.atan(r/(r-.5))/Math.PI*180,a=0;a<6;a++){var s=Mz[a],l=this._cameras[s];if(QN.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}});const Lz=Cz;var Az=xk.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var t=this.heightSegments,e=this.widthSegments,n=this.attributes,i=[],r=[],o=[],a=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var h=u/e;if(i.push([2*h-1,2*l-1,0]),r&&r.push([h,l]),o&&o.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],n)}});const Rz=Nz,kz=Rz;function zz(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var Bz=zz("DXT1"),Fz=zz("DXT3"),Vz=zz("DXT5"),Gz={parse:function(t,e){var n=new Int32Array(t,0,31);if(542327876!==n[0])return null;if(4&!n(20))return null;var i,r,o=n(21),a=n[4],s=n[3],l=512&n[28],u=131072&n[2];switch(o){case Bz:i=8,r=QR.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Fz:i=16,r=QR.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Vz:i=16,r=QR.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var h=n[1]+4,c=l?6:1,d=1;u&&(d=Math.max(1,n[7]));for(var f=[],p=0;p0){var r=Math.pow(2,t[3]-128-8+i);e[n+0]=t[0]*r,e[n+1]=t[1]*r,e[n+2]=t[2]*r}else e[n+0]=0,e[n+1]=0,e[n+2]=0;return e[n+3]=1,e}function jz(t,e,n,i){for(var r,o,a=0,s=0,l=i;l>0;)if(t[s][0]=e[n++],t[s][1]=e[n++],t[s][2]=e[n++],t[s][3]=e[n++],1===t[s][0]&&1===t[s][1]&&1===t[s][2]){for(var u=t[s][3]<>>0;u>0;u--)r=t[s-1],(o=t[s])[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],s++,l--;a+=8}else s++,l--,a=0;return n}function Zz(t,e,n,i){if(i<8|i>32767)return jz(t,e,n,i);if(2!=(r=e[n++]))return jz(t,e,n-1,i);if(t[0][1]=e[n++],t[0][2]=e[n++],r=e[n++],(t[0][2]<<8>>>0|r)>>>0!==i)return null;for(var r=0;r<4;r++)for(var o=0;o128){a=(127&a)>>>0;for(var s=e[n++];a--;)t[o++][r]=s}else for(;a--;)t[o++][r]=e[n++]}return n}var Xz={parseRGBE:function(t,e,n){null==n&&(n=0);var i=new Uint8Array(t),r=i.length;if("#?"===function(t,e,n){for(var i="",r=e;r=r)){o+=2;for(var a="";o20)return console.warn("Given image is not a height map"),t}var d,f,p,g;l%(4*i)==0?(d=a.data[l],p=a.data[l+4]):l%(4*i)==4*(i-1)?(d=a.data[l-4],p=a.data[l]):(d=a.data[l-4],p=a.data[l+4]),l<4*i?(f=a.data[l],g=a.data[l+4*i]):l>i*(r-1)*4?(f=a.data[l-4*i],g=a.data[l]):(f=a.data[l-4*i],g=a.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-g+127,s.data[l+2]=255,s.data[l+3]=255}return o.putImageData(s,0,0),n},isHeightImage:function(t,e,n){if(!t||!t.width||!t.height)return!1;var i=document.createElement("canvas"),r=i.getContext("2d"),o=e||32;n=n||20,i.width=i.height=o,r.drawImage(t,0,0,o,o);for(var a=r.getImageData(0,0,o,o),s=0;sn)return!1}return!0},_fetchTexture:function(t,e,n){xO.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:n})},createChessboard:function(t,e,n,i){t=t||512,e=e||64,n=n||"black",i=i||"white";var r=Math.ceil(t/e),o=document.createElement("canvas");o.width=t,o.height=t;var a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,t,t),a.fillStyle=n;for(var s=0;s=0||(Jz.forEach((function(e){t.on(e,this[$z(e)],this)}),this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),Jz.forEach((function(e){t.off(e,this[$z(e)])}),this)},dispose:function(){this._meshes.forEach((function(t){this.detachFromMesh(t)}),this)}};const tB=Qz;var eB=jk.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=jk.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});const nB=eB;LN.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var iB=new Dz,rB=new ek({geometry:iB,frustumCulling:!1}),oB=new nB;const aB=vE.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var t=new LN(LN.source("clay.compositor.vertex"),this.fragment),e=new HO({shader:t});e.enableTexturesAll(),this.material=e}),{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||dO,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var n in this.outputs){var i=this.outputs[n];i&&e.attach(i,n)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var n=t.gl;if(e){this.bind(t,e);var i=t.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var r=[];for(var o in this.outputs)(o=+o)>=n.COLOR_ATTACHMENT0&&o<=n.COLOR_ATTACHMENT0+8&&r.push(o);i.drawBuffersEXT(r)}}this.trigger("beforerender",this,t);var a=this.clearDepth?n.DEPTH_BUFFER_BIT:0;if(n.depthMask(!0),this.clearColor){a|=n.COLOR_BUFFER_BIT,n.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&n.clearColor(s[0],s[1],s[2],s[3])}n.clear(a),this.blendWithPrevious?(n.enable(n.BLEND),this.material.transparent=!0):(n.disable(n.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){rB.material=this.material,t.renderPass([rB],oB)},dispose:function(t){}});var sB={},lB=["px","nx","py","ny","pz","nz"];sB.prefilterEnvironmentMap=function(t,e,n,i,r){r&&i||(i=sB.generateNormalDistribution(),r=sB.integrateBRDF(t,i));var o=(n=n||{}).width||64,a=n.height||64,s=n.type||e.type,l=new hz({width:o,height:a,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(o,a),h=Math.log(u)/Math.log(2)+1,c=new HO({shader:new LN({vertex:LN.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),n.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),n.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new ez;if("texture2D"===e.textureType){var p=new hz({width:o,height:a,type:s===QR.FLOAT?QR.HALF_FLOAT:s});Kz.panoramaToCubeMap(t,e,p,{encodeRGBM:n.decodeRGBM}),e=p}(d=new Rz({scene:f,material:c})).material.set("environmentMap",e);var g=new Lz({texture:l});n.encodeRGBM&&(s=l.type=QR.UNSIGNED_BYTE);for(var m=new sk({width:o,height:a,type:s}),v=new Sz({depthBuffer:!1}),_=xO[s===QR.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),r=new sk({width:512,height:256,type:QR.HALF_FLOAT,wrapS:QR.CLAMP_TO_EDGE,wrapT:QR.CLAMP_TO_EDGE,minFilter:QR.NEAREST,magFilter:QR.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",e),i.setUniform("viewportSize",[512,256]),i.attachOutput(r),i.render(t,n),n.dispose(t),r},sB.generateNormalDistribution=function(t,e){for(var n=new sk({width:t=t||256,height:e=e||1024,type:QR.FLOAT,minFilter:QR.NEAREST,magFilter:QR.NEAREST,wrapS:QR.CLAMP_TO_EDGE,wrapT:QR.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(e*t*4),r=[],o=0;o>>16)>>>0;u=(((16711935&(u=((252645135&(u=((858993459&(u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0))<<2|(3435973836&u)>>>2)>>>0))<<4|(4042322160&u)>>>4)>>>0))<<8|(4278255360&u)>>>8)>>>0)/4294967296;var h=Math.sqrt((1-u)/(1+(s*s-1)*u));r[l]=h}for(l=0;l65535?Uint32Array:Uint16Array,_=this.indices=new v(e*t*6),y=this.radius,x=this.phiStart,w=this.phiLength,b=this.thetaStart,T=this.thetaLength,S=[],M=[],C=0,L=1/(y=this.radius);for(d=0;d<=t;d++)for(c=0;c<=e;c++)u=c/e,h=d/t,a=-y*Math.cos(x+u*w)*Math.sin(b+h*T),s=y*Math.cos(b+h*T),l=y*Math.sin(x+u*w)*Math.sin(b+h*T),S[0]=a,S[1]=s,S[2]=l,M[0]=u,M[1]=h,n.set(C,S),i.set(C,M),S[0]*=L,S[1]*=L,S[2]*=L,r.set(C,S),C++;var A=e+1,D=0;for(d=0;d=0)s=a*n.length;else for(var l=0;l-1e-8&&t=1?1:function(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(MF(h)&&MF(c))MF(s)?o[0]=0:(S=-l/s)>=0&&S<=1&&(o[f++]=S);else{var p=c*c-4*h*d;if(MF(p)){var g=c/h,m=-g/2;(S=-s/a+g)>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=wF(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(S=(-s-((_=_<0?-xF(-_,SF):xF(_,SF))+(y=y<0?-xF(-y,SF):xF(y,SF))))/(3*a))>=0&&S<=1&&(o[f++]=S)}else{var x=(2*h*s-3*a*c)/(2*wF(h*h*h)),w=Math.acos(x)/3,b=wF(h),T=Math.cos(w),S=(-s-2*b*T)/(3*a),M=(m=(-s+b*(T+TF*Math.sin(w)))/(3*a),(-s+b*(T-TF*Math.sin(w)))/(3*a));S>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}(0,i,o,1,t,s)&&CF(0,r,a,1,s[0])}}}var DF=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||vF,this.ondestroy=t.ondestroy||vF,this.onrestart=t.onrestart||vF,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=hF(t)?t:ZB[t]||AF(t)},t}();const IF=DF;var PF={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function EF(t){return(t=Math.round(t))<0?0:t>255?255:t}function OF(t){return t<0?0:t>1?1:t}function NF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?EF(parseFloat(e)/100*255):EF(parseInt(e,10))}function RF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?OF(parseFloat(e)/100):OF(parseFloat(e))}function kF(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function zF(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function BF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var FF=new oz(20),VF=null;function GF(t,e){VF&&BF(VF,e),VF=FF.put(t,VF||e.slice())}function HF(t,e){if(t){e=e||[];var n=FF.get(t);if(n)return BF(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in PF)return BF(e,PF[i]),GF(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(zF(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),GF(t,e),e):void zF(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(zF(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),GF(t,e),e):void zF(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?zF(e,+u[0],+u[1],+u[2],1):zF(e,0,0,0,1);h=RF(u.pop());case"rgb":return u.length>=3?(zF(e,NF(u[0]),NF(u[1]),NF(u[2]),3===u.length?h:RF(u[3])),GF(t,e),e):void zF(e,0,0,0,1);case"hsla":return 4!==u.length?void zF(e,0,0,0,1):(u[3]=RF(u[3]),UF(u,e),GF(t,e),e);case"hsl":return 3!==u.length?void zF(e,0,0,0,1):(UF(u,e),GF(t,e),e);default:return}}zF(e,0,0,0,1)}}function UF(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=RF(t[1]),r=RF(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return zF(e=e||[],EF(255*kF(a,o,n+1/3)),EF(255*kF(a,o,n)),EF(255*kF(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}new oz(100);var WF=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},jF=new function(){this.browser=new WF,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(jF.wxa=!0,jF.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?jF.worker=!0:!jF.hasGlobalWindow||"Deno"in window?(jF.node=!0,jF.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,jF);const ZF=jF;Math.round;ZF.hasGlobalWindow&&hF(window.btoa);var XF=Array.prototype.slice;function qF(t,e,n){return(e-t)*n+t}function YF(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(oF(e)){var l=function(t){return oF(t&&t[0])?2:1}(e);a=l,(1===l&&!cF(e[0])||2===l&&!cF(e[0][0]))&&(o=!0)}else if(cF(e)&&!function(t){return t!=t}(e))a=0;else if(function(t){return"string"==typeof t}(e))if(isNaN(+e)){var u=HF(e);u&&(s=u,a=3)}else a=0;else if(function(t){return null!=t.colorStops}(e)){var h=rF({},s);h.colorStops=aF(e.colorStops,(function(t){return{offset:t.offset,color:HF(t.color)}})),"linear"===e.type?a=4:function(t){return"radial"===t.type}(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=hF(n)?n:ZB[n]||AF(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=iV(i),l=nV(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?rV:t[h];if(!iV(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(iV(s))1===s?YF(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,tV(l),i),this._trackKeys.push(a)}s.addKeyframe(t,tV(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const sV=aV;var lV={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(t,e){this._animators=this._animators||[];var n;if(t){for(var i=t.split("."),r=this,o=0,a=i.length;o=0&&s.splice(t,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,n=e.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function cV(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}Object.assign(UR.prototype,uV),LN.import(hV),LN.import(AN),LN.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),LN.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),LN.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),LN.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var dV=ez.prototype.addToScene,fV=ez.prototype.removeFromScene;ez.prototype.addToScene=function(t){if(dV.call(this,t),this.__zr){var e=this.__zr;t.traverse((function(t){t.__zr=e,t.addAnimatorsToZr&&t.addAnimatorsToZr(e)}))}},ez.prototype.removeFromScene=function(t){fV.call(this,t),t.traverse((function(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}))},HO.prototype.setTextureImage=function(t,e,n,i){if(this.shader){var r,o,a=n.getZr(),s=this;return s.autoUpdateTextureStatus=!1,s.disableTexture(t),(o=e)&&"none"!==o&&(r=pV.loadTexture(e,n,i,(function(e){s.enableTexture(t),a&&a.refresh()})),s.set(t,r)),r}};var pV={};pV.Renderer=jN,pV.Node=UR,pV.Mesh=ek,pV.Shader=LN,pV.Material=HO,pV.Texture=QR,pV.Texture2D=sk,pV.Geometry=xk,pV.SphereGeometry=bB,pV.PlaneGeometry=Dz,pV.CubeGeometry=Oz,pV.AmbientLight=SB,pV.DirectionalLight=CB,pV.PointLight=AB,pV.SpotLight=IB,pV.PerspectiveCamera=dz,pV.OrthographicCamera=nB,pV.Vector2=JO,pV.Vector3=QN,pV.Vector4=NB,pV.Quaternion=DR,pV.Matrix2=BB,pV.Matrix2d=HB,pV.Matrix3=WB,pV.Matrix4=MR,pV.Plane=Nk,pV.Ray=sR,pV.BoundingBox=FR,pV.Frustum=Hk;var gV=null;function mV(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function vV(t){if((t.wrapS===QR.REPEAT||t.wrapT===QR.REPEAT)&&t.image){var e=mV(t.width),n=mV(t.height);if(e!==t.width||n!==t.height){var i=document.createElement("canvas");i.width=e,i.height=n,i.getContext("2d").drawImage(t.image,0,0,e,n),t.image=i}}}pV.loadTexture=function(t,e,n,i){"function"==typeof n&&(i=n,n={}),n=n||{};for(var r=Object.keys(n).sort(),o="",a=0;a3?e[3]=t[3]:e[3]=1,e):((e=Ri(t||"#000",e)||[0,0,0,0])[0]/=255,e[1]/=255,e[2]/=255,e)},pV.directionFromAlphaBeta=function(t,e){var n=t/180*Math.PI+Math.PI/2,i=-e/180*Math.PI+Math.PI/2,r=[],o=Math.sin(n);return r[0]=o*Math.cos(i),r[1]=-Math.cos(n),r[2]=o*Math.sin(i),r},pV.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096}return e},pV.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],pV.createShader=function(t){"ecgl.shadow"===t&&(t="ecgl.displayShadow");var e=LN.source(t+".vertex"),n=LN.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),n||console.error("Fragment shader of '%s' not exits",t);var i=new LN(e,n);return i.name=t,i},pV.createMaterial=function(t,e){e instanceof Array||(e=[e]);var n=pV.createShader(t),i=new HO({shader:n});return e.forEach((function(t){"string"==typeof t&&i.define(t)})),i},pV.setMaterialFromModel=function(t,e,n,i){e.autoUpdateTextureStatus=!1;var r=n.getModel(t+"Material"),o=r.get("detailTexture"),a=xB.firstNotNull(r.get("textureTiling"),1),s=xB.firstNotNull(r.get("textureOffset"),0);"number"==typeof a&&(a=[a,a]),"number"==typeof s&&(s=[s,s]);var l=a[0]>1||a[1]>1?pV.Texture.REPEAT:pV.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===t){var h=r.get("roughness"),c=r.get("metalness");null!=c?isNaN(c)&&(e.setTextureImage("metalnessMap",c,i,u),c=xB.firstNotNull(r.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(e.setTextureImage("roughnessMap",h,i,u),h=xB.firstNotNull(r.get("roughnessAdjust"),.5)):h=.5;var d=r.get("normalTexture");e.setTextureImage("detailMap",o,i,u),e.setTextureImage("normalMap",d,i,u),e.set({roughness:h,metalness:c,detailUvRepeat:a,detailUvOffset:s})}else if("lambert"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("color"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("hatching"===t){var f=r.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)e.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:pV.Texture.REPEAT,wrapT:pV.Texture.REPEAT});e.set({detailUvRepeat:a,detailUvOffset:s})}},pV.updateVertexAnimation=function(t,e,n,i){var r=i.get("animation"),o=i.get("animationDurationUpdate"),a=i.get("animationEasingUpdate"),s=n.shadowDepthMaterial;if(r&&e&&o>0&&e.geometry.vertexCount===n.geometry.vertexCount){n.material.define("vertex","VERTEX_ANIMATION"),n.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var n=this.zr;t.scene.traverse((function(t){t.__zr=n,t.addAnimatorsToZr&&t.addAnimatorsToZr(n)}))}},xV.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t))}},xV.prototype.removeViewsAll=function(){this.views.forEach((function(t){t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t)}),this),this.views.length=0},xV.prototype.resize=function(t,e){this.renderer.resize(t,e)},xV.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)},xV.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)},xV.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},xV.prototype.needsRefresh=function(){this.zr.refresh()},xV.prototype.refresh=function(t){this._backgroundColor=t?_V.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var i=this.pickObject(t.offsetX,t.offsetY);i&&(this._dispatchEvent(t.type,t,i),this._dispatchDataEvent(t.type,t,i));var r=this._clickToSetFocusPoint(t);if(r)r.view.setDOFFocusOnPoint(r.distance)&&this.zr.refresh()}}},xV.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,n=e.viewport,i=this.views.length-1;i>=0;i--){var r=this.views[i];if(r.hasDOF()&&r.containPoint(t.offsetX,t.offsetY)){this._picking.scene=r.scene,this._picking.camera=r.camera,e.viewport=r.viewport;var o=this._picking.pick(t.offsetX,t.offsetY,!0);if(o)return o.view=r,o}}e.viewport=n},xV.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})},xV.prototype.pickObject=function(t,e){for(var n=[],i=this.renderer,r=i.viewport,o=0;o=0&&(h.dataIndex=this._lastDataIndex,h.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0):null!=a&&a!==this._lastEventData&&(null!=this._lastEventData&&(h.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0),this._lastEventData=a,this._lastDataIndex=r,this._lastSeriesIndex=o),h.eventData=a,h.dataIndex=r,h.seriesIndex=o,(null!=a||parseInt(r,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,t,e),s&&this.zr.handler.dispatchToElement(u,"mouseover",e))},xV.prototype._dispatchToView=function(t,e){for(var n=0;nt&&a=0&&(!function(t){DV(t,"itemStyle"),DV(t,"lineStyle"),DV(t,"areaStyle"),DV(t,"label")}(e),"mapbox"===e.coordinateSystem&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))})),IV(t.xAxis3D),IV(t.yAxis3D),IV(t.zAxis3D),IV(t.grid3D),DV(t.geo3D)}));const EV={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(t){t=t||{},this.option.viewControl=this.option.viewControl||{},null!=t.alpha&&(this.option.viewControl.alpha=t.alpha),null!=t.beta&&(this.option.viewControl.beta=t.beta),null!=t.distance&&(this.option.viewControl.distance=t.distance),null!=t.center&&(this.option.viewControl.center=t.center)}},OV={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},NV={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var RV=Gc.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});nt(RV.prototype,EV),nt(RV.prototype,OV),nt(RV.prototype,NV);const kV=RV;var zV=xB.firstNotNull,BV={left:0,middle:1,right:2};function FV(t){return t instanceof Array||(t=[t,t]),t}var VV=vE.extend((function(){return{zr:null,viewGL:null,_center:new QN,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new JO,_panVelocity:new JO,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}}),(function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach((function(t){this[t]=this[t].bind(this)}),this)}),{init:function(){var t=this.zr;t&&(t.on("mousedown",this._mouseDownHandler),t.on("globalout",this._mouseUpHandler),t.on("mousewheel",this._mouseWheelHandler),t.on("pinch",this._pinchHandler),t.animation.on("frame",this._update),t.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var t=this.zr;t&&(t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("pinch",this._pinchHandler),t.off("globalout",this._mouseUpHandler),t.dom.removeEventListener("contextmenu",this._contextMenuHandler),t.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(t){this._distance=t,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(t){this._orthoSize=t,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(t){t=Math.max(Math.min(this.maxAlpha,t),this.minAlpha),this._theta=t/180*Math.PI,this._needsUpdate=!0},setBeta:function(t){t=Math.max(Math.min(this.maxBeta,t),this.minBeta),this._phi=-t/180*Math.PI,this._needsUpdate=!0},setCenter:function(t){this._center.setArray(t)},setViewGL:function(t){this.viewGL=t},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(t,e){var n=(e=e||{}).baseDistance||0,i=e.baseOrthoSize||1,r=t.get("projection");"perspective"!==r&&"orthographic"!==r&&"isometric"!==r&&(r="perspective"),this._projection=r,this.viewGL.setProjection(r);var o=t.get("distance")+n,a=t.get("orthographicSize")+i;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach((function(e){this[e[0]]=zV(t.get(e[0]),e[1])}),this),this.minDistance+=n,this.maxDistance+=n,this.minOrthographicSize+=i,this.maxOrthographicSize+=i;var s=t.ecModel,l={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach((function(e){l[e]=zV(t.get(e),s&&s.get(e))}));var u=zV(e.alpha,t.get("alpha"))||0,h=zV(e.beta,t.get("beta"))||0,c=zV(e.center,t.get("center"))||[0,0,0];l.animation&&l.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:u,beta:h,center:c,distance:o,orthographicSize:a,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(o),this.setAlpha(u),this.setBeta(h),this.setCenter(c),this.setOrthographicSize(a)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){0},animateTo:function(t){var e=this.zr,n=this,i={},r={};return null!=t.distance&&(i.distance=this.getDistance(),r.distance=t.distance),null!=t.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),r.orthographicSize=t.orthographicSize),null!=t.alpha&&(i.alpha=this.getAlpha(),r.alpha=t.alpha),null!=t.beta&&(i.beta=this.getBeta(),r.beta=t.beta),null!=t.center&&(i.center=this.getCenter(),r.center=t.center),this._addAnimator(e.animation.animate(i).when(t.duration||1e3,r).during((function(){null!=i.alpha&&n.setAlpha(i.alpha),null!=i.beta&&n.setBeta(i.beta),null!=i.distance&&n.setDistance(i.distance),null!=i.center&&n.setCenter(i.center),null!=i.orthographicSize&&n.setOrthographicSize(i.orthographicSize),n._needsUpdate=!0}))).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),n=this._orthoSize,i=n/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-i/2,e.right=i/2,e.top=n/2,e.bottom=-n/2},_updatePan:function(t){var e=this._panVelocity,n=this._distance,i=this.getCamera(),r=i.worldTransform.y,o=i.worldTransform.x;this._center.scaleAndAdd(o,-e.x*n/200).scaleAndAdd(r,-e.y*n/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new QN,n=this._theta+Math.PI/2,i=this._phi+Math.PI/2,r=Math.sin(n);e.x=r*Math.cos(i),e.y=-Math.cos(n),e.z=r*Math.sin(i),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout((function(){e._rotating=!0}),1e3*t))},_vectorDamping:function(t,e){var n=t.len();(n*=e)<1e-4&&(n=0),t.normalize().scale(n)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),n=Math.atan2(t.x,t.z);this._theta=e,this._phi=-n,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,n=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,n)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?1===t.event.targetTouches.length&&(this._mode="rotate"):t.event.button===BV[this.rotateMouseButton]?this._mode="rotate":t.event.button===BV[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy||this._isAnimating())){var e=FV(this.panSensitivity),n=FV(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*n[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*n[1]):"pan"===this._mode&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(0!==e){var n,i=t.offsetX,r=t.offsetY;if(!this.viewGL||this.viewGL.containPoint(i,r))n="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*n*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),t.event.preventDefault()}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done((function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)})),t}});Object.defineProperty(VV.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const GV=VV,HV={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var n in e)t||!e[n].value?e[n].value=[]:e[n].value=Array.prototype.slice.call(e[n].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},UV={vec2:qO,vec3:EN,vec4:uR,mat2:kB,mat2d:VB,mat3:cR,mat4:IN,quat:vR};var WV=UV.vec3,jV=[[0,0],[1,1]],ZV=xk.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),positionPrev:new xk.Attribute("positionPrev","float",3),positionNext:new xk.Attribute("positionNext","float",3),prevPositionPrev:new xk.Attribute("prevPositionPrev","float",3),prevPosition:new xk.Attribute("prevPosition","float",3),prevPositionNext:new xk.Attribute("prevPositionNext","float",3),offset:new xk.Attribute("offset","float",1),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(WV.dist(t,e)+WV.dist(n,e)+WV.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(jV)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(jV)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?0:2*Math.max(e-1,0)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=t[2],u=e[0],h=e[1],c=e[2],d=n[0],f=n[1],p=n[2],g=i[0],m=i[1],v=i[2],_=this._getCubicCurveApproxStep(t,e,n,i),y=_*_,x=y*_,w=3*_,b=3*y,T=6*y,S=6*x,M=a-2*u+d,C=s-2*h+f,L=l-2*c+p,A=3*(u-d)-a+g,D=3*(h-f)-s+m,I=3*(c-p)-l+v,P=a,E=s,O=l,N=(u-a)*w+M*b+A*x,R=(h-s)*w+C*b+D*x,k=(c-l)*w+L*b+I*x,z=M*T+A*S,B=C*T+D*S,F=L*T+I*S,V=A*S,G=D*S,H=I*S,U=0,W=0,j=Math.ceil(1/_),Z=new Float32Array(3*(j+1)),X=(Z=[],0);for(W=0;W1&&(P=N>0?Math.min(P,g):Math.max(P,g),E=R>0?Math.min(E,m):Math.max(E,m),O=k>0?Math.min(O,v):Math.max(O,v));return this.addPolyline(Z,r,o)},addLine:function(t,e,n,i){return this.addPolyline([t,e],n,i)},addPolyline:function(t,e,n,i,r){if(t.length){var o="number"!=typeof t[0];if(null==r&&(r=o?t.length:t.length/3),!(r<2)){null==i&&(i=0),null==n&&(n=1),this._itemVertexOffsets.push(this._vertexOffset);var a,s,l=(o="number"!=typeof t[0])?"number"!=typeof e[0]:e.length/4===r,u=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,g=this._vertexOffset;n=Math.max(n,.01);for(var m=i;m1&&(u.copy(g,g-1),d.copy(g,g-1),g++):(m0&&(c.set(g-2,a),c.set(g-1,a)),u.set(g,a),u.set(g+1,a),d.set(g,s),d.set(g+1,s),f.set(g,n/2),f.set(g+1,-n/2),g+=2),this.useNativeLine)d.set(g,s),u.set(g,a),g++;else if(m>0){var y=3*this._triangleOffset;(p=this.indices)[y]=g-4,p[y+1]=g-3,p[y+2]=g-2,p[y+3]=g-3,p[y+4]=g-1,p[y+5]=g-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,w=this._vertexOffset+2*r;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(w-1,w-3),c.copy(w-2,w-4)}return this._vertexOffset=g,this._vertexOffset}}},setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=ta&&(r=this._x=0,o+=this._rowHeight+l,this._y=o,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,n),o+n+l>s)return null;t.x+=this.offsetX*this.dpr+r,t.y+=this.offsetY*this.dpr+o,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height];return[[r/a+u[0],o/s+u[1]],[(r+e)/a+u[0],(o+n)/s+u[1]]]},_fitElement:function(t,e,n){var i=t.getBoundingRect(),r=e/i.width,o=n/i.height;t.x=-i.x*r,t.y=-i.y*o,t.scaleX=r,t.scaleY=o,t.update()}},YV.prototype={clear:function(){for(var t=0;t=t)){var r=(n+this._nodeWidth)*this._dpr,o=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:r,height:o})}catch(t){this._canvas.width=r,this._canvas.height=o}var a=new qV(this._zr,n,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(a),a}},add:function(t,e,n){if(this._coords[t.id])return this._coords[t.id];var i=this._getCurrentNode().add(t,e,n);if(!i){var r=this._expand();if(!r)return;i=r.add(t,e,n)}return this._coords[t.id]=i,i},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};const KV=YV;function JV(){}JV.prototype={constructor:JV,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new _V.DirectionalLight({shadowBias:.005}),this.ambientLight=new _V.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,n=this.ambientLight,i=t.getModel("light"),r=i.getModel("main"),o=i.getModel("ambient");e.intensity=r.get("intensity"),n.intensity=o.get("intensity"),e.color=_V.parseColor(r.get("color")).slice(0,3),n.color=_V.parseColor(o.get("color")).slice(0,3);var a=r.get("alpha")||0,s=r.get("beta")||0;e.position.setArray(_V.directionFromAlphaBeta(a,s)),e.lookAt(_V.Vector3.ZERO),e.castShadow=r.get("shadow"),e.shadowResolution=_V.getShadowResolution(r.get("shadowQuality"))},updateAmbientCubemap:function(t,e,n){var i=e.getModel("light.ambientCubemap"),r=i.get("texture");if(r){this._cubemapLightsCache=this._cubemapLightsCache||{};var o=this._cubemapLightsCache[r];if(!o){var a=this;o=this._cubemapLightsCache[r]=_V.createAmbientCubemap(i.option,t,n,(function(){a._isSkyboxFromAmbientCubemap&&a._skybox.setEnvironmentMap(o.specular.cubemap),n.getZr().refresh()}))}this._lightRoot.add(o.diffuse),this._lightRoot.add(o.specular),this._currentCubemapLights=o}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,n){var i=e.get("environment"),r=this;var o=(r._skybox=r._skybox||new Rz,r._skybox);if(i&&"none"!==i)if("auto"===i)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var a=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(a),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof i&&i.colorStops||"string"==typeof i&&Ri(i)){this._isSkyboxFromAmbientCubemap=!1;var s=new _V.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(s);var l=s.image=document.createElement("canvas");l.width=l.height=16,v_(l.getContext("2d"),new Fl({shape:{x:0,y:0,width:16,height:16},style:{fill:i}})),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;s=_V.loadTexture(i,n,{anisotropic:8,flipY:!1});o.setEnvironmentMap(s),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var u=e.coordinateSystem;if(this._skybox)if(!u||!u.viewGL||"auto"===i||i.match&&i.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var h=u.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[h]("fragment","SRGB_DECODE")}}};const $V=JV;var QV=UV.vec3,tG=xk.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,n=this.getQuadVertexCount()*t,i=this.getQuadTriangleCount()*t;this.vertexCount!==n&&(e.position.init(n),e.normal.init(n),e.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=QV.create(),e=QV.create(),n=QV.create(),i=[0,3,1,3,2,1];return function(r,o){var a=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;QV.sub(t,r[1],r[0]),QV.sub(e,r[2],r[1]),QV.cross(n,t,e),QV.normalize(n,n);for(var u=0;u<4;u++)a.set(this._vertexOffset+u,r[u]),l.set(this._vertexOffset+u,o),s.set(this._vertexOffset+u,n);var h=3*this._faceOffset;for(u=0;u<6;u++)this.indices[h+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});ot(tG.prototype,HV);const eG=tG;var nG=xB.firstNotNull,iG={x:0,y:2,z:1};function rG(t,e,n){this.rootNode=new _V.Node;var i=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),r=new _V.Mesh({geometry:new eG,material:n,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(r),this.rootNode.add(i),this.faceInfo=t,this.plane=new _V.Plane,this.linesMesh=i,this.quadsMesh=r}rG.prototype.update=function(t,e,n){var i=t.coordinateSystem,r=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,a=this.quadsMesh.geometry;o.convertToDynamicArray(!0),a.convertToDynamicArray(!0),this._updateSplitLines(o,r,t,n),this._udpateSplitAreas(a,r,t,n),o.convertToTypedArray(),a.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(t,e,n,i){var r=[0,0,0],o=i<0?n.getExtentMin():n.getExtentMax();r[iG[n.dim]]=o,t.position.setArray(r),t.rotation.identity(),e.distance=-Math.abs(o),e.normal.set(0,0,0),"x"===n.dim?(t.rotation.rotateY(i*Math.PI/2),e.normal.x=-i):"z"===n.dim?(t.rotation.rotateX(-i*Math.PI/2),e.normal.y=-i):(i>0&&t.rotation.rotateY(Math.PI),e.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},rG.prototype._updateSplitLines=function(t,e,n,i){var r=i.getDevicePixelRatio();e.forEach((function(i,o){var a=i.model,s=e[1-o].getExtent();if(!i.scale.isBlank()){var l=a.getModel("splitLine",n.getModel("splitLine"));if(l.get("show")){var u=l.getModel("lineStyle"),h=u.get("color"),c=nG(u.get("opacity"),1),d=nG(u.get("width"),1);h=yt(h)?h:[h];for(var f=i.getTicksCoords({tickModel:l}),p=0,g=0;g65535?new Uint32Array(3*n):new Uint16Array(3*n))},setSpriteAlign:function(t,e,n,i,r){var o,a,s,l;switch(null==n&&(n="left"),null==i&&(i="top"),r=r||0,n){case"left":o=r,s=e[0]+r;break;case"center":case"middle":o=-e[0]/2,s=e[0]/2;break;case"right":o=-e[0]-r,s=-r}switch(i){case"bottom":a=r,l=e[1]+r;break;case"middle":a=-e[1]/2,l=e[1]/2;break;case"top":a=-e[1]-r,l=-r}var u=4*t,h=this.attributes.offset;h.set(u,[o,l]),h.set(u+1,[s,l]),h.set(u+2,[s,a]),h.set(u+3,[o,a])},addSprite:function(t,e,n,i,r,o){var a=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,n,i,r,o);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var mG=xB.firstNotNull;_V.Shader.import(gG);var vG={x:0,y:2,z:1};const _G=Dp.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var n=new _V.Material({shader:_V.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new _V.Node,this._control=new GV({zr:e.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(t){var e=new oG(t,i,n);return this.groupGL.add(e.rootNode),e}),this),this._axes=["x","y","z"].map((function(t){var e=new pG(t,i);return this.groupGL.add(e.rootNode),e}),this);var r=e.getDevicePixelRatio();this._axisLabelSurface=new KV({width:256,height:256,devicePixelRatio:r}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new KV({width:128,height:128,devicePixelRatio:r}),this._axisPointerLabelsMesh=new uG({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new _V.Node,this._sceneHelper=new $V,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,n){this._model=t,this._api=n;var i=t.coordinateSystem;i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var r=this._control;r.setViewGL(i.viewGL);var o=t.getModel("viewControl");r.setFromViewControlModel(o,0),this._axisLabelSurface.clear(),r.off("update"),t.get("show")&&(this._faces.forEach((function(i){i.update(t,e,n)}),this),this._axes.forEach((function(e){e.update(t,this._axisLabelSurface,n)}),this)),r.on("update",this._onCameraChange.bind(this,t,n),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(t),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},showAxisPointer:function(t,e,n,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(t,e,n,i){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem.viewGL;t.get("show")&&t.get("axisPointer.show")?e.on("mousemove",this._updateAxisPointerOnMousePosition,this):e.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e,n=this._model.coordinateSystem,i=n.viewGL,r=i.castRay(t.offsetX,t.offsetY,new _V.Ray),o=0;oi[1]?0:1,a=this._faces[2*n+o],s=this._faces[2*n+1-o];a.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),n=t.getAxis("y"),i=t.getAxis("z"),r=i.getExtentMax(),o=i.getExtentMin(),a=e.getExtentMin(),s=e.getExtentMax(),l=n.getExtentMax(),u=n.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?u:l,g=f[2].rootNode.invisible?r:o,m=f[0].rootNode.invisible?a:s,v=f[2].rootNode.invisible?r:o,_=f[0].rootNode.invisible?s:a,y=f[4].rootNode.invisible?u:l;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,g,p),c.position.set(m,v,0),d.position.set(_,0,y),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new _V.Vector4,new _V.Vector4],n=new _V.Vector4;this.groupGL.getWorldPosition(n),n.w=1,n.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),n.x/=n.w,n.y/=n.w,this._axes.forEach((function(i){for(var r=i.axisLineCoords,o=(i.labelsMesh.geometry,0);on.y?"bottom":"top"):(s="middle",a=h>n.x?"left":"right"),i.setSpriteAlign(a,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,n=e.dataToPoint(t),i=this._axisPointerLineMesh.geometry,r=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function a(t){return xB.firstNotNull(t.model.get("axisPointer.show"),r.get("show"))}function s(t){var e=t.model.getModel("axisPointer",r).getModel("lineStyle"),n=_V.parseColor(e.get("color")),i=mG(e.get("width"),1),o=mG(e.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;l 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var PG,EG,OG,NG,RG,kG,zG,BG=vE.extend((function(){return{softShadow:BG.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new Sz,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new LG}}),(function(){this._gaussianPassH=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new aB({fragment:LN.source("clay.sm.debug_depth")})}),{render:function(t,e,n,i){n||(n=e.getMainCamera()),this.trigger("beforerender",this,t,e,n),this._renderShadowPass(t,e,n,i),this.trigger("afterrender",this,t,e,n)},renderDebug:function(t,e){t.saveClear();var n=t.viewport,i=0,r=e||n.width/4,o=r;for(var a in this.softShadow===BG.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[a];t.setViewport(i,0,r*s.width/s.height,o),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(t),i+=r*s.width/s.height}t.setViewport(n),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===BG.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var n=this.kernelPCF;n&&n.length?e.material.define("fragment","PCF_KERNEL_SIZE",n.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var n=this;e.traverse((function(e){e.isRenderable()&&n._updateReceivers(t,e)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(a=p),this.renderDirectionalLightShadow(t,e,n,p,c,h,u)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(t,e,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(t,e,p,d);this._shadowMapNumber[p.type]++}for(var g in this._shadowMapNumber){var m=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT";for(f=0;f0?_.define("fragment",v,m):_.isDefined("fragment",v)&&_.undefine("fragment",v))}}for(f=0;f0){var x=u.map(S);if(y.directionalLightShadowMaps={value:u,type:"tv"},y.directionalLightMatrices={value:h,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},a){var w=c.slice(),b=c.slice();w.pop(),b.shift(),w.reverse(),b.reverse(),h.reverse(),y.shadowCascadeClipsNear={value:w,type:"1fv"},y.shadowCascadeClipsFar={value:b,type:"1fv"}}}if(s.length>0){var T=s.map(S);(y=e.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:T,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function S(t){return t.height}},renderDirectionalLightShadow:(PG=new Hk,EG=new MR,OG=new FR,NG=new MR,RG=new MR,kG=new MR,zG=new MR,function(t,e,n,i,r,o,a){var s=this._getDepthMaterial(i),l={getMaterial:function(t){return t.shadowDepthMaterial||s},isMaterialChanged:IG,getUniform:DG,ifRender:function(t){return t.castShadow},sortCompare:jN.opaqueSortCompare};if(!e.viewBoundingBoxLastFrame.isFinite()){var u=e.getBoundingBox();e.viewBoundingBoxLastFrame.copy(u).applyTransform(n.viewMatrix)}var h=Math.min(-e.viewBoundingBoxLastFrame.min.z,n.far),c=Math.max(-e.viewBoundingBoxLastFrame.max.z,n.near),d=this._getDirectionalLightCamera(i,e,n),f=kG.array;zG.copy(d.projectionMatrix),IN.invert(RG.array,d.worldTransform.array),IN.multiply(RG.array,RG.array,n.worldTransform.array),IN.multiply(f,zG.array,RG.array);for(var p=[],g=n instanceof dz,m=(n.near+n.far)/(n.near-n.far),v=2*n.near*n.far/(n.near-n.far),_=0;_<=i.shadowCascade;_++){var y=c*Math.pow(h/c,_/i.shadowCascade),x=c+(h-c)*_/i.shadowCascade,w=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(w),r.push(-(-w*m+v)/-w)}var b=this._getTexture(i,i.shadowCascade);a.push(b);var T=t.viewport,S=t.gl;for(this._frameBuffer.attach(b),this._frameBuffer.bind(t),S.clear(S.COLOR_BUFFER_BIT|S.DEPTH_BUFFER_BIT),_=0;_d?s>f?p[r>0?"px":"nx"]=!0:p[a>0?"pz":"nz"]=!0:d>f?p[o>0?"py":"ny"]=!0:p[a>0?"pz":"nz"]=!0}for(n=0;n0)this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}}});var GG=vE.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){"string"==typeof t&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=n.COLOR_ATTACHMENT0&&h<=n.COLOR_ATTACHMENT0+8&&u.push(h);l.drawBuffersEXT(u)}t.saveClear(),t.clearBit=wE|TE,e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),i.unbind(t)}else e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",e),this._rendering=!1,this._rendered=!0}});const jG=VG.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}});const ZG=VG.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var t=new aB({fragment:this.shader});this.pass=t}),{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var n=t.gl;for(var i in this.inputLinks){var r=(c=this.inputLinks[i]).node.getOutput(t,c.pin);this.pass.setUniform(i,r)}if(this.outputs){this.pass.outputs={};var o={};for(var a in this.outputs){var s=this.updateParameter(a,t);isNaN(s.width)&&this.updateParameter(a,t);var l=this.outputs[a],u=this._compositor.allocateTexture(s);this._outputTextures[a]=u,"string"==typeof(h=l.attachment||n.COLOR_ATTACHMENT0)&&(h=n[h]),o[h]=u}for(var h in this._compositor.getFrameBuffer().bind(t),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var n,i,r=this.outputs[t],o=r.parameters,a=r._parametersCopy;if(a||(a=r._parametersCopy={}),o)for(var s in o)"width"!==s&&"height"!==s&&(a[s]=o[s]);return n="function"==typeof o.width?o.width.call(this,e):o.width,i="function"==typeof o.height?o.height.call(this,e):o.height,n=Math.ceil(n),i=Math.ceil(i),a.width===n&&a.height===i||this._outputTextures[t]&&this._outputTextures[t].dispose(e),a.width=n,a.height=i,a},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){(this._outputReferences[t]--,0===this._outputReferences[t])&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))},clear:function(){VG.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),XG="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",qG="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",YG="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",KG="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",JG="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",$G="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",QG="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",tH="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",eH="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(t){t.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),t.import(XG),t.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),t.import(qG),t.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),t.import(YG),t.import(KG),t.import(JG),t.import($G),t.import(QG),t.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),t.import(tH),t.import(eH)}(LN);var nH=/^#source\((.*?)\)/;function iH(t,e,n){var i,r,o,a,s=t.type||"filter";if("filter"===s){var l=t.shader.trim(),u=nH.exec(l);if(u?i=LN.source(u[1].trim()):"#"===l.charAt(0)&&(i=e.shaders[l.substr(1)]),i||(i=l),!i)return}if(t.inputs)for(var h in r={},t.inputs)"string"==typeof t.inputs[h]?r[h]=t.inputs[h]:r[h]={node:t.inputs[h].node,pin:t.inputs[h].pin};if(t.outputs)for(var h in o={},t.outputs){var c=t.outputs[h];o[h]={},null!=c.attachment&&(o[h].attachment=c.attachment),null!=c.keepLastFrame&&(o[h].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(o[h].outputLastFrame=c.outputLastFrame),c.parameters&&(o[h].parameters=aH(c.parameters))}if(a="scene"===s?new WG({name:t.name,scene:n.scene,camera:n.camera,outputs:o}):"texture"===s?new jG({name:t.name,outputs:o}):new ZG({name:t.name,shader:i,inputs:r,outputs:o})){if(t.parameters)for(var h in t.parameters){"string"==typeof(d=t.parameters[h])?"#"===(d=d.trim()).charAt(0)?d=e.textures[d.substr(1)]:a.on("beforerender",sH(h,lH(d))):"function"==typeof d&&a.on("beforerender",d),a.setParameter(h,d)}if(t.defines&&a.pass)for(var h in t.defines){var d=t.defines[h];a.pass.material.define("fragment",h,d)}}return a}function rH(t,e){return t}function oH(t,e){return e}function aH(t){var e={};if(!t)return e;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(n){var i=t[n];null!=i&&("string"==typeof i&&(i=QR[i]),e[n]=i)}));var n=t.scale||1;return["width","height"].forEach((function(i){if(null!=t[i]){var r=t[i];"string"==typeof r?(r=r.trim(),e[i]=function(t,e,n){return n=n||1,function(t){var i=t.getDevicePixelRatio(),r=t.getWidth()*n,o=t.getHeight()*n;return e(r,o,i)}}(0,lH(r),n)):e[i]=r}})),e.width||(e.width=rH),e.height||(e.height=oH),null!=t.useMipmap&&(e.useMipmap=t.useMipmap),e}function sH(t,e){return function(n){var i=n.getDevicePixelRatio(),r=n.getWidth(),o=n.getHeight(),a=e(r,o,i);this.setParameter(t,a)}}function lH(t){var e=/^expr\((.*)\)$/.exec(t);if(e)try{var n=new Function("width","height","dpr","return "+e[1]);return n(1,1),n}catch(t){throw new Error("Invalid expression.")}}const uH=function(t,e){var n=new UG;e=e||{};var i={textures:{},parameters:{}};for(var r in t.parameters){var o=t.parameters[r];i.parameters[r]=aH(o)}return function(t,e,n,i){if(!t.textures)return void i({});var r={},o=0,a=!1,s=n.textureRootPath;gE.each(t.textures,(function(t,e){var n,l=t.path,u=aH(t.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(t){return gE.relative2absolute(t,s)}))),n=new hz(u);else{if("string"!=typeof l)return;s&&(l=gE.relative2absolute(l,s)),n=new sk(u)}n.load(l),o++,n.once("success",(function(){r[e]=n,0===--o&&(i(r),a=!0)}))})),0!==o||a||i(r)}(t,0,e,(function(r){i.textures=r,function(){for(var r=0;r0;)n+=i*(r%e),r=Math.floor(r/e),i/=e;return n};function cH(t){for(var e=new Uint8Array(t*t*4),n=0,i=new QN,r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),pH.prototype.setDepthTexture=function(t){this._depthTex=t},pH.prototype.setNormalTexture=function(t){this._normalTex=t,this._ssaoPass.material[t?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},pH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._ssaoPass,a=this._blurPass;o.setUniform("kernel",this._kernels[n%this._kernels.length]),o.setUniform("depthTex",this._depthTex),null!=this._normalTex&&o.setUniform("normalTex",this._normalTex),o.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new MR;MR.transpose(s,e.worldTransform),o.setUniform("projection",e.projectionMatrix.array),o.setUniform("projectionInv",e.invProjectionMatrix.array),o.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,h=this._blurTexture2;l.width=i/2,l.height=r/2,u.width=i,u.height=r,h.width=i,h.height=r,this._framebuffer.attach(l),this._framebuffer.bind(t),t.gl.clearColor(1,1,1,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),o.render(t),a.setUniform("textureSize",[i/2,r/2]),a.setUniform("projection",e.projectionMatrix.array),this._framebuffer.attach(u),a.setUniform("direction",0),a.setUniform("ssaoTexture",l),a.render(t),this._framebuffer.attach(h),a.setUniform("textureSize",[i,r]),a.setUniform("direction",1),a.setUniform("ssaoTexture",u),a.render(t),this._framebuffer.unbind(t);var c=t.clearColor;t.gl.clearColor(c[0],c[1],c[2],c[3])},pH.prototype.getTargetTexture=function(){return this._blurTexture2},pH.prototype.setParameter=function(t,e){"noiseTexSize"===t?this.setNoiseSize(e):"kernelSize"===t?this.setKernelSize(e):"intensity"===t?this._ssaoPass.material.set("intensity",e):this._ssaoPass.setUniform(t,e)},pH.prototype.setKernelSize=function(t){this._kernelSize=t,this._ssaoPass.material.define("fragment","KERNEL_SIZE",t),this._kernels=this._kernels||[];for(var e=0;e<30;e++)this._kernels[e]=fH(t,e*t,!!this._normalTex)},pH.prototype.setNoiseSize=function(t){var e=this._ssaoPass.getUniform("noiseTex");e?(e.data=cH(t),e.width=e.height=t,e.dirty()):(e=dH(t),this._ssaoPass.setUniform("noiseTex",dH(t))),this._ssaoPass.setUniform("noiseTexSize",[t,t])},pH.prototype.dispose=function(t){this._blurTexture.dispose(t),this._ssaoTexture.dispose(t),this._blurTexture2.dispose(t)};const gH=pH;function mH(t){t=t||{},this._ssrPass=new aB({fragment:LN.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new aB({fragment:LN.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new sk({type:QR.HALF_FLOAT}),this._texture2=new sk({type:QR.HALF_FLOAT}),this._texture3=new sk({type:QR.HALF_FLOAT}),this._prevTexture=new sk({type:QR.HALF_FLOAT}),this._currentTexture=new sk({type:QR.HALF_FLOAT}),this._frameBuffer=new Sz({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}LN.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),mH.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var n=t&&e;this._ssrPass.material[n?"enableTexture":"disableTexture"]("specularCubemap")},mH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._ssrTexture,s=this._texture2,l=this._texture3;a.width=this._prevTexture.width=this._currentTexture.width=r/this._downScale,a.height=this._prevTexture.height=this._currentTexture.height=o/this._downScale,s.width=l.width=r,s.height=l.height=o;var u=this._frameBuffer,h=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new MR,g=new MR;MR.transpose(p,e.worldTransform),MR.transpose(g,e.viewMatrix),h.setUniform("sourceTexture",n),h.setUniform("projection",e.projectionMatrix.array),h.setUniform("projectionInv",e.invProjectionMatrix.array),h.setUniform("toViewSpace",p.array),h.setUniform("toWorldSpace",g.array),h.setUniform("nearZ",e.near);var m=i/this._totalSamples*this._samplePerFrame;if(h.setUniform("jitterOffset",m),h.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[a.width,a.height]),d.setUniform("textureSize",[r,o]),d.setUniform("sourceTexture",n),c.setUniform("projection",e.projectionMatrix.array),d.setUniform("projection",e.projectionMatrix.array),u.attach(a),u.bind(t),h.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",a),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(t)),u.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:a),c.render(t),u.attach(l),d.setUniform("texture",s),d.render(t),u.unbind(t),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},mH.prototype.getTargetTexture=function(){return this._texture3},mH.prototype.setParameter=function(t,e){"maxIteration"===t?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)},mH.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=uB.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t},mH.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")},mH.prototype.isFinished=function(t){return!this._physicallyCorrect||t>this._totalSamples/this._samplePerFrame},mH.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const vH=mH,_H=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function yH(t,e,n,i,r){var o=t.gl;e.setUniform(o,"1i",n,r),o.activeTexture(o.TEXTURE0+r),i.isRenderable()?i.bind(t):i.unbind(t)}function xH(t,e,n,i,r){var o,a,s,l,u=t.gl;return function(r,h,c){if(!l||l.material!==r.material){var d=r.material,f=r.__program,p=d.get("roughness");null==p&&(p=1);var g=d.get("normalMap")||e,m=d.get("roughnessMap"),v=d.get("bumpMap"),_=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),w=d.get("detailUvOffset"),b=!!v&&d.isTextureEnabled("bumpMap"),T=!!m&&d.isTextureEnabled("roughnessMap"),S=d.isDefined("fragment","DOUBLE_SIDED");v=v||n,m=m||i,c!==h?(h.set("normalMap",g),h.set("bumpMap",v),h.set("roughnessMap",m),h.set("useBumpMap",b),h.set("useRoughnessMap",T),h.set("doubleSide",S),null!=_&&h.set("uvRepeat",_),null!=y&&h.set("uvOffset",y),null!=x&&h.set("detailUvRepeat",x),null!=w&&h.set("detailUvOffset",w),h.set("roughness",p)):(f.setUniform(u,"1f","roughness",p),o!==g&&yH(t,f,"normalMap",g,0),a!==v&&v&&yH(t,f,"bumpMap",v,1),s!==m&&m&&yH(t,f,"roughnessMap",m,2),null!=_&&f.setUniform(u,"2f","uvRepeat",_),null!=y&&f.setUniform(u,"2f","uvOffset",y),null!=x&&f.setUniform(u,"2f","detailUvRepeat",x),null!=w&&f.setUniform(u,"2f","detailUvOffset",w),f.setUniform(u,"1i","useBumpMap",+b),f.setUniform(u,"1i","useRoughnessMap",+T),f.setUniform(u,"1i","doubleSide",+S)),o=g,a=v,s=m,l=r}}}function wH(t){t=t||{},this._depthTex=new sk({format:QR.DEPTH_COMPONENT,type:QR.UNSIGNED_INT}),this._normalTex=new sk({type:QR.HALF_FLOAT}),this._framebuffer=new Sz,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,Sz.DEPTH_ATTACHMENT),this._normalMaterial=new HO({shader:new LN(LN.source("ecgl.normal.vertex"),LN.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=Kz.createBlank("#000"),this._defaultBumpMap=Kz.createBlank("#000"),this._defaultRoughessMap=Kz.createBlank("#000"),this._debugPass=new aB({fragment:LN.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}LN.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),wH.prototype.getDepthTexture=function(){return this._depthTex},wH.prototype.getNormalTexture=function(){return this._normalTex},wH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._depthTex,a=this._normalTex,s=this._normalMaterial;o.width=i,o.height=r,a.width=i,a.height=r;var l=e.getRenderList(n).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,n,{getMaterial:function(){return s},ifRender:function(t){return t.renderNormal},beforeRender:xH(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)},wH.prototype.renderDebug=function(t){this._debugPass.render(t)},wH.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};const bH=wH;function TH(t){t=t||{},this._edgePass=new aB({fragment:LN.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new sk({type:QR.HALF_FLOAT}),this._frameBuffer=new Sz,this._frameBuffer.attach(this._targetTexture)}TH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._targetTexture;a.width=r,a.height=o;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[r,o]),this._edgePass.setUniform("texture",n),this._edgePass.render(t),s.unbind(t)},TH.prototype.getTargetTexture=function(){return this._targetTexture},TH.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)},TH.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const SH=TH,MH={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function CH(t,e){return{color:{parameters:{width:t,height:e}}}}LN.import(XG),LN.import(qG),LN.import(YG),LN.import(KG),LN.import(JG),LN.import($G),LN.import(QG),LN.import(tH),LN.import(eH),LN.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),LN.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var LH=["composite","FXAA"];function AH(){this._width,this._height,this._dpr,this._sourceTexture=new sk({type:QR.HALF_FLOAT}),this._depthTexture=new sk({format:QR.DEPTH_COMPONENT,type:QR.UNSIGNED_INT}),this._framebuffer=new Sz,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,Sz.DEPTH_ATTACHMENT),this._normalPass=new bH,this._compositor=uH(MH);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var e=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=e,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map((function(t){return this._compositor.getNodeByName(t)}),this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=LH.map((function(t){return this._compositor.getNodeByName(t)}),this);var n={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new gH(n),this._ssrPass=new vH(n),this._edgePass=new SH(n)}AH.prototype.resize=function(t,e,n){t*=n=n||1,e*=n;var i=this._sourceTexture,r=this._depthTexture;i.width=t,i.height=e,r.width=t,r.height=e;var o={getWidth:function(){return t},getHeight:function(){return e},getDevicePixelRatio:function(){return n}};function a(t,e){if("function"==typeof t[e]){var n=t[e].__original||t[e];t[e]=function(t){return n.call(this,o)},t[e].__original=n}}this._compositor.nodes.forEach((function(t){for(var e in t.outputs){var n=t.outputs[e].parameters;n&&(a(n,"width"),a(n,"height"))}for(var i in t.parameters)a(t.parameters,i)})),this._width=t,this._height=e,this._dpr=n},AH.prototype.getWidth=function(){return this._width},AH.prototype.getHeight=function(){return this._height},AH.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},AH.prototype._getPrevNode=function(t){for(var e=LH.indexOf(t.name)-1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e-=1,n=this._finalNodesChain[e];return n},AH.prototype._getNextNode=function(t){for(var e=LH.indexOf(t.name)+1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e+=1,n=this._finalNodesChain[e];return n},AH.prototype._addChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(t.inputs.texture=e.name,n?(t.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=t.name):t.outputs=null,this._compositor.addNode(t))},AH.prototype._removeChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(n?(e.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=e.name):e.outputs=null,this._compositor.removeNode(t))},AH.prototype.updateNormal=function(t,e,n,i){this._ifRenderNormalPass()&&this._normalPass.update(t,e,n)},AH.prototype.updateSSAO=function(t,e,n,i){this._ssaoPass.update(t,n,i)},AH.prototype.enableSSAO=function(){this._enableSSAO=!0},AH.prototype.disableSSAO=function(){this._enableSSAO=!1},AH.prototype.enableSSR=function(){this._enableSSR=!0},AH.prototype.disableSSR=function(){this._enableSSR=!1},AH.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()},AH.prototype.getSourceFrameBuffer=function(){return this._framebuffer},AH.prototype.getSourceTexture=function(){return this._sourceTexture},AH.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},AH.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},AH.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()},AH.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()},AH.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()},AH.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()},AH.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0},AH.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},AH.prototype.enableEdge=function(){this._enableEdge=!0},AH.prototype.disableEdge=function(){this._enableEdge=!1},AH.prototype.setBloomIntensity=function(t){this._compositeNode.setParameter("bloomIntensity",t)},AH.prototype.setSSAOParameter=function(t,e){switch(t){case"quality":var n={low:6,medium:12,high:32,ultra:62}[e]||12;this._ssaoPass.setParameter("kernelSize",n);break;case"radius":this._ssaoPass.setParameter(t,e),this._ssaoPass.setParameter("bias",e/200);break;case"intensity":this._ssaoPass.setParameter(t,e)}},AH.prototype.setDOFParameter=function(t,e){switch(t){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(t,e);break;case"blurRadius":for(var n=0;n=this._haltonSequence.length},render:function(t,e,n){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),i.render(t),this._blendFb.unbind(t),n||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};const PH=IH;function EH(t){t=t||"perspective",this.layer=null,this.scene=new ez,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new DH,this._temporalSS=new PH,this._shadowMapPass=new FG;for(var e=[],n=0,i=0;i<30;i++){for(var r=[],o=0;o<6;o++)r.push(4*hH(n,2)-2),r.push(4*hH(n,3)-2),n++;e.push(r)}this._pcfKernels=e,this.scene.on("beforerender",(function(t,e,n){this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,n)}),this)}EH.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),"perspective"===t?this.camera instanceof dz||(this.camera=new dz,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof nB||(this.camera=new nB,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3},EH.prototype.setViewport=function(t,e,n,i,r){this.camera instanceof dz&&(this.camera.aspect=n/i),r=r||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=n,this.viewport.height=i,this.viewport.devicePixelRatio=r,this._compositor.resize(n*r,i*r),this._temporalSS.resize(n*r,i*r)},EH.prototype.containPoint=function(t,e){var n=this.viewport;return e=this.layer.renderer.getHeight()-e,t>=n.x&&e>=n.y&&t<=n.x+n.width&&e<=n.y+n.height};var OH=new JO;EH.prototype.castRay=function(t,e,n){var i=this.layer.renderer,r=i.viewport;return i.viewport=this.viewport,i.screenToNDC(t,e,OH),this.camera.castRay(OH,n),i.viewport=r,n},EH.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30},EH.prototype._doRender=function(t,e,n){var i=this.scene,r=this.camera;n=n||0,this._updateTransparent(t,i,r,n),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,i,r,!0)),this._updateShadowPCFKernel(n);var o,a=t.clearColor;(t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,r),this._compositor.updateNormal(t,i,r,this._temporalSS.getFrame())),this._updateSSAO(t,i,r,this._temporalSS.getFrame()),this._enablePostEffect)?((o=this._compositor.getSourceFrameBuffer()).bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(i,r,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,i,r,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,i,r,null,0))):this.needsTemporalSS()&&e?((o=this._temporalSS.getSourceFrameBuffer()).bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(i,r,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),t.render(i,r,!0,!0))},EH.prototype._updateTransparent=function(t,e,n,i){for(var r=new QN,o=new MR,a=n.getWorldPosition(),s=e.getRenderList(n).transparent,l=0;lthis.camera.far||t80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),l>a&&(a=l);u=Math.max(o-i,a-r)}return nU(d,f,n,i,r,u),f}function tU(t,e,n,i,r){var o,a;if(r===wU(t,e,n,i)>0)for(o=e;o=e;o-=i)a=_U(o,t[o],t[o+1],a);return a&&pU(a,a.next)&&(yU(a),a=a.next),a}function eU(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!pU(i,i.next)&&0!==fU(i.prev,i,i.next))i=i.next;else{if(yU(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function nU(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=uU(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?rU(t,i,r,o):iU(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),yU(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?nU(t=oU(t,e,n),e,n,i,r,o,2):2===a&&aU(t,e,n,i,r,o):nU(eU(t),e,n,i,r,o,1);break}}}function iU(t){var e=t.prev,n=t,i=t.next;if(fU(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(cU(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&fU(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function rU(t,e,n,i){var r=t.prev,o=t,a=t.next;if(fU(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=uU(s,l,e,n,i),d=uU(u,h,e,n,i),f=t.nextZ;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function oU(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!pU(r,o)&&gU(r,i,i.next,o)&&mU(r,o)&&mU(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),yU(i),yU(i.next),i=t=o),i=i.next}while(i!==t);return i}function aU(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&dU(a,s)){var l=vU(a,s);return a=eU(a,a.next),l=eU(l,l.next),nU(a,e,n,i,r,o),void nU(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function sU(t,e){return t.x-e.x}function lU(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&cU(on.x)&&mU(i,t)&&(n=i,d=l),i=i.next;return n}(t,e),e){var n=vU(e,t);eU(n,n.next)}}function uU(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function hU(t){var e=t,n=t;do{e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function dU(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&gU(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&mU(t,e)&&mU(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function fU(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function pU(t,e){return t.x===e.x&&t.y===e.y}function gU(t,e,n,i){return!!(pU(t,e)&&pU(n,i)||pU(t,i)&&pU(n,e))||fU(t,e,n)>0!=fU(t,e,i)>0&&fU(n,i,t)>0!=fU(n,i,e)>0}function mU(t,e){return fU(t.prev,t,t.next)<0?fU(t,e,t.next)>=0&&fU(t,t.prev,e)>=0:fU(t,e,t.prev)<0||fU(t,t.next,e)<0}function vU(t,e){var n=new xU(t.i,t.x,t.y),i=new xU(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function _U(t,e,n,i){var r=new xU(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function yU(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xU(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wU(t,e,n,i){for(var r=0,o=e,a=n-i;ol&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});var u;l=o[a].pivot+1;(u=o[a].right)>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}o=this._parts=s}else for(a=0;a=2e4},doSortTriangles:function(t,e){var n=this.indices;if(0===e){var i=this.attributes.position;t=t.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new n.constructor(n.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var r,o=0,a=0;a0,n={},i=0;i65535?new Uint32Array(3*a):new Uint16Array(3*a),d.material.shader!==e&&d.material.attachShader(e,!0),_V.setMaterialFromModel(e.__shading,d.material,t,n),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(o),this._vertexRangeOfDataIndex=new Uint32Array(2*(r-i))},_updateRegionMesh:function(t,e,n,i){for(var r=t.getData(),o=0,a=0,s=!1,l=this._polygonMesh,u=this._linesMesh,h=n;h0;b&&(w*=e.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,t,h,_,w,t.coordinateSystem.transform)),u.invisible=!b,u.material.set({color:m})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?_V.Mesh.CCW:_V.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=t.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(t){var e=t.getModel("debug.wireframe");if(e.get("show")){var n=_V.parseColor(e.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=xB.firstNotNull(e.get("lineStyle.width"),1),r=this._polygonMesh;r.geometry.generateBarycentric(),r.material.define("both","WIREFRAME_TRIANGLE"),r.material.set("wireframeLineColor",n),r.material.set("wireframeLineWidth",i)}},_onmousemove:function(t){var e=this._dataIndexOfVertex[t.triangle[0]];null==e&&(e=-1),e!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(e),this._labelsBuilder.updateLabels([e])),this._lastHoverDataIndex=e,this._polygonMesh.dataIndex=e},_onmouseout:function(t){t.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(t,e,n){var i=t.getModel("groundPlane",t);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var r=t.get("shading"),o=this._groundMaterials[r];o||(o=this._groundMaterials.lambert),_V.setMaterialFromModel(r,o,i,n),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",_V.parseColor(i.get("color"))),this._groundMesh.scale.set(e.size[0],e.size[2],1)}},_triangulation:function(t,e,n){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],o=t.coordinateSystem,a=e;a1?i:0,I[V][m]=C.points[H+2],l.set(r+V,I[V]),s?(N[0]=(C.points[H]*v[0]-_[0])/x,N[1]=(C.points[H+2]*v[m]-_[m])/x):(N[0]=(G?R:R+F)/x,N[1]=(I[V][g]*v[g]-_[g])/x),h.set(r+V,N)}kU.sub(P,I[1],I[0]),kU.sub(E,I[3],I[0]),kU.cross(O,P,E),kU.normalize(O,O);for(V=0;V<4;V++)u.set(r+V,O),f&&c.set(r+V,a);for(V=0;V<6;V++)p[3*o+V]=D[V]+r;r+=4,o+=2,R+=F}}return e.dirty(),{vertexOffset:r,triangleOffset:o}},_getRegionLinesInfo:function(t,e,n){var i=0,r=0;e.getRegionModel(t).getModel("itemStyle").get("borderWidth")>0&&e.getRegionPolygonCoords(t).forEach((function(t){var e=t.exterior,o=t.interiors;i+=n.getPolylineVertexCount(e),r+=n.getPolylineTriangleCount(e);for(var a=0;athis._endIndex)){e-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*e];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var t=this.getDisplacementTexture(),e=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==t||this._displacementScale!==e,this._displacementTexture=t,this._displacementScale=e},isDisplacementChanged:function(){return this._displacementChanged}});nt(tW.prototype,EV),nt(tW.prototype,OV),nt(tW.prototype,NV),nt(tW.prototype,qH);const eW=tW;var nW=Math.PI,iW=Math.sin,rW=Math.cos,oW=Math.tan,aW=Math.asin,sW=Math.atan2,lW=nW/180;var uW=23.4397*lW;function hW(t,e){return sW(iW(t)*rW(uW)-oW(e)*iW(uW),rW(t))}function cW(t,e,n){return sW(iW(t),rW(t)*iW(e)-oW(n)*rW(e))}function dW(t,e,n){return aW(iW(e)*iW(n)+rW(e)*rW(n)*rW(t))}function fW(t){var e,n,i=function(t){return lW*(357.5291+.98560028*t)}(t),r=function(t){return t+lW*(1.9148*iW(t)+.02*iW(2*t)+3e-4*iW(3*t))+102.9372*lW+nW}(i);return{dec:(e=r,n=0,aW(iW(n)*rW(uW)+rW(n)*iW(uW)*iW(e))),ra:hW(r,0)}}var pW={};pW.getPosition=function(t,e,n){var i=lW*-n,r=lW*e,o=function(t){return function(t){return t.valueOf()/864e5-.5+2440588}(t)-2451545}(t),a=fW(o),s=function(t,e){return lW*(280.16+360.9856235*t)-e}(o,i)-a.ra;return{azimuth:cW(s,r,a.dec),altitude:dW(s,r,a.dec)}};const gW=pW;_V.Shader.import(hV),_V.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const mW=Dp.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(t,e){this.groupGL=new _V.Node,this._sphereGeometry=new _V.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new _V.PlaneGeometry,this._earthMesh=new _V.Mesh({renderNormal:!0}),this._atmosphereMesh=new _V.Mesh,this._atmosphereGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.atmosphere.vertex"),_V.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=_V.Mesh.CW,this._lightRoot=new _V.Node,this._sceneHelper=new $V,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new GV({zr:e.getZr()}),this._control.init(),this._layerMeshes={}},render:function(t,e,n){var i=t.coordinateSystem,r=t.get("shading");i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var a="ecgl."+r;o.material&&o.material.shader.name===a||(o.material=_V.createMaterial(a)),_V.setMaterialFromModel(r,o.material,t,n),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(t){var e=o.material.get(t);e&&(e.flipY=!1)})),o.material.set("color",_V.parseColor(t.get("baseColor")));var s=.99*i.radius;if(o.scale.set(s,s,s),t.get("atmosphere.show")){o.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:t.get("atmosphere.glowPower")||6,glowColor:t.get("atmosphere.color")||"#ffffff"}),o.material.setUniforms({glowPower:t.get("atmosphere.innerGlowPower")||2,glowColor:t.get("atmosphere.color")||"#ffffff"});var l=t.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else o.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=o.material.setTextureImage("diffuseMap",t.get("baseTexture"),n,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",t.get("heightTexture"),n,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[t.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(t,n),this._displaceVertices(t,n),this._updateViewControl(t,n),this._updateLayers(t,n)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},_updateLayers:function(t,e){var n=t.coordinateSystem,i=t.get("layers"),r=n.radius,o=[],a=[],s=[],l=[];ct(i,(function(t){var i=new Ih(t),u=i.get("type"),h=_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8});if(h.surface&&h.surface.attachToMesh(this._earthMesh),"blend"===u){var c=i.get("blendTo"),d=xB.firstNotNull(i.get("intensity"),1);"emission"===c?(s.push(h),l.push(d)):(o.push(h),a.push(d))}else{var f=i.get("id"),p=this._layerMeshes[f];p||(p=this._layerMeshes[f]=new _V.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===i.get("shading")?(p.material=p.__lambertMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),p.__lambertMaterial=p.material):(p.material=p.__colorMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.color"),transparent:!0,depthMask:!1}),p.__colorMaterial=p.material),p.material.enableTexture("diffuseMap");var g=i.get("distance"),m=r+(null==g?n.radius/100:g);p.scale.set(m,m,m),r=m;var v=this._blankTexture||(this._blankTexture=_V.createBlankTexture("rgba(255, 255, 255, 0)"));p.material.set("diffuseMap",v),_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8},(function(t){t.surface&&t.surface.attachToMesh(p),p.material.set("diffuseMap",t),e.getZr().refresh()})),i.get("show")?this.groupGL.add(p):this.groupGL.remove(p)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",s.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",a),u.set("layerEmissiveMap",s),u.set("layerEmissionIntensity",l);var h=t.getModel("debug.wireframe");if(h.get("show")){u.define("both","WIREFRAME_TRIANGLE");var c=_V.parseColor(h.get("lineStyle.color")||"rgba(0,0,0,0.5)"),d=xB.firstNotNull(h.get("lineStyle.width"),1);u.set("wireframeLineWidth",d),u.set("wireframeLineColor",c)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(t,e){var n=t.coordinateSystem,i=t.getModel("viewControl"),r=(n.viewGL.camera,this);var o=this._control;o.setViewGL(n.viewGL);var a,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,a=l[1]),o.setFromViewControlModel(i,{baseDistance:n.radius,alpha:a,beta:s}),o.off("update"),o.on("update",(function(){e.dispatchAction({type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-n.radius,center:o.getCenter(),from:r.uid,globeId:t.id})}))},_displaceVertices:function(t,e){var n=t.get("displacementQuality"),i=t.get("debug.wireframe.show"),r=t.coordinateSystem;if(t.isDisplacementChanged()||n!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=n,this._showDebugWireframe=i;var o=this._sphereGeometry,a={low:100,medium:200,high:400,ultra:800}[n]||200,s=a/2;(o.widthSegments!==a||i)&&(o.widthSegments=a,o.heightSegments=s,o.build()),this._doDisplaceVertices(o,r),i&&o.generateBarycentric()}},_doDisplaceVertices:function(t,e){var n=t.attributes.position.value,i=t.attributes.texcoord0.value,r=t.__originalPosition;r&&r.length===n.length||((r=new Float32Array(n.length)).set(n),t.__originalPosition=r);for(var o=e.displacementWidth,a=e.displacementHeight,s=e.displacementData,l=0;l50&&(o=1e3);var a=[];EW.perspective(a,NW,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(a),this.viewGL.camera.decomposeProjectionMatrix();a=EW.identity([]);var s=this.dataToPoint(this.center);EW.scale(a,a,[1,-1,1]),EW.translate(a,a,[0,0,-t]),EW.rotateX(a,a,e),EW.rotateZ(a,a,-this.bearing/180*Math.PI),EW.translate(a,a,[-s[0]*this.getScale()*kW,-s[1]*this.getScale()*kW,0]),this.viewGL.camera.viewMatrix.array=a;var l=[];EW.invert(l,a),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var u,h=OW*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];u=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else u=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*kW;this.viewGL.rootNode.scale.set(this.getScale()*kW,this.getScale()*kW,u)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(t,e){return this.projectOnTileWithScale(t,this.getScale()*OW,e)},projectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1]*RW/180,o=e*(i*RW/180+RW)/(2*RW),a=e*(RW-Math.log(Math.tan(RW/4+.5*r)))/(2*RW);return(n=n||[])[0]=o,n[1]=a,n},unprojectFromTile:function(t,e){return this.unprojectOnTileWithScale(t,this.getScale()*OW,e)},unprojectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1],o=i/e*(2*RW)-RW,a=2*(Math.atan(Math.exp(RW-r/e*(2*RW)))-RW/4);return(n=n||[])[0]=180*o/RW,n[1]=180*a/RW,n},dataToPoint:function(t,e){return(e=this.projectOnTileWithScale(t,OW,e))[0]-=this._origin[0],e[1]-=this._origin[1],e[2]=isNaN(t[2])?0:t[2],isNaN(t[2])||(e[2]=t[2],this.altitudeExtent&&(e[2]-=this.altitudeExtent[0])),e}};const BW=zW;function FW(){BW.apply(this,arguments)}FW.prototype=new BW,FW.prototype.constructor=FW,FW.prototype.type="mapbox3D";function VW(t,e,n){function i(t,e){var n=e.getWidth(),i=e.getHeight(),r=e.getDevicePixelRatio();this.viewGL.setViewport(0,0,n,i,r),this.width=n,this.height=i,this.altitudeScale=t.get("altitudeScale"),this.boxHeight=t.get("boxHeight")}function r(t,e){if("auto"!==this.model.get("boxHeight")){var n=[1/0,-1/0];t.eachSeries((function(t){if(t.coordinateSystem===this){var e=t.getData(),i=t.coordDimToDataDim("alt")[0];if(i){var r=e.getDataExtent(i,!0);n[0]=Math.min(n[0],r[0]),n[1]=Math.max(n[1],r[1])}}}),this),n&&isFinite(n[1]-n[0])&&(this.altitudeExtent=n)}}return{dimensions:e.prototype.dimensions,create:function(o,a){var s=[];return o.eachComponent(t,(function(t){var n=t.__viewGL;n||(n=t.__viewGL=new NH).setRootNode(new _V.Node);var o=new e;o.viewGL=t.__viewGL,o.resize=i,o.resize(t,a),s.push(o),t.coordinateSystem=o,o.model=t,o.update=r})),o.eachSeries((function(e){if(e.get("coordinateSystem")===t){var n=e.getReferringComponents(t).models[0];if(n||(n=o.getComponent(t)),!n)throw new Error(t+' "'+xB.firstNotNull(e.get(t+"Index"),e.get(t+"Id"),0)+'" not found');e.coordinateSystem=n.coordinateSystem}})),n&&n(s,o,a),s}}}const GW=VW("mapbox3D",FW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMapboxCameraOption())}))}));Jw((function(t){t.registerComponentModel(CW),t.registerComponentView(PW),t.registerCoordinateSystem("mapbox3D",GW),t.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"mapbox3D",query:t},(function(e){e.setMapboxCameraOption(t)}))}))}));var HW=["zoom","center","pitch","bearing"],UW=Gc.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var t=this;return HW.reduce((function(e,n){return e[n]=t.get(n),e}),{})},setMaptalksCameraOption:function(t){null!=t&&HW.forEach((function(e){null!=t[e]&&(this.option[e]=t[e])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(t){this._maptalks=t}});nt(UW.prototype,OV),nt(UW.prototype,NV);const WW=UW;function jW(t,e,n,i){if(this.id=t,this.zr=e,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:n,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}jW.prototype.setUnpainted=function(){},jW.prototype.resize=function(){this._maptalks.checkSize()},jW.prototype.getMaptalks=function(){return this._maptalks},jW.prototype.clear=function(){},jW.prototype.refresh=function(){this._maptalks.checkSize()};var ZW=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];jW.prototype._initEvents=function(){var t=this.dom;this._handlers=this._handlers||{contextmenu:function(t){return t.preventDefault(),!1}},ZW.forEach((function(e){this._handlers[e]=function(n){var i={};for(var r in n)i[r]=n[r];i.bubbles=!1;var o=new n.constructor(n.type,i);"mousewheel"===e||"DOMMouseScroll"===e?t.dispatchEvent(o):t.firstElementChild.dispatchEvent(o)},this.zr.dom.addEventListener(e,this._handlers[e])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},jW.prototype.dispose=function(){ZW.forEach((function(t){this.zr.dom.removeEventListener(t,this._handlers[t])}),this),this._maptalks.remove()};const XW=jW;_V.Shader.import(IW);const qW=Dp.extend({type:"maptalks3D",__ecgl__:!0,init:function(t,e){this._groundMesh=new _V.Mesh({geometry:new _V.PlaneGeometry,material:new _V.Material({shader:new _V.Shader({vertex:_V.Shader.source("ecgl.displayShadow.vertex"),fragment:_V.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(t,e){var n=e.getZr();this._zrLayer=new XW("maptalks3D",n,t.get("center"),t.get("zoom")),n.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new _V.Node,this._sceneHelper=new $V(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),r=this._dispatchInteractAction.bind(this,e,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(t){i.on(t,r)}))},render:function(t,e,n){this._zrLayer||this._initMaptalksLayer(t,n);var i=this._zrLayer.getMaptalks(),r=t.get("urlTemplate"),o=i.getBaseLayer();r!==this._oldUrlTemplate&&(o?o.setOptions({urlTemplate:r,attribution:t.get("attribution")}):(o=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:r,subdomains:["a","b","c"],attribution:t.get("attribution")}),i.setBaseLayer(o))),this._oldUrlTemplate=r,i.setCenter(t.get("center")),i.setZoom(t.get("zoom"),{animation:!1}),i.setPitch(t.get("pitch")),i.setBearing(t.get("bearing")),t.setMaptalks(i);var a=t.coordinateSystem;a.viewGL.scene.add(this._lightRoot),a.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(a.viewGL.scene),this._sceneHelper.updateLight(t),a.viewGL.setPostEffect(t.getModel("postEffect"),n),a.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._maptalks3DModel=t},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n),t.coordinateSystem.viewGL.scene.traverse((function(t){t.material&&(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(t,e,n,i){t.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),n.getZr().refresh()},_dispatchInteractAction:function(t,e,n){var i;t.dispatchAction({type:"maptalks3DChangeCamera",pitch:e.getPitch(),zoom:(i=e.getResolution(),19-Math.log(i/YW)/Math.LN2+1),center:e.getCenter().toArray(),bearing:e.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var t=this._maptalks3DModel.coordinateSystem,e=t.dataToPoint(t.center);this._groundMesh.position.set(e[0],e[1],-.001);var n=new _V.Plane(new _V.Vector3(0,0,1),0),i=t.viewGL.camera.castRay(new _V.Vector2(-1,-1)),r=t.viewGL.camera.castRay(new _V.Vector2(1,1)),o=i.intersectPlane(n),a=r.intersectPlane(n),s=o.dist(a)/t.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(t,e){this._zrLayer&&this._zrLayer.dispose(),e.getZr().painter.delLayer(-1e3)}}),YW=12756274*Math.PI/(256*Math.pow(2,20));function KW(){BW.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}KW.prototype=new BW,KW.prototype.constructor=KW,KW.prototype.type="maptalks3D";const JW=VW("maptalks3D",KW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMaptalksCameraOption())}))}));Jw((function(t){t.registerComponentModel(WW),t.registerComponentView(qW),t.registerCoordinateSystem("maptalks3D",JW),t.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"maptalks3D",query:t},(function(e){e.setMaptalksCameraOption(t)}))}))}));var $W=UV.vec3,QW=jw.isDimensionStacked;const tj=function(t,e){var n=t.getData(),i=t.get("barSize");if(null==i){var r,o,a=e.size,s=e.getAxis("x"),l=e.getAxis("y");r="category"===s.type?.7*s.getBandWidth():.6*Math.round(a[0]/Math.sqrt(n.count())),o="category"===l.type?.7*l.getBandWidth():.6*Math.round(a[1]/Math.sqrt(n.count())),i=[r,o]}else yt(i)||(i=[i,i]);var u=e.getAxis("z").scale.getExtent(),h=function(t){var e=t[0],n=t[1];return!(e>0&&n>0||e<0&&n<0)}(u),c=["x","y","z"].map((function(e){return t.coordDimToDataDim(e)[0]})),d=QW(n,c[2]),f=d?n.getCalculationInfo("stackResultDimension"):c[2];n.each(c,(function(t,r,o,a){var s=n.get(f,a),l=d?s-o:h?0:u[0],c=e.dataToPoint([t,r,l]),p=e.dataToPoint([t,r,s]),g=$W.dist(c,p),m=[0,p[1]"+r.join("
")}(r):ze(mc(r)),a=i.getName(e),s=EU(i,e);St(s)&&s.colorStops&&(s=(s.colorStops[0]||{}).color);var l=Tc(s=s||"transparent"),u=t.name;return"\0-"===u&&(u=""),u=u?ze(u)+(n?": ":"
"):"",n?l+u+o:u+l+(a?ze(a)+": "+o:o)}function uj(t,e,n){n=n||t.getSource();var i=e||Hy(t.get("coordinateSystem"))||["x","y","z"],r=Lx(n,{dimensionsDefine:n.dimensionsDefine||t.get("dimensions"),encodeDefine:n.encodeDefine||t.get("encode"),coordDimensions:i.map((function(e){var n=t.getReferringComponents(e+"Axis3D").models[0];return{type:n&&"category"===n.get("type")?"ordinal":"float",name:e}}))});"cartesian3D"===t.get("coordinateSystem")&&r.forEach((function(e){if(i.indexOf(e.coordDim)>=0){var n=t.getReferringComponents(e.coordDim+"Axis3D").models[0];n&&"category"===n.get("type")&&(e.ordinalMeta=n.getOrdinalMeta())}}));var o=jw.enableDataStack(t,r,{byIndex:!0,stackedCoordDimension:"z"}),a=new Cx(r,t);return a.setCalculationInfo(o),a.initData(n),a}var hj=Lp.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);return null==r&&(r=this.getData().get("z",t)),r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});nt(hj.prototype,qH);const cj=hj;var dj,fj,pj,gj,mj,vj,_j,yj,xj=UV.vec3,wj=UV.mat3,bj=xk.extend((function(){return{attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR"),prevPosition:new xk.Attribute("prevPosition","float",3),prevNormal:new xk.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(t){var e=this.enableNormal,n=this.getBarVertexCount()*t,i=this.getBarTriangleCount()*t;this.vertexCount!==n&&(this.attributes.position.init(n),e?this.attributes.normal.init(n):this.attributes.normal.value=null,this.attributes.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(n))},getBarVertexCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarVertexCount(t):this.enableNormal?24:8},getBarTriangleCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarTriangleCount(t):12},_getBevelBarVertexCount:function(t){return 4*(t+1)*(t+1)*2},_getBevelBarTriangleCount:function(t){return(4*t+3+1)*(2*t+1)*2+4},setColor:function(t,e){for(var n=this.getBarVertexCount(),i=n*(t+1),r=n*t;r0&&this.bevelSegments>0)this._addBevelBar(t,c,g,m,this.bevelSize,this.bevelSegments,v);else{xj.copy(r,c),xj.normalize(r,r),xj.cross(o,g,r),xj.normalize(o,o),xj.cross(i,r,o),xj.normalize(o,o),xj.negate(a,i),xj.negate(s,r),xj.negate(l,o),e(u[0],t,i,m[0]/2),e(u[0],u[0],o,m[2]/2),e(u[1],t,i,m[0]/2),e(u[1],u[1],l,m[2]/2),e(u[2],t,a,m[0]/2),e(u[2],u[2],l,m[2]/2),e(u[3],t,a,m[0]/2),e(u[3],u[3],o,m[2]/2),e(n,t,r,m[1]),e(u[4],n,i,m[0]/2),e(u[4],u[4],o,m[2]/2),e(u[5],n,i,m[0]/2),e(u[5],u[5],l,m[2]/2),e(u[6],n,a,m[0]/2),e(u[6],u[6],l,m[2]/2),e(u[7],n,a,m[0]/2),e(u[7],u[7],o,m[2]/2);var x=this.attributes;if(this.enableNormal){h[0]=i,h[1]=a,h[2]=r,h[3]=s,h[4]=o,h[5]=l;for(var w=this._vertexOffset,b=0;b0&&(f++,h[3]<.99&&(p=!0))}})),a.geometry.setBarCount(f);var g=n.getLayout("orient"),m=this._barIndexOfData=new Int32Array(n.count());f=0;n.each((function(t){if(n.hasValue(t)){var e=n.getItemLayout(t),i=e[0],r=e[1],a=e[2],s=4*t;h[0]=c[s++],h[1]=c[s++],h[2]=c[s++],h[3]=c[s++],h[3]>0&&(o._barMesh.geometry.addBar(i,r,g,a,h,t),m[t]=f++)}else m[t]=-1})),a.geometry.dirty(),a.geometry.updateBoundingBox();var v=a.material;v.transparent=p,v.depthMask=!p,a.geometry.sortTriangles=p,this._initHandler(t,e)},_initHandler:function(t,e){var n=t.getData(),i=this._barMesh,r="cartesian3D"===t.coordinateSystem.type;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=i.geometry.getDataIndexOfVertex(t.triangle[0]);a!==o&&(this._downplay(o),this._highlight(a),this._labelsBuilder.updateLabels([a]),r&&e.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get("x",a),n.get("y",a),n.get("z",a,!0)]})),o=a,i.dataIndex=a}),this),i.on("mouseout",(function(t){this._downplay(o),this._labelsBuilder.updateLabels(),o=-1,i.dataIndex=-1,r&&e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=e.getItemModel(t).getModel("emphasis.itemStyle"),r=i.get("color"),o=i.get("opacity");if(null==r)r=zi(EU(e,t),-.4);null==o&&(o=OU(e,t));var a=_V.parseColor(r);a[3]*=o,this._barMesh.geometry.setColor(n,a),this._api.getZr().refresh()}}},_downplay:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=EU(e,t),r=OU(e,t),o=_V.parseColor(i);o[3]*=r,this._barMesh.geometry.setColor(n,o),this._api.getZr().refresh()}}},highlight:function(t,e,n,i){this._toggleStatus("highlight",t,e,n,i)},downplay:function(t,e,n,i){this._toggleStatus("downplay",t,e,n,i)},_toggleStatus:function(t,e,n,i,r){var o=e.getData(),a=xB.queryDataIndex(o,r),s=this;null!=a?ct(sj.normalizeToArray(a),(function(e){"highlight"===t?this._highlight(e):this._downplay(e)}),this):o.each((function(e){"highlight"===t?s._highlight(e):s._downplay(e)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Mj),t.registerSeriesModel(cj),oj(t),t.registerProcessor((function(t,e){t.eachSeriesByType("bar3d",(function(t){var e=t.getData();e.filterSelf((function(t){return e.hasValue(t)}))}))}))}));const Cj=Lp.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(t,e){return uj(this)},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Lj(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||o=0){var m=3*l,v=new QN(this._points[m],this._points[m+1],this._points[m+2]);o.push({dataIndex:l,point:v,pointWorld:v.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(v)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Dj),t.registerSeriesModel(Cj),t.registerLayout((function(t,e){t.eachSeriesByType("line3D",(function(t){var e=t.getData(),n=t.coordinateSystem;if(n){if("cartesian3D"!==n.type)return void 0;var i=new Float32Array(3*e.count()),r=[],o=[],a=n.dimensions.map((function(e){return t.coordDimToDataDim(e)[0]}));n&&e.each(a,(function(t,e,a,s){r[0]=t,r[1]=e,r[2]=a,n.dataToPoint(r,o),i[3*s]=o[0],i[3*s+1]=o[1],i[3*s+2]=o[2]})),e.setLayout("points",i)}}))}))}));const Ij=Lp.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Pj(t,e,n){(e=e||document.createElement("canvas")).width=t,e.height=t;var i=e.getContext("2d");return n&&n(i),e}var Ej={getMarginByStyle:function(t){var e=t.minMargin||0,n=0;t.stroke&&"none"!==t.stroke&&(n=null==t.lineWidth?1:t.lineWidth);var i=t.shadowBlur||0,r=t.shadowOffsetX||0,o=t.shadowOffsetY||0,a={};return a.left=Math.max(n/2,-r+i,e),a.right=Math.max(n/2,r+i,e),a.top=Math.max(n/2,-o+i,e),a.bottom=Math.max(n/2,o+i,e),a},createSymbolSprite:function(t,e,n,i){var r=function(t,e,n,i){yt(e)||(e=[e,e]);var r=Ej.getMarginByStyle(n,i),o=e[0]+r.left+r.right,a=e[1]+r.top+r.bottom,s=jv(t,0,0,e[0],e[1]),l=Math.max(o,a);s.x=r.left,s.y=r.top,o>a?s.y+=(l-a)/2:s.x+=(l-o)/2;var u=s.getBoundingRect();return s.x-=u.x,s.y-=u.y,s.setStyle(n),s.update(),s.__size=l,s}(t,e,n),o=Ej.getMarginByStyle(n);return{image:Pj(r.__size,i,(function(t){v_(t,r)})),margin:o}},createSDFFromCanvas:function(t,e,n,i){return Pj(e,i,(function(e){var i=t.getContext("2d").getImageData(0,0,t.width,t.height);e.putImageData(function(t,e,n){var i=e.width,r=e.height,o=t.canvas.width,a=t.canvas.height,s=i/o,l=r/a;function u(t){return t<128?1:-1}function h(t,o){var a=1/0;t=Math.floor(t*s);for(var h=(o=Math.floor(o*l))*i+t,c=u(e.data[4*h]),d=Math.max(o-n,0);d=2e4},doSortVertices:function(t,e){var n=this.indices,i=Nj.create();if(!n){n=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var r=0;r.05);else for(r=0;r<3;r++)this._progressiveQuickSort(3*e+r);this.dirtyIndices()},_simpleSort:function(t){var e=this._zList,n=this.indices;function i(t,n){return e[n]-e[t]}t?Array.prototype.sort.call(n,i):CU.sort(n,i,0,n.length-1)},_progressiveQuickSort:function(t){var e=this._zList,n=this.indices;this._quickSort=this._quickSort||new CU,this._quickSort.step(n,(function(t,n){return e[n]-e[t]}),t)}};var kj=UV.vec4;_V.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");var zj=_V.Mesh.extend((function(){var t=new _V.Geometry({dynamic:!0,attributes:{color:new _V.Geometry.Attribute("color","float",4,"COLOR"),position:new _V.Geometry.Attribute("position","float",3,"POSITION"),size:new _V.Geometry.Attribute("size","float",1),prevPosition:new _V.Geometry.Attribute("prevPosition","float",3),prevSize:new _V.Geometry.Attribute("prevSize","float",1)}});Object.assign(t,Rj);var e=new _V.Material({shader:_V.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});e.enableTexture("sprite"),e.define("both","VERTEX_COLOR"),e.define("both","VERTEX_SIZE");var n=new _V.Texture2D({image:document.createElement("canvas"),flipY:!1});return e.set("sprite",n),t.pick=this._pick.bind(this),{geometry:t,material:e,mode:_V.Mesh.POINTS,sizeScale:1}}),{_pick:function(t,e,n,i,r,o){var a=this._positionNDC;if(a)for(var s=n.viewport,l=2/s.width,u=2/s.height,h=this.geometry.vertexCount-1;h>=0;h--){var c,d=a[2*(c=this.geometry.indices?this.geometry.indices[h]:h)],f=a[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(t>d-p*l&&tf-p*u&&e2?(p=this._updateSymbolSprite(t,d,h,c),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(r-i);var g=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var m=function(t){const e=t.getVisual("style");if(e)return e[t.getVisual("drawType")]}(a),v=function(t){return t.getVisual("style").opacity}(a);_V.parseColor(m,g),g[3]*=v,s.set({color:g,u_Size:h.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(r-i),u.color.init(r-i),this._originalOpacity=new Float32Array(r-i);for(var _=a.getLayout("points"),y=u.position.value,x=0;x1?(a[0]=n.maxSize,a[1]=n.maxSize/n.aspect):(a[1]=n.maxSize,a[0]=n.maxSize*n.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===n.type&&(r=this._symbolSize,o=a,r&&o&&r[0]===o[0]&&r[1]===o[1])&&this._lineWidth===e.lineWidth||(Oj.createSymbolSprite(n.type,a,{fill:"#fff",lineWidth:e.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),Oj.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=n.type,this._symbolSize=a,this._lineWidth=e.lineWidth),this._spriteImageCanvas.width/n.maxSize*i},_updateMaterial:function(t,e){var n="lighter"===t.get("blendMode")?_V.additiveBlend:null,i=this._mesh.material;i.blend=n,i.set("lineWidth",e.lineWidth/20);var r=_V.parseColor(e.stroke);i.set("strokeColor",r),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(t,e,n){var i=t.getData(),r=this._mesh.geometry,o=r.attributes.position.value,a=(e=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,e,n),this._labelsBuilder.getLabelPosition=function(t,n,i){var r=3*(t-e);return[o[r],o[r+1],o[r+2]]},this._labelsBuilder.getLabelDistance=function(t,n,i){return r.attributes.size.get(t-e)/a/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,t)},_updateHandler:function(t,e,n){var i,r=t.getData(),o=this._mesh,a=this,s=-1,l=t.coordinateSystem&&"cartesian3D"===t.coordinateSystem.type;l&&(i=t.coordinateSystem.model),o.seriesIndex=t.seriesIndex,o.off("mousemove"),o.off("mouseout"),o.on("mousemove",(function(e){var u=e.vertexIndex+a._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(r,s),this.highlight(r,u),this._labelsBuilder.updateLabels([u])),l&&n.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get(t.coordDimToDataDim("x")[0],u),r.get(t.coordDimToDataDim("y")[0],u),r.get(t.coordDimToDataDim("z")[0],u)],grid3DIndex:i.componentIndex})),o.dataIndex=u,s=u}),this),o.on("mouseout",(function(t){var e=t.vertexIndex+a._startDataIndex;this.highlightOnMouseover&&(this.downplay(r,e),this._labelsBuilder.updateLabels()),s=-1,o.dataIndex=-1,l&&n.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(t,e,n){var i=t.getData();if(this._mesh){var r=this._mesh.geometry.attributes.position.value,o=i.getLayout("points");if(this.is2D)for(var a=0;athis._endDataIndex||ethis._endDataIndex||e 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const lZ=_V.Mesh.extend((function(){var t=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.trail2.vertex"),_V.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),e=new XV({dynamic:!0});return e.createAttribute("dist","float",1),e.createAttribute("distAll","float",1),e.createAttribute("start","float",1),{geometry:e,material:t,culling:!1,$ignorePicking:!0}}),{updateData:function(t,e,n){var i=t.hostModel,r=this.geometry,o=i.getModel("effect"),a=o.get("trailWidth")*e.getDevicePixelRatio(),s=o.get("trailLength"),l=i.get("effect.constantSpeed"),u=1e3*i.get("effect.period"),h=null!=l;h?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[h?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");r.trailLength=s,this.material.set("trailLength",s),r.resetOffset(),["position","positionPrev","positionNext"].forEach((function(t){r.attributes[t].value=n.attributes[t].value}));["dist","distAll","start","offset","color"].forEach((function(t){r.attributes[t].init(r.vertexCount)})),r.indices=n.indices;var d=[],f=o.get("trailColor"),p=o.get("trailOpacity"),g=null!=f,m=null!=p;this.updateWorldTransform();var v=this.worldTransform.x.len(),_=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,w=0;t.each((function(e){var i=t.getItemLayout(e),o=m?p:OU(t,e),s=EU(t,e);null==o&&(o=1),(d=_V.parseColor(g?f:s,d))[3]*=o;for(var l=c?n.getPolylineVertexCount(i):n.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),b=0,T=[],S=[],M=x;Mx&&(b+=sZ.dist(T,S)),r.attributes.dist.set(M,b),sZ.copy(S,T);w=Math.max(w,b);var C=Math.random()*(h?b:u);for(M=x;M0?1:-1)*a/2),r.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*w*s),this.material.set("spotIntensity",o.get("spotIntensity")),r.dirty()},setAnimationTime:function(t){this.material.set("time",t)}});_V.Shader.import(gG);const uZ=Fm.extend({type:"lines3D",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this._meshLinesMaterial=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new _V.Mesh({geometry:new XV,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new lZ},render:function(t,e,n){this.groupGL.add(this._linesMesh);var i=t.coordinateSystem,r=t.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(t,e,n);var o=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var a=this._trailMesh;if(a.stopAnimation(),t.get("effect.show")){this.groupGL.add(a),a.updateData(r,n,this._linesMesh.geometry),a.__time=a.__time||0;var s=36e5;this._curveEffectsAnimator=a.animate("",{loop:!0}).when(s,{__time:s}).during((function(){a.setAnimationTime(a.__time)})).start()}else this.groupGL.remove(a),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===t.get("blendMode")?_V.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var t=this._curveEffectsAnimator;t&&(t.isPaused()?t.resume():t.pause())},_updateLines:function(t,e,n){var i=t.getData(),r=t.coordinateSystem,o=this._linesMesh.geometry,a=t.get("polyline");o.expandLine=!0;var s=function(t){return null!=t.radius?t.radius:null!=t.size?Math.max(t.size[0],t.size[1],t.size[2]):100}(r);o.segmentScale=s/20;var l="lineStyle.width".split("."),u=n.getDevicePixelRatio(),h=0;i.each((function(t){var e=i.getItemModel(t).get(l);null==e&&(e=1),i.setItemVisual(t,"lineWidth",e),h=Math.max(e,h)})),o.useNativeLine=!1;var c=0,d=0;i.each((function(t){var e=i.getItemLayout(t);a?(c+=o.getPolylineVertexCount(e),d+=o.getPolylineTriangleCount(e)):(c+=o.getCubicCurveVertexCount(e[0],e[1],e[2],e[3]),d+=o.getCubicCurveTriangleCount(e[0],e[1],e[2],e[3]))})),o.setVertexCount(c),o.setTriangleCount(d),o.resetOffset();var f=[];i.each((function(t){var e=i.getItemLayout(t),n=EU(i,t),r=OU(i,t),s=i.getItemVisual(t,"lineWidth")*u;null==r&&(r=1),(f=_V.parseColor(n,f))[3]*=r,a?o.addPolyline(e,f,s):o.addCubicCurve(e[0],e[1],e[2],e[3],f,s)})),o.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function hZ(t,e){for(var n=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,t,h,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",_V.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(t,n),this._updateAnimation(t)},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new _V.Mesh({geometry:new _V.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.sm.depth.vertex"),_V.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,PU),t},_initHandler:function(t,e){var n=t.getData(),i=this._surfaceMesh,r=t.coordinateSystem;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=function(t,e){for(var n=1/0,r=-1,o=[],a=0;a=0){var s=[];i.geometry.attributes.position.get(a,s);for(var l=r.pointToData(s),u=1/0,h=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(g-1)*6),b=function(t,e,n){n[1]=t*g+e,n[0]=t*g+e+1,n[3]=(t+1)*g+e+1,n[2]=(t+1)*g+e},T=!1;if(l){var S=[],M=[],C=0;m?h.init(r.vertexCount):h.value=null;for(var L=[[],[],[]],A=[],D=[],I=mZ.create(),P=function(t,e,n){var i=3*e;return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n},E=new Float32Array(a.length),O=new Float32Array(a.length/3*4),N=0;N0;){if(Math.floor(s/h)===s/h)return[h,s/h];h--}return[h=Math.floor(Math.sqrt(s)),h]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function _Z(t,e){for(var n=[],i=0;i "+f)),h++)}var p=Lx(t,{coordDimensions:["value"]});(s=new Cx(p,n)).initData(t);var g=new Cx(["value"],n);return g.initData(u,l),r&&r(s,g),CZ({mainData:s,struct:o,structAttr:"graph",datas:{node:s,edge:g},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(i,n,this,!0,(function(t,n){t.wrapMethod("getItemModel",(function(t){const e=r._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));const i=e.getModel([]).getModel;function o(t,e){const n=i.call(this,t,e);return n.resolveParentPath=a,n}function a(t){if(t&&("label"===t[0]||"label"===t[1])){const e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}n.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=a,t.getModel=o,t}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),l=ze(l.join(" > ")),r.value&&(l+=" : "+ze(r.value)),l}return LZ.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=(this.option.categories||[]).map((function(t){return null!=t.value?t:Object.assign({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t,!0)}))},setView:function(t){null!=t.zoom&&(this.option.zoom=t.zoom),null!=t.offset&&(this.option.offset=t.offset)},setNodePosition:function(t){for(var e=0;e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(DZ.dist(t,e)+DZ.dist(n,e)+DZ.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(IZ)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(IZ)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?0:2*(e-1)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=e[0],u=e[1],h=n[0],c=n[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(t,e,n,i),g=p*p,m=g*p,v=3*p,_=3*g,y=6*g,x=6*m,w=a-2*l+h,b=s-2*u+c,T=3*(l-h)-a+d,S=3*(u-c)-s+f,M=a,C=s,L=(l-a)*v+w*_+T*m,A=(u-s)*v+b*_+S*m,D=w*y+T*x,I=b*y+S*x,P=T*x,E=S*x,O=0,N=0,R=Math.ceil(1/p),k=new Float32Array(3*(R+1)),z=(k=[],0);for(N=0;N1&&(M=L>0?Math.min(M,d):Math.max(M,d),C=A>0?Math.min(C,f):Math.max(C,f));this.addPolyline(k,r,o)},addLine:function(t,e,n,i){this.addPolyline([t,e],n,i)},addPolyline:function(){var t=DZ.create(),e=DZ.create(),n=DZ.create(),i=DZ.create(),r=[],o=[],a=[];return function(s,l,u,h,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==h&&(h=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,g=this.attributes.position,m=this.attributes.color,v=this.attributes.offset,_=this.attributes.normal,y=this.indices,x=this._vertexOffset,w=0;w1&&(g.copy(x,x-1),m.copy(x,x-1),x++);else{var S;if(w0){DZ.sub(t,r,a),DZ.sub(e,o,r),DZ.normalize(t,t),DZ.normalize(e,e),DZ.add(i,t,e),DZ.normalize(i,i);var M=u/2*Math.min(1/DZ.dot(t,i),2);n[0]=-i[1],n[1]=i[0],S=M}else DZ.sub(t,o,r),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],S=u/2}else DZ.sub(t,r,a),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],S=u/2;_.set(x,n),_.set(x+1,n),v.set(x,S),v.set(x+1,-S),DZ.copy(a,r),g.set(x,r),g.set(x+1,r),m.set(x,f),m.set(x+1,f),x+=2}if(this.useNativeLine)m.set(x,f),g.set(x,r),x++;else if(w>0){var C=3*this._faceOffset;(y=this.indices)[C]=x-4,y[C+1]=x-3,y[C+2]=x-2,y[C+3]=x-3,y[C+4]=x-1,y[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=t 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var OZ={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function NZ(t){var e={type:_V.Texture.FLOAT,minFilter:_V.Texture.NEAREST,magFilter:_V.Texture.NEAREST};this._positionSourceTex=new _V.Texture2D(e),this._positionSourceTex.flipY=!1,this._positionTex=new _V.Texture2D(e),this._positionPrevTex=new _V.Texture2D(e),this._forceTex=new _V.Texture2D(e),this._forcePrevTex=new _V.Texture2D(e),this._weightedSumTex=new _V.Texture2D(e),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new _V.Texture2D(e),this._globalSpeedPrevTex=new _V.Texture2D(e),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new aB({fragment:_V.Shader.source("clay.compositor.output")});var n=function(t){t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE)};this._edgeForceMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node1:new _V.Geometry.Attribute("node1","float",2),node2:new _V.Geometry.Attribute("node2","float",2),weight:new _V.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._weightedSumMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._framebuffer=new Sz({depthBuffer:!1}),this._dummyCamera=new _V.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}NZ.prototype.updateOption=function(t){for(var e in OZ)this[e]=OZ[e];var n=this._nodes.length;if(this.jitterTolerence=n>5e4?10:n>5e3?1:.1,this.scaling=n>100?2:10,t)for(var e in OZ)null!=t[e]&&(this[e]=t[e]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,r=0;rt},NZ.prototype._swapTexture=function(){var t=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=t;t=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=t;t=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=t},NZ.prototype._initFromSource=function(t){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(t),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(t),t.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(t)},NZ.prototype._resize=function(t,e){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(n){this[n].width=t,this[n].height=e,this[n].dirty()}),this)},NZ.prototype.dispose=function(t){this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.dispose(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.dispose(t),this._globalSpeedPrevTex.dispose(t)};const RZ=NZ;const kZ=function(){var t=function(){return new Float32Array(2)},e=function(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)},n=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t},r=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},o=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},a=function(t,e){return t[0]=e[0],t[1]=e[1],t},s=function(t,e,n){return t[0]=e,t[1]=n,t};function l(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var u=l.prototype;function h(){this.position=new Float32Array(2),this.force=t(),this.forcePrev=t(),this.mass=1,this.inDegree=0,this.outDegree=0}function c(t,e){this.source=t,this.target=e,this.weight=1}function d(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new l,this.rootRegion.centerOfMass=t(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}u.beforeUpdate=function(){for(var t=0;t=t&&this.bbox[1]<=e&&this.bbox[3]>=e},u.setBBox=function(t,e,n,i){this.bbox[0]=t,this.bbox[1]=e,this.bbox[2]=n,this.bbox[3]=i,this.size=(n-t+i-e)/2},u._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new l,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},u._addNodeToSubRegion=function(t){var e=this.findSubRegion(t.position[0],t.position[1]),n=this.bbox;if(!e){var i=(n[0]+n[2])/2,r=(n[1]+n[3])/2,o=(n[2]-n[0])/2,a=(n[3]-n[1])/2,s=t.position[0]>=i?1:0,l=t.position[1]>=r?1:0;(e=this._newSubRegion()).setBBox(s*o+n[0],l*a+n[1],(s+1)*o+n[0],(l+1)*a+n[1])}e.addNode(t)},u._updateCenterOfMass=function(t){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var e=this.centerOfMass[0]*this.mass,n=this.centerOfMass[1]*this.mass;e+=t.position[0]*t.mass,n+=t.position[1]*t.mass,this.mass+=t.mass,this.centerOfMass[0]=e/this.mass,this.centerOfMass[1]=n/this.mass};var f=d.prototype;f.initNodes=function(t,e,n){var i=e.length;this.nodes.length=0;for(var r=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(h):this.applyNodeGravity(h))}for(l=0;l0&&(m=Math.min(m/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=m;for(l=0;l0&&(_=Math.min(y*_,10)/y,i(u.position,u.position,u.force,_))}},f.applyRegionToNodeRepulsion=function(){var e=t();return function(t,n){if(t.node)this.applyNodeToNodeRepulsion(t.node,n,!0);else{o(e,n.position,t.centerOfMass);var r=e[0]*e[0]+e[1]*e[1];if(r>this.barnesHutTheta*t.size*t.size){var a=this.scaling*n.mass*t.mass/r;i(n.force,n.force,e,a)}else for(var s=0;s0)s=this.scaling*t.mass*n.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*t.mass*n.mass}}else s=this.scaling*t.mass*n.mass/a;i(t.force,t.force,e,s),i(n.force,n.force,e,-s)}}}}(),f.applyEdgeAttraction=function(){var e=t();return function(t){var r=t.source,a=t.target;o(e,r.position,a.position);var s,l,u=n(e);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence),this.preventOverlap&&(u=u-r.size-a.size)<=0||(l=this.linLogMode?-s*Math.log(u+1)/(u+1):-s,i(r.force,r.force,e,l),i(a.force,a.force,e,-l))}}(),f.applyNodeGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position);var r=n(e);i(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),f.applyNodeStrongGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position),i(t.force,t.force,e,this.gravity*t.mass)}}(),f.updateBBox=function(){for(var t=1/0,e=1/0,n=-1/0,i=-1/0,r=0;r5e4?10:o>5e3?1:.1,e.scaling=o>100?2:10,e.barnesHutOptimize=o>1e3,t)for(var n in BZ)null!=t[n]&&(e[n]=t[n]);if(!e.gravityCenter){for(var a=[1/0,1/0],s=[-1/0,-1/0],l=0;lt},FZ.prototype.getNodePosition=function(t,e){if(e||(e=new Float32Array(2*this._nodes.length)),this._positionArr)for(var n=0;n0?1.1:.9,o=Math.max(Math.min(this._zoom*r,this.maxZoom),this.minZoom);r=o/this._zoom;var a=this._convertPos(n,i),s=(a.x-this._dx)*(r-1),l=(a.y-this._dy)*(r-1);this._dx-=s,this._dy-=l,this._zoom=o,this._needsUpdate=!0}}},dispose:function(){var t=this.zr;t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("globalout",this._mouseUpHandler),t.animation.off("frame",this._update)}});const HZ=GZ;var UZ=UV.vec2;_V.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var WZ=1;const jZ=Fm.extend({type:"graphGL",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this.viewGL=new NH("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Vj(!0,e),this._forceEdgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2),color:new _V.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:_V.Mesh.LINES}),this._edgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new EZ({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new HZ({zr:e.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(t,e,n){this.groupGL.add(this._pointsBuilder.rootNode),this._model=t,this._api=n,this._initLayout(t,e,n),this._pointsBuilder.update(t,e,n),this._forceLayoutInstance instanceof RZ||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(t,n),this._control.off("update"),this._control.on("update",(function(){n.dispatchAction({type:"graphGLRoam",seriesId:t.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(xB.firstNotNull(t.get("zoom"),1)),this._control.setOffset(t.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),n.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,t.get("focusNodeAdjacency")){var r=t.get("focusNodeAdjacencyOn");"click"===r?n.getZr().on("click",this._clickHandler):"mouseover"===r&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?e!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._mouseOutHandler(t),this._lastMouseOverDataIndex=e}},_mouseOutHandler:function(t){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(t,e){var n=this._forceEdgesMesh.geometry,i=e.getEdgeData(),r=0,o=this._forceLayoutInstance,a=2*i.count();n.attributes.node.init(a),n.attributes.color.init(a),i.each((function(e){var a=t[e];n.attributes.node.set(r,o.getNodeUV(a.node1)),n.attributes.node.set(r+1,o.getNodeUV(a.node2));var s=EU(i,a.dataIndex),l=_V.parseColor(s);l[3]*=xB.firstNotNull(OU(i,a.dataIndex),1),n.attributes.color.set(r,l),n.attributes.color.set(r+1,l),r+=2})),n.dirty()},_updateMeshLinesGeometry:function(){var t=this._model.getEdgeData(),e=this._edgesMesh.geometry,n=(t=this._model.getEdgeData(),this._model.getData().getLayout("points"));e.resetOffset(),e.setVertexCount(t.count()*e.getLineVertexCount()),e.setTriangleCount(t.count()*e.getLineTriangleCount());var i=[],r=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*t.count()),this._edgeIndicesMap=new Float32Array(t.count()),t.each((function(a){var s=t.graph.getEdgeByIndex(a),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;i[0]=n[l],i[1]=n[l+1],r[0]=n[u],r[1]=n[u+1];var h=EU(t,s.dataIndex),c=_V.parseColor(h);c[3]*=xB.firstNotNull(OU(t,s.dataIndex),1);var d=t.getItemModel(s.dataIndex),f=xB.firstNotNull(d.get(o),1)*this._api.getDevicePixelRatio();e.addLine(i,r,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=a}),this),e.dirty()},_updateForceNodesGeometry:function(t){for(var e=this._pointsBuilder.getPointsMesh(),n=[],i=0;i=f&&(l._syncNodePosition(t),d=0),n.getZr().refresh(),yV((function(){p(e)}))}))};yV((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(r.layer.renderer),l._forceLayoutInstanceToDispose=null),p(u)})),this._layouting=!0}}},stopLayout:function(t,e,n,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(t),this._updateAfterLayout(t,e,n)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(t){var e=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);t.getData().setLayout("points",e),t.setNodePosition(e)},_updateAfterLayout:function(t,e,n){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(t,e,n),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(t,e,n,i){var r=this._model.getData();this._downplayAll();var o=i.dataIndex,a=r.graph,s=[],l=a.getNodeByIndex(o);s.push(l),l.edges.forEach((function(t){t.dataIndex<0||(t.node1!==l&&s.push(t.node1),t.node2!==l&&s.push(t.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(t){this._pointsBuilder.highlight(r,t.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(t){return t.dataIndex})));var u=[];l.edges.forEach((function(t){t.dataIndex>=0&&(this._highlightEdge(t.dataIndex),u.push(t))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(t,e,n,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(t){var e=this._model.getEdgeData().getItemModel(t),n=_V.parseColor(e.get("emphasis.lineStyle.color")||e.get("lineStyle.color")),i=xB.firstNotNull(e.get("emphasis.lineStyle.opacity"),e.get("lineStyle.opacity"),1);n[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],n)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(t){this._pointsBuilder.downplay(this._model.getData(),t.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(t){this._downplayEdge(t.dataIndex)}),this)},_downplayEdge:function(t){var e=this._getColor(t,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)},_setEdgeFade:function(){var t=[];return function(e,n){this._getColor(e,t),t[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)}}(),_getColor:function(t,e){for(var n=0;n<4;n++)e[n]=this._originalEdgeColors[4*t+n];return e},_fadeOutEdgesAll:function(t){this._model.getData().graph.eachEdge((function(e){this._setEdgeFade(e.dataIndex,t)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(t,e){this.viewGL.setViewport(0,0,e.getWidth(),e.getHeight(),e.getDevicePixelRatio());for(var n=this.viewGL.camera,i=t.getData().getLayout("points"),r=UZ.create(1/0,1/0),o=UZ.create(-1/0,-1/0),a=[],s=0;sn.left&&un.top)){var h=Math.max(o[0]-r[0],10),c=h/e.getWidth()*e.getHeight();h*=1.4,c*=1.4,r[0]-=.2*h,n.left=r[0],n.top=l-c/2,n.bottom=l+c/2,n.right=h+r[0],n.near=0,n.far=100}},dispose:function(){var t=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(t),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});function ZZ(t){return t instanceof Array||(t=[t,t]),t}Jw((function(t){function e(){}t.registerChartView(jZ),t.registerSeriesModel(AZ),t.registerVisual((function(t){const e={};t.eachSeriesByType("graphGL",(function(t){var n=t.getCategoriesData(),i=t.getData(),r={};n.each((function(i){var o=n.getName(i);r["ec-"+o]=i;var a=n.getItemModel(i),s=a.getModel("itemStyle").getItemStyle();s.fill||(s.fill=t.getColorFromPalette(o,e)),n.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(t){var e=this._vertexOffset;this.attributes.position.set(e,[t[0],t[1],1]),this.attributes.position.set(e+1,[t[0],t[1],-1]),this.attributes.position.set(e+2,[t[0],t[1],2]),this.attributes.position.set(e+3,[t[0],t[1],-2]),this.setTriangleIndices(this._faceOffset++,[e,e+1,e+2]),this.setTriangleIndices(this._faceOffset++,[e+1,e+2,e+3]),this._vertexOffset+=4}});LN.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var YZ=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new sk({type:QR.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};YZ.prototype={constructor:YZ,init:function(){var t={type:QR.FLOAT,minFilter:QR.NEAREST,magFilter:QR.NEAREST,useMipmap:!1};this._spawnTexture=new sk(t),this._particleTexture0=new sk(t),this._particleTexture1=new sk(t),this._frameBuffer=new Sz({depthBuffer:!1}),this._particlePass=new aB({fragment:LN.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new aB({fragment:LN.source("clay.compositor.downsample")});var e=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderPoints.vertex"),LN.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:ek.POINTS,geometry:new xk({dynamic:!0,mainAttribute:"texcoord0"})}),n=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderLines.vertex"),LN.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new qZ,culling:!1}),i=new ek({material:new HO({shader:new LN(LN.source("ecgl.color.vertex"),LN.source("ecgl.color.fragment"))}),geometry:new Dz});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=e,this._particleLinesMesh=n,this._lastFrameFullQuadMesh=i,this._camera=new nB,this._thisFrameTexture=new sk,this._lastFrameTexture=new sk},setParticleDensity:function(t,e){for(var n=new Float32Array(4*(t*e)),i=0,r=this.particleLife,o=0;o0?t[t.length-1]:this._lastFrameTexture},setRegion:function(t){this._particlePass.setUniform("region",t)},resize:function(t,e){this._lastFrameTexture.width=t*this._supersampling,this._lastFrameTexture.height=e*this._supersampling,this._thisFrameTexture.width=t*this._supersampling,this._thisFrameTexture.height=e*this._supersampling,this._width=t,this._height=e},setParticleSize:function(t){var e=this._getParticleMesh();if(t<=2)return e.material.disableTexture("spriteTexture"),void(e.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new sk),this._spriteTexture.image&&this._spriteTexture.image.width===t||(this._spriteTexture.image=function(t){var e=document.createElement("canvas");e.width=e.height=t;var n=e.getContext("2d");return n.fillStyle="#fff",n.arc(t/2,t/2,t/2,0,2*Math.PI),n.fill(),e}(t),this._spriteTexture.dirty()),e.material.transparent=!0,e.material.enableTexture("spriteTexture"),e.material.set("spriteTexture",this._spriteTexture),this._particleSize=t},setGradientTexture:function(t){var e=this._getParticleMesh().material;e[t?"enableTexture":"disableTexture"]("gradientTexture"),e.setUniform("gradientTexture",t)},setColorTextureImage:function(t,e){this._getParticleMesh().material.setTextureImage("colorTexture",t,e,{flipY:!0})},setParticleType:function(t){this._particleType=t},clearFrame:function(t){var e=this._frameBuffer;e.attach(this._lastFrameTexture),e.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),e.unbind(t)},setSupersampling:function(t){this._supersampling=t,this.resize(this._width,this._height)},_updateDownsampleTextures:function(t,e){for(var n=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/e.getDevicePixelRatio())/Math.log(2)),0),r=2,o=this._width*this._supersampling,a=this._height*this._supersampling,s=0;s=359&&(r[0]>0&&(r[0]=0),o[0]1?(e.material.shader!==this._meshLinesShader&&e.material.attachShader(this._meshLinesShader),e.mode=_V.Mesh.TRIANGLES):(e.material.shader!==this._nativeLinesShader&&e.material.attachShader(this._nativeLinesShader),e.mode=_V.Mesh.LINES),n=n||0,i=i||r.count(),s.resetOffset();var h=0,c=0,d=[],f=[],p=[],g=[],m=[],v=.3,_=.7;function y(){f[0]=d[0]*_+g[0]*v-(d[1]-g[1])*o,f[1]=d[1]*_+g[1]*v-(g[0]-d[0])*o,p[0]=d[0]*v+g[0]*_-(d[1]-g[1])*o,p[1]=d[1]*v+g[1]*_-(g[0]-d[0])*o}if(a||0!==o)for(var x=n;x{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"graphGL"===t.componentSubType?e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},n.echartsOption);return i.setOption(e.utils.deepMergeObj(r,t)),i.on("click",(t=>{const i=n.onClickElement.bind(e);return e.utils.addActionToUrl(e,t),"graph"===t.componentSubType?i("edge"===t.dataType?"link":"node",t.data):"graphGL"===t.componentSubType?i("node",t.data):"lines"===t.componentSubType?i("link",t.data.link):!t.data.cluster&&i("node",t.data.node)}),{passive:!0}),i}generateGraphOption(t,e){const n=[],i=e.config,r=t.nodes.map((t=>{const n=e.utils.fastDeepCopy(t),{nodeStyleConfig:r,nodeSizeConfig:o,nodeEmphasisConfig:a}=e.utils.getNodeStyle(t,i,"graph");n.itemStyle=r,n.symbolSize=o,n.emphasis={itemStyle:a.nodeStyle,symbolSize:a.nodeSize};let s="";return"string"==typeof t.label?s=t.label:"string"==typeof t.name?s=t.name:void 0!==t.id&&null!==t.id&&(s=String(t.id)),n.name=s,n._source=e.utils.fastDeepCopy(t),n})),o=t.links.map((t=>{const n=e.utils.fastDeepCopy(t),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,i,"graph");return n.lineStyle=r,n.emphasis={lineStyle:o.linkStyle},n})),a={...i.graphConfig.series},s={...a.label||{}};if("number"==typeof e.config.showGraphLabelsAtZoom&&e.config.showGraphLabelsAtZoom>0){const t=e.config.showGraphLabelsAtZoom;s.formatter=n=>(()=>{try{const t=e.echarts.getOption(),n=(Array.isArray(t.series)?t.series:[]).find((t=>t&&"network-graph"===t.id));return n&&"number"==typeof n.zoom?n.zoom:1}catch(t){return 1}})()>=t&&n&&n.data&&n.data.name||""}a.label=s;const l=[{...a,id:"network-graph",type:"graphGL"===i.graphConfig.series.type?"graphGL":"graph",layout:"graphGL"===i.graphConfig.series.type?"forceAtlas2":i.graphConfig.series.layout,nodes:r,links:o}];return{legend:n.length?{data:n}:void 0,series:l,...i.graphConfig.baseOptions}}generateMapOption(t,e,n=[]){const i=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];r.forEach((n=>{if(n.properties&&(t.flatNodes||(a[n.id]=e.utils.fastDeepCopy(n))),!n.properties||!n.properties._featureType||"Point"===n.properties._featureType)if(n.properties){const{location:t}=n.properties;if(t&&t.lng&&t.lat){const{nodeEmphasisConfig:r}=e.utils.getNodeStyle(n,i,"map");let o="";"string"==typeof n.label?o=n.label:"string"==typeof n.name?o=n.name:void 0!==n.id&&null!==n.id&&(o=String(n.id)),l.push({name:o,value:[t.lng,t.lat],emphasis:{itemStyle:r.nodeStyle,symbolSize:r.nodeSize},node:n,_source:e.utils.fastDeepCopy(n)})}else console.error(`Node ${n.id} position is undefined!`)}else console.error(`Node ${n.id} position is undefined!`)})),o.forEach((t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:n,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,i,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:n,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)})),l=l.concat(n);const u=[{id:"geo-map",type:"effectScatter"===i.mapOptions.nodeConfig.type?"effectScatter":"scatter",name:"nodes",coordinateSystem:"leaflet",data:l,animationDuration:1e3,label:i.mapOptions.nodeConfig.label,itemStyle:{color:t=>{if(t.data&&t.data.cluster&&t.data.itemStyle&&t.data.itemStyle.color)return t.data.itemStyle.color;if(t.data&&t.data.node&&t.data.node.category){const e=i.nodeCategories.find((e=>e.name===t.data.node.category));return e&&e.nodeStyle&&e.nodeStyle.color||i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}},symbolSize:(t,n)=>{if(n.data&&n.data.cluster)return i.mapOptions.clusterConfig&&i.mapOptions.clusterConfig.symbolSize||30;if(n.data&&n.data.node){const{nodeSizeConfig:t}=e.utils.getNodeStyle(n.data.node,i,"map");return"object"==typeof t?i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17:t}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17},emphasis:i.mapOptions.nodeConfig.emphasis},Object.assign(i.mapOptions.linkConfig,{id:"map-links",type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:i.mapTileConfig,mapOptions:i.mapOptions},series:u,...i.mapOptions.baseOptions}}_propagateGraphZoom(t){const e=t.echarts.getDom&&t.echarts.getDom();if(!e)return;const n=e.querySelector("canvas");e.addEventListener("wheel",(t=>{if(!n)return;const i=e.getBoundingClientRect();if(t.clientXi.right||t.clientYi.bottom)return;t.preventDefault();const r=n.getBoundingClientRect();n.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,view:window,clientX:r.left+r.width/2,clientY:r.top+r.height/2,deltaY:-t.deltaY,deltaMode:t.deltaMode}))}),{passive:!1})}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.utils._propagateGraphZoom(e),e.config.showGraphLabelsAtZoom>0&&e.echarts.on("graphRoam",(t=>{if(!t||!t.zoom)return;const n=e.echarts.getOption(),i=n&&n.series&&n.series[0]&&n.series[0].zoom>=e.config.showGraphLabelsAtZoom;i!==e._labelsVisible&&(e.echarts.resize({animation:!1,silent:!0}),e._labelsVisible=i)})),e.utils.setupHashChangeHandler(e),e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray"),e.event.emit("applyUrlFragmentState")}mapRender(t,e){if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');e.utils.isGeoJSON(t)&&(e.originalGeoJSON=e.utils.fastDeepCopy(t),t=e.utils.geojsonToNetjson(t));const n=e.utils.generateMapOption(t,e);if(e.utils.echartsSetOption(n,e),e.bboxData={nodes:[],links:[]},e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,n)=>g().circleMarker(n,e.config.geoOptions.style),onEachFeature:(t,n)=>{n.on("click",(()=>{const n={...t.properties};e.config.onClickElement.call(e,"Feature",n)}))}},e.config.geoOptions),e.originalGeoJSON){!function(t){if(!t.originalGeoJSON||!Array.isArray(t.originalGeoJSON.features))return;const e=t.leaflet,n=t.originalGeoJSON.features.filter((t=>t&&t.geometry&&("Polygon"===t.geometry.type||"MultiPolygon"===t.geometry.type)));if(!n.length)return;let i=e.getPane("njg-polygons");i||(i=e.createPane("njg-polygons"),i.style.zIndex=410);const r={fillColor:"#1566a9",color:"#1566a9",weight:0,fillOpacity:.6},o=g().geoJSON({type:"FeatureCollection",features:n},{pane:"njg-polygons",style:e=>{const n=e.properties&&e.properties.echartsStyle||{},i={...r,...t.config.geoOptions&&t.config.geoOptions.style};return n.areaColor&&(i.fillColor=n.areaColor),n.color&&(i.color=n.color),void 0!==n.opacity&&(i.fillOpacity=n.opacity),void 0!==n.borderWidth&&(i.weight=n.borderWidth),i},onEachFeature:(e,n)=>{n.on("click",(()=>{const n=e.properties||{};t.config.onClickElement.call(t,"Feature",n)}))},...t.config.geoOptions}).addTo(e);t.leaflet.polygonGeoJSON=o}(e);let n=null;if(e.leaflet.polygonGeoJSON&&"function"==typeof e.leaflet.polygonGeoJSON.getBounds&&(n=e.leaflet.polygonGeoJSON.getBounds()),t.nodes&&t.nodes.length){const e=t.nodes.map((t=>t.properties.location)).map((t=>[t.lat,t.lng]));n?e.forEach((t=>n.extend(t))):n=g().latLngBounds(e)}n&&n.isValid()&&e.leaflet.fitBounds(n,{padding:[20,20]})}if(e.leaflet.getZoom(){const t=e.leaflet.getZoom(),n=t>=e.config.showLabelsAtZoomLevel;e.echarts.setOption({series:[{id:"geo-map",label:{show:n},emphasis:{label:{show:n}}}]});const i=e.leaflet.getMinZoom(),r=e.leaflet.getMaxZoom(),o=document.querySelector(".leaflet-control-zoom-in"),a=document.querySelector(".leaflet-control-zoom-out");o&&a&&(Math.round(t)>=r?o.classList.add("leaflet-disabled"):o.classList.remove("leaflet-disabled"),Math.round(t)<=i?a.classList.add("leaflet-disabled"):a.classList.remove("leaflet-disabled"))})),e.leaflet.on("moveend",(async()=>{const n=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const i=await e.utils.getBBoxData.call(e,e.JSONParam,n);e.config.prepareData.call(e,i);const r=new Set(e.data.nodes.map((t=>t.id))),o=new Set(e.data.links.map((t=>t.source))),a=new Set(e.data.links.map((t=>t.target))),s=i.nodes.filter((t=>!r.has(t.id))),l=i.links.filter((t=>!o.has(t.source)&&!a.has(t.target))),u=new Set(i.nodes.map((t=>t.id))),h=e.bboxData.nodes.filter((t=>!u.has(t.id))),c=new Set(h.map((t=>t.id)));t.nodes=t.nodes.filter((t=>!c.has(t.id))),e.bboxData.nodes=e.bboxData.nodes.concat(s),e.bboxData.links=e.bboxData.links.concat(l),t={...t,nodes:t.nodes.concat(s),links:t.links.concat(l)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{const n=new Set(e.bboxData.nodes),i=new Set(e.bboxData.links);t={...t,nodes:t.nodes.filter((t=>!n.has(t))),links:t.links.filter((t=>!i.has(t)))},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]})()})),e.config.clustering&&e.config.clusteringThresholde.config.disableClusteringAtLevel&&(n=[],i=t.nodes,r=t.links),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:i,links:r},e,n)),e.echarts.on("click",(t=>{if(("scatter"===t.componentSubType||"effectScatter"===t.componentSubType)&&t.data.cluster){const n=e.leaflet.getZoom(),i=Math.min(n+2,e.leaflet.getMaxZoom());e.leaflet.setView([t.data.value[1],t.data.value[0]],i)}})),e.leaflet.on("zoomend",(()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:n,data:t.data})})),e.utils.mergeData(t,e)}e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.data.nodes&&e.data.nodes.length>0&&(e.data.nodes=e.utils.deduplicateNodesById(e.data.nodes)),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){t.nodes||(t.nodes=[]);const n=new Set;e.data.nodes.forEach((t=>{t.id&&n.add(t.id)}));const i=t.nodes.filter((t=>!t.id||(!n.has(t.id)||(console.warn(`Duplicate node ID ${t.id} detected during merge and skipped.`),!1)))),r=e.data.nodes.concat(i),o=t.links||[],a=e.data.links.concat(o);Object.assign(e.data,t,{nodes:r,links:a})}}const nX=function(t,e){const{util:n,graphic:i,matrix:r}=t,o=e.Layer.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){e.DomUtil.remove(this._container)},_update(){}});function a(t,n){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=n,this._projection=e.Projection.Mercator}function s(t,e,n,i){const{leafletModel:r,seriesModel:o}=n,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](i):null}return a.dimensions=["lng","lat"],a.prototype.dimensions=["lng","lat"],a.prototype.setZoom=function(t){this._zoom=t},a.prototype.setCenter=function(t){this._center=this._projection.project(new e.LatLng(t[1],t[0]))},a.prototype.setMapOffset=function(t){this._mapOffset=t},a.prototype.getLeaflet=function(){return this._map},a.prototype.getViewRect=function(){const t=this._api;return new i.BoundingRect(0,0,t.getWidth(),t.getHeight())},a.prototype.getRoamTransform=function(){return r.create()},a.prototype.dataToPoint=function(t){const n=new e.LatLng(t[1],t[0]),i=this._map.latLngToLayerPoint(n),r=this._mapOffset;return[i.x-r[0],i.y-r[1]]},a.prototype.pointToData=function(t){const e=this._mapOffset,n=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[n.lng,n.lat]},a.prototype.convertToPixel=n.curry(s,"dataToPoint"),a.prototype.convertFromPixel=n.curry(s,"pointToData"),a.create=function(t,n){let i;const r=[],s=n.getDom();return t.eachComponent("leaflet",(t=>{const l=n.getZr().painter.getViewportRoot();if(void 0===e)throw new Error("Leaflet api is not loaded");if(i)throw new Error("Only one leaflet component can exist");if(!t.__map){let n=s.querySelector(".ec-extension-leaflet");n&&(l.style.left="0px",l.style.top="0px",s.removeChild(n)),n=document.createElement("div"),n.style.cssText="width:100%;height:100%",n.classList.add("ec-extension-leaflet"),s.appendChild(n),t.__map=e.map(n,t.get("mapOptions"));const i=t.__map,r=t.get("tiles"),a={};let u=!1;if(r.forEach((t=>{const n=e.tileLayer(t.urlTemplate,t.options);t.label?(u||(n.addTo(i),u=!0),a[t.label]=n):n.addTo(i)})),r.length>1){const n=t.get("layerControl");e.control.layers(a,{},n).addTo(i)}const h=document.createElement("div");h.style="position: absolute;left: 0;top: 0;z-index: 100",h.appendChild(l),new o(h).addTo(i)}const u=t.__map;i=new a(u,n),r.push(i),i.setMapOffset(t.__mapOffset||[0,0]);const{center:h,zoom:c}=t.get("mapOptions");h&&c&&(i.setZoom(c),i.setCenter(h)),t.coordinateSystem=i})),t.eachSeries((t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=i)})),r},a};function iX(t,e,n){!function(t){t.extendComponentModel({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:n}=this;return i=t,r=n.center,!(i&&r&&i[0]===r[0]&&i[1]===r[1]&&e===n.zoom);var i,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}})}(t),function(t){t.extendComponentView({type:"leaflet",render(e,n,i){let r=!0;const o=e.getLeaflet(),a=i.getZr().painter.getViewportRoot().parentNode,s=e.coordinateSystem,{roam:l}=e.get("mapOptions");function u(t){if(r)return;const n=o._mapPane;let l=n.style.transform,u=0,h=0;if(l){l=l.replace("translate3d(","");let t=l.split(",");u=-parseInt(t[0],10),h=-parseInt(t[1],10)}else u=-parseInt(n.style.left,10),h=-parseInt(n.style.top,10);let c=[u,h];a.style.left=`${c[0]}px`,a.style.top=`${c[1]}px`,s.setMapOffset(c),e.__mapOffset=c,i.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function h(){r||i.dispatchAction({type:"leafletRoam"})}function c(){u()}function d(){t.getInstanceByDom(i.getDom()).resize()}l&&"scale"!==l?o.dragging.enable():o.dragging.disable(),l&&"move"!==l?(o.scrollWheelZoom.enable(),o.doubleClickZoom.enable(),o.touchZoom.enable()):(o.scrollWheelZoom.disable(),o.doubleClickZoom.disable(),o.touchZoom.disable()),this._oldMoveHandler&&o.off("move",this._oldMoveHandler),this._oldZoomHandler&&o.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&o.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&o.off("resize",this._oldResizeHandler),o.on("move",u),o.on("zoom",c),o.on("zoomend",h),o.on("resize",d),this._oldMoveHandler=u,this._oldZoomHandler=c,this._oldZoomEndHandler=h,this._oldResizeHandler=d,r=!1}})}(t),t.registerCoordinateSystem("leaflet",nX(t,e)),t.registerAction({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},((t,e)=>{e.eachComponent("leaflet",(t=>{const e=t.getLeaflet(),n=e.getCenter();t.setCenterAndZoom([n.lng,n.lat],e.getZoom())}))}))}iX.version="1.0.0";const rX=iX;const oX=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),n=document.createElement("div");n.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const i=document.createElement("span");return i.classList.add("njg-closeButton"),e.innerHTML="Info",i.innerHTML=" ✕",e.appendChild(i),t.appendChild(e),t.appendChild(n),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),i.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const n=document.querySelectorAll(".njg-infoContainer"),i=document.querySelectorAll(".njg-headerContainer");for(let t=0;t"clients"===t?"Clients":/^clients\s*\[\d+\]$/i.test(t)?t.replace(/^clients/i,"Client"):"localAddresses"===t?"Local Addresses":t.replace(/_/g," "),u=(t,e,n,i=0)=>{if(null==n||"string"==typeof n&&(""===n.trim()||/^(undefined|null)$/i.test(n.trim()))&&"0"!==n)return;if(Array.isArray(n)){if(0===n.length){const n=document.createElement("div");n.classList.add("njg-infoItems"),n.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML=l(e),o.innerHTML="[]",n.appendChild(r),n.appendChild(o),void t.appendChild(n)}if(n.every((t=>"object"!=typeof t||null===t))){const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML=n.map((t=>"string"==typeof t?t.replace(/\n/g,"
"):String(t))).join("
"),r.appendChild(o),r.appendChild(a),void t.appendChild(r)}return void n.forEach(((n,r)=>{u(t,`${e} [${r+1}]`,n,i)}))}if("object"==typeof n){if("location"===e&&"number"==typeof n.lat&&"number"==typeof n.lng){const e=document.createElement("div");e.classList.add("njg-infoItems"),e.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML="Location",o.innerHTML=`${Math.round(1e3*n.lat)/1e3}, ${Math.round(1e3*n.lng)/1e3}`,e.appendChild(r),e.appendChild(o),void t.appendChild(e)}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML="",r.appendChild(o),r.appendChild(a),t.appendChild(r),void Object.keys(n).forEach((e=>{u(t,e,n[e],i+1)}))}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e);const s="string"==typeof n?n.replace(/\n/g,"
"):String(n);a.innerHTML=s,r.appendChild(o),r.appendChild(a),t.appendChild(r)};Object.keys(e).forEach((t=>u(o,t,e[t],0))),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}};const aX=function(t,e={}){const n=t.echarts,i=echarts.graphic,r={wifi:e.colors&&e.colors.wifi||"#d35454"},o=e.radius||3,a=e.gap||8;let s=e.minZoomLevel||1.5,l=1;const u=t=>t?"number"==typeof t.clients?t.clients:Array.isArray(t.clients)?t.clients.length:0:0,h=function(){const t=n.getModel().getSeriesByIndex(0);if(!t)return null;const e=(n._chartsViews||[]).find((e=>e&&e.__model&&e.__model.uid===t.uid));return e?e.group:null}();if(!h)return{destroy(){}};const c=new i.Group({silent:!0,z:100,zlevel:1});h.add(c);const d=t&&t.config&&t.config.graphConfig&&t.config.graphConfig.series||{},f=("number"==typeof d.nodeSize?d.nodeSize:18)/2;function p(){l=function(){const t=n.getOption();return t&&t.series&&t.series[0]&&t.series[0].zoom?t.series[0].zoom:1}();const t=l>=s;c.attr("invisible",!t)}function g(){const t=n.getModel().getSeriesByIndex(0);if(!t)return;const e=t.getData();if(!e)return;if(p(),c.removeAll(),l{let s=0;if(0!==n)for(let l=0;s{p(),g()}]];return m.forEach((([t,e])=>n.on(t,e))),g(),{destroy(){m.forEach((([t,e])=>{n&&n.off&&n.off(t,e)})),c&&c.parent&&c.parent.remove(c)},setMinZoomLevel(t){s=t,g()},getMinZoomLevel:()=>s}},sX=n(936),{each:lX}=n(627),uX=n(123);rX(f,g(),{colorTool:sX,each:lX,env:uX}),window.NetJSONGraph=class{constructor(t,e={}){return this.graph=new A(t),this.config=this.initializeConfig(e),this.graph.setConfig(this.config),this.setupGraph(),this.config.onInit.call(this.graph),this.initializeECharts(),this.graph}initializeConfig(t={}){return{...t,render:"map"===t.render?eX.prototype.mapRender:eX.prototype.graphRender,onInit:this.onInit,onRender:this.onRender,onUpdate:this.onUpdate,afterUpdate:this.afterUpdate,onLoad:this.onLoad}}setupGraph(){Object.setPrototypeOf(eX.prototype,this.graph.utils),this.graph.gui=new oX(this.graph),this.graph.utils=new eX,this.graph.setUtils(),this.graph.event=this.graph.utils.createEvent()}initializeECharts(){this.graph.echarts=Ly(this.graph.el,null,{renderer:this.graph.config.svgRender?"svg":"canvas"})}onInit(){return this.config}onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config}onUpdate(){return this.config}afterUpdate(){return this.config}onLoad(){return this.config.metadata&&this.utils.isNetJSON(this.data)?(this.gui.createMetaInfoContainer(this.graph),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&this.utils.isNetJSON(this.data)&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.attachClientsOverlay=t=>aX(this,t),this.config}},window.echarts=f,window.L=g()})()})(); +var Oo={},No={};var Ro,ko=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var r=new Hn,o=n.renderer||"canvas";Oo[o]||(o=mt(Oo)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var a=new Oo[o](e,r,n,t),s=n.ssr||a.ssrOnly;this.storage=r,this.painter=a;var l,u=O.node||O.worker||s?null:new qr(a.getViewportRoot(),a.root),h=n.useCoarsePointer;(null==h||"auto"===h?O.touchEventsSupported:!!h)&&(l=Ot(n.pointerSize,44)),this.handler=new Dn(r,a,u,a.root,l),this.animation=new Dr({stage:{update:s?null:function(){return i._flush(!0)}}}),s||this.animation.start()}return t.prototype.add=function(t){!this._disposed&&t&&(this.storage.addRoot(t),t.addSelfToZr(this),this.refresh())},t.prototype.remove=function(t){!this._disposed&&t&&(this.storage.delRoot(t),t.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(t,e){this._disposed||(this.painter.configLayer&&this.painter.configLayer(t,e),this.refresh())},t.prototype.setBackgroundColor=function(t){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(t),this.refresh(),this._backgroundColor=t,this._darkMode=function(t){if(!t)return!1;if("string"==typeof t)return Zi(t,1)<.4;if(t.colorStops){for(var e=t.colorStops,n=0,i=e.length,r=0;r0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this._disposed||this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function qo(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return wt(t)?(n=t,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var n}function Yo(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),Zo),t=(+t).toFixed(e),n?t:+t}function Ko(t){return t.sort((function(t,e){return t-e})),t}function Jo(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return $o(t)}function $o(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf("."),a=o<0?0:r-1-o;return Math.max(0,a-i)}function Qo(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function ta(t,e,n){if(!t[e])return 0;var i=function(t,e){var n=ft(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===n)return[];var i=Math.pow(10,e),r=dt(t,(function(t){return(isNaN(t)?0:t)/n*i*100})),o=100*i,a=dt(r,(function(t){return Math.floor(t)})),s=ft(a,(function(t,e){return t+e}),0),l=dt(r,(function(t,e){return t-a[e]}));for(;su&&(u=l[c],h=c);++a[h],l[h]=0,++s}return dt(a,(function(t){return t/i}))}(t,n);return i[e]||0}function ea(t,e){var n=Math.max(Jo(t),Jo(e)),i=t+e;return n>Zo?i:Yo(i,n)}var na=9007199254740991;function ia(t){var e=2*Math.PI;return(t%e+e)%e}function ra(t){return t>-jo&&t=10&&e++,e}function ua(t,e){var n=la(t),i=Math.pow(10,n),r=t/i;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t}function ha(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function ca(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-1/0,n=1,i=0;i=0||r&&st(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}var Ka=Ya([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),Ja=function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return Ka(this,t,e)},t}(),$a=new bi(50);function Qa(t){if("string"==typeof t){var e=$a.get(t);return e&&e.image}return t}function ts(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=$a.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?!ns(e=o.image)&&o.pending.push(a):((e=F.loadImage(t,es,es)).__zrImageSrc=t,$a.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function es(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=a;l++)s-=a;var u=co(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function ss(t,e,n){var i=n.containerWidth,r=n.font,o=n.contentWidth;if(!i)return t.textLine="",void(t.isTruncated=!1);var a=co(e,r);if(a<=i)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=o||s>=n.maxIterations){e+=n.ellipsis;break}var l=0===s?ls(e,o,n.ascCharWidth,n.cnCharWidth):a>0?Math.floor(e.length*o/a):0;a=co(e=e.substr(0,l),r)}""===e&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function ls(t,e,n,i){for(var r=0,o=0,a=t.length;o0&&p+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=p}else{var g=gs(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+f,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var m=0;m=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}(t)||!!fs[t]}function gs(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+f>n)?h?(s||l)&&(p?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=d,s="",h=u+=f):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=d,h=f)):p?(o.push(l),a.push(u),l=d,u=f):(o.push(d),a.push(f)):(h+=f,p?(l+=d,u+=f):(l&&(s+=l,l="",u=0),s+=d))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}var ms="__zr_style_"+Math.round(10*Math.random()),vs={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"var(--ow-color-black)",opacity:1,blend:"source-over"},_s={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};vs[ms]=!0;var ys=["z","z2","invisible"],xs=["invisible"],ws=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype._init=function(e){for(var n=mt(e),i=0;i1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(Is[0]=As(r)*n+t,Is[1]=Ls(r)*i+e,Ps[0]=As(o)*n+t,Ps[1]=Ls(o)*i+e,u(s,Is,Ps),h(l,Is,Ps),(r%=Ds)<0&&(r+=Ds),(o%=Ds)<0&&(o+=Ds),r>o&&!a?o+=Ds:rr&&(Es[0]=As(f)*n+t,Es[1]=Ls(f)*i+e,u(s,Es,s),h(l,Es,l))}var Fs={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Vs=[],Gs=[],Hs=[],Us=[],Ws=[],js=[],Zs=Math.min,Xs=Math.max,qs=Math.cos,Ys=Math.sin,Ks=Math.abs,Js=Math.PI,$s=2*Js,Qs="undefined"!=typeof Float32Array,tl=[];function el(t){return Math.round(t/Js*1e8)/1e8%2*Js}var nl=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,n){(n=n||0)>0&&(this._ux=Ks(n/Kr/t)||0,this._uy=Ks(n/Kr/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Fs.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=Ks(t-this._xi),i=Ks(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(Fs.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(Fs.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(Fs.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){this._drawPendingPt(),tl[0]=i,tl[1]=r,function(t,e){var n=el(t[0]);n<0&&(n+=$s);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=$s?r=n+$s:e&&n-r>=$s?r=n-$s:!e&&n>r?r=n+($s-el(n-r)):e&&nu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){Hs[0]=Hs[1]=Ws[0]=Ws[1]=Number.MAX_VALUE,Us[0]=Us[1]=js[0]=js[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tn||Ks(m)>i||c===e-1)&&(p=Math.sqrt(D*D+m*m),r=g,o=y);break;case Fs.C:var v=t[c++],_=t[c++],y=(g=t[c++],t[c++]),x=t[c++],w=t[c++];p=ui(r,o,v,_,g,y,x,w,10),r=x,o=w;break;case Fs.Q:p=gi(r,o,v=t[c++],_=t[c++],g=t[c++],y=t[c++],10),r=g,o=y;break;case Fs.A:var b=t[c++],T=t[c++],S=t[c++],M=t[c++],C=t[c++],L=t[c++],A=L+C;c+=1,f&&(a=qs(C)*S+b,s=Ys(C)*M+T),p=Xs(S,M)*Zs($s,Math.abs(L)),r=qs(A)*S+b,o=Ys(A)*M+T;break;case Fs.R:a=r=t[c++],s=o=t[c++],p=2*t[c++]+2*t[c++];break;case Fs.Z:var D=a-r;m=s-o;p=Math.sqrt(D*D+m*m),r=a,o=s}p>=0&&(l[h++]=p,u+=p)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,d=this.data,f=this._ux,p=this._uy,g=this._len,m=e<1,v=0,_=0,y=0;if(!m||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),y=0),w){case Fs.M:n=r=d[x++],i=o=d[x++],t.moveTo(r,o);break;case Fs.L:a=d[x++],s=d[x++];var T=Ks(a-r),S=Ks(s-o);if(T>f||S>p){if(m){if(v+(q=l[_++])>u){var M=(u-v)/q;t.lineTo(r*(1-M)+a*M,o*(1-M)+s*M);break t}v+=q}t.lineTo(a,s),r=a,o=s,y=0}else{var C=T*T+S*S;C>y&&(h=a,c=s,y=C)}break;case Fs.C:var L=d[x++],A=d[x++],D=d[x++],I=d[x++],P=d[x++],E=d[x++];if(m){if(v+(q=l[_++])>u){si(r,L,D,P,M=(u-v)/q,Vs),si(o,A,I,E,M,Gs),t.bezierCurveTo(Vs[1],Gs[1],Vs[2],Gs[2],Vs[3],Gs[3]);break t}v+=q}t.bezierCurveTo(L,A,D,I,P,E),r=P,o=E;break;case Fs.Q:L=d[x++],A=d[x++],D=d[x++],I=d[x++];if(m){if(v+(q=l[_++])>u){fi(r,L,D,M=(u-v)/q,Vs),fi(o,A,I,M,Gs),t.quadraticCurveTo(Vs[1],Gs[1],Vs[2],Gs[2]);break t}v+=q}t.quadraticCurveTo(L,A,D,I),r=D,o=I;break;case Fs.A:var O=d[x++],N=d[x++],R=d[x++],k=d[x++],z=d[x++],B=d[x++],F=d[x++],V=!d[x++],G=R>k?R:k,H=Ks(R-k)>.001,U=z+B,W=!1;if(m)v+(q=l[_++])>u&&(U=z+B*(u-v)/q,W=!0),v+=q;if(H&&t.ellipse?t.ellipse(O,N,R,k,F,z,U,V):t.arc(O,N,G,z,U,V),W)break t;b&&(n=qs(z)*R+O,i=Ys(z)*k+N),r=qs(U)*R+O,o=Ys(U)*k+N;break;case Fs.R:n=r=d[x],i=o=d[x+1],a=d[x++],s=d[x++];var j=d[x++],Z=d[x++];if(m){if(v+(q=l[_++])>u){var X=u-v;t.moveTo(a,s),t.lineTo(a+Zs(X,j),s),(X-=j)>0&&t.lineTo(a+j,s+Zs(X,Z)),(X-=Z)>0&&t.lineTo(a+Xs(j-X,0),s+Z),(X-=j)>0&&t.lineTo(a,s+Xs(Z-X,0));break t}v+=q}t.rect(a,s,j,Z);break;case Fs.Z:if(m){var q;if(v+(q=l[_++])>u){M=(u-v)/q;t.lineTo(r*(1-M)+n*M,o*(1-M)+i*M);break t}v+=q}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=Fs,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();const il=nl;function rl(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||oe+c&&h>i+c&&h>o+c&&h>s+c||ht+c&&u>n+c&&u>r+c&&u>a+c||ue+u&&l>i+u&&l>o+u||lt+u&&s>n+u&&s>r+u||sn||h+ur&&(r+=ul);var d=Math.atan2(l,s);return d<0&&(d+=ul),d>=i&&d<=r||d+ul>=i&&d+ul<=r}function cl(t,e,n,i,r,o){if(o>e&&o>i||or?s:0}var dl=il.CMD,fl=2*Math.PI;var pl=[-1,-1,-1],gl=[-1,-1];function ml(t,e,n,i,r,o,a,s,l,u){if(u>e&&u>i&&u>o&&u>s||u1&&(h=void 0,h=gl[0],gl[0]=gl[1],gl[1]=h),p=ii(e,i,o,s,gl[0]),f>1&&(g=ii(e,i,o,s,gl[1]))),2===f?ve&&s>i&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(ei(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=Xn(u),d=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}(e,i,o,s,pl);if(0===l)return 0;var u=di(e,i,o);if(u>=0&&u<=1){for(var h=0,c=hi(e,i,o,u),d=0;dn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);pl[0]=-l,pl[1]=l;var u=Math.abs(i-r);if(u<1e-4)return 0;if(u>=fl-1e-4){i=0,r=fl;var h=o?1:-1;return a>=pl[0]+t&&a<=pl[1]+t?h:0}if(i>r){var c=i;i=r,r=c}i<0&&(i+=fl,r+=fl);for(var d=0,f=0;f<2;f++){var p=pl[f];if(p+t>a){var g=Math.atan2(s,p);h=o?1:-1;g<0&&(g=fl+g),(g>=i&&g<=r||g+fl>=i&&g+fl<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),d+=h)}}return d}function yl(t,e,n,i,r){for(var o,a,s,l,u=t.data,h=t.len(),c=0,d=0,f=0,p=0,g=0,m=0;m1&&(n||(c+=cl(d,f,p,g,i,r))),_&&(p=d=u[m],g=f=u[m+1]),v){case dl.M:d=p=u[m++],f=g=u[m++];break;case dl.L:if(n){if(rl(d,f,u[m],u[m+1],e,i,r))return!0}else c+=cl(d,f,u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.C:if(n){if(ol(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=ml(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.Q:if(n){if(al(d,f,u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=vl(d,f,u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.A:var y=u[m++],x=u[m++],w=u[m++],b=u[m++],T=u[m++],S=u[m++];m+=1;var M=!!(1-u[m++]);o=Math.cos(T)*w+y,a=Math.sin(T)*b+x,_?(p=o,g=a):c+=cl(d,f,o,a,i,r);var C=(i-y)*b/w+y;if(n){if(hl(y,x,b,T,T+S,M,e,C,r))return!0}else c+=_l(y,x,b,T,T+S,M,C,r);d=Math.cos(T+S)*w+y,f=Math.sin(T+S)*b+x;break;case dl.R:if(p=d=u[m++],g=f=u[m++],o=p+u[m++],a=g+u[m++],n){if(rl(p,g,o,g,e,i,r)||rl(o,g,o,a,e,i,r)||rl(o,a,p,a,e,i,r)||rl(p,a,p,g,e,i,r))return!0}else c+=cl(o,g,o,a,i,r),c+=cl(p,a,p,g,i,r);break;case dl.Z:if(n){if(rl(d,f,p,g,e,i,r))return!0}else c+=cl(d,f,p,g,i,r);d=p,f=g}}return n||(s=f,l=g,Math.abs(s-l)<1e-4)||(c+=cl(d,f,p,g,i,r)||0),0!==c}var xl=ot({fill:"var(--ow-color-black)",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},vs),wl={style:ot({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},_s.style)},bl=so.concat(["invisible","culling","z","z2","zlevel","parent"]),Tl=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype.update=function(){var n=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){n.buildPath(t,n.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?Jr:e>.2?"#eee":$r}if(t)return $r}return Jr},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(wt(e)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Zi(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,n){},e.prototype.pathUpdated=function(){this.__dirty&=~zn},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new il(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||this.__dirty&zn)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,n,i){return yl(t,e,!0,n,i)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,n){return yl(t,0,!1,e,n)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=zn,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},e.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:rt(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&zn)},e.prototype.createStyle=function(t){return Xt(xl,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=rt({},this.shape))},e.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=rt({},i.shape),rt(s,n.shape)):(s=rt({},r?this.shape:i.shape),rt(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=rt({},this.shape);for(var u={},h=mt(s),c=0;c0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return Xt(Ml,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=po(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(Ss);Cl.prototype.type="tspan";const Ll=Cl;var Al=ot({x:0,y:0},vs),Dl={style:ot({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},_s.style)};var Il=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.createStyle=function(t){return Xt(Al,t)},e.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i,r=(i=e.image)&&"string"!=typeof i&&i.width&&i.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Dl},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new _n(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Ss);Il.prototype.type="image";const Pl=Il;var El=Math.round;function Ol(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(El(2*i)===El(2*r)&&(t.x1=t.x2=Rl(i,s,!0)),El(2*o)===El(2*a)&&(t.y1=t.y2=Rl(o,s,!0)),t):t}}function Nl(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=Rl(i,s,!0),t.y=Rl(r,s,!0),t.width=Math.max(Rl(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Rl(r+a,s,!1)-t.y,0===a?0:1),t):t}}function Rl(t,e,n){if(!e)return t;var i=El(2*t);return(i+El(e))%2==0?i/2:(i+(n?1:-1))/2}var kl=function(){this.x=0,this.y=0,this.width=0,this.height=0},zl={},Bl=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new kl},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Nl(zl,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?function(t,e){var n,i,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?n=i=r=o=c:c instanceof Array?1===c.length?n=i=r=o=c[0]:2===c.length?(n=r=c[0],i=o=c[1]):3===c.length?(n=c[0],i=o=c[1],r=c[2]):(n=c[0],i=c[1],r=c[2],o=c[3]):n=i=r=o=0,n+i>u&&(n*=u/(a=n+i),i*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),i+r>h&&(i*=h/(a=i+r),r*=h/a),n+o>h&&(n*=h/(a=n+o),o*=h/a),t.moveTo(s+n,l),t.lineTo(s+u-i,l),0!==i&&t.arc(s+u-i,l+i,i,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+n),0!==n&&t.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(t,e):t.rect(n,i,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Sl);Bl.prototype.type="rect";const Fl=Bl;var Vl={fill:"var(--ow-color-black)"},Gl={style:ot({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},_s.style)},Hl=function(t){function e(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Vl,n.attr(e),n}return I(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ep&&h){var g=Math.floor(p/l);c=c||n.length>g,n=n.slice(0,g)}if(t&&a&&null!=d)for(var m=as(d,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v={},_=0;_0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=i.calculatedLineHeight,L=0;Ll&&ds(n,t.substring(l,u),e,s),ds(n,i[2],e,s,i[1]),l=is.lastIndex}lo){var A=n.lines.length;b>0?(y.tokens=y.tokens.slice(0,b),v(y,w,x),n.lines=n.lines.slice(0,_+1)):n.lines=n.lines.slice(0,_),n.isTruncated=n.isTruncated||n.lines.length=0&&"right"===(L=y[C]).align;)this._placeToken(L,t,w,p,M,"right",m),b-=L.width,M-=L.width,C--;for(S+=(n-(S-f)-(g-M)-b)/2;T<=C;)L=y[T],this._placeToken(L,t,w,p,S+L.width/2,"center",m),S+=L.width,T++;p+=w}},e.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2),!t.isLineHolder&&tu(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=$l(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var d=this._getOrCreateChild(Ll),f=d.createStyle();d.useStyle(f);var p=this._defaultStyle,g=!1,m=0,v=Jl("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,p.fill)),_=Kl("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||p.autoStroke&&!g?null:(m=2,p.stroke)),y=s.textShadowBlur>0||e.textShadowBlur>0;f.text=t.text,f.x=r,f.y=u,y&&(f.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,f.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",f.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,f.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),f.textAlign=o,f.textBaseline="middle",f.font=t.font||R,f.opacity=Nt(s.opacity,e.opacity,1),Xl(f,s),_&&(f.lineWidth=Nt(s.lineWidth,e.lineWidth,m),f.lineDash=Ot(s.lineDash,e.lineDash),f.lineDashOffset=e.lineDashOffset||0,f.stroke=_),v&&(f.fill=v);var x=t.contentWidth,w=t.contentHeight;d.setBoundingRect(new _n(go(f.x,x,f.textAlign),mo(f.y,w,f.textBaseline),x,w))},e.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,d=u&&u.image,f=u&&!d,p=t.borderRadius,g=this;if(f||t.lineHeight||h&&c){(a=this._getOrCreateChild(Fl)).useStyle(a.createStyle()),a.style.fill=null;var m=a.shape;m.x=n,m.y=i,m.width=r,m.height=o,m.r=p,a.dirtyShape()}if(f)(l=a.style).fill=u||null,l.fillOpacity=Ot(t.fillOpacity,1);else if(d){(s=this._getOrCreateChild(Pl)).onload=function(){g.dirtyStyle()};var v=s.style;v.image=u.image,v.x=n,v.y=i,v.width=r,v.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=Ot(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var _=(a||s).style;_.shadowBlur=t.shadowBlur||0,_.shadowColor=t.shadowColor||"transparent",_.shadowOffsetX=t.shadowOffsetX||0,_.shadowOffsetY=t.shadowOffsetY||0,_.opacity=Nt(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return ql(t)&&(e=[t.fontStyle,t.fontWeight,Zl(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&Bt(e)||t.textFont||t.font},e}(Ss),Ul={left:!0,right:1,center:1},Wl={top:1,bottom:1,middle:1},jl=["fontStyle","fontWeight","fontSize","fontFamily"];function Zl(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?"12px":t+"px":t}function Xl(t,e){for(var n=0;n=0,o=!1;if(t instanceof Sl){var a=ou(t),s=r&&a.selectFill||a.normalFill,l=r&&a.selectStroke||a.normalStroke;if(mu(s)||mu(l)){var u=(i=i||{}).style||{};"inherit"===u.fill?(o=!0,i=rt({},i),(u=rt({},u)).fill=s):!mu(u.fill)&&mu(s)?(o=!0,i=rt({},i),(u=rt({},u)).fill=Yi(s)):!mu(u.stroke)&&mu(l)&&(o||(i=rt({},i),u=rt({},u)),u.stroke=Yi(l)),i.style=u}}if(i&&null==i.z2){o||(i=rt({},i));var h=t.z2EmphasisLift;i.z2=t.z2+(null!=h?h:uu)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=st(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:function(t,e,n,i){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}}))})),e}function Hu(t,e,n){Wu(t,!0),Mu(t,Lu),function(t,e,n){var i=nu(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}(t,e,n)}function Uu(t,e,n,i){i?function(t){Wu(t,!1)}(t):Hu(t,e,n)}function Wu(t,e){var n=!1===e,i=t;t.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=t.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function ju(t){return!(!t||!t.__highDownDispatcher)}function Zu(t){var e=t.type;return e===fu||e===pu||e===gu}function Xu(t){var e=t.type;return e===cu||e===du}var qu=Ea();function Yu(t,e,n,i,r){var o;if(e&&e.ecModel){var a=e.ecModel.getUpdatePayload();o=a&&a.animation}var s="update"===t;if(e&&e.isAnimationEnabled()){var l=void 0,u=void 0,h=void 0;return i?(l=Ot(i.duration,200),u=Ot(i.easing,"cubicOut"),h=0):(l=e.getShallow(s?"animationDurationUpdate":"animationDuration"),u=e.getShallow(s?"animationEasingUpdate":"animationEasing"),h=e.getShallow(s?"animationDelayUpdate":"animationDelay")),o&&(null!=o.duration&&(l=o.duration),null!=o.easing&&(u=o.easing),null!=o.delay&&(h=o.delay)),xt(h)&&(h=h(n,r)),xt(l)&&(l=l(n)),{duration:l||0,delay:h,easing:u}}return null}function Ku(t,e,n,i,r,o,a){var s,l=!1;xt(r)?(a=o,o=r,r=null):St(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u="leave"===t;u||e.stopAnimation("leave");var h=Yu(t,i,r,u?s||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null);if(h&&h.duration>0){var c={duration:h.duration,delay:h.delay||0,easing:h.easing,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,c):e.animateTo(n,c)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function Ju(t,e,n,i,r,o){Ku("update",t,e,n,i,r,o)}function $u(t,e,n,i,r,o){Ku("enter",t,e,n,i,r,o)}function Qu(t){if(!t.__zr)return!0;for(var e=0;e-1?Oh:Rh;function Fh(t,e){t=t.toUpperCase(),zh[t]=new Ih(e),kh[t]=e}Fh(Nh,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Fh(Oh,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Vh=1e3,Gh=6e4,Hh=36e5,Uh=864e5,Wh=31536e6,jh={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Zh="{yyyy}-{MM}-{dd}",Xh={year:"{yyyy}",month:"{yyyy}-{MM}",day:Zh,hour:Zh+" "+jh.hour,minute:Zh+" "+jh.minute,second:Zh+" "+jh.second,millisecond:jh.none},qh=["year","month","day","hour","minute","second","millisecond"],Yh=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Kh(t,e){return"0000".substr(0,e-(t+="").length)+t}function Jh(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function $h(t){return t===Jh(t)}function Qh(t,e,n,i){var r=aa(t),o=r[nc(n)](),a=r[ic(n)]()+1,s=Math.floor((a-1)/3)+1,l=r[rc(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[oc(n)](),c=(h-1)%12+1,d=r[ac(n)](),f=r[sc(n)](),p=r[lc(n)](),g=h>=12?"pm":"am",m=g.toUpperCase(),v=i instanceof Ih?i:function(t){return zh[t]}(i||Bh)||zh[Rh],_=v.getModel("time"),y=_.get("month"),x=_.get("monthAbbr"),w=_.get("dayOfWeek"),b=_.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,m+"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,Kh(o%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,y[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,Kh(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,Kh(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[u]).replace(/{ee}/g,b[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Kh(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,Kh(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,Kh(d,2)).replace(/{m}/g,d+"").replace(/{ss}/g,Kh(f,2)).replace(/{s}/g,f+"").replace(/{SSS}/g,Kh(p,3)).replace(/{S}/g,p+"")}function tc(t,e){var n=aa(t),i=n[ic(e)]()+1,r=n[rc(e)](),o=n[oc(e)](),a=n[ac(e)](),s=n[sc(e)](),l=0===n[lc(e)](),u=l&&0===s,h=u&&0===a,c=h&&0===o,d=c&&1===r;return d&&1===i?"year":d?"month":c?"day":h?"hour":u?"minute":l?"second":"millisecond"}function ec(t,e,n){var i=Tt(t)?aa(t):t;switch(e=e||tc(t,n)){case"year":return i[nc(n)]();case"half-year":return i[ic(n)]()>=6?1:0;case"quarter":return Math.floor((i[ic(n)]()+1)/4);case"month":return i[ic(n)]();case"day":return i[rc(n)]();case"half-day":return i[oc(n)]()/24;case"hour":return i[oc(n)]();case"minute":return i[ac(n)]();case"second":return i[sc(n)]();case"millisecond":return i[lc(n)]()}}function nc(t){return t?"getUTCFullYear":"getFullYear"}function ic(t){return t?"getUTCMonth":"getMonth"}function rc(t){return t?"getUTCDate":"getDate"}function oc(t){return t?"getUTCHours":"getHours"}function ac(t){return t?"getUTCMinutes":"getMinutes"}function sc(t){return t?"getUTCSeconds":"getSeconds"}function lc(t){return t?"getUTCMilliseconds":"getMilliseconds"}function uc(t){return t?"setUTCFullYear":"setFullYear"}function hc(t){return t?"setUTCMonth":"setMonth"}function cc(t){return t?"setUTCDate":"setDate"}function dc(t){return t?"setUTCHours":"setHours"}function fc(t){return t?"setUTCMinutes":"setMinutes"}function pc(t){return t?"setUTCSeconds":"setSeconds"}function gc(t){return t?"setUTCMilliseconds":"setMilliseconds"}function mc(t){if(!fa(t))return wt(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function vc(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var _c=kt;function yc(t,e,n){function i(t){return t&&Bt(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="time"===e,a=t instanceof Date;if(o||a){var s=o?aa(t):t;if(!isNaN(+s))return Qh(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(a)return"-"}if("ordinal"===e)return bt(t)?i(t):Tt(t)&&r(t)?t+"":"-";var l=da(t);return r(l)?mc(l):bt(t)?i(t):"boolean"==typeof t?t+"":"-"}var xc=["a","b","c","d","e","f","g"],wc=function(t,e){return"{"+t+(null==e?"":e)+"}"};function bc(t,e,n){yt(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;o':'':{renderMode:o,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function Sc(t,e,n){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var i=aa(e),r=n?"getUTC":"get",o=i[r+"FullYear"](),a=i[r+"Month"]()+1,s=i[r+"Date"](),l=i[r+"Hours"](),u=i[r+"Minutes"](),h=i[r+"Seconds"](),c=i[r+"Milliseconds"]();return t=t.replace("MM",Kh(a,2)).replace("M",a).replace("yyyy",o).replace("yy",Kh(o%100+"",2)).replace("dd",Kh(s,2)).replace("d",s).replace("hh",Kh(l,2)).replace("h",l).replace("mm",Kh(u,2)).replace("m",u).replace("ss",Kh(h,2)).replace("s",h).replace("SSS",Kh(c,3))}function Mc(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Cc(t,e){return e=e||"transparent",wt(t)?t:St(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}function Lc(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}var Ac=ct,Dc=["left","right","top","bottom","width","height"],Ic=[["width","left","right"],["height","top","bottom"]];function Pc(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),f=e.childAt(u+1),p=f&&f.getBoundingRect();if("horizontal"===t){var g=d.width+(p?-p.x+d.x:0);(h=o+g)>i||l.newline?(o=0,h=g,a+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(p?-p.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+n,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)}))}var Ec=Pc;_t(Pc,"vertical"),_t(Pc,"horizontal");function Oc(t,e,n){n=_c(n||0);var i=e.width,r=e.height,o=qo(t.left,i),a=qo(t.top,r),s=qo(t.right,i),l=qo(t.bottom,r),u=qo(t.width,i),h=qo(t.height,r),c=n[2]+n[0],d=n[1]+n[3],f=t.aspect;switch(isNaN(u)&&(u=i-s-d-o),isNaN(h)&&(h=r-l-c-a),null!=f&&(isNaN(u)&&isNaN(h)&&(f>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(o)&&(o=i-s-u-d),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-d}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-d-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var p=new _n(o+n[3],a+n[0],u,h);return p.margin=n,p}function Nc(t,e,n,i,r,o){var a,s=!r||!r.hv||r.hv[0],l=!r||!r.hv||r.hv[1],u=r&&r.boundingMode||"all";if((o=o||t).x=t.x,o.y=t.y,!s&&!l)return!1;if("raw"===u)a="group"===t.type?new _n(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(a=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(a=a.clone()).applyTransform(h)}var c=Oc(ot({width:a.width,height:a.height},e),n,i),d=s?c.x-a.x:0,f=l?c.y-a.y:0;return"raw"===u?(o.x=d,o.y=f):(o.x+=d,o.y+=f),o===t&&t.markRedraw(),!0}function Rc(t){var e=t.layoutMode||t.constructor.layoutMode;return St(e)?e:e?{type:e}:null}function kc(t,e,n){var i=n&&n.ignoreSize;!yt(i)&&(i=[i,i]);var r=a(Ic[0],0),o=a(Ic[1],1);function a(n,r){var o={},a=0,u={},h=0;if(Ac(n,(function(e){u[e]=t[e]})),Ac(n,(function(t){s(e,t)&&(o[t]=u[t]=e[t]),l(o,t)&&a++,l(u,t)&&h++})),i[r])return l(e,n[1])?u[n[2]]=null:l(e,n[2])&&(u[n[1]]=null),u;if(2!==h&&a){if(a>=2)return o;for(var c=0;c=0;a--)o=nt(o,n[a],!0);e.defaultOption=o}return e.defaultOption},e.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return Ba(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Ih);Wa(Vc,Ih),qa(Vc),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=Ha(t);e[i.main]=n},t.determineSubType=function(n,i){var r=i.type;if(!r){var o=Ha(n).main;t.hasSubTypes(n)&&e[o]&&(r=e[o](i))}return r}}(Vc),function(t,e){function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,i,r,o){if(t.length){var a=function(t){var i={},r=[];return ct(t,(function(o){var a=n(i,o),s=function(t,e){var n=[];return ct(t,(function(t){st(e,t)>=0&&n.push(t)})),n}(a.originalDeps=e(o),t);a.entryCount=s.length,0===a.entryCount&&r.push(o),ct(s,(function(t){st(a.predecessor,t)<0&&a.predecessor.push(t);var e=n(i,t);st(e.successor,t)<0&&e.successor.push(o)}))})),{graph:i,noEntryList:r}}(i),s=a.graph,l=a.noEntryList,u={};for(ct(t,(function(t){u[t]=!0}));l.length;){var h=l.pop(),c=s[h],d=!!u[h];d&&(r.call(o,h,c.originalDeps.slice()),delete u[h]),ct(c.successor,d?p:f)}ct(u,(function(){throw new Error("")}))}function f(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}function p(t){u[t]=!0,f(t)}}}(Vc,(function(t){var e=[];ct(Vc.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})),e=dt(e,(function(t){return Ha(t).main})),"dataset"!==t&&st(e,"dataset")<=0&&e.unshift("dataset");return e}));const Gc=Vc;var Hc="";"undefined"!=typeof navigator&&(Hc=navigator.platform||"");var Uc="rgba(0, 0, 0, 0.2)";const Wc={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Uc,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Uc,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Uc,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Uc,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Uc,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Uc,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Hc.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var jc=jt(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Zc="original",Xc="arrayRows",qc="objectRows",Yc="keyedColumns",Kc="typedArray",Jc="unknown",$c="column",Qc="row",td={Must:1,Might:2,Not:3},ed=Ea();function nd(t,e,n){var i={},r=id(e);if(!r||!t)return i;var o,a,s=[],l=[],u=e.ecModel,h=ed(u).datasetMap,c=r.uid+"_"+n.seriesLayoutBy;ct(t=t.slice(),(function(e,n){var r=St(e)?e:t[n]={name:e};"ordinal"===r.type&&null==o&&(o=n,a=p(r)),i[r.name]=[]}));var d=h.get(c)||h.set(c,{categoryWayDim:a,valueWayDim:0});function f(t,e,n){for(var i=0;ie)return t[i];return t[n-1]}(i,a):n;if((h=h||n)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}var fd="\0_ec_inner";var pd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new Ih(i),this._locale=new Ih(r),this._optionManager=o},e.prototype.setOption=function(t,e,n){var i=vd(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},e.prototype.resetOption=function(t,e){return this._resetOption(t,vd(e))},e.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);0,this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):ud(this,r),n=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&ct(a,(function(t){n=!0,this._mergeOption(t,e)}),this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,e){var n=this.option,i=this._componentsMap,r=this._componentsCount,o=[],a=jt(),s=e&&e.replaceMergeMainTypeMap;ed(this).datasetMap=jt(),ct(t,(function(t,e){null!=t&&(Gc.hasClass(e)?e&&(o.push(e),a.set(e,!0)):n[e]=null==n[e]?et(t):nt(n[e],t,!0))})),s&&s.each((function(t,e){Gc.hasClass(e)&&!a.get(e)&&(o.push(e),a.set(e,!0))})),Gc.topologicalTravel(o,Gc.getAllClassMainTypes(),(function(e){var o=function(t,e,n){var i=ad.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}(this,e,xa(t[e])),a=i.get(e),l=a?s&&s.get(e)?"replaceMerge":"normalMerge":"replaceAll",u=Ma(a,o,l);(function(t,e,n){ct(t,(function(t){var i=t.newOption;St(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){return e.type?e.type:n?n.subType:i.determineSubType(t,e)}(e,i,t.existing,n))}))})(u,e,Gc),n[e]=null,i.set(e,null),r.set(e,0);var h,c=[],d=[],f=0;ct(u,(function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=Gc.getClass(e,t.keyInfo.subType,!o);if(!a)return;if("tooltip"===e){if(h)return void 0;h=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=rt({componentIndex:n},t.keyInfo);rt(i=new a(r,this,this,s),s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(c.push(i.option),d.push(i),f++):(c.push(void 0),d.push(void 0))}),this),n[e]=c,i.set(e,d),r.set(e,f),"series"===e&&sd(this)}),this),this._seriesIndices||sd(this)},e.prototype.getOption=function(){var t=et(this.option);return ct(t,(function(e,n){if(Gc.hasClass(n)){for(var i=xa(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!Ia(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}})),delete t[fd],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;r=e:"max"===n?t<=e:t===e})(i[a],t,o)||(r=!1)}})),r}const Ld=Md;var Ad=ct,Dd=St,Id=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Pd(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=Id.length;n=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var v=m.data.getByRawIndex(m.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&v<0||"samesign"===l&&f>=0&&v>0||"samesign"===l&&f<=0&&v<0){f=ea(f,v),p=v;break}}}return i[0]=f,i[1]=p,i}))}))}var Yd,Kd,Jd,$d,Qd,tf=function(t){this.data=t.data||(t.sourceFormat===Yc?{}:[]),this.sourceFormat=t.sourceFormat||Jc,this.seriesLayoutBy=t.seriesLayoutBy||$c,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;nu&&(u=f)}s[0]=l,s[1]=u}},i=function(){return this._data?this._data.length/this._dimSize:0};function r(t){for(var e=0;e=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""})):void 0},t.prototype.getRawValue=function(t,e){return xf(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,n){},t}();function Tf(t){var e,n;return St(t)?t.type&&(n=t):e=t,{text:e,frag:n}}function Sf(t){return new Mf(t)}var Mf=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){var e,n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(e=this._plan(this.context));var o,a=h(this._modBy),s=this._modDataCount||0,l=h(t&&t.modBy),u=t&&t.modDataCount||0;function h(t){return!(t>=1)&&(t=1),t}a===l&&s===u||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,o=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(o||d1&&i>0?s:a}};return o;function a(){return e=t?null:oe},gte:function(t,e){return t>=e}},Pf=(function(){function t(t,e){if(!Tt(e)){0,Af("")}this._opFn=If[t],this._rvalFloat=da(e)}t.prototype.evaluate=function(t){return Tt(t)?this._opFn(t,this._rvalFloat):this._opFn(da(t),this._rvalFloat)}}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=Tt(t)?t:da(t),i=Tt(e)?e:da(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=wt(t),s=wt(e);a&&(n=s?t:0),s&&(i=a?e:0)}return ni?-this._resultLT:0},t}());!function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=da(e)}t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=da(t)===this._rvalFloat)}return this._isEQ?e:!e}}();var Ef=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return Df(t,e)},t}();function Of(t){if(!Ff(t.sourceFormat)){0,Af("")}return t.data}function Nf(t){var e=t.sourceFormat,n=t.data;if(!Ff(e)){0,Af("")}if(e===Xc){for(var i=[],r=0,o=n.length;r65535?Hf:Uf}function qf(t,e,n,i,r){var o=Zf[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;ug[1]&&(g[1]=p)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=dt(o,(function(t){return t.property})),u=0;um[1]&&(m[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&nt))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],r=[];if(!i)return r;null==n&&(n=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;r=u&&y<=h||isNaN(y))&&(a[s++]=f),f++}d=!0}else if(2===r){p=c[i[0]];var m=c[i[1]],v=t[i[1]][0],_=t[i[1]][1];for(g=0;g=u&&y<=h||isNaN(y))&&(x>=v&&x<=_||isNaN(x))&&(a[s++]=f),f++}d=!0}}if(!d)if(1===r)for(g=0;g=u&&y<=h||isNaN(y))&&(a[s++]=w)}else for(g=0;gt[S][1])&&(b=!1)}b&&(a[s++]=e.getRawIndex(g))}return sm[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(Xf(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var d=1;dn&&(n=i,r=M)}S>0&&Sa&&(p=a-u);for(var g=0;gf&&(f=m,d=u+g)}var v=this.getRawIndex(h),_=this.getRawIndex(d);hu-f&&(s=u-f,a.length=s);for(var p=0;ph[1]&&(h[1]=m),c[d++]=v}return r._count=d,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();ra&&(a=l)}return i=[o,a],this._extent[t]=i,i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return Df(t[i],this._dimensions[i])}Vf={arrayRows:t,objectRows:function(t,e,n,i){return Df(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return Df(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const Kf=Yf;var Jf=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(Qf(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]}else s=Ct(a=o.get("data",!0))?Kc:Zc,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},d=Ot(h.seriesLayoutBy,c.seriesLayoutBy)||null,f=Ot(h.sourceHeader,c.sourceHeader),p=Ot(h.dimensions,c.dimensions);t=d!==c.seriesLayoutBy||!!f!=!!c.sourceHeader||p?[nf(a,{seriesLayoutBy:d,sourceHeader:f,dimensions:p},s)]:[]}else{var g=n;if(r){var m=this._applyTransform(i);t=m.sourceList,e=m.upstreamSignList}else{t=[nf(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,i=n.get("transform",!0),r=n.get("fromTransformResult",!0);if(null!=r){1!==t.length&&tp("")}var o,a=[],s=[];return ct(t,(function(t){t.prepareSource();var e=t.getSource(r||0);null==r||e||tp(""),a.push(e),s.push(t._getVersionSign())})),i?e=function(t,e){var n=xa(t),i=n.length;i||Af("");for(var r=0,o=i;r1||n>0&&!t.noHeader;return ct(t.blocks,(function(t){var n=lp(t);n>=e&&(e=n+ +(i&&(!n||ap(t)&&!t.noHeader)))})),e}return 0}function up(t,e,n,i){var r,o=e.noHeader,a=(r=lp(e),{html:ip[r],richText:rp[r]}),s=[],l=e.blocks||[];zt(!l||yt(l)),l=l||[];var u=t.orderMode;if(e.sortBlocks&&u){l=l.slice();var h={valueAsc:"asc",valueDesc:"desc"};if(Yt(h,u)){var c=new Pf(h[u],null);l.sort((function(t,e){return c.evaluate(t.sortParam,e.sortParam)}))}else"seriesDesc"===u&&l.reverse()}ct(l,(function(n,r){var o=e.valueFormatter,l=sp(n)(o?rt(rt({},t),{valueFormatter:o}):t,n,r>0?a.html:0,i);null!=l&&s.push(l)}));var d="richText"===t.renderMode?s.join(a.richText):dp(i,s.join(""),o?n:a.html);if(o)return d;var f=yc(e.header,"ordinal",t.useUTC),p=np(i,t.renderMode).nameStyle,g=ep(i);return"richText"===t.renderMode?fp(t,f,p)+a.richText+d:dp(i,'
'+ze(f)+"
"+d,n)}function hp(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return dt(t=yt(t)?t:[t],(function(t,e){return yc(t,yt(f)?f[e]:f,u)}))};if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"var(--ow-color-fg-darker)",r),d=o?"":yc(l,"ordinal",u),f=e.valueType,p=a?[]:h(e.value,e.dataIndex),g=!s||!o,m=!s&&o,v=np(i,r),_=v.nameStyle,y=v.valueStyle;return"richText"===r?(s?"":c)+(o?"":fp(t,d,_))+(a?"":function(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(yt(e)?e.join(" "):e,o)}(t,p,g,m,y)):dp(i,(s?"":c)+(o?"":function(t,e,n){return''+ze(t)+""}(d,!s,_))+(a?"":function(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return t=yt(t)?t:[t],''+dt(t,(function(t){return ze(t)})).join("  ")+""}(p,g,m,y)),n)}}function cp(t,e,n,i,r,o){if(t)return sp(t)({useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function dp(t,e,n){return'
'+e+'
'}function fp(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function pp(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}var gp=function(){function t(){this.richTextStyles={},this._nextStyleNameId=pa()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,n){var i="richText"===n?this._generateStyleName():null,r=Tc({color:e,type:t,renderMode:n,markerId:i});return wt(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};yt(e)?ct(e,(function(t){return rt(n,t)})):rt(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}();function mp(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),d=yt(c),f=function(t,e){return Cc(t.getData().getItemVisual(e,"style")[t.visualDrawType])}(o,a);if(h>1||d&&!h){var p=function(t,e,n,i,r){var o=e.getData(),a=ft(t,(function(t,e,n){var i=o.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName}),!1),s=[],l=[],u=[];function h(t,e){var n=o.getDimensionInfo(e);n&&!1!==n.otherDims.tooltip&&(a?u.push(op("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(s.push(t),l.push(n.type)))}return i.length?ct(i,(function(t){h(xf(o,n,t),t)})):ct(t,h),{inlineValues:s,inlineValueTypes:l,blocks:u}}(c,o,a,u,f);e=p.inlineValues,n=p.inlineValueTypes,i=p.blocks,r=p.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=xf(l,a,u[0]),n=g.type}else r=e=d?c[0]:c;var m=Da(o),v=m&&o.name||"",_=l.getName(a),y=s?v:_;return op("section",{header:v,noHeader:s||!m,sortParam:r,blocks:[op("nameValue",{markerType:"item",markerColor:f,name:y,noName:!Bt(y),value:e,valueType:n,dataIndex:a})].concat(i||[])})}var vp=Ea();function _p(t,e){return t.getName(e)||t.getId(e)}var yp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}return I(e,t),e.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=Sf({count:wp,reset:bp}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(vp(this).sourceManager=new Jf(this)).prepareSource();var i=this.getInitialData(t,n);Sp(i,this),this.dataTask.context.data=i,vp(this).dataBeforeProcessed=i,xp(this),this._initSelectedMapFromData(i)},e.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{},r=this.subType;Gc.hasClass(r)&&(r+="Series"),nt(t,e.getTheme().get(this.subType)),nt(t,this.getDefaultOption()),wa(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&kc(t,i,n)},e.prototype.mergeOption=function(t,e){t=nt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Rc(this);n&&kc(this.option,t,n);var i=vp(this).sourceManager;i.dirty(),i.prepareSource();var r=this.getInitialData(t,e);Sp(r,this),this.dataTask.dirty(),this.dataTask.context.data=r,vp(this).dataBeforeProcessed=r,xp(this),this._initSelectedMapFromData(r)},e.prototype.fillDataTextStyle=function(t){if(t&&!Ct(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=cd.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},e.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[_p(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){St(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;l0&&this._innerSelect(t,e)}},e.registerClass=function(t){return Gc.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Gc);function xp(t){var e=t.name;Da(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return ct(n,(function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)})),i.join(" ")}(t)||e)}function wp(t){return t.model.getRawData().count()}function bp(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Tp}function Tp(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Sp(t,e){ct(Zt(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(n){t.wrapMethod(n,_t(Mp,e))}))}function Mp(t,e){var n=Cp(t);return n&&n.setOutputEnd((e||this).count()),e}function Cp(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}ut(yp,bf),ut(yp,cd),Wa(yp,Gc);const Lp=yp;var Ap=function(){function t(){this.group=new Eo,this.uid=Eh("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){},t.prototype.updateLayout=function(t,e,n,i){},t.prototype.updateVisual=function(t,e,n,i){},t.prototype.toggleBlurSeries=function(t,e,n){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Ua(Ap),qa(Ap);const Dp=Ap;function Ip(){var t=Ea();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}var Pp=il.CMD,Ep=[[],[],[]],Op=Math.sqrt,Np=Math.atan2;var Rp=Math.sqrt,kp=Math.sin,zp=Math.cos,Bp=Math.PI;function Fp(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vp(t,e){return(t[0]*e[0]+t[1]*e[1])/(Fp(t)*Fp(e))}function Gp(t,e){return(t[0]*e[1]1&&(a*=Rp(p),s*=Rp(p));var g=(r===o?-1:1)*Rp((a*a*(s*s)-a*a*(f*f)-s*s*(d*d))/(a*a*(f*f)+s*s*(d*d)))||0,m=g*a*f/s,v=g*-s*d/a,_=(t+n)/2+zp(c)*m-kp(c)*v,y=(e+i)/2+kp(c)*m+zp(c)*v,x=Gp([1,0],[(d-m)/a,(f-v)/s]),w=[(d-m)/a,(f-v)/s],b=[(-1*d-m)/a,(-1*f-v)/s],T=Gp(w,b);if(Vp(w,b)<=-1&&(T=Bp),Vp(w,b)>=1&&(T=0),T<0){var S=Math.round(T/Bp*1e6)/1e6;T=2*Bp+S%2*Bp}h.addData(u,_,y,a,s,x,T,c,o)}var Up=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Wp=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var jp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.applyTransform=function(t){},e}(Sl);function Zp(t){return null!=t.setData}function Xp(t,e){var n=function(t){var e=new il;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=il.CMD,l=t.match(Up);if(!l)return e;for(var u=0;uI*I+P*P&&(S=C,M=L),{cx:S,cy:M,x0:-h,y0:-c,x1:S*(r/w-1),y1:M*(r/w-1)}}function dg(t,e){var n,i=lg(e.r,0),r=lg(e.r0||0,0),o=i>0;if(o||r>0){if(o||(i=r,r=0),r>i){var a=i;i=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var u=e.cx,h=e.cy,c=!!e.clockwise,d=ag(l-s),f=d>eg&&d%eg;if(f>hg&&(d=f),i>hg)if(d>eg-hg)t.moveTo(u+i*ig(s),h+i*ng(s)),t.arc(u,h,i,s,l,!c),r>hg&&(t.moveTo(u+r*ig(l),h+r*ng(l)),t.arc(u,h,r,l,s,c));else{var p=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,w=void 0,b=void 0,T=void 0,S=void 0,M=void 0,C=void 0,L=void 0,A=void 0,D=void 0,I=i*ig(s),P=i*ng(s),E=r*ig(l),O=r*ng(l),N=d>hg;if(N){var R=e.cornerRadius;R&&(n=function(t){var e;if(yt(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}(R),p=n[0],g=n[1],m=n[2],v=n[3]);var k=ag(i-r)/2;if(_=ug(k,m),y=ug(k,v),x=ug(k,p),w=ug(k,g),S=b=lg(_,y),M=T=lg(x,w),(b>hg||T>hg)&&(C=i*ig(l),L=i*ng(l),A=r*ig(s),D=r*ng(s),dhg){var W=ug(m,S),j=ug(v,S),Z=cg(A,D,I,P,i,W,c),X=cg(C,L,E,O,i,j,c);t.moveTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),S0&&t.arc(u+Z.cx,h+Z.cy,W,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,i,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),!c),j>0&&t.arc(u+X.cx,h+X.cy,j,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.moveTo(u+I,h+P),t.arc(u,h,i,s,l,!c);else t.moveTo(u+I,h+P);if(r>hg&&N)if(M>hg){W=ug(p,M),Z=cg(E,O,C,L,r,-(j=ug(g,M)),c),X=cg(I,P,A,D,r,-W,c);t.lineTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),M0&&t.arc(u+Z.cx,h+Z.cy,j,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,r,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),c),W>0&&t.arc(u+X.cx,h+X.cy,W,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.lineTo(u+E,h+O),t.arc(u,h,r,l,s,c);else t.lineTo(u+E,h+O)}else t.moveTo(u,h);t.closePath()}}}var fg=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},pg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new fg},e.prototype.buildPath=function(t,e){dg(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(Sl);pg.prototype.type="sector";const gg=pg;var mg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},vg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new mg},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},e}(Sl);vg.prototype.type="ring";const _g=vg;function yg(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=function(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;dXg[1]){if(a=!1,r)return a;var u=Math.abs(Xg[0]-Zg[1]),h=Math.abs(Zg[0]-Xg[1]);Math.min(u,h)>i.len()&&(uMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function xm(t){return!t.isGroup}function wm(t,e,n){if(t&&e){var i=function(t){var e={};return t.traverse((function(t){xm(t)&&t.anid&&(e[t.anid]=t)})),e}(t);e.traverse((function(t){if(xm(t)&&t.anid){var e=i[t.anid];if(e){var o=r(t);t.attr(r(e)),Ju(t,o,n,nu(t).dataIndex)}}}))}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=rt({},t.shape)),e}}function bm(t,e){return dt(t,(function(t){var n=t[0];n=em(n,e.x),n=nm(n,e.x+e.width);var i=t[1];return i=em(i,e.y),[n,i=nm(i,e.y+e.height)]}))}function Tm(t,e){var n=em(t.x,e.x),i=nm(t.x+t.width,e.x+e.width),r=em(t.y,e.y),o=nm(t.y+t.height,e.y+e.height);if(i>=n&&o>=r)return{x:n,y:r,width:i-n,height:o-r}}function Sm(t,e,n){var i=rt({rectHover:!0},e),r=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),ot(r,n),new Pl(i)):um(t.replace("path://",""),i,n,"center")}function Mm(t,e,n,i,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var p=t-r,g=e-o,m=Lm(p,g,u,h)/f;if(m<0||m>1)return!1;var v=Lm(p,g,c,d)/f;return!(v<0||v>1)}function Lm(t,e,n,i){return t*i-n*e}function Am(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=wt(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&ct(mt(l),(function(t){Yt(s,t)||(s[t]=l[t],s.$vars.push(t))}));var u=nu(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:ot({content:i,encodeHTMLContent:!0,formatterParams:s},r)}}function Dm(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Im(t,e){if(t)if(yt(t))for(var n=0;n=0?c():h=setTimeout(c,-r),l=i};return d.clear=function(){h&&(clearTimeout(h),h=null)},d.debounceNextCall=function(t){s=t},d}function Wm(t,e,n,i){var r=t[e];if(r){var o=r[Vm]||r,a=r[Hm];if(r[Gm]!==n||a!==i){if(null==n||!i)return t[e]=o;(r=t[e]=Um(o,n,"debounce"===i))[Vm]=o,r[Hm]=i,r[Gm]=n}return r}}function jm(t,e){var n=t[e];n&&n[Vm]&&(n.clear&&n.clear(),t[e]=n[Vm])}var Zm=Ea(),Xm={itemStyle:Ya(Ch,!0),lineStyle:Ya(Th,!0)},qm={lineStyle:"stroke",itemStyle:"fill"};function Ym(t,e){var n=t.visualStyleMapper||Xm[e];return n||(console.warn("Unknown style type '"+e+"'."),Xm.itemStyle)}function Km(t,e){var n=t.visualDrawType||qm[e];return n||(console.warn("Unknown style type '"+e+"'."),"fill")}var Jm={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=Ym(t,i)(r),a=r.getShallow("decal");a&&(n.setVisual("decal",a),a.dirty=!0);var s=Km(t,i),l=o[s],u=xt(l)?l:null,h="auto"===o.fill||"auto"===o.stroke;if(!o[s]||u||h){var c=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[s]||(o[s]=c,n.setVisual("colorFromPalette",!0)),o.fill="auto"===o.fill||xt(o.fill)?c:o.fill,o.stroke="auto"===o.stroke||xt(o.stroke)?c:o.stroke}if(n.setVisual("style",o),n.setVisual("drawType",s),!e.isSeriesFiltered(t)&&u)return n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=rt({},o);r[s]=u(i),e.setItemVisual(n,"style",r)}}}},$m=new Ih,Qm={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=Ym(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){$m.option=n[i];var a=r($m);rt(t.ensureUniqueItemVisual(e,"style"),a),$m.option.decal&&(t.setItemVisual(e,"decal",$m.option.decal),$m.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},tv={performRawSeries:!0,overallReset:function(t){var e=jt();t.eachSeries((function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,r=e.get(i);r||(r={},e.set(i,r)),Zm(t).scope=r}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=Zm(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Km(e,a);r.each((function(t){var e=r.getRawIndex(t);i[e]=t})),n.each((function(t){var a=i[t];if(r.getItemVisual(a,"colorFromPalette")){var l=r.ensureUniqueItemVisual(a,"style"),u=n.getName(t)||t+"",h=n.count();l[s]=e.getColorFromPalette(u,o,h)}}))}}))}},ev=Math.PI;var nv=function(){function t(t,e,n,i){this._stageTaskMap=jt(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex?n.step:null,o=i&&i.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),r=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,o=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=jt();t.eachSeries((function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;ct(this._allHandlers,(function(i){var r=t.get(i.uid)||t.set(i.uid,{});zt(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)}),this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){i=i||{};var r=!1,o=this;function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}ct(t,(function(t,s){if(!i.visualType||i.visualType===t.visualType){var l=o._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each((function(t){a(i,t)&&(t.dirty(),c=!0)})),c&&h.dirty(),o.updatePayload(h,n);var f=o.getPerformArgs(h,i.block);d.each((function(t){t.perform(f)})),h.perform(f)&&(r=!0)}else u&&u.each((function(s,l){a(i,s)&&s.dirty();var u=o.getPerformArgs(s,i.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),o.updatePayload(s,n),s.perform(u)&&(r=!0)}))}})),this.unfinished=r||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){var r=this,o=e.seriesTaskMap,a=e.seriesTaskMap=jt(),s=t.seriesType,l=t.getTargetSeries;function u(e){var s=e.uid,l=a.set(s,o&&o.get(s)||Sf({plan:sv,reset:lv,count:cv}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:r},r._pipe(e,l)}t.createOnAllSeries?n.eachRawSeries(u):s?n.eachRawSeriesByType(s,u):l&&l(n,i).each(u)},t.prototype._createOverallStageTask=function(t,e,n,i){var r=this,o=e.overallTask=e.overallTask||Sf({reset:iv});o.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:r};var a=o.agentStubMap,s=o.agentStubMap=jt(),l=t.seriesType,u=t.getTargetSeries,h=!0,c=!1;function d(t){var e=t.uid,n=s.set(e,a&&a.get(e)||(c=!0,Sf({reset:rv,onDirty:av})));n.context={model:t,overallProgress:h},n.agent=o,n.__block=h,r._pipe(t,n)}zt(!t.createOnAllSeries,""),l?n.eachRawSeriesByType(l,d):u?u(n,i).each(d):(h=!1,ct(n.getSeries(),d)),c&&o.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return xt(t)&&(t={overallReset:t,seriesType:dv(t)}),t.uid=Eh("stageHandler"),e&&(t.visualType=e),t},t}();function iv(t){t.overallReset(t.ecModel,t.api,t.payload)}function rv(t){return t.overallProgress&&ov}function ov(){this.agent.dirty(),this.getDownstream().dirty()}function av(){this.agent&&this.agent.dirty()}function sv(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function lv(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=xa(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?dt(e,(function(t,e){return hv(e)})):uv}var uv=hv(0);function hv(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)}))}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,r=n.packedEvent,o=n.model,a=n.view;if(!o||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,o,"mainType")&&u(s,o,"subType")&&u(s,o,"index","componentIndex")&&u(s,o,"name")&&u(s,o,"id")&&u(l,r,"name")&&u(l,r,"dataIndex")&&u(l,r,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,i,r));function u(t,e,n,i){return null==t[n]||e[i||n]===t[n]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Lv=["symbol","symbolSize","symbolRotate","symbolOffset"],Av=Lv.concat(["symbolKeepAspect"]),Dv={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},r={},o=!1,a=0;a=0&&qv(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}(t,e,n):function(t,e,n){var i=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(i=i*n.width+n.x,r=r*n.width+n.x,o=o*n.height+n.y,a=a*n.height+n.y),i=qv(i)?i:0,r=qv(r)?r:1,o=qv(o)?o:0,a=qv(a)?a:0,t.createLinearGradient(i,o,r,a)}(t,e,n),r=e.colorStops,o=0;o0&&(e=i.lineDash,n=i.lineWidth,e&&"solid"!==e&&n>0?"dashed"===e?[4*n,2*n]:"dotted"===e?[n]:Tt(e)?[e]:yt(e)?e:null:null),o=i.lineDashOffset;if(r){var a=i.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=dt(r,(function(t){return t/a})),o/=a)}return[r,o]}var Qv=new il(!0);function t_(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function e_(t){return"string"==typeof t&&"none"!==t}function n_(t){var e=t.fill;return null!=e&&"none"!==e}function i_(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function r_(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function o_(t,e,n){var i=ts(e.image,e.__image,n);if(ns(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*Jt),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}var a_=["shadowBlur","shadowOffsetX","shadowOffsetY"],s_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function l_(t,e,n,i,r){var o=!1;if(!i&&e===(n=n||{}))return!1;if(i||e.opacity!==n.opacity){g_(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?vs.opacity:a}(i||e.blend!==n.blend)&&(o||(g_(t,r),o=!0),t.globalCompositeOperation=e.blend||vs.blend);for(var s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,e,n){if(!this[z_])if(this._disposed)py(this.id);else{var i,r,o;if(St(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[z_]=!0,!this._model||e){var a=new Ld(this._api),s=this._theme,l=this._model=new _d;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},_y);var u={seriesTransition:o,optionChanged:!0};if(n)this[B_]={silent:i,updateParams:u},this[z_]=!1,this.getZr().wakeUp();else{try{j_(this),q_.update.call(this,null,u)}catch(t){throw this[B_]=null,this[z_]=!1,t}this._ssr||this._zr.flush(),this[B_]=null,this[z_]=!1,$_.call(this,i),Q_.call(this,i)}}},e.prototype.setTheme=function(){Lf()},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||O.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(O.svgSupported){var t=this._zr;return ct(t.storage.getDisplayList(),(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,n=this._model,i=[],r=this;ct(e,(function(t){n.eachComponent({mainType:t},(function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)}))}));var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return ct(i,(function(t){t.group.ignore=!1})),o}py(this.id)},e.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(Ty[n]){var a=o,s=o,l=-1/0,u=-1/0,h=[],c=t&&t.pixelRatio||this.getDevicePixelRatio();ct(by,(function(o,c){if(o.group===n){var d=e?o.getZr().painter.getSvgDom().innerHTML:o.renderToCanvas(et(t)),f=o.getDom().getBoundingClientRect();a=i(f.left,a),s=i(f.top,s),l=r(f.right,l),u=r(f.bottom,u),h.push({dom:d,left:f.left,top:f.top})}}));var d=(l*=c)-(a*=c),f=(u*=c)-(s*=c),p=F.createCanvas(),g=zo(p,{renderer:e?"svg":"canvas"});if(g.resize({width:d,height:f}),e){var m="";return ct(h,(function(t){var e=t.left-a,n=t.top-s;m+=''+t.dom+""})),g.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&g.painter.setBackgroundColor(t.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return t.connectedBackgroundColor&&g.add(new Fl({shape:{x:0,y:0,width:d,height:f},style:{fill:t.connectedBackgroundColor}})),ct(h,(function(t){var e=new Pl({style:{x:t.left*c-a,y:t.top*c-s,image:t.dom}});g.add(e)})),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}py(this.id)},e.prototype.convertToPixel=function(t,e){return Y_(this,"convertToPixel",t,e)},e.prototype.convertFromPixel=function(t,e){return Y_(this,"convertFromPixel",t,e)},e.prototype.containPixel=function(t,e){var n;if(!this._disposed)return ct(Na(this._model,t),(function(t,i){i.indexOf("Models")>=0&&ct(t,(function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}else 0}),this)}),this),!!n;py(this.id)},e.prototype.getVisual=function(t,e){var n=Na(this._model,t,{defaultMainType:"series"});var i=n.seriesModel.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=r?function(t,e,n){switch(n){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,n)}}(i,r,e):function(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}(i,e)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t,e,n,i=this;ct(fy,(function(t){var e=function(e){var n,r=i.getModel(),o=e.target;if("globalout"===t?n={}:o&&Ev(o,(function(t){var e=nu(t);if(e&&null!=e.dataIndex){var i=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType,o)||{},!0}if(e.eventData)return n=rt({},e.eventData),!0}),!0),n){var a=n.componentType,s=n.componentIndex;"markLine"!==a&&"markPoint"!==a&&"markArea"!==a||(a="series",s=n.seriesIndex);var l=a&&null!=s&&r.getComponent(a,s),u=l&&i["series"===l.mainType?"_chartsMap":"_componentsMap"][l.__viewId];0,n.event=e,n.type=t,i._$eventProcessor.eventInfo={targetEl:o,packedEvent:n,model:l,view:u},i.trigger(t,n)}};e.zrEventfulCallAtLast=!0,i._zr.on(t,e,i)})),ct(my,(function(t,e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})),ct(["selectchanged"],(function(t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),t=this._messageCenter,e=this,n=this._api,t.on("selectchanged",(function(t){var i=n.getModel();t.isFromClick?(Pv("map","selectchanged",e,i,t),Pv("pie","selectchanged",e,i,t)):"select"===t.fromAction?(Pv("map","selected",e,i,t),Pv("pie","selected",e,i,t)):"unselect"===t.fromAction&&(Pv("map","unselected",e,i,t),Pv("pie","unselected",e,i,t))}))},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){this._disposed?py(this.id):this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed)py(this.id);else{this._disposed=!0,this.getDom()&&Fa(this.getDom(),Cy,"");var t=this,e=t._api,n=t._model;ct(t._componentsViews,(function(t){t.dispose(n,e)})),ct(t._chartsViews,(function(t){t.dispose(n,e)})),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete by[t.id]}},e.prototype.resize=function(t){if(!this[z_])if(this._disposed)py(this.id);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[B_]&&(null==i&&(i=this[B_].silent),n=!0,this[B_]=null),this[z_]=!0;try{n&&j_(this),q_.update.call(this,{type:"resize",animation:rt({duration:0},t&&t.animation)})}catch(t){throw this[z_]=!1,t}this[z_]=!1,$_.call(this,i),Q_.call(this,i)}}},e.prototype.showLoading=function(t,e){if(this._disposed)py(this.id);else if(St(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),wy[t]){var n=wy[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},e.prototype.hideLoading=function(){this._disposed?py(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},e.prototype.makeActionFromEvent=function(t){var e=rt({},t);return e.type=my[t.type],e},e.prototype.dispatchAction=function(t,e){if(this._disposed)py(this.id);else if(St(e)||(e={silent:!!e}),gy[t.type]&&this._model)if(this[z_])this._pendingActions.push(t);else{var n=e.silent;J_.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&O.browser.weChat&&this._throttledZrFlush(),$_.call(this,n),Q_.call(this,n)}},e.prototype.updateLabelLayout=function(){C_.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed)py(this.id);else{var e=t.seriesIndex;0,this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},e.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))}function e(t){for(var e=[],n=t.currentStates,i=0;i0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(t){if(t.states&&t.states.emphasis){if(Qu(t))return;if(t instanceof Sl&&function(t){var e=ou(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var n=t.prevStates;n&&t.useStates(n)}if(r){t.stateTransition=a;var i=t.getTextContent(),o=t.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&e(t)}}))}j_=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),Z_(t,!0),Z_(t,!1),e.plan()},Z_=function(t,e){for(var n=t._model,i=t._scheduler,r=e?t._componentsViews:t._chartsViews,o=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!O.node&&!O.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),C_.trigger("series:afterupdate",e,i,s)},sy=function(t){t[F_]=!0,t.getZr().wakeUp()},ly=function(t){t[F_]&&(t.getZr().storage.traverse((function(t){Qu(t)||e(t)})),t[F_]=!1)},oy=function(t){return new(function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return I(n,e),n.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(e){for(;e;){var n=e.__ecComponentInfo;if(null!=n)return t._model.getComponent(n.mainType,n.index);e=e.parent}},n.prototype.enterEmphasis=function(e,n){Iu(e,n),sy(t)},n.prototype.leaveEmphasis=function(e,n){Pu(e,n),sy(t)},n.prototype.enterBlur=function(e){!function(t){Mu(t,xu)}(e),sy(t)},n.prototype.leaveBlur=function(e){Eu(e),sy(t)},n.prototype.enterSelect=function(e){Ou(e),sy(t)},n.prototype.leaveSelect=function(e){Nu(e),sy(t)},n.prototype.getModel=function(){return t.getModel()},n.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},n.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},n}(xd))(t)},ay=function(t){function e(t,e){for(var n=0;n=0)){jy.push(n);var o=vv.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function Xy(t,e){wy[t]=e}function qy(t){V({createCanvas:t})}function Yy(t,e,n){var i=A_("registerMap");i&&i(t,e,n)}function Ky(t){var e=A_("getMap");return e&&e(t)}var Jy=function(t){var e=(t=et(t)).type;e||Af("");var n=e.split(":");2!==n.length&&Af("");var i=!1;"echarts"===n[0]&&(e=n[1],i=!0),t.__isBuiltIn=i,zf.set(e,t)};Wy(O_,Jm),Wy(R_,Qm),Wy(R_,tv),Wy(O_,Dv),Wy(R_,Iv),Wy(7e3,(function(t,e){t.eachRawSeries((function(n){if(!t.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(t){var n=i.getItemVisual(t,"decal");n&&(i.ensureUniqueItemVisual(t,"style").decal=b_(n,e))}));var r=i.getVisual("decal");if(r)i.getVisual("style").decal=b_(r,e)}}))})),Ry(Xd),ky(900,(function(t){var e=jt();t.eachSeries((function(t){var n=t.get("stack");if(n){var i=e.get(n)||e.set(n,[]),r=t.getData(),o={stackResultDimension:r.getCalculationInfo("stackResultDimension"),stackedOverDimension:r.getCalculationInfo("stackedOverDimension"),stackedDimension:r.getCalculationInfo("stackedDimension"),stackedByDimension:r.getCalculationInfo("stackedByDimension"),isStackedByIndex:r.getCalculationInfo("isStackedByIndex"),data:r,seriesModel:t};if(!o.stackedDimension||!o.isStackedByIndex&&!o.stackedByDimension)return;i.length&&r.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(o)}})),e.each(qd)})),Xy("default",(function(t,e){ot(e=e||{},{text:"loading",textColor:"var(--ow-color-black)",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Eo,i=new Fl({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r,o=new eu({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Fl({style:{fill:"none"},textContent:o,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return n.add(a),e.showSpinner&&((r=new zg({shape:{startAngle:-ev/2,endAngle:-ev/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*ev/2}).start("circularInOut"),r.animateShape(!0).when(1e3,{startAngle:3*ev/2}).delay(300).start("circularInOut"),n.add(r)),n.resize=function(){var n=o.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&r.setShape({cx:l,cy:u}),a.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n})),Vy({type:cu,event:cu,update:cu},Kt),Vy({type:du,event:du,update:du},Kt),Vy({type:fu,event:fu,update:fu},Kt),Vy({type:pu,event:pu,update:pu},Kt),Vy({type:gu,event:gu,update:gu},Kt),Ny("light",yv),Ny("dark",Mv);var $y={};function Qy(t){return null==t?0:t.length||1}function tx(t){return t}const ex=function(){function t(t,e,n,i,r,o){this._old=t,this._new=e,this._oldKeyGetter=n||tx,this._newKeyGetter=i||tx,this.context=r,this._diffModeMultiple="multiple"===o}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),r=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,r,"_newKeyGetter");for(var o=0;o1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1&&c>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(h>1)for(var d=0;d1)for(var a=0;a30}var dx,fx,px,gx,mx,vx,_x,yx=St,xx=dt,bx="undefined"==typeof Int32Array?Array:Int32Array,Tx=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Sx=["_approximateExtent"],Mx=function(){function t(t,e){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var i=!1;lx(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(i=!0,n=t),n=n||["x","y"];for(var r={},o=[],a={},s=!1,l={},u=0;u=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,r=this._idList;if(n.getSource().sourceFormat===Zc&&!n.pure)for(var o=[],a=t;a0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(yt(r=this.getVisual(e))?r=r.slice():yx(r)&&(r=rt({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,yx(e)?rt(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){yx(t)?rt(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?rt(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){!function(t,e,n,i){if(i){var r=nu(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,r.ssrType="chart","group"===i.type&&i.traverse((function(i){var r=nu(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e,r.ssrType="chart"}))}}(this.hostModel&&this.hostModel.seriesIndex,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){ct(this._graphicEls,(function(n,i){n&&t&&t.call(e,n,i)}))},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:xx(this.dimensions,this._getDimInfo,this),this.hostModel)),mx(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];xt(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(Rt(arguments)))})},t.internalField=(dx=function(t){var e=t._invertedIndicesMap;ct(e,(function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new bx(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),t}();const Cx=Mx;function Lx(t,e){return Ax(t,e).dimensions}function Ax(t,e){ef(t)||(t=rf(t));var n=(e=e||{}).coordDimensions||[],i=e.dimensionsDefine||t.dimensionsDefine||[],r=jt(),o=[],a=function(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return ct(e,(function(t){var e;St(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(t,n,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&cx(a),l=i===t.dimensionsDefine,u=l?hx(t):ux(i),h=e.encodeDefine;!h&&e.encodeDefaulter&&(h=e.encodeDefaulter(t,a));for(var c=jt(h),d=new Wf(a),f=0;f0&&(i.name=r+(o-1)),o++,e.set(r,o)}}(o),new sx({source:t,dimensions:o,fullDimensionCount:a,dimensionOmitted:s})}function Dx(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}var Ix=function(t){this.coordSysDims=[],this.axisMap=jt(),this.categoryAxisMap=jt(),this.coordSysName=t};var Px={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",ka).models[0],o=t.getReferringComponents("yAxis",ka).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),Ex(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),Ex(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",ka).models[0];e.coordSysDims=["single"],n.set("single",r),Ex(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",ka).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),Ex(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),Ex(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,n,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();ct(o.parallelAxisIndex,(function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),Ex(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))}))}};function Ex(t){return"category"===t.get("type")}function Ox(t,e,n){var i,r,o,a=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(t){return!lx(t.schema)}(e)?(r=e.schema,i=r.dimensions,o=e.store):i=e;var l,u,h,c,d=!(!t||!t.get("stack"));if(ct(i,(function(t,e){wt(t)&&(i[e]=t={name:t}),d&&!t.isExtraCoord&&(a||l||!t.ordinalMeta||(l=t),u||"ordinal"===t.type||"time"===t.type||s&&s!==t.coordDim||(u=t))})),!u||a||l||(a=!0),u){h="__\0ecstackresult_"+t.id,c="__\0ecstackedover_"+t.id,l&&(l.createInvertedIndices=!0);var f=u.coordDim,p=u.type,g=0;ct(i,(function(t){t.coordDim===f&&g++}));var m={name:h,coordDim:f,coordDimIndex:g,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:c,coordDim:c,coordDimIndex:g+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};r?(o&&(m.storeDimIndex=o.ensureCalculationDimension(c,p),v.storeDimIndex=o.ensureCalculationDimension(h,p)),r.appendCalculationDimension(m),r.appendCalculationDimension(v)):(i.push(m),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:a,stackedOverDimension:c,stackResultDimension:h}}function Nx(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function Rx(t,e){return Nx(t,e)?t.getCalculationInfo("stackResultDimension"):e}const kx=function(t,e,n){n=n||{};var i,r=e.getSourceManager(),o=!1;t?(o=!0,i=rf(t)):o=(i=r.getSource()).sourceFormat===Zc;var a=function(t){var e=t.get("coordinateSystem"),n=new Ix(e),i=Px[e];if(i)return i(t,n,n.axisMap,n.categoryAxisMap),n}(e),s=function(t,e){var n,i=t.get("coordinateSystem"),r=Td.get(i);return e&&e.coordSysDims&&(n=dt(e.coordSysDims,(function(t){var n={name:t},i=e.axisMap.get(t);if(i){var r=i.get("type");n.type=function(t){return"category"===t?"ordinal":"time"===t?"time":"float"}(r)}return n}))),n||(n=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),n}(e,a),l=n.useEncodeDefaulter,u=xt(l)?l:l?_t(nd,s,e):null,h=Ax(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!o}),c=function(t,e,n){var i,r;return n&&ct(t,(function(t,o){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=o),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(r=!0)})),r||null==i||(t[i].otherDims.itemName=0),i}(h.dimensions,n.createInvertedIndices,a),d=o?null:r.getSharedDataStore(h),f=Ox(e,{schema:h,store:d}),p=new Cx(h,e);p.setCalculationInfo(f);var g=null!=c&&function(t){if(t.sourceFormat===Zc){return!yt(Ta(function(t){var e=0;for(;ee[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();qa(zx);const Bx=zx;var Fx=0;function Vx(t){return St(t)&&null!=t.value?t.value:t+""}const Gx=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++Fx}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&dt(i,Vx);return new t({categories:r,needCollect:!r,deduplication:!1!==n.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!wt(t)&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return null==(e=i.get(t))&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=jt(this.categories))},t}();function Hx(t){return"interval"===t.type||"log"===t.type}function Ux(t,e,n,i){var r={},o=t[1]-t[0],a=r.interval=ua(o/e,!0);null!=n&&ai&&(a=r.interval=i);var s=r.intervalPrecision=jx(a);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Zx(t,0,e),Zx(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(r.niceTickExtent=[Yo(Math.ceil(t[0]/a)*a,s),Yo(Math.floor(t[1]/a)*a,s)],t),r}function Wx(t){var e=Math.pow(10,la(t)),n=t/e;return n?2===n?n=3:3===n?n=5:n*=2:n=1,Yo(n*e)}function jx(t){return Jo(t)+2}function Zx(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function Xx(t,e){return t>=e[0]&&t<=e[1]}function qx(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Yx(t,e){return t*(e[1]-e[0])+e[0]}var Kx=function(t){function e(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new Gx({})),yt(i)&&(i=new Gx({categories:dt(i,(function(t){return St(t)?t.value:t}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return I(e,t),e.prototype.parse=function(t){return null==t?NaN:wt(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return Xx(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]},e.prototype.normalize=function(t){return qx(t=this._getTickNumber(this.parse(t)),this._extent)},e.prototype.scale=function(t){return t=Math.round(Yx(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Bx);Bx.registerClass(Kx);const Jx=Kx;var $x=Yo,Qx=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return I(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t,this._extent)},e.prototype.normalize=function(t){return qx(t,this._extent)},e.prototype.scale=function(t){return Yx(t,this._extent)},e.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=jx(t)},e.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;n[0]1e4)return[];var s=o.length?o[o.length-1].value:i[1];return n[1]>s&&(t?o.push({value:$x(s+e,r)}):o.push({value:n[1]})),o},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;ri[0]&&h0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}(t),n=[];return ct(t,(function(t){var i,r=t.coordinateSystem.getBaseAxis(),o=r.getExtent();if("category"===r.type)i=r.getBandWidth();else if("value"===r.type||"time"===r.type){var a=r.dim+"_"+r.index,s=e[a],l=Math.abs(o[1]-o[0]),u=r.scale.getExtent(),h=Math.abs(u[1]-u[0]);i=s?l/h*s:l}else{var c=t.getData();i=Math.abs(o[1]-o[0])/c.count()}var d=qo(t.get("barWidth"),i),f=qo(t.get("barMaxWidth"),i),p=qo(t.get("barMinWidth")||(lw(t)?.5:1),i),g=t.get("barGap"),m=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:d,barMaxWidth:f,barMinWidth:p,barGap:g,barCategoryGap:m,axisKey:iw(r),stackId:nw(t)})})),aw(n)}function aw(t){var e={};ct(t,(function(t,n){var i=t.axisKey,r=t.bandWidth,o=e[i]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[i]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var d=t.barCategoryGap;null!=d&&(o.categoryGap=d)}));var n={};return ct(e,(function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=mt(i).length;o=Math.max(35-4*a,15)+"%"}var s=qo(o,r),l=qo(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),ct(i,(function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&ei&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}})),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var d,f=0;ct(i,(function(t,e){t.width||(t.width=c),d=t,f+=t.width*(1+l)})),d&&(f-=d.width*l);var p=-f/2;ct(i,(function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:p,width:t.width},p+=t.width*(1+l)}))})),n}function sw(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function lw(t){return t.pipelineContext&&t.pipelineContext.large}var uw=function(t){function e(e){var n=t.call(this,e)||this;return n.type="time",n}return I(e,t),e.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return Qh(t.value,Xh[function(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}(Jh(this._minLevelUnit))]||Xh.second,e,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,e,n){var i=this.getSetting("useUTC");return function(t,e,n,i,r){var o=null;if(wt(n))o=n;else if(xt(n))o=n(t.value,e,{level:t.level});else{var a=rt({},jh);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(yt(o)){var h=null==t.level?0:t.level>=0?t.level:o.length+t.level;o=o[h=Math.min(h,o.length-1)]}}return Qh(new Date(t.value),o,r,i)}(t,e,n,this.getSetting("locale"),i)},e.prototype.getTicks=function(){var t=this._interval,e=this._extent,n=[];if(!t)return n;n.push({value:e[0],level:0});var i=this.getSetting("useUTC"),r=function(t,e,n,i){var r=1e4,o=Yh,a=0;function s(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===u&&o.unshift({value:o[0].value-d})}}for(u=0;u=i[0]&&v<=i[1]&&c++)}var _=(i[1]-i[0])/e;if(c>1.5*_&&d>_/1.5)break;if(u.push(g),c>_||t===o[f])break}h=[]}}0;var y=pt(dt(u,(function(t){return pt(t,(function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd}))})),(function(t){return t.length>0})),x=[],w=y.length-1;for(f=0;fn&&(this._approxInterval=n);var o=hw.length,a=Math.min(function(t,e,n,i){for(;n>>1;t[r][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function dw(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function fw(t){return(t/=Hh)>12?12:t>6?6:t>3.5?4:t>2?2:1}function pw(t,e){return(t/=e?Gh:Vh)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function gw(t){return ua(t,!0)}function mw(t,e,n){var i=new Date(t);switch(Jh(e)){case"year":case"month":i[hc(n)](0);case"day":i[cc(n)](1);case"hour":i[dc(n)](0);case"minute":i[fc(n)](0);case"second":i[pc(n)](0),i[gc(n)](0)}return i.getTime()}Bx.registerClass(uw);const vw=uw;var _w=Bx.prototype,yw=tw.prototype,xw=Yo,ww=Math.floor,bw=Math.ceil,Tw=Math.pow,Sw=Math.log,Mw=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new tw,e._interval=0,e}return I(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent();return dt(yw.getTicks.call(this,t),(function(t){var e=t.value,r=Yo(Tw(this.base,e));return r=e===n[0]&&this._fixMin?Lw(r,i[0]):r,{value:r=e===n[1]&&this._fixMax?Lw(r,i[1]):r}}),this)},e.prototype.setExtent=function(t,e){var n=Sw(this.base);t=Sw(Math.max(0,t))/n,e=Sw(Math.max(0,e))/n,yw.setExtent.call(this,t,e)},e.prototype.getExtent=function(){var t=this.base,e=_w.getExtent.call(this);e[0]=Tw(t,e[0]),e[1]=Tw(t,e[1]);var n=this._originalScale.getExtent();return this._fixMin&&(e[0]=Lw(e[0],n[0])),this._fixMax&&(e[1]=Lw(e[1],n[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=Sw(t[0])/Sw(e),t[1]=Sw(t[1])/Sw(e),_w.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=sa(n);for(t/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var r=[Yo(bw(e[0]/i)*i),Yo(ww(e[1]/i)*i)];this._interval=i,this._niceExtent=r}},e.prototype.calcNiceExtent=function(t){yw.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t=Sw(t)/Sw(this.base),this._extent)},e.prototype.normalize=function(t){return qx(t=Sw(t)/Sw(this.base),this._extent)},e.prototype.scale=function(t){return t=Yx(t,this._extent),Tw(this.base,t)},e.type="log",e}(Bx),Cw=Mw.prototype;function Lw(t,e){return xw(t,Jo(e))}Cw.getMinorTicks=yw.getMinorTicks,Cw.getLabel=yw.getLabel,Bx.registerClass(Mw);const Aw=Mw;var Dw=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),a<0&&s<0&&!u&&(s=0));var c=this._determinedMin,d=this._determinedMax;return null!=c&&(a=c,l=!0),null!=d&&(s=d,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[Pw[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[Iw[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),Iw={min:"_determinedMin",max:"_determinedMax"},Pw={min:"_dataMin",max:"_dataMax"};function Ew(t,e,n){var i=t.rawExtentInfo;return i||(i=new Dw(t,e,n),t.rawExtentInfo=i,i)}function Ow(t,e){return null==e?null:Pt(e)?NaN:t.parse(e)}function Nw(t,e){var n=t.type,i=Ew(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var r=i.min,o=i.max,a=e.ecModel;if(a&&"time"===n){var s=rw("bar",a),l=!1;if(ct(s,(function(t){l=l||t.getBaseAxis()===e.axis})),l){var u=ow(s),h=function(t,e,n,i){var r=n.axis.getExtent(),o=Math.abs(r[1]-r[0]),a=function(t,e,n){if(t&&e){var i=t[iw(e)];return null!=i&&null!=n?i[nw(n)]:i}}(i,n.axis);if(void 0===a)return{min:t,max:e};var s=1/0;ct(a,(function(t){s=Math.min(t.offset,s)}));var l=-1/0;ct(a,(function(t){l=Math.max(t.offset+t.width,l)})),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/o)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}(r,o,e,u);r=h.min,o=h.max}}return{extent:[r,o],fixMin:i.minFixed,fixMax:i.maxFixed}}function Rw(t,e){var n=e,i=Nw(t,n),r=i.extent,o=n.get("splitNumber");t instanceof Aw&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function kw(t,e){if(e=e||t.get("type"))switch(e){case"category":return new Jx({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new vw({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(Bx.getClass(e)||tw)}}function zw(t){var e,n,i=t.getLabelModel().get("formatter"),r="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(n=i,function(e,i){return t.scale.getFormattedLabel(e,i,n)}):wt(i)?function(e){return function(n){var i=t.scale.getLabel(n);return e.replace("{value}",null!=i?i:"")}}(i):xt(i)?(e=i,function(n,i){return null!=r&&(i=n.value-r),e(Bw(t,n),i,null!=n.level?{level:n.level}:null)}):function(e){return t.scale.getLabel(e)}}function Bw(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Fw(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n));return new _n(t.x,t.y,o,a)}function Vw(t){var e=t.get("interval");return null==e?"auto":e}function Gw(t){return"category"===t.type&&0===Vw(t.getLabelModel())}function Hw(t,e){var n={};return ct(t.mapDimensionsAll(e),(function(e){n[Rx(t,e)]=!0})),mt(n)}var Uw=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}();function Ww(t){return kx(null,t)}var jw={isDimensionStacked:Nx,enableDataStack:Ox,getStackedDimension:Rx};function Zw(t,e){var n=e;e instanceof Ih||(n=new Ih(e));var i=kw(n);return i.setExtent(t[0],t[1]),Rw(i,n),i}function Xw(t){ut(t,Uw)}function qw(t,e){return lh(t,null,null,"normal"!==(e=e||{}).state)}var Yw=[],Kw={registerPreprocessor:Ry,registerProcessor:ky,registerPostInit:zy,registerPostUpdate:By,registerUpdateLifecycle:Fy,registerAction:Vy,registerCoordinateSystem:Gy,registerLayout:Uy,registerVisual:Wy,registerTransform:Jy,registerLoading:Xy,registerMap:Yy,registerImpl:function(t,e){L_[t]=e},PRIORITY:k_,ComponentModel:Gc,ComponentView:Dp,SeriesModel:Lp,ChartView:Fm,registerComponentModel:function(t){Gc.registerClass(t)},registerComponentView:function(t){Dp.registerClass(t)},registerSeriesModel:function(t){Lp.registerClass(t)},registerChartView:function(t){Fm.registerClass(t)},registerSubTypeDefaulter:function(t,e){Gc.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){Go(t,e)}};function Jw(t){yt(t)?ct(t,(function(t){Jw(t)})):st(Yw,t)>=0||(Yw.push(t),xt(t)&&(t={install:t}),t.install(Kw))}function $w(t,e){return Math.abs(t-e)<1e-8}function Qw(t,e,n){var i=0,r=t[0];if(!r)return!1;for(var o=1;on&&(t=r,n=a)}if(t)return function(t){for(var e=0,n=0,i=0,r=t.length,o=t[r-1][0],a=t[r-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),r=s+=r,o=l+=o,i.push([s/n,l/n])}return i}function ub(t,e){return dt(pt((t=function(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;return null==n&&(n=1024),ct(e.features,(function(t){var e=t.geometry,i=e.encodeOffsets,r=e.coordinates;if(i)switch(e.type){case"LineString":e.coordinates=lb(r,i,n);break;case"Polygon":case"MultiLineString":sb(r,i,n);break;case"MultiPolygon":ct(r,(function(t,e){return sb(t,i[e],n)}))}})),e.UTF8Encoding=!1,e}(t)).features,(function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var n=t.properties,i=t.geometry,r=[];switch(i.type){case"Polygon":var o=i.coordinates;r.push(new rb(o[0],o.slice(1)));break;case"MultiPolygon":ct(i.coordinates,(function(t){t[0]&&r.push(new rb(t[0],t.slice(1)))}));break;case"LineString":r.push(new ob([i.coordinates]));break;case"MultiLineString":r.push(new ob(i.coordinates))}var a=new ab(n[e||"name"],r,n.cp);return a.properties=n,a}))}function hb(t,e,n,i,r,o,a,s){return new eu({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()}var cb=Ea();function db(t,e){var n=dt(e,(function(e){return t.scale.parse(e)}));return"time"===t.type&&n.length>0&&(n.sort(),n.unshift(n[0]),n.push(n[n.length-1])),n}function fb(t){var e=t.getLabelModel().get("customValues");if(e){var n=zw(t),i=t.scale.getExtent();return{labels:dt(pt(db(t,e),(function(t){return t>=i[0]&&t<=i[1]})),(function(e){var i={value:e};return{formattedLabel:n(i),rawLabel:t.scale.getLabel(i),tickValue:e}}))}}return"category"===t.type?function(t){var e=t.getLabelModel(),n=gb(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),n=zw(t);return{labels:dt(e,(function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)}function pb(t,e){var n=t.getTickModel().get("customValues");if(n){var i=t.scale.getExtent();return{ticks:pt(db(t,n),(function(t){return t>=i[0]&&t<=i[1]}))}}return"category"===t.type?function(t,e){var n,i,r=mb(t,"ticks"),o=Vw(e),a=vb(r,o);if(a)return a;e.get("show")&&!t.scale.isBlank()||(n=[]);if(xt(o))n=xb(t,o,!0);else if("auto"===o){var s=gb(t,t.getLabelModel());i=s.labelCategoryInterval,n=dt(s.labels,(function(t){return t.tickValue}))}else n=yb(t,i=o,!0);return _b(r,o,{ticks:n,tickCategoryInterval:i})}(t,e):{ticks:dt(t.scale.getTicks(),(function(t){return t.value}))}}function gb(t,e){var n,i,r=mb(t,"labels"),o=Vw(e),a=vb(r,o);return a||(xt(o)?n=xb(t,o):(i="auto"===o?function(t){var e=cb(t).autoInterval;return null!=e?e:cb(t).autoInterval=t.calculateCategoryInterval()}(t):o,n=yb(t,i)),_b(r,o,{labels:n,labelCategoryInterval:i}))}function mb(t,e){return cb(t)[e]||(cb(t)[e]=[])}function vb(t,e){for(var n=0;n1&&h/l>2&&(u=Math.round(Math.ceil(u/l)*l));var c=Gw(t),d=a.get("showMinLabel")||c,f=a.get("showMaxLabel")||c;d&&u!==o[0]&&g(o[0]);for(var p=u;p<=o[1];p+=l)g(p);function g(t){var e={value:t};s.push(n?t:{formattedLabel:i(e),rawLabel:r.getLabel(e),tickValue:t})}return f&&p-l!==o[1]&&g(o[1]),s}function xb(t,e,n){var i=t.scale,r=zw(t),o=[];return ct(i.getTicks(),(function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})})),o}var wb=[0,1],bb=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return Qo(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Tb(n=n.slice(),i.count()),Xo(t,wb,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Tb(n=n.slice(),i.count());var r=Xo(t,n,wb,e);return this.scale.scale(r)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),n=dt(pb(this,e).ticks,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this);return function(t,e,n,i){var r=e.length;if(!t.onBand||n||!r)return;var o,a,s=t.getExtent();if(1===r)e[0].coord=s[0],o=e[1]={coord:s[1],tickValue:e[0].tickValue};else{var l=e[r-1].tickValue-e[0].tickValue,u=(e[r-1].coord-e[0].coord)/l;ct(e,(function(t){t.coord-=u/2}));var h=t.scale.getExtent();a=1+h[1]-e[r-1].tickValue,o={coord:e[r-1].coord+u*a,tickValue:h[1]+1},e.push(o)}var c=s[0]>s[1];d(e[0].coord,s[0])&&(i?e[0].coord=s[0]:e.shift());i&&d(s[0],e[0].coord)&&e.unshift({coord:s[0]});d(s[1],o.coord)&&(i?o.coord=s[1]:e.pop());i&&d(o.coord,s[1])&&e.push({coord:s[1]});function d(t,e){return t=Yo(t),e=Yo(e),c?t>e:t0&&t<100||(t=5),dt(this.scale.getMinorTicks(t),(function(t){return dt(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return fb(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=zw(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,o=r.getExtent(),a=r.count();if(o[1]-o[0]<1)return 0;var s=1;a>40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),d=0,f=0;l<=o[1];l+=s){var p,g,m=po(n({value:l}),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,_=f/c;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=cb(t.model),w=t.getExtent(),b=x.lastAutoInterval,T=x.lastTickCount;return null!=b&&null!=T&&Math.abs(b-y)<=1&&Math.abs(T-a)<=1&&b>y&&x.axisExtent0===w[0]&&x.axisExtent1===w[1]?y=b:(x.lastTickCount=a,x.lastAutoInterval=y,x.axisExtent0=w[0],x.axisExtent1=w[1]),y}(this)},t}();function Tb(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}const Sb=bb;function Mb(t){var e=Gc.extend(t);return Gc.registerClass(e),e}function Cb(t){var e=Dp.extend(t);return Dp.registerClass(e),e}function Lb(t){var e=Lp.extend(t);return Lp.registerClass(e),e}function Ab(t){var e=Fm.extend(t);return Fm.registerClass(e),e}var Db=2*Math.PI,Ib=il.CMD,Pb=["top","right","bottom","left"];function Eb(t,e,n,i,r){var o=n.width,a=n.height;switch(t){case"top":i.set(n.x+o/2,n.y-e),r.set(0,-1);break;case"bottom":i.set(n.x+o/2,n.y+a+e),r.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),r.set(-1,0);break;case"right":i.set(n.x+o+e,n.y+a/2),r.set(1,0)}}function Ob(t,e,n,i,r,o,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s),h=(a/=u)*n+t,c=(s/=u)*n+e;if(Math.abs(i-r)%Db<1e-4)return l[0]=h,l[1]=c,u-n;if(o){var d=i;i=ll(r),r=ll(d)}else i=ll(i),r=ll(r);i>r&&(r+=Db);var f=Math.atan2(s,a);if(f<0&&(f+=Db),f>=i&&f<=r||f+Db>=i&&f+Db<=r)return l[0]=h,l[1]=c,u-n;var p=n*Math.cos(i)+t,g=n*Math.sin(i)+e,m=n*Math.cos(r)+t,v=n*Math.sin(r)+e,_=(p-a)*(p-a)+(g-s)*(g-s),y=(m-a)*(m-a)+(v-s)*(v-s);return _0))return;e=e/180*Math.PI,Fb.fromArray(t[0]),Vb.fromArray(t[1]),Gb.fromArray(t[2]),ln.sub(Hb,Fb,Vb),ln.sub(Ub,Gb,Vb);var n=Hb.len(),i=Ub.len();if(n<.001||i<.001)return;Hb.scale(1/n),Ub.scale(1/i);var r=Hb.dot(Ub);if(Math.cos(e)1&&ln.copy(Zb,Gb),Zb.toArray(t[1])}}(o,e.get("minTurnAngle")),n.setShape({points:o})}}}var jb=[],Zb=new ln;function Xb(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&!0===a&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function qb(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=ge(i[0],i[1]),o=ge(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=ye([],i[1],i[0],a/r),l=ye([],i[1],i[2],a/o),u=ye([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;h0&&o&&b(-c/a,0,a);var m,v,_=t[0],y=t[a-1];return x(),m<0&&T(-m,.8),v<0&&T(v,.8),x(),w(m,v,1),w(v,m,-1),x(),m<0&&S(-m),v<0&&S(v),u}function x(){m=_.rect[e]-i,v=r-y.rect[e]-y.rect[n]}function w(t,e,n){if(t<0){var i=Math.min(e,-t);if(i>0){b(i*n,0,a);var r=i+t;r<0&&T(-r*n,1)}else T(-t*n,1)}}function b(n,i,r){0!==n&&(u=!0);for(var o=i;o0)for(l=0;l0;l--){b(-(o[l-1]*c),l,a)}}}function S(t){var e=t<0?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(a-1)),i=0;i0?b(n,0,i+1):b(-n,a-i-1,a),(t-=n)<=0)return}}function Jb(t){var e=[];t.sort((function(t,e){return e.priority-t.priority}));var n=new _n(0,0,0,0);function i(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var r=0;r=0&&n.attr(f.oldLayoutSelect),st(u,"emphasis")>=0&&n.attr(f.oldLayoutEmphasis)),Ju(n,s,e,a)}else if(n.attr(s),!gh(n).valueAnimation){var h=Ot(n.style.opacity,1);n.style.opacity=0,$u(n,{style:{opacity:h}},e,a)}if(f.oldLayout=s,n.states.select){var c=f.oldLayoutSelect={};rT(c,s,oT),rT(c,n.states.select,oT)}if(n.states.emphasis){var d=f.oldLayoutEmphasis={};rT(d,s,oT),rT(d,n.states.emphasis,oT)}mh(n,a,l,e,e)}if(i&&!i.ignore&&!i.invisible){r=(f=iT(i)).oldLayout;var f,p={points:i.shape.points};r?(i.attr({shape:r}),Ju(i,{shape:p},e)):(i.setShape(p),i.style.strokePercent=0,$u(i,{style:{strokePercent:1}},e)),f.oldLayout=p}},t}();var sT=Ea();function lT(t){t.registerUpdateLifecycle("series:beforeupdate",(function(t,e,n){var i=sT(e).labelManager;i||(i=sT(e).labelManager=new aT),i.clearLabels()})),t.registerUpdateLifecycle("series:layoutlabels",(function(t,e,n){var i=sT(e).labelManager;n.updatedSeries.forEach((function(t){i.addLabelsOfSeries(e.getViewOfSeriesModel(t))})),i.updateLayoutConfig(e),i.layout(e),i.processLabelsOverall()}))}function uT(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",(function(t){var n=t.getCategoriesData(),i=t.getGraph().data,r=n.mapArray(n.getName);i.filterSelf((function(t){var n=i.getItemModel(t).getShallow("category");if(null!=n){Tt(n)&&(n=r[n]);for(var o=0;oi&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a0?+d:1;C.scaleX=this._sizeX*L,C.scaleY=this._sizeY*L,this.setSymbolScale(1),Uu(this,l,u,h)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=nu(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&th(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();th(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},e.getSymbolSize=function(t,e){return Zv(t.getItemVisual(e,"symbolSize"))},e}(Eo);function FT(t,e){this.parent.drift(t,e)}const VT=BT;function GT(t,e,n,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&"none"!==t.getItemVisual(n,"symbol")}function HT(t){return null==t||St(t)||(t={isIgnore:t}),t||{}}function UT(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:sh(e),cursorStyle:e.get("cursor")}}var WT=function(){function t(t){this.group=new Eo,this._SymbolCtor=t||VT}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=HT(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=UT(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add((function(i){var r=u(i);if(GT(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}})).update((function(h,c){var d=r.getItemGraphicEl(c),f=u(h);if(GT(t,f,h,e)){var p=t.getItemVisual(h,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==p)n.remove(d),(d=new o(t,h,s,l)).setPosition(f);else{d.updateData(t,h,s,l);var m={x:f[0],y:f[1]};a?d.attr(m):Ju(d,m,i)}n.add(d),t.setItemGraphicEl(h,d)}else n.remove(d)})).remove((function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut((function(){n.remove(e)}),i)})).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl((function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()}))},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=UT(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=HT(n);for(var r=t.start;r0&&(_[0]=-_[0],_[1]=-_[1]);var x=v[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var w=-Math.atan2(v[1],v[0]);u[0].8?"left":h[0]<-.8?"right":"center",d=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":i.x=-h[0]*p+l[0],i.y=-h[1]*g+l[1],c=h[0]>.8?"right":h[0]<-.8?"left":"center",d=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=p*x+l[0],i.y=l[1]+b,c=v[0]<0?"right":"left",i.originX=-p*x,i.originY=-b;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=y[0],i.y=y[1]+b,c="center",i.originY=-b;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-p*x+u[0],i.y=u[1]+b,c=v[0]>=0?"right":"left",i.originX=p*x,i.originY=-b}i.scaleX=i.scaleY=r,i.setStyle({verticalAlign:i.__verticalAlign||d,align:i.__align||c})}}}function T(t,e){var n=t.__specifiedRotation;if(null==n){var i=a.tangentAt(e);t.attr("rotation",(1===e?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else t.attr("rotation",n)}},e}(Eo);const iS=nS;function rS(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:sh(e)}}function oS(t){return isNaN(t[0])||isNaN(t[1])}function aS(t){return t&&!oS(t[0])&&!oS(t[1])}const sS=function(){function t(t){this.group=new Eo,this._LineCtor=t||iS}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=rS(t);t.diff(r).add((function(n){e._doAdd(t,n,o)})).update((function(n,i){e._doUpdate(r,t,i,n,o)})).remove((function(t){i.remove(r.getItemGraphicEl(t))})).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl((function(e,n){e.updateLayout(t,n)}),this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=rS(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i3?1.4:r>1?1.2:1.1;dS(this,"zoom","zoomOnMouseWheel",t,{scale:i>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(n){var l=Math.abs(i);dS(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){uS(this._zr,"globalPan")||dS(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},e}(Le);function dS(t,e,n,i,r){t.pointerChecker&&t.pointerChecker(i,r.originX,r.originY)&&(Ze(i.event),fS(t,e,n,i,r))}function fS(t,e,n,i,r){r.isAvailableBehavior=vt(pS,null,n,i),t.trigger(e,r)}function pS(t,e,n){var i=n[t];return!t||i&&(!wt(i)||e.event[i+"Key"])}const gS=cS;var mS={axisPointer:1,tooltip:1,brush:1};function vS(t,e,n){var i=e.getComponentByElement(t.topTarget),r=i&&i.coordinateSystem;return i&&i!==n&&!mS.hasOwnProperty(i.mainType)&&r&&r.model!==n}var _S=[],yS=[],xS=[],wS=hi,bS=ve,TS=Math.abs;function SS(t,e,n){for(var i,r=t[0],o=t[1],a=t[2],s=1/0,l=n*n,u=.1,h=.1;h<=.9;h+=.1){_S[0]=wS(r[0],o[0],a[0],h),_S[1]=wS(r[1],o[1],a[1],h),(f=TS(bS(_S,e)-l))=0?i+=u:i-=u:p>=0?i-=u:i+=u}return i}function MS(t,e){var n=[],i=fi,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge((function(t,s){var l=t.getLayout(),u=t.getVisual("fromSymbol"),h=t.getVisual("toSymbol");l.__original||(l.__original=[te(l[0]),te(l[1])],l[2]&&l.__original.push(te(l[2])));var c=l.__original;if(null!=l[2]){if(Qt(r[0],c[0]),Qt(r[1],c[2]),Qt(r[2],c[1]),u&&"none"!==u){var d=ST(t.node1),f=SS(r,c[0],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[0][0]=n[3],r[1][0]=n[4],i(r[0][1],r[1][1],r[2][1],f,n),r[0][1]=n[3],r[1][1]=n[4]}if(h&&"none"!==h){d=ST(t.node2),f=SS(r,c[1],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[1][0]=n[1],r[2][0]=n[2],i(r[0][1],r[1][1],r[2][1],f,n),r[1][1]=n[1],r[2][1]=n[2]}Qt(l[0],r[0]),Qt(l[1],r[2]),Qt(l[2],r[1])}else{if(Qt(o[0],c[0]),Qt(o[1],c[1]),re(a,o[1],o[0]),fe(a,a),u&&"none"!==u){d=ST(t.node1);ie(o[0],o[0],a,d*e)}if(h&&"none"!==h){d=ST(t.node2);ie(o[1],o[1],a,-d*e)}Qt(l[0],o[0]),Qt(l[1],o[1])}}))}function CS(t){return"view"===t.type}var LS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.init=function(t,e){var n=new jT,i=new sS,r=this.group;this._controller=new gS(e.getZr()),this._controllerHost={target:r},r.add(n.group),r.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},e.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(CS(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):Ju(s,l,t)}MS(t.getGraph(),TT(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,d=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,d);var f=t.get("layout");u.graph.eachNode((function(e){var n=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",(function(o){switch(f){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,d),c.setFixed(n),u.setItemLayout(n,[r.x,r.y]);break;case"circular":u.setItemLayout(n,[r.x,r.y]),e.setLayout({fixed:!0},!0),LT(t,"symbolSize",e,[o.offsetX,o.offsetY]),i.updateLayout(t);break;default:u.setItemLayout(n,[r.x,r.y]),wT(t.getGraph(),t),i.updateLayout(t)}})).on("dragend",(function(){c&&c.setUnfixed(n)})),r.setDraggable(a,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&(nu(r).focus=e.getAdjacentDataIndices())}})),u.graph.eachEdge((function(t){var e=t.getGraphicEl(),n=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===n&&(nu(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})}));var p="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),m=u.getLayout("cy");u.graph.eachNode((function(t){DT(t,p,g,m)})),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,e){var n=this;!function i(){t.step((function(t){n.updateLayout(n._model),(n._layouting=!t)&&(e?n._layoutTimeout=setTimeout(i,16):i())}))}()},e.prototype._updateController=function(t,e,n){var i=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker((function(e,i,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(i,r)&&!vS(e,n,t)})),CS(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",(function(e){!function(t,e,n){var i=t.target;i.x+=e,i.y+=n,i.dirty()}(o,e.dx,e.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})})).on("zoom",(function(e){!function(t,e,n,i){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0,l=o.max||1/0;a=Math.max(Math.min(l,a),s)}var u=a/t.zoom;t.zoom=a,r.x-=(n-r.x)*(u-1),r.y-=(i-r.y)*(u-1),r.scaleX*=u,r.scaleY*=u,r.dirty()}(o,e.scale,e.originX,e.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),i._updateNodeAndLinkScale(),MS(t.getGraph(),TT(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):r.disable()},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),n=TT(t);e.eachItemGraphicEl((function(t,e){t&&t.setSymbolScale(n)}))},e.prototype.updateLayout=function(t){MS(t.getGraph(),TT(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Fm);const AS=LS;function DS(t){return"_EC_"+t}var IS=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){t=null==t?""+e:""+t;var n=this._nodesMap;if(!n[DS(t)]){var i=new PS(t,e);return i.hostGraph=this,this.nodes.push(i),n[DS(t)]=i,i}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[DS(t)]},t.prototype.addEdge=function(t,e,n){var i=this._nodesMap,r=this._edgesMap;if(Tt(t)&&(t=this.nodes[t]),Tt(e)&&(e=this.nodes[e]),t instanceof PS||(t=i[DS(t)]),e instanceof PS||(e=i[DS(e)]),t&&e){var o=t.id+"-"+e.id,a=new ES(t,e,n);return a.hostGraph=this,this._directed&&(t.outEdges.push(a),e.inEdges.push(a)),t.edges.push(a),t!==e&&e.edges.push(a),this.edges.push(a),r[o]=a,a}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof PS&&(t=t.id),e instanceof PS&&(e=e.id);var n=this._edgesMap;return this._directed?n[t+"-"+e]:n[t+"-"+e]||n[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var n=this.nodes,i=n.length,r=0;r=0&&t.call(e,n[r],r)},t.prototype.eachEdge=function(t,e){for(var n=this.edges,i=n.length,r=0;r=0&&n[r].node1.dataIndex>=0&&n[r].node2.dataIndex>=0&&t.call(e,n[r],r)},t.prototype.breadthFirstTraverse=function(t,e,n,i){if(e instanceof PS||(e=this._nodesMap[DS(e)]),e){for(var r="out"===n?"outEdges":"in"===n?"inEdges":"edges",o=0;o=0&&n.node2.dataIndex>=0}));for(r=0,o=i.length;r=0&&this[t][e].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[t][e].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}ut(PS,OS("hostGraph","data")),ut(ES,OS("hostGraph","edgeData"));const NS=IS;var RS=Ea();function kS(t,e){if(RS(i=this).mainData===i){var n=rt({},RS(this).datas);n[this.dataType]=e,GS(e,n,t)}else HS(e,this.dataType,RS(this).mainData,t);var i;return e}function zS(t,e){return t.struct&&t.struct.update(),e}function BS(t,e){return ct(RS(e).datas,(function(n,i){n!==e&&HS(n.cloneShallow(),i,e,t)})),e}function FS(t){var e=RS(this).mainData;return null==t||null==e?e:RS(e).datas[t]}function VS(){var t=RS(this).mainData;return null==t?[{data:t}]:dt(mt(RS(t).datas),(function(e){return{type:e,data:RS(t).datas[e]}}))}function GS(t,e,n){RS(t).datas={},ct(e,(function(e,i){HS(e,i,t,n)}))}function HS(t,e,n,i){RS(n).datas[e]=t,RS(t).mainData=n,t.dataType=e,i.struct&&(t[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=t),t.getLinkedData=FS,t.getLinkedDataAll=VS}const US=function(t){var e=t.mainData,n=t.datas;n||(n={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,GS(e,n,t),ct(n,(function(n){ct(e.TRANSFERABLE_METHODS,(function(e){n.wrapMethod(e,_t(kS,t))}))})),e.wrapMethod("cloneShallow",_t(BS,t)),ct(e.CHANGABLE_METHODS,(function(n){e.wrapMethod(n,_t(zS,t))})),zt(n[e.dataType]===e)};var WS=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){return this._getRawData().indexOfName(t)>=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}();const jS=WS;var ZS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new jS(i,i),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(e){t.prototype.mergeDefaultAndTheme.apply(this,arguments),wa(e,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,e){var n,i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i){pT(n=this)&&(n.__curvenessList=[],n.__edgeMap={},gT(n));var a=function(t,e,n,i,r){for(var o=new NS(i),a=0;a "+d)),u++)}var f,p=n.get("coordinateSystem");if("cartesian2d"===p||"polar"===p)f=kx(t,n);else{var g=Td.get(p),m=g&&g.dimensions||[];st(m,"value")<0&&m.concat(["value"]);var v=Ax(t,{coordDimensions:m,encodeDefine:n.getEncode()}).dimensions;(f=new Cx(v,n)).initData(t)}var _=new Cx(["value"],n);return _.initData(l,s),r&&r(f,_),US({mainData:f,struct:o,structAttr:"graph",datas:{node:f,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(r,i,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));var n=Ih.prototype.getModel;function i(t,e){var i=n.call(this,t,e);return i.resolveParentPath=r,i}function r(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}e.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=r,t.getModel=i,t}))}));return ct(a.edges,(function(t){!function(t,e,n,i){if(pT(n)){var r=mT(t,e,n),o=n.__edgeMap,a=o[vT(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(i)}}(t.node1,t.node2,this,t.dataIndex)}),this),a.data}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),op("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return mp({series:this,dataIndex:t,multipleSeries:e})},e.prototype._updateCategoriesData=function(){var t=dt(this.option.categories||[],(function(t){return null!=t.value?t:rt({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t)}))},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return t.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Lp);const XS=ZS;function qS(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}var YS={type:"graphRoam",event:"graphRoam",update:"none"};function KS(t,e){var n=e.rippleEffectColor||e.color;t.eachChild((function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?n:null,fill:"fill"===e.brushType?n:null}})}))}var JS=function(t){function e(e,n){var i=t.call(this)||this,r=new VT(e,n),o=new Eo;return i.add(r),i.add(o),i.updateData(e,n),i}return I(e,t),e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var e=t.symbolType,n=t.color,i=t.rippleNumber,r=this.childAt(1),o=0;o0&&(o=this._getLineLength(i)/l*1e3),o!==this._period||a!==this._loop||s!==this._roundTrip){i.stopAnimation();var h=void 0;h=xt(u)?u(n):u,i.__t>0&&(h=-o*i.__t),this._animateSymbol(i,o,h,a,s)}this._period=o,this._loop=a,this._roundTrip=s}},e.prototype._animateSymbol=function(t,e,n,i,r){if(e>0){t.__t=0;var o=this,a=t.animate("",i).when(r?2*e:e,{__t:r?2:1}).delay(n).during((function(){o._updateSymbolPosition(t)}));i||a.done((function(){o.remove(t)})),a.start()}},e.prototype._getLineLength=function(t){return ge(t.__p1,t.__cp1)+ge(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},e.prototype.updateData=function(t,e,n){this.childAt(0).updateData(t,e,n),this._updateEffectSymbol(t,e)},e.prototype._updateSymbolPosition=function(t){var e=t.__p1,n=t.__p2,i=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=hi,l=ci;o[0]=s(e[0],i[0],n[0],r),o[1]=s(e[1],i[1],n[1],r);var u=t.__t<1?l(e[0],i[0],n[0],r):l(n[0],i[0],e[0],1-r),h=t.__t<1?l(e[1],i[1],n[1],r):l(n[1],i[1],e[1],1-r);t.rotation=-Math.atan2(h,u)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(i[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-i[o])/(i[o+1]-i[o]),l=n[o],u=n[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1];var h=t.__t<1?u[0]-l[0]:l[0]-u[0],c=t.__t<1?u[1]-l[1]:l[1]-u[1];t.rotation=-Math.atan2(c,h)-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},e}(oM);const uM=lM;var hM=function(){this.polyline=!1,this.curveness=0,this.segs=[]},cM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"var(--ow-color-black)",fill:null}},e.prototype.getDefaultShape=function(){return new hM},e.prototype.buildPath=function(t,e){var n,i=e.segs,r=e.curveness;if(e.polyline)for(n=this._off;n0){t.moveTo(i[n++],i[n++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*r,d=(l+h)/2-(u-s)*r;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}this.incremental&&(this._off=n,this.notClear=!0)},e.prototype.findDataIndex=function(t,e){var n=this.shape,i=n.segs,r=n.curveness,o=this.style.lineWidth;if(n.polyline)for(var a=0,s=0;s0)for(var u=i[s++],h=i[s++],c=1;c0){if(al(u,h,(u+d)/2-(h-f)*r,(h+f)/2-(d-u)*r,d,f,o,t,e))return a}else if(rl(u,h,d,f,o,t,e))return a;a++}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,n=1/0,i=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=n+t.__startIndex)}))},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();var fM={seriesType:"lines",plan:Ip(),reset:function(t){var e=t.coordinateSystem;if(e){var n=t.get("polyline"),i=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(i){var s=void 0,l=r.end-r.start;if(n){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(i);var u=t.get("clip",!0)&&gM(t.coordinateSystem,!1,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateLineDraw(i,t).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,e,n){var i=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=pM.reset(t,e,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,e){var n=this._lineDraw,i=this._showEffect(e),r=!!e.get("polyline"),o=e.pipelineContext.large;return n&&i===this._hasEffet&&r===this._isPolyline&&o===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=o?new dM:new sS(r?i?uM:sM:i?oM:iS),this._hasEffet=i,this._isPolyline=r,this._isLargeDraw=o),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},e.prototype.dispose=function(t,e){this.remove(t,e)},e.type="lines",e}(Fm);var vM="undefined"==typeof Uint32Array?Array:Uint32Array,_M="undefined"==typeof Float64Array?Array:Float64Array;function yM(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=dt(e,(function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),it([e,t[0],t[1]])})))}var xM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}return I(e,t),e.prototype.init=function(e){e.data=e.data||[],yM(e);var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count)),t.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(e){if(yM(e),e.data){var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count))}t.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=Zt(this._flatCoords,e.flatCoords),this._flatCoordsOffset=Zt(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*t],i=this._flatCoordsOffset[2*t+1],r=0;r ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(Lp);const wM=xM;function bM(t){return t instanceof Array||(t=[t,t]),t}const TM={seriesType:"lines",reset:function(t){var e=bM(t.get("symbol")),n=bM(t.get("symbolSize")),i=t.getData();return i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",n&&n[0]),i.setVisual("toSymbolSize",n&&n[1]),{dataEach:i.hasItemOption?function(t,e){var n=t.getItemModel(e),i=bM(n.getShallow("symbol",!0)),r=bM(n.getShallow("symbolSize",!0));i[0]&&t.setItemVisual(e,"fromSymbol",i[0]),i[1]&&t.setItemVisual(e,"toSymbol",i[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};const SM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.getInitialData=function(t,e){return kx(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,e,n){return n.point(e.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Lp);var MM=function(){},CM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.getDefaultShape=function(){return new MM},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,e){var n,i=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=s&&r[0]<4,u=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,u=i[l]-o/2,h=i[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,n=e.points,i=e.size,r=i[0],o=i[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=n+(t.startIndex||0))}))},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const AM=LM;const DM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).incrementalPrepareUpdate(i),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},e.prototype.updateTransform=function(t,e,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var r=eM("").reset(t,e,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var e=t.coordinateSystem;return e&&e.getArea&&e.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,e){var n=this._symbolDraw,i=e.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new AM:new jT,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Fm);const IM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Gc);var PM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",ka).models[0]},e.type="cartesian2dAxis",e}(Gc);ut(PM,Uw);var EM={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},OM=nt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},EM),NM=nt({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},EM);const RM={category:OM,value:NM,time:nt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},NM),log:ot({logBase:10},NM)};var kM={value:1,category:1,time:1,log:1};function zM(t,e,n,i){ct(kM,(function(r,o){var a=nt(nt({},RM[o],!0),i,!0),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e+"Axis."+o,n}return I(n,t),n.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{};nt(t,e.getTheme().get(o+"Axis")),nt(t,this.getDefaultOption()),t.type=BM(t),n&&kc(t,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=Gx.createByAxisModel(this))},n.prototype.getCategories=function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.type=e+"Axis."+o,n.defaultOption=a,n}(n);t.registerComponentModel(s)})),t.registerSubTypeDefaulter(e+"Axis",BM)}function BM(t){return t.type||(t.data?"category":"value")}const FM=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return dt(this._dimList,(function(t){return this._axes[t]}),this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),pt(this.getAxes(),(function(e){return e.scale.type===t}))},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}();var VM=["x","y"];function GM(t){return"interval"===t.type||"time"===t.type}var HM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=VM,e}return I(e,t),e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(GM(t)&&GM(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-n[0]*l,c=r[1]-i[0]*u,d=this._transform=[l,0,0,u,h,c];this._invTransform=on([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,e){var n=this.dataToPoint(t),i=this.dataToPoint(e),r=this.getArea(),o=new _n(n[0],n[1],i[0]-n[0],i[1]-n[1]);return r.intersect(o)},e.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return xe(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i,e)),n[1]=a.toGlobalCoord(a.dataToCoord(r,e)),n},e.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},e.prototype.pointToData=function(t,e){var n=[];if(this._invTransform)return xe(n,t,this._invTransform);var i=this.getAxis("x"),r=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),e),n[1]=r.coordToData(r.toLocalCoord(t[1]),e),n},e.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},e.prototype.getArea=function(t){t=t||0;var e=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(e[0],e[1])-t,r=Math.min(n[0],n[1])-t,o=Math.max(e[0],e[1])-i+t,a=Math.max(n[0],n[1])-r+t;return new _n(i,r,o,a)},e}(FM);const UM=HM;var WM=function(t){function e(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return I(e,t),e.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},e.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},e.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},e.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(Sb);const jM=WM;function ZM(t,e,n){n=n||{};var i=t.coordinateSystem,r=e.axis,o={},a=r.getAxesOnZeroOf()[0],s=r.position,l=a?"onZero":s,u=r.dim,h=i.getRect(),c=[h.x,h.x+h.width,h.y,h.y+h.height],d={left:0,right:1,top:0,bottom:1,onZero:2},f=e.get("offset")||0,p="x"===u?[c[2]-f,c[3]+f]:[c[0]-f,c[1]+f];if(a){var g=a.toGlobalCoord(a.dataToCoord(0));p[d.onZero]=Math.max(Math.min(g,p[1]),p[0])}o.position=["y"===u?p[d[l]]:c[0],"x"===u?p[d[l]]:c[3]],o.rotation=Math.PI/2*("x"===u?0:1);o.labelDirection=o.tickDirection=o.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],o.labelOffset=a?p[d[s]]-p[d.onZero]:0,e.get(["axisTick","inside"])&&(o.tickDirection=-o.tickDirection),Et(n.labelInside,e.get(["axisLabel","inside"]))&&(o.labelDirection=-o.labelDirection);var m=e.get(["axisLabel","rotate"]);return o.labelRotate="top"===l?-m:m,o.z2=1,o}function XM(t){return"cartesian2d"===t.get("coordinateSystem")}function qM(t){var e={xAxisModel:null,yAxisModel:null};return ct(e,(function(n,i){var r=i.replace(/Model$/,""),o=t.getReferringComponents(r,ka).models[0];e[i]=o})),e}var YM=Math.log;var KM=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=VM,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var n=this._axesMap;function i(t){var e,n=mt(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=t[+n[o]],s=a.model,l=a.scale;Hx(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):(Rw(l,s),Hx(l)&&(e=a))}r.length&&(e||Rw((e=r.pop()).scale,e.model),ct(r,(function(t){!function(t,e,n){var i=tw.prototype,r=i.getTicks.call(n),o=i.getTicks.call(n,!0),a=r.length-1,s=i.getInterval.call(n),l=Nw(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var d=YM(t.base);u=[YM(u[0])/d,YM(u[1])/d]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var f=i.getExtent.call(t);h&&(u[0]=f[0]),c&&(u[1]=f[1]);var p=i.getInterval.call(t),g=u[0],m=u[1];if(h&&c)p=(m-g)/a;else if(h)for(m=u[0]+p*a;mu[0]&&isFinite(g)&&isFinite(u[0]);)p=Wx(p),g=u[1]-p*a;else{t.getTicks().length-1>a&&(p=Wx(p));var v=p*a;(g=Yo((m=Math.ceil(u[1]/p)*p)-v))<0&&u[0]>=0?(g=0,m=Yo(v)):m>0&&u[1]<=0&&(m=0,g=-Yo(v))}var _=(r[0].value-o[0].value)/s,y=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+p*_,m+p*y),i.setInterval.call(t,p),(_||y)&&i.setNiceExtent.call(t,g+p,m-p)}(t.scale,t.model,e.scale)})))}}this._updateScale(t,this.model),i(n.x),i(n.y);var r={};ct(n.x,(function(t){$M(n,"y",t,r)})),ct(n.y,(function(t){$M(n,"x",t,r)})),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){var i=t.getBoxLayoutParams(),r=!n&&t.get("containLabel"),o=Oc(i,{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;function s(){ct(a,(function(t){var e=t.isHorizontal(),n=e?[0,o.width]:[0,o.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),function(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}(t,e?o.x:o.y)}))}s(),r&&(ct(a,(function(t){if(!t.model.get(["axisLabel","inside"])){var e=function(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();r=n instanceof Jx?n.count():(i=n.getTicks()).length;var a,s=t.getLabelModel(),l=zw(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;h0&&i>0||n<0&&i<0)}(t)}const tC=KM;var eC=Math.PI,nC=function(){function t(t,e){this.group=new Eo,this.opt=e,this.axisModel=t,ot(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Eo({x:e.position[0],y:e.position[1],rotation:e.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(t){return!!iC[t]},t.prototype.add=function(t){iC[t](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(t,e,n){var i,r,o=ia(e-t);return ra(o)?(r=n>0?"top":"bottom",i="center"):ra(o-eC)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&o0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),iC={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0],u=s[0]>l[0];a&&(xe(s,s,a),xe(l,l,a));var h=rt({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),c=new Dg({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:h,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});pm(c.shape,c.style.lineWidth),c.anid="line",n.add(c);var d=e.get(["axisLine","symbol"]);if(null!=d){var f=e.get(["axisLine","symbolSize"]);wt(d)&&(d=[d,d]),(wt(f)||Tt(f))&&(f=[f,f]);var p=Xv(e.get(["axisLine","symbolOffset"])||0,f),g=f[0],m=f[1];ct([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],(function(e,i){if("none"!==d[i]&&null!=d[i]){var r=jv(d[i],-g/2,-m/2,g,m,h.stroke,!0),o=e.r+e.offset,a=u?l:s;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}}))}}},axisTickLabel:function(t,e,n,i){var r=function(t,e,n,i){var r=n.axis,o=n.getModel("axisTick"),a=o.get("show");"auto"===a&&i.handleAutoShown&&(a=i.handleAutoShown("axisTick"));if(!a||r.scale.isBlank())return;for(var s=o.getModel("lineStyle"),l=i.tickDirection*o.get("length"),u=sC(r.getTicksCoords(),e.transform,l,ot(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),h=0;hc[1]?-1:1,f=["start"===s?c[0]-d*h:"end"===s?c[1]+d*h:(c[0]+c[1])/2,aC(s)?t.labelOffset+l*h:0],p=e.get("nameRotate");null!=p&&(p=p*eC/180),aC(s)?o=nC.innerTextLayout(t.rotation,null!=p?p:t.rotation,l):(o=function(t,e,n,i){var r,o,a=ia(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;ra(a-eC/2)?(o=l?"bottom":"top",r="center"):ra(a-1.5*eC)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*eC&&a>eC/2?l?"left":"right":l?"right":"left");return{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,s,p||0,c),null!=(a=t.axisNameAvailableWidth)&&(a=Math.abs(a/Math.sin(o.rotation)),!isFinite(a)&&(a=null)));var g=u.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Et(t.nameTruncateMaxWidth,m.maxWidth,a),y=new eu({x:f[0],y:f[1],rotation:o.rotation,silent:nC.isLabelSilent(e),style:lh(u,{text:r,font:g,overflow:"truncate",width:_,ellipsis:v,fill:u.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:u.get("align")||o.textAlign,verticalAlign:u.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(Am({el:y,componentModel:e,itemName:r}),y.__fullText=r,y.anid="name",e.get("triggerEvent")){var x=nC.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,nu(y).eventData=x}i.add(y),y.updateTransform(),n.add(y),y.decomposeTransform()}}};function rC(t){t&&(t.ignore=!0)}function oC(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=$e([]);return nn(r,r,-t.rotation),n.applyTransform(tn([],r,t.getLocalTransform())),i.applyTransform(tn([],r,e.getLocalTransform())),n.intersect(i)}}function aC(t){return"middle"===t||"center"===t}function sC(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function cC(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[fC(t)]}function dC(t){return!!t.get(["handle","show"])}function fC(t){return t.type+"||"+t.id}var pC={},gC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(e,n,i,r){this.axisPointerClass&&function(t){var e=cC(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=dC(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),aa)return!0;if(o){var s=cC(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return!0===n},t.prototype.makeElOption=function(t,e,n,i,r){},t.prototype.createPointerEl=function(t,e,n,i){var r=e.pointer;if(r){var o=LC(t).pointerEl=new a[r.type](AC(e.pointer));t.add(o)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=LC(t).labelEl=new eu(AC(e.label));t.add(r),OC(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=LC(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=LC(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),OC(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,n=this._axisPointerModel,i=this._api.getZr(),r=this._handle,o=n.getModel("handle"),a=n.get("status");if(!o.get("show")||!a||"hide"===a)return r&&i.remove(r),void(this._handle=null);this._handle||(e=!0,r=this._handle=Sm(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){Ze(t.event)},onmousedown:DC(this._onHandleDragMove,this,0,0),drift:DC(this._onHandleDragMove,this),ondragend:DC(this._onHandleDragEnd,this)}),i.add(r)),RC(r,n,!1),r.setStyle(o.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=o.get("size");yt(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,Wm(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){PC(this._axisPointerModel,!e&&this._moveAnimation,this._handle,NC(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(NC(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(NC(i)),LC(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),jm(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return{x:t[n=n||0],y:t[1-n],width:e[n],height:e[1-n]}},t}();function PC(t,e,n,i){EC(LC(n).lastProp,i)||(LC(n).lastProp=i,e?Ju(n,i,t):(n.stopAnimation(),n.attr(i)))}function EC(t,e){if(St(t)&&St(e)){var n=!0;return ct(e,(function(e,i){n=n&&EC(t[i],e)})),!!n}return t===e}function OC(t,e){t[e.get(["label","show"])?"show":"hide"]()}function NC(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function RC(t,e,n){var i=e.get("z"),r=e.get("zlevel");t&&t.traverse((function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=r&&(t.zlevel=r),t.silent=n)}))}function kC(t,e,n,i,r){var o=zC(n.get("value"),e.axis,e.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),a=n.getModel("label"),s=_c(a.get("padding")||0),l=a.getFont(),u=po(o,l),h=r.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=r.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=r.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),function(t,e,n,i){var r=i.getWidth(),o=i.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+n,o)-n,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(h,c,d,i);var g=a.get("backgroundColor");g&&"auto"!==g||(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:lh(a,{text:o,font:l,fill:a.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function zC(t,e,n,i,r){t=e.scale.parse(t);var o=e.scale.getLabel({value:t},{precision:r.precision}),a=r.formatter;if(a){var s={value:Bw(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};ct(i,(function(t){var e=n.getSeriesByIndex(t.seriesIndex),i=t.dataIndexInside,r=e&&e.getDataParams(i);r&&s.seriesData.push(r)})),wt(a)?o=a.replace("{value}",o):xt(a)&&(o=a(s))}return o}function BC(t,e,n){var i=[1,0,0,1,0,0];return nn(i,i,n.rotation),en(i,i,n.position),_m([t.dataToCoord(e),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}var FC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=VC(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=function(t){var e,n=t.get("type"),i=t.getModel(n+"Style");return"line"===n?(e=i.getLineStyle()).fill=null:"shadow"===n&&((e=i.getAreaStyle()).stroke=null),e}(i),c=GC[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}!function(t,e,n,i,r,o){var a=lC.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=r.get(["label","margin"]),kC(e,i,r,o,{position:BC(i.axis,t,n),align:a.textAlign,verticalAlign:a.textVerticalAlign})}(e,t,ZM(a.model,n),n,i,r)},e.prototype.getHandleTransform=function(t,e,n){var i=ZM(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=BC(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,n,i){var r=n.axis,o=r.grid,a=r.getGlobalExtent(!0),s=VC(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,u=[t.x,t.y];u[l]+=e[l],u[l]=Math.min(a[1],u[l]),u[l]=Math.max(a[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];return{x:u[0],y:u[1],rotation:t.rotation,cursorPoint:c,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},e}(IC);function VC(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}var GC={line:function(t,e,n){var i=function(t,e,n){return{x1:t[n=n||0],y1:t[1-n],x2:e[n],y2:e[1-n]}}([e,n[0]],[e,n[1]],HC(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i,r,o,a=Math.max(1,t.getBandWidth()),s=n[1]-n[0];return{type:"Rect",shape:(i=[e-a/2,n[0]],r=[a,s],o=HC(t),{x:i[o=o||0],y:i[1-o],width:r[o],height:r[1-o]})}}};function HC(t){return"x"===t.dim?0:1}const UC=FC;const WC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"var(--ow-color-fg-darker)",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Gc);var jC=Ea(),ZC=ct;function XC(t,e,n){if(!O.node){var i=e.getZr();jC(i).records||(jC(i).records={}),function(t,e){if(jC(t).initialized)return;function n(n,i){t.on(n,(function(n){var r=function(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}(e);ZC(jC(t).records,(function(t){t&&i(t,n,r.dispatchAction)})),function(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]);n&&(n.dispatchAction=null,e.dispatchAction(n))}(r.pendings,e)}))}jC(t).initialized=!0,n("click",_t(YC,"click")),n("mousemove",_t(YC,"mousemove")),n("globalout",qC)}(i,e),(jC(i).records[t]||(jC(i).records[t]={})).handler=n}}function qC(t,e,n){t.handler("leave",null,n)}function YC(t,e,n,i){e.handler(t,n,i)}function KC(t,e){if(!O.node){var n=e.getZr();(jC(n).records||{})[t]&&(jC(n).records[t]=null)}}var JC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";XC("axisPointer",n,(function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})}))},e.prototype.remove=function(t,e){KC("axisPointer",e)},e.prototype.dispose=function(t,e){KC("axisPointer",e)},e.type="axisPointer",e}(Dp);const $C=JC;function QC(t,e){var n,i=[],r=t.seriesIndex;if(null==r||!(n=e.getSeriesByIndex(r)))return{point:[]};var o=n.getData(),a=Pa(o,t);if(null==a||a<0||yt(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u).dim,c=u.dim,d="x"===h||"radius"===h?1:0,f=o.mapDimension(c),p=[];p[d]=o.get(f,a),p[1-d]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(p)||[]}else i=l.dataToPoint(o.getValues(dt(l.dimensions,(function(t){return o.mapDimension(t)})),a))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var tL=Ea();function eL(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||vt(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){aL(r)&&(r=QC({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=aL(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||aL(r),d={},f={},p={list:[],map:{}},g={showPointer:_t(iL,f),showTooltip:_t(rL,p)};ct(s.coordSysMap,(function(t,e){var n=l||t.containPoint(r);ct(s.coordSysAxesInfo[e],(function(t,e){var i=t.axis,o=function(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}(u,t);if(!c&&n&&(!u||o)){var a=o&&o.value;null!=a||l||(a=i.pointToData(r)),null!=a&&nL(t,a,g,!1,d)}}))}));var m={};return ct(h,(function(t,e){var n=t.linkGroup;n&&!f[e]&&ct(n.axesInfo,(function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,oL(e),oL(t)))),m[t.key]=o}}))})),ct(m,(function(t,e){nL(h[e],t,g,!0,d)})),function(t,e,n){var i=n.axesInfo=[];ct(e,(function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})}))}(f,h,d),function(t,e,n,i){if(aL(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}(p,r,t,a),function(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=tL(i)[r]||{},a=tL(i)[r]={};ct(t,(function(t,e){var n=t.axisPointerModel.option;"show"===n.status&&t.triggerEmphasis&&ct(n.seriesDataIndices,(function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t}))}));var s=[],l=[];ct(o,(function(t,e){!a[e]&&l.push(t)})),ct(a,(function(t,e){!o[e]&&s.push(t)})),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(h,0,n),d}}function nL(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e))if(t.involveSeries){var a=function(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return ct(e.seriesModels,(function(e,l){var u,h,c=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,n);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===n.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=a&&((p=0&&s<0)&&(a=p,s=f,r=u,o.length=0),ct(h,(function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})})))}})),{payloadBatch:o,snapToValue:r}}(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&rt(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}else n.showPointer(t,e)}function iL(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function rL(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=fC(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function oL(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function aL(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function sL(t){mC.registerAxisPointerClass("CartesianAxisPointer",UC),t.registerComponentModel(WC),t.registerComponentView($C),t.registerPreprocessor((function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!yt(e)&&(t.axisPointer.link=[e])}})),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,(function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=uC(t,e)})),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},eL)}const lL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Gc);function uL(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function hL(t){if(O.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;n-1?(u+="top:50%",h+="translateY(-50%) rotate("+(a="left"===s?-225:-45)+"deg)"):(u+="left:50%",h+="translateX(-50%) rotate("+(a="top"===s?225:45)+"deg)");var c=a*Math.PI/180,d=l+r,f=d*Math.abs(Math.cos(c))+d*Math.abs(Math.sin(c)),p=e+" solid "+r+"px;";return'
'}(n,i,r)),wt(t))o.innerHTML=t+a;else if(t){o.innerHTML="",yt(t)||(t=[t]);for(var s=0;s=0?this._tryShow(n,i):"leave"===e&&this._hide(i))}),this))},e.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})}))}},e.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!O.node&&n.getDom()){var r=DL(i,n);this._ticket="";var o=i.dataByCoordSys,a=function(t,e,n){var i=Ra(t).queryOptionMap,r=i.keys()[0];if(!r||"series"===r)return;var o=Ba(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(!a)return;var s,l=n.getViewOfComponentModel(a);if(l.group.traverse((function(e){var n=nu(e).tooltipConfig;if(n&&n.name===t.name)return s=e,!0})),s)return{componentMainType:r,componentIndex:a.componentIndex,el:s}}(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=CL;l.x=i.x,l.y=i.y,l.update(),nu(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=QC(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},e.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(DL(i,n))},e.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s)if("axis"===AL([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}},e.prototype._tryShow=function(t,e){var n=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(n){var r,o;if("legend"===nu(n).ssrType)return;this._lastDataByCoordSys=null,Ev(n,(function(t){return null!=nu(t).dataIndex?(r=t,!0):null!=nu(t).tooltipConfig?(o=t,!0):void 0}),!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},e.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=vt(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},e.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=AL([e.tooltipOption],i),a=this._renderMode,s=[],l=op("section",{blocks:[],noHeader:!0}),u=[],h=new gp;ct(t,(function(t){ct(t.dataByAxis,(function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=zC(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),c=op("section",{header:o,noHeader:!Bt(o),sortBlocks:!0,blocks:[]});l.blocks.push(c),ct(t.seriesDataIndices,(function(l){var d=n.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,p=d.getDataParams(f);if(!(p.dataIndex<0)){p.axisDim=t.axisDim,p.axisIndex=t.axisIndex,p.axisType=t.axisType,p.axisId=t.axisId,p.axisValue=Bw(e.axis,{value:r}),p.axisValueLabel=o,p.marker=h.makeTooltipMarker("item",Cc(p.color),a);var g=Tf(d.formatTooltip(f,!0,null)),m=g.frag;if(m){var v=AL([d],i).get("valueFormatter");c.blocks.push(v?rt({valueFormatter:v},m):m)}g.text&&u.push(g.text),s.push(p)}}))}}))})),l.blocks.reverse(),u.reverse();var c=e.position,d=o.get("order"),f=cp(l,h,a,d,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var p="richText"===a?"\n\n":"
",g=u.join(p);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t,s)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)}))},e.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=nu(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,d=t.positionDefault,f=AL([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),p=f.get("trigger");if(null==p||"item"===p){var g=s.getDataParams(l,u),m=new gp;g.marker=m.makeTooltipMarker("item",Cc(g.color),c);var v=Tf(s.formatTooltip(l,!1,u)),_=f.get("order"),y=f.get("valueFormatter"),x=v.frag,w=x?cp(y?rt({valueFormatter:y},x):x,m,c,_,i.get("useUTC"),f.get("textStyle")):v.text,b="item_"+s.name+"_"+l;this._showOrMove(f,(function(){this._showTooltipContent(f,w,g,b,t.offsetX,t.offsetY,t.position,t.target,m)})),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,n){var i="html"===this._renderMode,r=nu(e),o=r.tooltipConfig.option||{},a=o.encodeHTMLContent;if(wt(o)){o={content:o,formatter:o},a=!0}a&&i&&o.content&&((o=et(o)).content=ze(o.content));var s=[o],l=this._ecModel.getComponent(r.componentMainType,r.componentIndex);l&&s.push(l),s.push({formatter:o.content});var u=t.positionDefault,h=AL(s,this._tooltipModel,u?{position:u}:null),c=h.get("content"),d=Math.random()+"",f=new gp;this._showOrMove(h,(function(){var n=et(h.get("formatterParams")||{});this._showTooltipContent(h,c,n,d,t.offsetX,t.offsetY,t.position,e,f)})),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,d=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h)if(wt(h)){var f=t.ecModel.get("useUTC"),p=yt(n)?n[0]:n;c=h,p&&p.axisType&&p.axisType.indexOf("time")>=0&&(c=Qh(p.axisValue,c,f)),c=bc(c,n,!0)}else if(xt(h)){var g=vt((function(e,i){e===this._ticket&&(u.setContent(i,l,t,d,a),this._updatePosition(t,a,r,o,u,n,s))}),this);this._ticket=i,c=h(n,i,g)}else c=h;u.setContent(c,l,t,d,a),u.show(t,d),this._updatePosition(t,a,r,o,u,n,s)}},e.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||yt(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:yt(e)?void 0:{color:i||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=a&&a.getBoundingRect().clone();if(a&&d.applyTransform(a.transform),xt(e)&&(e=e([n,i],o,r.el,d,{viewSize:[s,l],contentSize:u.slice()})),yt(e))n=qo(e[0],s),i=qo(e[1],l);else if(St(e)){var f=e;f.width=u[0],f.height=u[1];var p=Oc(f,{width:s,height:l});n=p.x,i=p.y,h=null,c=null}else if(wt(e)&&a){var g=function(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,d,u,t.get("borderWidth"));n=g[0],i=g[1]}else{g=function(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];null!=o&&(t+l+o+2>i?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=IL(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=IL(c)?u[1]/2:"bottom"===c?u[1]:0),uL(t)){g=function(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&ct(n,(function(n,o){var a=n.dataByAxis||[],s=(t[o]||{}).dataByAxis||[];(r=r&&a.length===s.length)&&ct(a,(function(t,n){var o=s[n]||{},a=t.seriesDataIndices||[],l=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===l.length)&&ct(a,(function(t,e){var n=l[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})),i&&ct(t.seriesDataIndices,(function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){!O.node&&e.getDom()&&(jm(this,"_updatePosition"),this._tooltipContent.dispose(),KC("itemTooltip",e))},e.type="tooltip",e}(Dp);function AL(t,e,n){var i,r=e.ecModel;n?(i=new Ih(n,r,r),i=new Ih(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof Ih&&(a=a.get("tooltip",!0)),wt(a)&&(a={formatter:a}),a&&(i=new Ih(a,i,r)))}return i}function DL(t,e){return t.dispatchAction||vt(e.dispatchAction,e)}function IL(t){return"center"===t||"middle"===t}const PL=LL;var EL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Gc),OL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){if(this.group.removeAll(),t.get("show")){var i=this.group,r=t.getModel("textStyle"),o=t.getModel("subtextStyle"),a=t.get("textAlign"),s=Ot(t.get("textBaseline"),t.get("textVerticalAlign")),l=new eu({style:lh(r,{text:t.get("text"),fill:r.getTextColor()},{disableBox:!0}),z2:10}),u=l.getBoundingRect(),h=t.get("subtext"),c=new eu({style:lh(o,{text:h,fill:o.getTextColor(),y:u.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),f=t.get("sublink"),p=t.get("triggerEvent",!0);l.silent=!d&&!p,c.silent=!f&&!p,d&&l.on("click",(function(){Lc(d,"_"+t.get("target"))})),f&&c.on("click",(function(){Lc(f,"_"+t.get("subtarget"))})),nu(l).eventData=nu(c).eventData=p?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(l),h&&i.add(c);var g=i.getBoundingRect(),m=t.getBoxLayoutParams();m.width=g.width,m.height=g.height;var v=Oc(m,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));a||("middle"===(a=t.get("left")||t.get("right"))&&(a="center"),"right"===a?v.x+=v.width:"center"===a&&(v.x+=v.width/2)),s||("center"===(s=t.get("top")||t.get("bottom"))&&(s="middle"),"bottom"===s?v.y+=v.height:"middle"===s&&(v.y+=v.height/2),s=s||"top"),i.x=v.x,i.y=v.y,i.markRedraw();var _={align:a,verticalAlign:s};l.setStyle(_),c.setStyle(_),g=i.getBoundingRect();var y=v.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var w=new Fl({shape:{x:g.x-y[3],y:g.y-y[0],width:g.width+y[1]+y[3],height:g.height+y[0]+y[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(w)}},e.type="title",e}(Dp);var NL=["x","y","radius","angle","single"],RL=["cartesian2d","polar","singleAxis"];function kL(t){return t+"Axis"}function zL(t,e){var n,i=jt(),r=[],o=jt();t.eachComponent({mainType:"dataZoom",query:e},(function(t){o.get(t.uid)||s(t)}));do{n=!1,t.eachComponent("dataZoom",a)}while(n);function a(t){!o.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis((function(t,n){var r=i.get(t);r&&r[n]&&(e=!0)})),e}(t)&&(s(t),n=!0)}function s(t){o.set(t.uid,!0),r.push(t),t.eachTargetAxis((function(t,e){(i.get(t)||i.set(t,[]))[e]=!0}))}return r}var BL=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();function FL(t){var e={};return ct(["start","end","startValue","endValue","throttle"],(function(n){t.hasOwnProperty(n)&&(e[n]=t[n])})),e}const VL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="dataZoom.select",e}(function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return I(e,t),e.prototype.init=function(t,e,n){var i=FL(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},e.prototype.mergeOption=function(t){var e=FL(t);nt(this.option,t,!0),nt(this.settledOption,e,!0),this._doInit(e)},e.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=n[t[0]]=null)}),this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=jt();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each((function(t){t.indexList.length&&(this._noTarget=!1)}),this)},e.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return ct(NL,(function(n){var i=this.getReferringComponents(kL(n),za);if(i.specified){e=!0;var r=new BL;ct(i.models,(function(t){r.add(t.componentIndex)})),t.set(n,r)}}),this),e},e.prototype._fillAutoTargetAxisByOrient=function(t,e){var n=this.ecModel,i=!0;if(i){var r="vertical"===e?"y":"x";o(n.findComponents({mainType:r+"Axis"}),r)}i&&o(n.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single");function o(e,n){var r=e[0];if(r){var o=new BL;if(o.add(r.componentIndex),t.set(n,o),i=!1,"x"===n||"y"===n){var a=r.getReferringComponents("grid",ka).models[0];a&&ct(e,(function(t){r.componentIndex!==t.componentIndex&&a===t.getReferringComponents("grid",ka).models[0]&&o.add(t.componentIndex)}))}}}i&&ct(NL,(function(e){if(i){var r=n.findComponents({mainType:kL(e),filter:function(t){return"category"===t.get("type",!0)}});if(r[0]){var o=new BL;o.add(r[0].componentIndex),t.set(e,o),i=!1}}}),this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis((function(e){!t&&(t=e)}),this),"y"===t?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var e=this._rangePropMode,n=this.get("rangeMode");ct([["start","startValue"],["end","endValue"]],(function(i,r){var o=null!=t[i[0]],a=null!=t[i[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":n?e[r]=n[r]:o&&(e[r]="percent")}))},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis((function(e,n){null==t&&(t=this.ecModel.getComponent(kL(e),n))}),this),t},e.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each((function(n,i){ct(n.indexList,(function(n){t.call(e,i,n)}))}))},e.prototype.getAxisProxy=function(t,e){var n=this.getAxisModel(t,e);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,e){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[e])return this.ecModel.getComponent(kL(t),e)},e.prototype.setRawRange=function(t){var e=this.option,n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(i){null==t[i[0]]&&null==t[i[1]]||(e[i[0]]=n[i[0]]=t[i[0]],e[i[1]]=n[i[1]]=t[i[1]])}),this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var e=this.option;ct(["start","startValue","end","endValue"],(function(n){e[n]=t[n]}))},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var n=this.findRepresentativeAxisProxy();return n?n.getDataValueWindow():void 0},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,n=this._targetAxisInfoMap.keys(),i=0;io&&(e[1-i]=e[i]+u.sign*o),e}function UL(t,e){var n=t[e]-t[1-e];return{span:Math.abs(n),sign:n>0?-1:n<0?1:e?-1:1}}function WL(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}var jL=ct,ZL=Ko,XL=function(){function t(t,e,n,i){this._dimName=t,this._axisIndex=e,this.ecModel=i,this._dataZoomModel=n}return t.prototype.hostedBy=function(t){return this._dataZoomModel===t},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var t=[];return this.ecModel.eachSeries((function(e){if(function(t){var e=t.get("coordinateSystem");return st(RL,e)>=0}(e)){var n=kL(this._dimName),i=e.getReferringComponents(n,ka).models[0];i&&this._axisIndex===i.componentIndex&&t.push(e)}}),this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return et(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){var e,n=this._dataExtent,i=this.getAxisModel().axis.scale,r=this._dataZoomModel.getRangePropMode(),o=[0,100],a=[],s=[];jL(["start","end"],(function(l,u){var h=t[l],c=t[l+"Value"];"percent"===r[u]?(null==h&&(h=o[u]),c=i.parse(Xo(h,o,n))):(e=!0,h=Xo(c=null==c?n[u]:i.parse(c),n,o)),s[u]=null==c||isNaN(c)?n[u]:c,a[u]=null==h||isNaN(h)?o[u]:h})),ZL(s),ZL(a);var l=this._minMaxSpan;function u(t,e,n,r,o){var a=o?"Span":"ValueSpan";HL(0,t,n,"all",l["min"+a],l["max"+a]);for(var s=0;s<2;s++)e[s]=Xo(t[s],n,r,!0),o&&(e[s]=i.parse(e[s]))}return e?u(s,a,n,o,!1):u(a,s,o,n,!0),{valueWindow:s,percentWindow:a}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,n){var i=[1/0,-1/0];jL(n,(function(t){!function(t,e,n){e&&ct(Hw(e,n),(function(n){var i=e.getApproximateExtent(n);i[0]t[1]&&(t[1]=i[1])}))}(i,t.getData(),e)}));var r=t.getAxisModel(),o=Ew(r.axis.scale,r,i).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var n=this.calculateDataWindow(t.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow;"none"!==r&&jL(i,(function(t){var e=t.getData(),i=e.mapDimensionsAll(n);if(i.length){if("weakFilter"===r){var a=e.getStore(),s=dt(i,(function(t){return e.getDimensionIndex(t)}),e);e.filterSelf((function(t){for(var e,n,r,l=0;lo[1];if(h&&!c&&!d)return!0;h&&(r=!0),c&&(e=!0),d&&(n=!0)}return r&&e&&n}))}else jL(i,(function(n){if("empty"===r)t.setData(e=e.map(n,(function(t){return function(t){return t>=o[0]&&t<=o[1]}(t)?t:NaN})));else{var i={};i[n]=o,e.selectRange(i)}}));jL(i,(function(t){e.setApproximateExtent(o,t)}))}}))}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,n=this._dataExtent;jL(["min","max"],(function(i){var r=e.get(i+"Span"),o=e.get(i+"ValueSpan");null!=o&&(o=this.getAxisModel().axis.scale.parse(o)),null!=o?r=Xo(n[0]+o,n,[0,100],!0):null!=r&&(o=Xo(r,[0,100],n,!0)-n[0]),t[i+"Span"]=r,t[i+"ValueSpan"]=o}),this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,n=this._valueWindow;if(e){var i=Qo(n,[0,500]);i=Math.min(i,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==e[1]&&r.setDeterminedMinMax("max",+n[1].toFixed(i)),r.freeze()}},t}();const qL=XL;const YL={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,r){var o=t.getComponent(kL(i),r);e(i,r,o,n)}))}))}e((function(t,e,n,i){n.__dzAxisProxy=null}));var n=[];e((function(e,i,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new qL(e,i,o,t),n.push(r.__dzAxisProxy))}));var i=jt();return ct(n,(function(t){ct(t.getTargetSeriesModels(),(function(t){i.set(t.uid,t)}))})),i},overallReset:function(t,e){t.eachComponent("dataZoom",(function(t){t.eachTargetAxis((function(e,n){t.getAxisProxy(e,n).reset(t)})),t.eachTargetAxis((function(n,i){t.getAxisProxy(n,i).filterData(t,e)}))})),t.eachComponent("dataZoom",(function(t){var e=t.findRepresentativeAxisProxy();if(e){var n=e.getDataPercentWindow(),i=e.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}}))}};var KL=!1;function JL(t){KL||(KL=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,YL),function(t){t.registerAction("dataZoom",(function(t,e){ct(zL(e,t),(function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})}))}))}(t),t.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}function $L(t){t.registerComponentModel(VL),t.registerComponentView(GL),JL(t)}var QL=function(){},tA={};function eA(t,e){tA[t]=e}function nA(t){return tA[t]}const iA=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.optionUpdated=function(){t.prototype.optionUpdated.apply(this,arguments);var e=this.ecModel;ct(this.option.feature,(function(t,n){var i=nA(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(e)),nt(t,i.defaultOption))}))},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Gc);function rA(t,e){var n=_c(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),t=new Fl({shape:{x:t.x-n[3],y:t.y-n[0],width:t.width+n[1]+n[3],height:t.height+n[0]+n[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1})}var oA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){var r=this.group;if(r.removeAll(),t.get("show")){var o=+t.get("itemSize"),a="vertical"===t.get("orient"),s=t.get("feature")||{},l=this._features||(this._features={}),u=[];ct(s,(function(t,e){u.push(e)})),new ex(this._featureNames||[],u).add(h).update(h).remove(_t(h,null)).execute(),this._featureNames=u,function(t,e,n){var i=e.getBoxLayoutParams(),r=e.get("padding"),o={width:n.getWidth(),height:n.getHeight()},a=Oc(i,o,r);Ec(e.get("orient"),t,e.get("itemGap"),a.width,a.height),Nc(t,i,o,r)}(r,t,n),r.add(rA(r.getBoundingRect(),t)),a||r.eachChild((function(t){var e=t.__title,i=t.ensureState("emphasis"),a=i.textConfig||(i.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!xt(l)&&e){var u=l.style||(l.style={}),h=po(e,eu.makeFont(u)),c=t.x+r.x,d=!1;t.y+r.y+o+h.height>n.getHeight()&&(a.position="top",d=!0);var f=d?-5-h.height:o+10;c+h.width/2>n.getWidth()?(a.position=["100%",f],u.align="right"):c-h.width/2<0&&(a.position=[0,f],u.align="left")}}))}function h(h,c){var d,f=u[h],p=u[c],g=s[f],m=new Ih(g,t,t.ecModel);if(i&&null!=i.newTitle&&i.featureName===f&&(g.title=i.newTitle),f&&!p){if(function(t){return 0===t.indexOf("my")}(f))d={onclick:m.option.onclick,featureName:f};else{var v=nA(f);if(!v)return;d=new v}l[f]=d}else if(!(d=l[p]))return;d.uid=Eh("toolbox-feature"),d.model=m,d.ecModel=e,d.api=n;var _=d instanceof QL;f||!p?!m.get("show")||_&&d.unusable?_&&d.remove&&d.remove(e,n):(!function(i,s,l){var u,h,c=i.getModel("iconStyle"),d=i.getModel(["emphasis","iconStyle"]),f=s instanceof QL&&s.getIcons?s.getIcons():i.get("icon"),p=i.get("title")||{};wt(f)?(u={})[l]=f:u=f;wt(p)?(h={})[l]=p:h=p;var g=i.iconPaths={};ct(u,(function(l,u){var f=Sm(l,{},{x:-o/2,y:-o/2,width:o,height:o});f.setStyle(c.getItemStyle()),f.ensureState("emphasis").style=d.getItemStyle();var p=new eu({style:{text:h[u],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:ph({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},e)},ignore:!0});f.setTextContent(p),Am({el:f,componentModel:t,itemName:u,formatterParamsExtra:{title:h[u]}}),f.__title=h[u],f.on("mouseover",(function(){var e=d.getItemStyle(),i=a?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";p.setStyle({fill:d.get("textFill")||e.fill||e.stroke||"var(--ow-color-black)",backgroundColor:d.get("textBackgroundColor")}),f.setTextConfig({position:d.get("textPosition")||i}),p.ignore=!t.get("showTitle"),n.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==i.get(["iconStatus",u])&&n.leaveEmphasis(this),p.hide()})),("emphasis"===i.get(["iconStatus",u])?Iu:Pu)(f),r.add(f),f.on("click",vt(s.onclick,s,e,n,u)),g[u]=f}))}(m,d,f),m.setIconStatus=function(t,e){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[t]=e,i[t]&&("emphasis"===e?Iu:Pu)(i[t])},d instanceof QL&&d.render&&d.render(m,e,n,i)):_&&d.dispose&&d.dispose(e,n)}},e.prototype.updateView=function(t,e,n,i){ct(this._features,(function(t){t instanceof QL&&t.updateView&&t.updateView(t.model,e,n,i)}))},e.prototype.remove=function(t,e){ct(this._features,(function(n){n instanceof QL&&n.remove&&n.remove(t,e)})),this.group.removeAll()},e.prototype.dispose=function(t,e){ct(this._features,(function(n){n instanceof QL&&n.dispose&&n.dispose(t,e)}))},e.type="toolbox",e}(Dp);const aA=oA;const sA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.onclick=function(t,e){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":n.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=O.browser;if("function"!=typeof MouseEvent||!s.newEdge&&(s.ie||s.edge))if(window.navigator.msSaveOrOpenBlob||r){var l=a.split(","),u=l[0].indexOf("base64")>-1,h=r?decodeURIComponent(l[1]):l[1];u&&(h=window.atob(h));var c=i+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var d=h.length,f=new Uint8Array(d);d--;)f[d]=h.charCodeAt(d);var p=new Blob([f]);window.navigator.msSaveOrOpenBlob(p,c)}else{var g=document.createElement("iframe");document.body.appendChild(g);var m=g.contentWindow,v=m.document;v.open("image/svg+xml","replace"),v.write(h),v.close(),m.focus(),v.execCommand("SaveAs",!0,c),document.body.removeChild(g)}}else{var _=n.get("lang"),y='',x=window.open();x.document.write(y),x.document.title=i}else{var w=document.createElement("a");w.download=i+"."+o,w.target="_blank",w.href=a;var b=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});w.dispatchEvent(b)}},e.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},e}(QL);var lA="__ec_magicType_stack__",uA=[["line","bar"],["stack"]],hA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return ct(t.get("type"),(function(t){e[t]&&(n[t]=e[t])})),n},e.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,n){var i=this.model,r=i.get(["seriesIndex",n]);if(cA[n]){var o,a={series:[]};ct(uA,(function(t){st(t,n)>=0&&ct(t,(function(t){i.setIconStatus(t,"normal")}))})),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=cA[n](e,r,t,i);o&&(ot(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var u=l.dim+"Axis",h=t.getReferringComponents(u,ka).models[0].componentIndex;a[u]=a[u]||[];for(var c=0;c<=h;c++)a[u][h]=a[u][h]||{};a[u][h].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(o=nt({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}(QL),cA={line:function(t,e,n,i){if("bar"===t)return nt({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return nt({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var r=n.get("stack")===lA;if("line"===t||"bar"===t)return i.setIconStatus("stack",r?"normal":"emphasis"),nt({id:e,stack:r?"":lA},i.get(["option","stack"])||{},!0)}};Vy({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));const dA=hA;var fA=new Array(60).join("-"),pA="\t";function gA(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var mA=new RegExp("[\t]+","g");function vA(t,e){var n=t.split(new RegExp("\n*"+fA+"\n*","g")),i={series:[]};return ct(n,(function(t,n){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(pA)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=[],i=dt(gA(e.shift()).split(mA),(function(t){return{name:t,data:[]}})),r=0;r6}(t)||o){if(a&&!o){"single"===s.brushMode&&WA(t);var l=et(s);l.brushType=sD(l.brushType,a),l.panelId=a===CA?null:a.panelId,o=t._creatingCover=kA(t,l),t._covers.push(o)}if(o){var u=hD[sD(t._brushType,a)];o.__brushOption.range=u.getCreatingRange(iD(t,o,t._track)),i&&(zA(t,o),u.updateCommon(t,o)),BA(t,o),r={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&HA(t,e,n)&&WA(t)&&(r={isEnd:i,removeOnClick:!0});return r}function sD(t,e){return"auto"===t?e.defaultBrushType:t}var lD={mousedown:function(t){if(this._dragging)uD(this,t);else if(!t.target||!t.target.draggable){rD(t);var e=this.group.transformCoordToLocal(t.offsetX,t.offsetY);this._creatingCover=null,(this._creatingPanel=HA(this,t,e))&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(t){var e=t.offsetX,n=t.offsetY,i=this.group.transformCoordToLocal(e,n);if(function(t,e,n){if(t._brushType&&!function(t,e,n){var i=t._zr;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}(t,e.offsetX,e.offsetY)){var i=t._zr,r=t._covers,o=HA(t,e,n);if(!t._dragging)for(var a=0;a=0)&&t(r,i._targetInfoList)}))}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,(function(t,e,n){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var i=SD[t.brushType](0,n,e);t.__rangeOffset={offset:CD[t.brushType](i.values,t.range,[1,1]),xyMinMax:i.xyMinMax}}})),t},t.prototype.matchOutputRanges=function(t,e,n){ct(t,(function(t){var i=this.findTargetInfo(t,e);i&&!0!==i&&ct(i.coordSyses,(function(i){var r=SD[t.brushType](1,i,t.range,!0);n(t,r.values,i,e)}))}),this)},t.prototype.setInputRanges=function(t,e){ct(t,(function(t){var n,i,r,o,a,s=this.findTargetInfo(t,e);if(t.range=t.range||[],s&&!0!==s){t.panelId=s.panelId;var l=SD[t.brushType](0,s.coordSys,t.coordRange),u=t.__rangeOffset;t.range=u?CD[t.brushType](l.values,u.offset,(n=l.xyMinMax,i=u.xyMinMax,r=AD(n),o=AD(i),a=[r[0]/o[0],r[1]/o[1]],isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a)):l.values}}),this)},t.prototype.makePanelOpts=function(t,e){return dt(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:e?e(n):null,clipPath:fD(i),isTargetByCursor:gD(i,t,n.coordSysModel),getLinearBrushOtherExtent:pD(i)}}))},t.prototype.controlSeries=function(t,e,n){var i=this.findTargetInfo(t,n);return!0===i||i&&st(i.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var n=this._targetInfoList,i=xD(e,t),r=0;rt[1]&&t.reverse(),t}function xD(t,e){return Na(t,e,{includeMainTypes:vD})}var wD={grid:function(t,e){var n=t.xAxisModels,i=t.yAxisModels,r=t.gridModels,o=jt(),a={},s={};(n||i||r)&&(ct(n,(function(t){var e=t.axis.grid.model;o.set(e.id,e),a[e.id]=!0})),ct(i,(function(t){var e=t.axis.grid.model;o.set(e.id,e),s[e.id]=!0})),ct(r,(function(t){o.set(t.id,t),a[t.id]=!0,s[t.id]=!0})),o.each((function(t){var r=t.coordinateSystem,o=[];ct(r.getCartesians(),(function(t,e){(st(n,t.getAxis("x").model)>=0||st(i,t.getAxis("y").model)>=0)&&o.push(t)})),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:o[0],coordSyses:o,getPanelRect:TD.grid,xAxisDeclared:a[t.id],yAxisDeclared:s[t.id]})})))},geo:function(t,e){ct(t.geoModels,(function(t){var n=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:n,coordSyses:[n],getPanelRect:TD.geo})}))}},bD=[function(t,e){var n=t.xAxisModel,i=t.yAxisModel,r=t.gridModel;return!r&&n&&(r=n.axis.grid.model),!r&&i&&(r=i.axis.grid.model),r&&r===e.gridModel},function(t,e){var n=t.geoModel;return n&&n===e.geoModel}],TD={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(vm(t)),e}},SD={lineX:_t(MD,0),lineY:_t(MD,1),rect:function(t,e,n,i){var r=t?e.pointToData([n[0][0],n[1][0]],i):e.dataToPoint([n[0][0],n[1][0]],i),o=t?e.pointToData([n[0][1],n[1][1]],i):e.dataToPoint([n[0][1],n[1][1]],i),a=[yD([r[0],o[0]]),yD([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,n,i){var r=[[1/0,-1/0],[1/0,-1/0]];return{values:dt(n,(function(n){var o=t?e.pointToData(n,i):e.dataToPoint(n,i);return r[0][0]=Math.min(r[0][0],o[0]),r[1][0]=Math.min(r[1][0],o[1]),r[0][1]=Math.max(r[0][1],o[0]),r[1][1]=Math.max(r[1][1],o[1]),o})),xyMinMax:r}}};function MD(t,e,n,i){var r=n.getAxis(["x","y"][t]),o=yD(dt([0,1],(function(t){return e?r.coordToData(r.toLocalCoord(i[t]),!0):r.toGlobalCoord(r.dataToCoord(i[t]))}))),a=[];return a[t]=o,a[1-t]=[NaN,NaN],{values:o,xyMinMax:a}}var CD={lineX:_t(LD,0),lineY:_t(LD,1),rect:function(t,e,n){return[[t[0][0]-n[0]*e[0][0],t[0][1]-n[0]*e[0][1]],[t[1][0]-n[1]*e[1][0],t[1][1]-n[1]*e[1][1]]]},polygon:function(t,e,n){return dt(t,(function(t,i){return[t[0]-n[0]*e[i][0],t[1]-n[1]*e[i][1]]}))}};function LD(t,e,n,i){return[e[0]-i[t]*n[0],e[1]-i[t]*n[1]]}function AD(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}const DD=_D;var ID,PD,ED=ct,OD=ya+"toolbox-dataZoom_",ND=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){this._brushController||(this._brushController=new dD(n.getZr()),this._brushController.on("brush",vt(this._onBrush,this)).mount()),function(t,e,n,i,r){var o=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(o="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new DD(kD(t),e,{include:["grid"]}),s=a.makePanelOpts(r,(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"}));n._brushController.setPanels(s).enableBrush(!(!o||!s.length)&&{brushType:"auto",brushStyle:t.getModel("brushStyle").getItemStyle()})}(t,e,this,i,n),function(t,e){t.setIconStatus("back",function(t){return TA(t).length}(e)>1?"emphasis":"normal")}(t,e)},e.prototype.onclick=function(t,e,n){RD[n].call(this)},e.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var e=t.areas;if(t.isEnd&&e.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new DD(kD(this.model),i,{include:["grid"]}).matchOutputRanges(e,i,(function(t,e,n){if("cartesian2d"===n.type){var i=t.brushType;"rect"===i?(r("x",n,e[0]),r("y",n,e[1])):r({lineX:"x",lineY:"y"}[i],n,e)}})),function(t,e){var n=TA(t);wA(e,(function(e,i){for(var r=n.length-1;r>=0&&!n[r][i];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(o){var a=o.getPercentRange();n[0][i]={dataZoomId:i,start:a[0],end:a[1]}}}})),n.push(e)}(i,n),this._dispatchZoomAction(n)}function r(t,e,r){var o=e.getAxis(t),a=o.model,s=function(t,e,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},(function(n){n.getAxisModel(t,e.componentIndex)&&(i=n)})),i}(t,a,i),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(r=HL(0,r.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(n[s.id]={dataZoomId:s.id,startValue:r[0],endValue:r[1]})}},e.prototype._dispatchZoomAction=function(t){var e=[];ED(t,(function(t,n){e.push(et(t))})),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},e.getDefaultOption=function(t){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},e}(QL),RD={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(function(t){var e=TA(t),n=e[e.length-1];e.length>1&&e.pop();var i={};return wA(n,(function(t,n){for(var r=e.length-1;r>=0;r--)if(t=e[r][n]){i[n]=t;break}})),i}(this.ecModel))}};function kD(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}ID="dataZoom",PD=function(t){var e=t.getComponent("toolbox",0),n=["feature","dataZoom"];if(e&&null!=e.get(n)){var i=e.getModel(n),r=[],o=Na(t,kD(i));return ED(o.xAxisModels,(function(t){return a(t,"xAxis","xAxisIndex")})),ED(o.yAxisModels,(function(t){return a(t,"yAxis","yAxisIndex")})),r}function a(t,e,n){var o=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:OD+e+o};a[n]=o,r.push(a)}},zt(null==ad.get(ID)&&PD),ad.set(ID,PD);const zD=ND;const BD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),this._updateSelector(e)},e.prototype._updateSelector=function(t){var e=t.selector,n=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),yt(e)&&ct(e,(function(t,i){wt(t)&&(t={type:t}),e[i]=nt(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(n,t.type))}))},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,n=0;n=0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"var(--ow-color-fg-darker)"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Gc);var FD=_t,VD=ct,GD=Eo,HD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.newlineDisabled=!1,n}return I(e,t),e.prototype.init=function(){this.group.add(this._contentGroup=new GD),this.group.add(this._selectorGroup=new GD),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),c=Oc(l,u,h),d=this.layoutInner(t,r,c,i,a,s),f=Oc(ot({width:d.width,height:d.height},l),u,h);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=rA(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=jt(),u=e.get("selectedMode"),h=[];n.eachRawSeries((function(t){!t.get("legendHoverLink")&&h.push(t.id)})),VD(e.getData(),(function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new GD;return c.newline=!0,void s.add(c)}var d=n.getSeriesByName(a)[0];if(!l.get(a)){if(d){var f=d.getData(),p=f.getVisual("legendLineStyle")||{},g=f.getVisual("legendIcon"),m=f.getVisual("style"),v=this._createItem(d,a,o,r,e,t,p,m,g,u,i);v.on("click",FD(UD,a,null,i,h)).on("mouseover",FD(jD,d.name,null,i,h)).on("mouseout",FD(ZD,d.name,null,i,h)),n.ssr&&v.eachChild((function(t){var e=nu(t);e.seriesIndex=d.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}else n.eachRawSeries((function(s){if(!l.get(a)&&s.legendVisualProvider){var c=s.legendVisualProvider;if(!c.containName(a))return;var d=c.indexOfName(a),f=c.getItemVisual(d,"style"),p=c.getItemVisual(d,"legendIcon"),g=Ri(f.fill);g&&0===g[3]&&(g[3]=.2,f=rt(rt({},f),{fill:ji(g,"rgba")}));var m=this._createItem(s,a,o,r,e,t,{},f,p,u,i);m.on("click",FD(UD,null,a,i,h)).on("mouseover",FD(jD,null,a,i,h)).on("mouseout",FD(ZD,null,a,i,h)),n.ssr&&m.eachChild((function(t){var e=nu(t);e.seriesIndex=s.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}}),this);0}}),this),r&&this._createSelector(r,e,i,o,a)},e.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();VD(t,(function(t){var i=t.type,r=new eu({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect",legendId:e.id})}});o.add(r),ah(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),Hu(r)}))},e.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c=t.visualDrawType,d=r.get("itemWidth"),f=r.get("itemHeight"),p=r.isSelected(e),g=i.get("symbolRotate"),m=i.get("symbolKeepAspect"),v=i.get("icon"),_=function(t,e,n,i,r,o,a){function s(t,e){"auto"===t.lineWidth&&(t.lineWidth=e.lineWidth>0?2:0),VD(t,(function(n,i){"inherit"===t[i]&&(t[i]=e[i])}))}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?b_(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]);"inherit"===u.stroke&&(u.stroke=i[h]);"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity);s(u,i);var d=e.getModel("lineStyle"),f=d.getLineStyle();if(s(f,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===f.stroke&&(f.stroke=i.fill),!o){var p=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===p?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),f.stroke=d.get("inactiveColor"),f.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:f}}(l=v||l||"roundRect",i,a,s,c,p,h),y=new GD,x=i.getModel("textStyle");if(!xt(t.getLegendIcon)||v&&"inherit"!==v){var w="inherit"===v&&t.getData().getVisual("symbol")?"inherit"===g?t.getData().getVisual("symbolRotate"):g:0;y.add(function(t){var e=t.icon||"roundRect",n=jv(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);n.setStyle(t.itemStyle),n.rotation=(t.iconRotate||0)*Math.PI/180,n.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:d,itemHeight:f,icon:l,iconRotate:w,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}))}else y.add(t.getLegendIcon({itemWidth:d,itemHeight:f,icon:l,iconRotate:g,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}));var b="left"===o?d+5:-5,T=o,S=r.get("formatter"),M=e;wt(S)&&S?M=S.replace("{name}",null!=e?e:""):xt(S)&&(M=S(e));var C=p?x.getTextColor():i.get("inactiveColor");y.add(new eu({style:lh(x,{text:M,x:b,y:f/2,fill:C,align:T,verticalAlign:"middle"},{inheritColor:C})}));var L=new Fl({shape:y.getBoundingRect(),style:{fill:"transparent"}}),A=i.getModel("tooltip");return A.get("show")&&Am({el:L,componentModel:r,itemName:e,itemTooltipOption:A.option}),y.add(L),y.eachChild((function(t){t.silent=!0})),L.silent=!u,this.getContentGroup().add(y),Hu(y),y.__legendDataIndex=n,y},e.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();Ec(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){Ec("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),f=t.getOrient().index,p=0===f?"width":"height",g=0===f?"height":"width",m=0===f?"y":"x";"end"===o?c[f]+=l[p]+d:u[f]+=h[p]+d,c[1-f]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[p]=l[p]+d+h[p],v[g]=Math.max(l[g],h[g]),v[m]=Math.min(0,h[m]+c[1-f]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Dp);function UD(t,e,n,i){ZD(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),jD(t,e,n,i)}function WD(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;in[r],p=[-c.x,-c.y];e||(p[i]=l[s]);var g=[0,0],m=[-d.x,-d.y],v=Ot(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[i]+=n[r]-d[r]:g[i]+=d[r]+v);m[1-i]+=c[o]/2-d[o]/2,l.setPosition(p),u.setPosition(g),h.setPosition(m);var _={x:0,y:0};if(_[r]=f?n[r]:c[r],_[o]=Math.max(c[o],d[o]),_[a]=Math.min(0,d[a]+m[1-i]),u.__rectSize=n[r],f){var y={x:0,y:0};y[r]=Math.max(n[r]-d[r]-v,0),y[o]=_[o],u.setClipPath(new Fl({shape:y})),u.__rectSize=y[r]}else h.eachChild((function(t){t.attr({invisible:!0,silent:!0})}));var x=this._getPageInfo(t);return null!=x.pageIndex&&Ju(l,{x:x.contentPosition[0],y:x.contentPosition[1]},f?t:null),this._updatePageInfoView(t,x),_},e.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},e.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;ct(["pagePrev","pageNext"],(function(i){var r=null!=e[i+"DataIndex"],o=n.childOfName(i);o&&(o.setStyle("fill",r?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")}));var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",wt(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},e.prototype._getPageInfo=function(t){var e=t.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,r=t.getOrient().index,o=eI[r],a=nI[r],s=this._findTargetItemIndex(e),l=n.children(),u=l[s],h=l.length,c=h?1:0,d={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!u)return d;var f=_(u);d.contentPosition[r]=-f.s;for(var p=s+1,g=f,m=f,v=null;p<=h;++p)(!(v=_(l[p]))&&m.e>g.s+i||v&&!y(v,g.s))&&(g=m.i>g.i?m:v)&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=g.i),++d.pageCount),m=v;for(p=s-1,g=f,m=f,v=null;p>=-1;--p)(v=_(l[p]))&&y(m,v.s)||!(g.i=e&&t.s<=e+i}},e.prototype._findTargetItemIndex=function(t){return this._showController?(this.getContentGroup().eachChild((function(i,r){var o=i.__legendDataIndex;null==n&&null!=o&&(n=r),o===t&&(e=r)})),null!=e?e:n):0;var e,n},e.type="legend.scroll",e}(XD);const rI=iI;function oI(t){Jw(JD),t.registerComponentModel(QD),t.registerComponentView(rI),function(t){t.registerAction("legendScroll","legendscroll",(function(t,e){var n=t.scrollDataIndex;null!=n&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},(function(t){t.setScrollDataIndex(n)}))}))}(t)}function aI(t,e){var n;return ct(e,(function(e){null!=t[e]&&"auto"!==t[e]&&(n=!0)})),n}var sI=["transition","enterFrom","leaveTo"],lI=sI.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function uI(t,e,n){if(n&&(!t[n]&&e[n]&&(t[n]={}),t=t[n],e=e[n]),t&&e)for(var i=n?sI:lI,r=0;r0&&(a.during=s?vt(bI,{el:e,userDuring:s}):null,a.setToFinal=!0,a.scope=t),rt(a,n[o]),a}function vI(t,e,n,i){var r=(i=i||{}).dataIndex,o=i.isInit,a=i.clearStyle,s=n.isAnimationEnabled(),l=gI(t),u=e.style;l.userDuring=e.during;var h={},c={};if(function(t,e,n){for(var i=0;i=0)){var c=t.getAnimationStyleProps(),d=c?c.style:null;if(d){!r&&(r=i.style={});var f=mt(n);for(u=0;u0&&t.animateFrom(d,f)}else!function(t,e,n,i,r){if(r){var o=mI("update",t,e,i,n);o.duration>0&&t.animateFrom(r,o)}}(t,e,r||0,n,h);_I(t,e),u?t.dirty():t.markRedraw()}function _I(t,e){for(var n=gI(t).leaveToProps,i=0;i=0){!o&&(o=i[t]={});var d=mt(a);for(h=0;h=0;l--){var d,f,p;if(p=null!=(f=Aa((d=n[l]).id,null))?r.get(f):null){var g=p.parent,m=(c=II(g),{}),v=Nc(p,d,g===i?{width:o,height:a}:{width:c.width,height:c.height},null,{hv:d.hv,boundingMode:d.bounding},m);if(!II(p).isNew&&v){for(var _=d.transition,y={},x=0;x=0)?y[w]=b:p[w]=b}Ju(p,y,t,0)}else p.attr(m)}}},e.prototype._clear=function(){var t=this,e=this._elMap;e.each((function(n){NI(n,II(n).option,e,t._lastGraphicModel)})),this._elMap=jt()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(Dp);function EI(t){var e=new(Yt(DI,t)?DI[t]:lm(t))({});return II(e).type=t,e}function OI(t,e,n,i){var r=EI(n);return e.add(r),i.set(t,r),II(r).id=t,II(r).isNew=!0,r}function NI(t,e,n,i){t&&t.parent&&("group"===t.type&&t.traverse((function(t){NI(t,e,n,i)})),function(t,e,n,i){if(t){var r=t.parent,o=gI(t).leaveToProps;if(o){var a=mI("update",t,e,n,0);a.done=function(){r.remove(t),i&&i()},t.animateTo(o,a)}else r.remove(t),i&&i()}}(t,e,i),n.removeKey(II(t).id))}function RI(t,e,n,i){t.isGroup||ct([["cursor",Ss.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];Yt(e,i)?t[i]=Ot(e[i],n[1]):null==t[i]&&(t[i]=n[1])})),ct(mt(e),(function(n){if(0===n.indexOf("on")){var i=e[n];t[n]=xt(i)?i:null}})),Yt(e,"draggable")&&(t.draggable=e.draggable),null!=e.name&&(t.name=e.name),null!=e.id&&(t.id=e.id)}var kI=Math.sin,zI=Math.cos,BI=Math.PI,FI=2*Math.PI,VI=180/BI,GI=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){this._add("C",t,e,n,i,r,o)},t.prototype.quadraticCurveTo=function(t,e,n,i){this._add("Q",t,e,n,i)},t.prototype.arc=function(t,e,n,i,r,o){this.ellipse(t,e,n,n,0,i,r,o)},t.prototype.ellipse=function(t,e,n,i,r,o,a,s){var l=a-o,u=!s,h=Math.abs(l),c=Qi(h-FI)||(u?l>=FI:-l>=FI),d=l>0?l%FI:l%FI+FI,f=!1;f=!!c||!Qi(h)&&d>=BI==!!u;var p=t+n*zI(o),g=e+i*kI(o);this._start&&this._add("M",p,g);var m=Math.round(r*VI);if(c){var v=1/this._p,_=(u?1:-1)*(FI-v);this._add("A",n,i,m,1,+u,t+n*zI(o+_),e+i*kI(o+_)),v>.01&&this._add("A",n,i,m,0,+u,p,g)}else{var y=t+n*zI(a),x=e+i*kI(a);this._add("A",n,i,m,+f,+u,y,x)}},t.prototype.rect=function(t,e,n,i){this._add("M",t,e),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,n,i,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"}(r,o)+("style"!==r?ze(a):a||"")+(i?""+n+dt(i,(function(e){return t(e)})).join(n)+n:"")+("")}(t)}function tP(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function eP(t,e,n,i){return $I("svg","root",{width:t,height:e,xmlns:qI,"xmlns:xlink":YI,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},n)}var nP=0;function iP(){return nP++}var rP={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},oP="transform-origin";function aP(t,e,n){var i=rt({},t.shape);rt(i,e),t.buildPath(n,i);var r=new HI;return r.reset(ur(t)),n.rebuildPath(r,1),r.generateStr(),r.getStr()}function sP(t,e){var n=e.originX,i=e.originY;(n||i)&&(t[oP]=n+"px "+i+"px")}var lP={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function uP(t,e){var n=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[n]=t,n}function hP(t){return wt(t)?rP[t]?"cubic-bezier("+rP[t]+")":vi(t)?t:"":""}function cP(t,e,n,i){var r=t.animators,o=r.length,a=[];if(t instanceof Fg){var s=function(t,e,n){var i,r,o=t.shape.paths,a={};if(ct(o,(function(t){var e=tP(n.zrId);e.animation=!0,cP(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=mt(o),u=l.length;if(u){var h=o[r=l[u-1]];for(var c in h){var d=h[c];a[c]=a[c]||{d:""},a[c].d+=d.d||""}for(var f in s){var p=s[f].animation;p.indexOf(r)>=0&&(i=p)}}})),i){e.d=!1;var s=uP(a,n);return i.replace(r,s)}}(t,e,n);if(s)a.push(s);else if(!o)return}else if(!o)return;for(var l={},u=0;u0})).length)return uP(h,n)+" "+r[0]+" both"}for(var m in l){(s=g(l[m]))&&a.push(s)}if(a.length){var v=n.zrId+"-cls-"+iP();n.cssNodes["."+v]={animation:a.join(",")},e.class=v}}function dP(t,e,n,i){var r=JSON.stringify(t),o=n.cssStyleCache[r];o||(o=n.zrId+"-cls-"+iP(),n.cssStyleCache[r]=o,n.cssNodes["."+o+(i?":hover":"")]=t),e.class=e.class?e.class+" "+o:o}var fP=Math.round;function pP(t){return t&&wt(t.src)}function gP(t){return t&&xt(t.toDataURL)}function mP(t,e,n,i){XI((function(r,o){var a="fill"===r||"stroke"===r;a&&sr(o)?LP(e,t,r,i):a&&rr(o)?AP(n,t,r,i):t[r]=o,a&&i.ssr&&"none"===o&&(t["pointer-events"]="visible")}),e,n,!1),function(t,e,n){var i=t.style;if(function(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}(i)){var r=function(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(t),o=n.shadowCache,a=o[r];if(!a){var s=t.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var h=i.shadowOffsetX||0,c=i.shadowOffsetY||0,d=i.shadowBlur,f=Ji(i.shadowColor),p=f.opacity,g=f.color,m=d/2/l+" "+d/2/u;a=n.zrId+"-s"+n.shadowIdx++,n.defs[a]=$I("filter",a,{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},[$I("feDropShadow","",{dx:h/l,dy:c/u,stdDeviation:m,"flood-color":g,"flood-opacity":p})]),o[r]=a}e.filter=lr(a)}}(n,t,i)}function vP(t,e){var n=Ho(e);n&&(n.each((function(e,n){null!=e&&(t[(KI+n).toLowerCase()]=e+"")})),e.isSilent()&&(t[KI+"silent"]="true"))}function _P(t){return Qi(t[0]-1)&&Qi(t[1])&&Qi(t[2])&&Qi(t[3]-1)}function yP(t,e,n){if(e&&(!function(t){return Qi(t[4])&&Qi(t[5])}(e)||!_P(e))){var i=n?10:1e4;t.transform=_P(e)?"translate("+fP(e[4]*i)/i+" "+fP(e[5]*i)/i+")":function(t){return"matrix("+tr(t[0])+","+tr(t[1])+","+tr(t[2])+","+tr(t[3])+","+er(t[4])+","+er(t[5])+")"}(e)}}function xP(t,e,n){for(var i=t.points,r=[],o=0;o=0&&a||o;s&&(r=Yi(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&t.transform?t.transform[0]:1);var u={cursor:"pointer"};r&&(u.fill=r),i.stroke&&(u.stroke=i.stroke),l&&(u["stroke-width"]=l),dP(u,e,n,!0)}}(t,o,e),$I(s,t.id+"",o)}function CP(t,e){return t instanceof Sl?MP(t,e):t instanceof Pl?function(t,e){var n=t.style,i=n.image;if(i&&!wt(i)&&(pP(i)?i=i.src:gP(i)&&(i=i.toDataURL())),i){var r=n.x||0,o=n.y||0,a={href:i,width:n.width,height:n.height};return r&&(a.x=r),o&&(a.y=o),yP(a,t.transform),mP(a,n,t,e),vP(a,t),e.animation&&cP(t,a,e),$I("image",t.id+"",a)}}(t,e):t instanceof Ll?function(t,e){var n=t.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var r=n.font||R,o=n.x||0,a=function(t,e,n){return"top"===n?t+=e/2:"bottom"===n&&(t-=e/2),t}(n.y||0,vo(r),n.textBaseline),s={"dominant-baseline":"central","text-anchor":nr[n.textAlign]||n.textAlign};if(ql(n)){var l="",u=n.fontStyle,h=Zl(n.fontSize);if(!parseFloat(h))return;var c=n.fontFamily||N,d=n.fontWeight;l+="font-size:"+h+";font-family:"+c+";",u&&"normal"!==u&&(l+="font-style:"+u+";"),d&&"normal"!==d&&(l+="font-weight:"+d+";"),s.style=l}else s.style="font: "+r;return i.match(/\s/)&&(s["xml:space"]="preserve"),o&&(s.x=o),a&&(s.y=a),yP(s,t.transform),mP(s,n,t,e),vP(s,t),e.animation&&cP(t,s,e),$I("text",t.id+"",s,void 0,i)}}(t,e):void 0}function LP(t,e,n,i){var r,o=t[n],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(or(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!ar(o))return void 0;r="radialGradient",a.cx=Ot(o.x,.5),a.cy=Ot(o.y,.5),a.r=Ot(o.r,.5)}for(var s=o.colorStops,l=[],u=0,h=s.length;ul?UP(t,null==n[c+1]?null:n[c+1].elm,n,s,c):WP(t,e,a,l))}(n,i,r):FP(r)?(FP(t.text)&&kP(n,""),UP(n,null,r,0,r.length-1)):FP(i)?WP(n,i,0,i.length-1):FP(t.text)&&kP(n,""):t.text!==e.text&&(FP(i)&&WP(n,i,0,i.length-1),kP(n,e.text)))}var XP=0,qP=function(){function t(t,e,n){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=n=rt({},n),this.root=t,this._id="zr"+XP++,this._oldVNode=eP(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=JI("svg");jP(null,this._oldVNode),i.appendChild(r),t.appendChild(i)}this.resize(n.width,n.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(GP(t,e))ZP(t,e);else{var n=t.elm,i=NP(n);HP(e),null!==i&&(PP(i,e.elm,RP(n)),WP(i,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return CP(t,tP(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),n=this._width,i=this._height,r=tP(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress,r.emphasis=t.emphasis,r.ssr=this._opts.ssr;var o=[],a=this._bgVNode=function(t,e,n,i){var r;if(n&&"none"!==n)if(r=$I("rect","bg",{width:t,height:e,x:"0",y:"0"}),sr(n))LP({fill:n},r.attrs,"fill",i);else if(rr(n))AP({style:{fill:n},dirty:Kt,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",i);else{var o=Ji(n),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}(n,i,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=$I("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=dt(mt(r.defs),(function(t){return r.defs[t]}));if(l.length&&o.push($I("defs","defs",{},l)),t.animation){var u=function(t,e,n){var i=(n=n||{}).newline?"\n":"",r=" {"+i,o=i+"}",a=dt(mt(t),(function(e){return e+r+dt(mt(t[e]),(function(n){return n+":"+t[e][n]+";"})).join(i)+o})).join(i),s=dt(mt(e),(function(t){return"@keyframes "+t+r+dt(mt(e[t]),(function(n){return n+r+dt(mt(e[t][n]),(function(i){var r=e[t][n][i];return"d"===i&&(r='path("'+r+'")'),i+":"+r+";"})).join(i)+o})).join(i)+o})).join(i);return a||s?[""].join(i):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=$I("style","stl",{},[],u);o.push(h)}}return eP(n,i,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},QI(this.renderToVNode({animation:Ot(t.cssAnimation,!0),emphasis:Ot(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Ot(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,n){for(var i,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[p]!==r[p]);p--);for(var g=f-1;g>p;g--)i=a[--s-1];for(var m=p+1;m=a)}}for(var h=this.__startIndex;h15)break}n.prevElClipPaths&&c.restore()};if(f)if(0===f.length)s=l.__endIndex;else for(var x=d.dpr,w=0;w0&&t>i[0]){for(s=0;st);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?eE:0),this._needsManuallyCompositing),u.__builtin__||tt("ZLevel "+l+" has been used by unkown layer "+u.id),u!==o&&(u.__used=!0,u.__startIndex!==r&&(u.__dirty=!0),u.__startIndex=r,u.incremental?u.__drawIndex=-1:u.__drawIndex=r,e(r),o=u),s.__dirty&kn&&!s.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=r))}e(r),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,ct(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?nt(n[t],e,!0):n[t]=e;for(var i=0;i=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}};var vO,_O={supportWebGL:function(){if(null==vO)try{var t=document.createElement("canvas");if(!(t.getContext("webgl")||t.getContext("experimental-webgl")))throw new Error}catch(t){vO=!1}return vO}};_O.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,_O.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,_O.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,_O.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,_O.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,_O.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,_O.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var yO={};"undefined"!=typeof window?yO=window:void 0!==n.g&&(yO=n.g),_O.requestAnimationFrame=yO.requestAnimationFrame||yO.msRequestAnimationFrame||yO.mozRequestAnimationFrame||yO.webkitRequestAnimationFrame||function(t){setTimeout(t,16)},_O.createCanvas=function(){return document.createElement("canvas")},_O.createImage=function(){return new yO.Image},_O.request={get:mO.get},_O.addEventListener=function(t,e,n,i){t.addEventListener(e,n,i)},_O.removeEventListener=function(t,e,n){t.removeEventListener(e,n)};const xO=_O;var wO=function(){this.head=null,this.tail=null,this._length=0};wO.prototype.insert=function(t){var e=new wO.Entry(t);return this.insertEntry(e),e},wO.prototype.insertAt=function(t,e){if(!(t<0)){for(var n=this.head,i=0;n&&i!=t;)n=n.next,i++;if(n){var r=new wO.Entry(e),o=n.prev;o?(o.next=r,r.prev=o):this.head=r,r.next=n,n.prev=r}else this.insert(e)}},wO.prototype.insertBeforeEntry=function(t,e){var n=new wO.Entry(t),i=e.prev;i?(i.next=n,n.prev=i):this.head=n,n.next=e,e.prev=n,this._length++},wO.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++},wO.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._length--},wO.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e?(this.remove(e),e.value):void 0}},wO.prototype.getHead=function(){if(this.head)return this.head.value},wO.prototype.getTail=function(){if(this.tail)return this.tail.value},wO.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e.value}},wO.prototype.indexOf=function(t){for(var e=this.head,n=0;e;){if(e.value===t)return n;e=e.next,n++}},wO.prototype.length=function(){return this._length},wO.prototype.isEmpty=function(){return 0===this._length},wO.prototype.forEach=function(t,e){for(var n=this.head,i=0,r=void 0!==e;n;)r?t.call(e,n.value,i):t(n.value,i),n=n.next,i++},wO.prototype.clear=function(){this.tail=this.head=null,this._length=0},wO.Entry=function(t){this.value=t,this.next=null,this.prev=null};const bO=wO;var TO=function(t){this._list=new bO,this._map={},this._maxSize=t||10};TO.prototype.setMaxSize=function(t){this._maxSize=t},TO.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var n=this._list.length();if(n>=this._maxSize&&n>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var r=this._list.insert(e);r.key=t,this._map[t]=r}},TO.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value},TO.prototype.remove=function(t){var e=this._map[t];void 0!==e&&(delete this._map[t],this._list.remove(e))},TO.prototype.clear=function(){this._list.clear(),this._map={}};const SO=TO;var MO={},CO={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function LO(t){return(t=Math.round(t))<0?0:t>255?255:t}function AO(t){return t<0?0:t>1?1:t}function DO(t){return t.length&&"%"===t.charAt(t.length-1)?LO(parseFloat(t)/100*255):LO(parseInt(t,10))}function IO(t){return t.length&&"%"===t.charAt(t.length-1)?AO(parseFloat(t)/100):AO(parseFloat(t))}function PO(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function EO(t,e,n){return t+(e-t)*n}function OO(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function NO(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var RO=new SO(20),kO=null;function zO(t,e){kO&&NO(kO,e),kO=RO.put(t,kO||e.slice())}function BO(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=IO(t[1]),r=IO(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return OO(e=e||[],LO(255*PO(a,o,n+1/3)),LO(255*PO(a,o,n)),LO(255*PO(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}MO.parse=function(t,e){if(t){e=e||[];var n=RO.get(t);if(n)return NO(e,n);var i,r=(t+="").replace(/ /g,"").toLowerCase();if(r in CO)return NO(e,CO[r]),zO(t,e),e;if("#"===r.charAt(0))return 4===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=4095?(OO(e,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),zO(t,e),e):void OO(e,0,0,0,1):7===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=16777215?(OO(e,(16711680&i)>>16,(65280&i)>>8,255&i,1),zO(t,e),e):void OO(e,0,0,0,1):void 0;var o=r.indexOf("("),a=r.indexOf(")");if(-1!==o&&a+1===r.length){var s=r.substr(0,o),l=r.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return void OO(e,0,0,0,1);u=IO(l.pop());case"rgb":return 3!==l.length?void OO(e,0,0,0,1):(OO(e,DO(l[0]),DO(l[1]),DO(l[2]),u),zO(t,e),e);case"hsla":return 4!==l.length?void OO(e,0,0,0,1):(l[3]=IO(l[3]),BO(l,e),zO(t,e),e);case"hsl":return 3!==l.length?void OO(e,0,0,0,1):(BO(l,e),zO(t,e),e);default:return}}OO(e,0,0,0,1)}},MO.parseToFloat=function(t,e){if(e=MO.parse(t,e))return e[0]/=255,e[1]/=255,e[2]/=255,e},MO.lift=function(t,e){var n=MO.parse(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0;return MO.stringify(n,4===n.length?"rgba":"rgb")}},MO.toHex=function(t){var e=MO.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)},MO.fastLerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=LO(EO(a[0],s[0],l)),n[1]=LO(EO(a[1],s[1],l)),n[2]=LO(EO(a[2],s[2],l)),n[3]=AO(EO(a[3],s[3],l)),n}},MO.fastMapToColor=MO.fastLerp,MO.lerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=MO.parse(e[r]),s=MO.parse(e[o]),l=i-r,u=MO.stringify([LO(EO(a[0],s[0],l)),LO(EO(a[1],s[1],l)),LO(EO(a[2],s[2],l)),AO(EO(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}},MO.mapToColor=MO.lerp,MO.modifyHSL=function(t,e,n,i){if(t=MO.parse(t))return t=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(t),null!=e&&(t[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(t[1]=IO(n)),null!=i&&(t[2]=IO(i)),MO.stringify(BO(t),"rgba");var r},MO.modifyAlpha=function(t,e){if((t=MO.parse(t))&&null!=e)return t[3]=AO(e),MO.stringify(t,"rgba")},MO.stringify=function(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}};var FO=MO.parseToFloat,VO={};function GO(t){var e=Object.keys(t);e.sort();for(var n=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if("object"==typeof t)for(var n in t){var i=t[n];this.setUniform(n,i)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var n=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(t){var e=this.uniforms[t].type;return"t"===e||"tv"===e}),this);var r=this.vertexDefines,o=this.fragmentDefines;if(this.vertexDefines=gE.clone(t.vertexDefines),this.fragmentDefines=gE.clone(t.fragmentDefines),e){for(var a in n)i[a]&&(i[a].value=n[a].value);gE.defaults(this.vertexDefines,r),gE.defaults(this.fragmentDefines,o)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:!(!e||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=gE.clone(this.vertexDefines),t.fragmentDefines=gE.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,n){var i=this.vertexDefines,r=this.fragmentDefines;"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<3&&(n=e,e=t,t="both"),n=null!=n?n:null,"vertex"!==t&&"both"!==t||i[e]!==n&&(i[e]=n,this._programKey=""),"fragment"!==t&&"both"!==t||r[e]!==n&&(r[e]=n,"both"!==t&&(this._programKey=""))},undefine:function(t,e){"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<2&&(e=t,t="both"),"vertex"!==t&&"both"!==t||this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),"fragment"!==t&&"both"!==t||this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],"both"!==t&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return void 0!==this.vertexDefines[e];case"fragment":return void 0!==this.fragmentDefines[e]}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t))for(var e=0;e0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},XO.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},XO.cross=function(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t},XO.lerp=function(t,e,n,i){var r=e[0],o=e[1];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t},XO.random=function(t,e){e=e||1;var n=2*GLMAT_RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},XO.transformMat2=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t},XO.transformMat2d=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},XO.transformMat3=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t},XO.transformMat4=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t},XO.forEach=(UO=XO.create(),function(t,e,n,i,r,o){var a,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,a=n;a0&&i.push("#define "+r.toUpperCase()+"_COUNT "+o)}if(n)for(var a=0;al.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+aN(d)+"\n"}o&&(c+="\n#define INSTANCING\n");var f=c+aN(e.vertexDefines,s,h),p=c+aN(e.fragmentDefines,s,h),g=f+"\n"+e.shader.vertex,m=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(t){return null!=l.getGLExtension(t)}));m.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),m.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var v,_,y=function(t){for(var e=[],n=0;n=0){if(1!==s&&4!==s){bN();break}s=2,u=[]}else if(1!==s)if(4!==s)h(c),s=0;else{var d=c;gN.indexOf(d)>=0||mN.indexOf(d)>=0||vN.indexOf(d)>=0?l[a].semantic=d:"ignore"===d||"unconfigurable"===d?l[a].ignore=!0:l[a].value="bool"===t?"true"===d:parseFloat(d)}else l[a].value="bool"===t?"true"===c:parseFloat(c),u=null;else{if(2!==s){bN();break}if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else l[a].value=new xO.Float32Array(u),u=null,s=5;else if(2===s){if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else s=5;else s=4;else{if(0!==s&&3!==s){bN();break}s=1}}return l}function SN(t,e){"object"==typeof t&&(e=t.fragment,t=t.vertex),t=wN(t),e=wN(e),this._shaderID=function(t,e){var n="vertex:"+t+"fragment:"+e;if(yN[n])return yN[n];var i=gE.genGUID();return yN[n]=i,xN[i]={vertex:t,fragment:e},i}(t,e),this._vertexCode=SN.parseImport(t),this._fragmentCode=SN.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}SN.prototype={constructor:SN,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var n=this.uniformTemplates[e];t[e]={type:n.type,value:n.value()}}return t},_parseImport:function(){this._vertexCode=SN.parseImport(this.vertex),this._fragmentCode=SN.parseImport(this.fragment)},_addSemanticUniform:function(t,e,n){if(gN.indexOf(n)>=0)this.attributeSemantics[n]={symbol:t,type:e};else if(vN.indexOf(n)>=0){var i=!1,r=n;n.match(/TRANSPOSE$/)&&(i=!0,r=n.slice(0,-9)),this.matrixSemantics[n]={symbol:t,type:e,isTranspose:i,semanticNoTranspose:r}}else mN.indexOf(n)>=0&&(this.uniformSemantics[n]={symbol:t,type:e})},_addMaterialUniform:function(t,e,n,i,r,o){o[t]={type:n,value:r?pN.array:i||pN[e],semantic:null}},_parseUniforms:function(){var t={},e=this,n="vertex";function i(t){return null!=t?function(){return t}:null}function r(r,o,a){var s=TN(o,a),l=[];for(var u in s){var h=s[u],c=h.semantic,d=u,f=dN[o],p=i(s[u].value);s[u].isArray&&(d+="["+s[u].arraySize+"]",f+="v"),l.push(d),e._uniformList.push(u),h.ignore||("sampler2D"!==o&&"samplerCube"!==o||(e.textures[u]={shaderType:n,type:o}),c?e._addSemanticUniform(u,f,c):e._addMaterialUniform(u,o,f,p,s[u].isArray,t))}return l.length>0?"uniform "+o+" "+l.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(uN,r),n="fragment",this._fragmentCode=this._fragmentCode.replace(uN,r),e.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(hN,(function(n,i,r){var o=TN(i,r),a=_N[i]||1,s=[];for(var l in o){var u=o[l].semantic;if(t[l]={type:"float",size:a,semantic:u||null},u){if(gN.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');e.attributeSemantics[u]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=t},_parseDefines:function(){var t=this,e="vertex";function n(n,i,r){var o="vertex"===e?t.vertexDefines:t.fragmentDefines;return o[i]||(o[i]="false"!==r&&("true"===r||(r?isNaN(parseFloat(r))?r.trim():parseFloat(r):null))),""}this._vertexCode=this._vertexCode.replace(cN,n),e="fragment",this._fragmentCode=this._fragmentCode.replace(cN,n)},clone:function(){var t=xN[this._shaderID];return new SN(t.vertex,t.fragment)}},Object.defineProperty&&(Object.defineProperty(SN.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(SN.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(SN.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(SN.prototype,"uniforms",{get:function(){return this._uniformList}}));var MN=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;SN.parseImport=function(t){return t=t.replace(MN,(function(t,e,n){return(t=SN.source(n))?SN.parseImport(t):(console.error('Shader chunk "'+n+'" not existed in library'),"")}))};var CN=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;SN.import=function(t){t.replace(CN,(function(t,e,n,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var r,o=n.split("."),a=SN.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var DN={create:function(){var t=new jO(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var e=new jO(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=r,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},invert:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],_=n*s-i*a,y=n*l-r*a,x=n*u-o*a,w=i*l-r*s,b=i*u-o*s,T=r*u-o*l,S=h*g-c*p,M=h*m-d*p,C=h*v-f*p,L=c*m-d*g,A=c*v-f*g,D=d*v-f*m,I=_*D-y*A+x*L+w*C-b*M+T*S;return I?(I=1/I,t[0]=(s*D-l*A+u*L)*I,t[1]=(r*A-i*D-o*L)*I,t[2]=(g*T-m*b+v*w)*I,t[3]=(d*b-c*T-f*w)*I,t[4]=(l*C-a*D-u*M)*I,t[5]=(n*D-r*C+o*M)*I,t[6]=(m*x-p*T-v*y)*I,t[7]=(h*T-d*x+f*y)*I,t[8]=(a*A-s*C+u*S)*I,t[9]=(i*C-n*A-o*S)*I,t[10]=(p*b-g*x+v*_)*I,t[11]=(c*x-h*b-f*_)*I,t[12]=(s*M-a*L-l*S)*I,t[13]=(n*L-i*M+r*S)*I,t[14]=(g*y-p*w-m*_)*I,t[15]=(h*w-c*y+d*_)*I,t):null},adjoint:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-c*(l*v-u*m)+g*(l*f-u*d),t[1]=-(i*(d*v-f*m)-c*(r*v-o*m)+g*(r*f-o*d)),t[2]=i*(l*v-u*m)-s*(r*v-o*m)+g*(r*u-o*l),t[3]=-(i*(l*f-u*d)-s*(r*f-o*d)+c*(r*u-o*l)),t[4]=-(a*(d*v-f*m)-h*(l*v-u*m)+p*(l*f-u*d)),t[5]=n*(d*v-f*m)-h*(r*v-o*m)+p*(r*f-o*d),t[6]=-(n*(l*v-u*m)-a*(r*v-o*m)+p*(r*u-o*l)),t[7]=n*(l*f-u*d)-a*(r*f-o*d)+h*(r*u-o*l),t[8]=a*(c*v-f*g)-h*(s*v-u*g)+p*(s*f-u*c),t[9]=-(n*(c*v-f*g)-h*(i*v-o*g)+p*(i*f-o*c)),t[10]=n*(s*v-u*g)-a*(i*v-o*g)+p*(i*u-o*s),t[11]=-(n*(s*f-u*c)-a*(i*f-o*c)+h*(i*u-o*s)),t[12]=-(a*(c*m-d*g)-h*(s*m-l*g)+p*(s*d-l*c)),t[13]=n*(c*m-d*g)-h*(i*m-r*g)+p*(i*d-r*c),t[14]=-(n*(s*m-l*g)-a*(i*m-r*g)+p*(i*l-r*s)),t[15]=n*(s*d-l*c)-a*(i*d-r*c)+h*(i*l-r*s),t},determinant:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(c*m-d*g)-(e*s-i*o)*(h*m-d*p)+(e*l-r*o)*(h*g-c*p)+(n*s-i*a)*(u*m-d*f)-(n*l-r*a)*(u*g-c*f)+(i*l-r*s)*(u*p-h*f)},multiply:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],_=e[15],y=n[0],x=n[1],w=n[2],b=n[3];return t[0]=y*i+x*s+w*c+b*g,t[1]=y*r+x*l+w*d+b*m,t[2]=y*o+x*u+w*f+b*v,t[3]=y*a+x*h+w*p+b*_,y=n[4],x=n[5],w=n[6],b=n[7],t[4]=y*i+x*s+w*c+b*g,t[5]=y*r+x*l+w*d+b*m,t[6]=y*o+x*u+w*f+b*v,t[7]=y*a+x*h+w*p+b*_,y=n[8],x=n[9],w=n[10],b=n[11],t[8]=y*i+x*s+w*c+b*g,t[9]=y*r+x*l+w*d+b*m,t[10]=y*o+x*u+w*f+b*v,t[11]=y*a+x*h+w*p+b*_,y=n[12],x=n[13],w=n[14],b=n[15],t[12]=y*i+x*s+w*c+b*g,t[13]=y*r+x*l+w*d+b*m,t[14]=y*o+x*u+w*f+b*v,t[15]=y*a+x*h+w*p+b*_,t},multiplyAffine:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],h=e[9],c=e[10],d=e[12],f=e[13],p=e[14],g=n[0],m=n[1],v=n[2];return t[0]=g*i+m*a+v*u,t[1]=g*r+m*s+v*h,t[2]=g*o+m*l+v*c,g=n[4],m=n[5],v=n[6],t[4]=g*i+m*a+v*u,t[5]=g*r+m*s+v*h,t[6]=g*o+m*l+v*c,g=n[8],m=n[9],v=n[10],t[8]=g*i+m*a+v*u,t[9]=g*r+m*s+v*h,t[10]=g*o+m*l+v*c,g=n[12],m=n[13],v=n[14],t[12]=g*i+m*a+v*u+d,t[13]=g*r+m*s+v*h+f,t[14]=g*o+m*l+v*c+p,t}};DN.mul=DN.multiply,DN.mulAffine=DN.multiplyAffine,DN.translate=function(t,e,n){var i,r,o,a,s,l,u,h,c,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=i*g+s*m+c*v+e[12],t[13]=r*g+l*m+d*v+e[13],t[14]=o*g+u*m+f*v+e[14],t[15]=a*g+h*m+p*v+e[15]),t},DN.scale=function(t,e,n){var i=n[0],r=n[1],o=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},DN.rotate=function(t,e,n,i){var r,o,a,s,l,u,h,c,d,f,p,g,m,v,_,y,x,w,b,T,S,M,C,L,A=i[0],D=i[1],I=i[2],P=Math.sqrt(A*A+D*D+I*I);return Math.abs(P)0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},PN.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},PN.cross=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t},PN.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t},PN.random=function(t,e){e=e||1;var n=2*ZO()*Math.PI,i=2*ZO()-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t},PN.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,t},PN.transformMat3=function(t,e,n){var i=e[0],r=e[1],o=e[2];return t[0]=i*n[0]+r*n[3]+o*n[6],t[1]=i*n[1]+r*n[4]+o*n[7],t[2]=i*n[2]+r*n[5]+o*n[8],t},PN.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},PN.rotateX=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0],o[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),o[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateY=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),o[1]=r[1],o[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateZ=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),o[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),o[2]=r[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.forEach=function(){var t=PN.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=3),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s1?0:Math.acos(r)};const EN=PN;LN.import(AN);var ON=IN.create,NN={};function RN(t){return t.material}function kN(t,e,n){return e.uniforms[n].value}function zN(t,e,n,i){return n!==i}function BN(t){return!0}function FN(){}var VN={float:jE,byte:FE,ubyte:VE,short:GE,ushort:HE};function GN(t,e,n){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=n,this.vao=null}function HN(t){var e,n;this.bind=function(t){e||((e=xO.createCanvas()).width=e.height=1,e.getContext("2d"));var i=t.gl,r=!n;r&&(n=i.createTexture()),i.bindTexture(i.TEXTURE_2D,n),r&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e)},this.unbind=function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var UN=vE.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=xO.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new xE(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(t){throw"Error creating WebGL Context "+t}this._programMgr=new lN(this),this._placeholderTexture=new HN(this)}),{resize:function(t,e){var n=this.canvas,i=this.devicePixelRatio;null!=t?(n.style&&(n.style.width=t+"px",n.style.height=e+"px"),n.width=t*i,n.height=e*i,this._width=t,this._height=e):(this._width=n.width/i,this._height=n.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,n,i,r){if("object"==typeof t){var o=t;t=o.x,e=o.y,n=o.width,i=o.height,r=o.devicePixelRatio}r=r||this.devicePixelRatio,this.gl.viewport(t*r,e*r,n*r,i*r),this.viewport={x:t,y:e,width:n,height:i,devicePixelRatio:r}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,n,i){var r=this.gl,o=this.clearColor;if(this.clearBit){r.colorMask(!0,!0,!0,!0),r.depthMask(!0);var a=this.viewport,s=!1,l=a.devicePixelRatio;(a.width!==this._width||a.height!==this._height||l&&l!==this.devicePixelRatio||a.x||a.y)&&(s=!0,r.enable(r.SCISSOR_TEST),r.scissor(a.x*l,a.y*l,a.width*l,a.height*l)),r.clearColor(o[0],o[1],o[2],o[3]),r.clear(this.clearBit),s&&r.disable(r.SCISSOR_TEST)}if(n||t.update(!1),t.updateLights(),e=e||t.getMainCamera()){e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var h=u.opaque,c=u.transparent,d=t.material;t.trigger("beforerender",this,t,e,u),i?(this.renderPreZ(h,t,e),r.depthFunc(r.LEQUAL)):r.depthFunc(r.LESS);for(var f=ON(),p=EN.create(),g=0;g0){var s=t[r-1],l=s.joints?s.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===s.material&&o.lightGroup===s.lightGroup){o.__program=s.__program;continue}}var u=this._programMgr.getProgram(o,a,e);this.validateProgram(u),o.__program=u}},renderPass:function(t,e,n){this.trigger("beforerenderpass",this,t,e,n),(n=n||{}).getMaterial=n.getMaterial||RN,n.getUniform=n.getUniform||kN,n.isMaterialChanged=n.isMaterialChanged||zN,n.beforeRender=n.beforeRender||FN,n.afterRender=n.afterRender||FN;var i=n.ifRender||BN;this.updatePrograms(t,this._sceneRendering,n),n.sortCompare&&t.sort(n.sortCompare);var r=this.viewport,o=r.devicePixelRatio,a=[r.x*o,r.y*o,r.width*o,r.height*o],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[a[2],a[3]],h=Date.now();e?(IN.copy(WN.VIEW,e.viewMatrix.array),IN.copy(WN.PROJECTION,e.projectionMatrix.array),IN.copy(WN.VIEWINVERSE,e.worldTransform.array)):(IN.identity(WN.VIEW),IN.identity(WN.PROJECTION),IN.identity(WN.VIEWINVERSE)),IN.multiply(WN.VIEWPROJECTION,WN.PROJECTION,WN.VIEW),IN.invert(WN.PROJECTIONINVERSE,WN.PROJECTION),IN.invert(WN.VIEWPROJECTIONINVERSE,WN.VIEWPROJECTION);for(var c,d,f,p,g,m,v,_,y,x,w,b,T=this.gl,S=this._sceneRendering,M=null,C=0;Cthis.getMaxJointNumber()){var o=r.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,o,n),e.setUniform(i,"1i","skinMatricesTexture",n),e.setUniform(i,"1f","skinMatricesTextureSize",o.width)}else{var a=r.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(i,"SKIN_MATRIX",a)}},_renderObject:function(t,e,n){var i=this.gl,r=t.geometry,o=t.mode;null==o&&(o=4);var a=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(!s||(a=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(t,n,a)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint")&&r.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?a.drawElementsInstancedANGLE(o,e.indicesBuffer.count,u,0,t.getInstanceCount()):i.drawElements(o,e.indicesBuffer.count,u,0)}else s?a.drawArraysInstancedANGLE(o,0,r.vertexCount,t.getInstanceCount()):i.drawArrays(o,0,r.vertexCount);if(s)for(var h=0;hn?n:t}ZN.add=function(t,e,n){return EN.add(t.array,e.array,n.array),t._dirty=!0,t},ZN.set=function(t,e,n,i){EN.set(t.array,e,n,i),t._dirty=!0},ZN.copy=function(t,e){return EN.copy(t.array,e.array),t._dirty=!0,t},ZN.cross=function(t,e,n){return EN.cross(t.array,e.array,n.array),t._dirty=!0,t},ZN.distance=ZN.dist=function(t,e){return EN.distance(t.array,e.array)},ZN.div=function(t,e,n){return EN.divide(t.array,e.array,n.array),t._dirty=!0,t},ZN.divide=ZN.div,ZN.dot=function(t,e){return EN.dot(t.array,e.array)},ZN.len=function(t){return EN.length(t.array)},ZN.lerp=function(t,e,n,i){return EN.lerp(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.min=function(t,e,n){return EN.min(t.array,e.array,n.array),t._dirty=!0,t},ZN.max=function(t,e,n){return EN.max(t.array,e.array,n.array),t._dirty=!0,t},ZN.mul=function(t,e,n){return EN.multiply(t.array,e.array,n.array),t._dirty=!0,t},ZN.multiply=ZN.mul,ZN.negate=function(t,e){return EN.negate(t.array,e.array),t._dirty=!0,t},ZN.normalize=function(t,e){return EN.normalize(t.array,e.array),t._dirty=!0,t},ZN.random=function(t,e){return EN.random(t.array,e),t._dirty=!0,t},ZN.scale=function(t,e,n){return EN.scale(t.array,e.array,n),t._dirty=!0,t},ZN.scaleAndAdd=function(t,e,n,i){return EN.scaleAndAdd(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.squaredDistance=ZN.sqrDist=function(t,e){return EN.sqrDist(t.array,e.array)},ZN.squaredLength=ZN.sqrLen=function(t){return EN.sqrLen(t.array)},ZN.sub=function(t,e,n){return EN.subtract(t.array,e.array,n.array),t._dirty=!0,t},ZN.subtract=ZN.sub,ZN.transformMat3=function(t,e,n){return EN.transformMat3(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformMat4=function(t,e,n){return EN.transformMat4(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformQuat=function(t,e,n){return EN.transformQuat(t.array,e.array,n.array),t._dirty=!0,t};var KN=Math.atan2,JN=Math.asin,$N=Math.abs;ZN.eulerFromQuat=function(t,e,n){t._dirty=!0,e=e.array;var i=t.array,r=e[0],o=e[1],a=e[2],s=e[3],l=r*r,u=o*o,h=a*a,c=s*s;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":i[0]=KN(2*(r*s-o*a),c-l-u+h),i[1]=JN(YN(2*(r*a+o*s),-1,1)),i[2]=KN(2*(a*s-r*o),c+l-u-h);break;case"YXZ":i[0]=JN(YN(2*(r*s-o*a),-1,1)),i[1]=KN(2*(r*a+o*s),c-l-u+h),i[2]=KN(2*(r*o+a*s),c-l+u-h);break;case"ZXY":i[0]=JN(YN(2*(r*s+o*a),-1,1)),i[1]=KN(2*(o*s-a*r),c-l-u+h),i[2]=KN(2*(a*s-r*o),c-l+u-h);break;case"ZYX":i[0]=KN(2*(r*s+a*o),c-l-u+h),i[1]=JN(YN(2*(o*s-r*a),-1,1)),i[2]=KN(2*(r*o+a*s),c+l-u-h);break;case"YZX":i[0]=KN(2*(r*s-a*o),c-l+u-h),i[1]=KN(2*(o*s-r*a),c+l-u-h),i[2]=JN(YN(2*(r*o+a*s),-1,1));break;case"XZY":i[0]=KN(2*(r*s+o*a),c-l+u-h),i[1]=KN(2*(r*a+o*s),c+l-u-h),i[2]=JN(YN(2*(a*s-r*o),-1,1));break;default:console.warn("Unkown order: "+n)}return t},ZN.eulerFromMat3=function(t,e,n){var i=e.array,r=i[0],o=i[3],a=i[6],s=i[1],l=i[4],u=i[7],h=i[2],c=i[5],d=i[8],f=t.array;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":f[1]=JN(YN(a,-1,1)),$N(a)<.99999?(f[0]=KN(-u,d),f[2]=KN(-o,r)):(f[0]=KN(c,l),f[2]=0);break;case"YXZ":f[0]=JN(-YN(u,-1,1)),$N(u)<.99999?(f[1]=KN(a,d),f[2]=KN(s,l)):(f[1]=KN(-h,r),f[2]=0);break;case"ZXY":f[0]=JN(YN(c,-1,1)),$N(c)<.99999?(f[1]=KN(-h,d),f[2]=KN(-o,l)):(f[1]=0,f[2]=KN(s,r));break;case"ZYX":f[1]=JN(-YN(h,-1,1)),$N(h)<.99999?(f[0]=KN(c,d),f[2]=KN(s,r)):(f[0]=0,f[2]=KN(-o,l));break;case"YZX":f[2]=JN(YN(s,-1,1)),$N(s)<.99999?(f[0]=KN(-u,l),f[1]=KN(-h,r)):(f[0]=0,f[1]=KN(a,d));break;case"XZY":f[2]=JN(-YN(o,-1,1)),$N(o)<.99999?(f[0]=KN(c,l),f[1]=KN(a,r)):(f[0]=KN(-u,d),f[1]=0);break;default:console.warn("Unkown order: "+n)}return t._dirty=!0,t},Object.defineProperties(ZN,{POSITIVE_X:{get:function(){return new ZN(1,0,0)}},NEGATIVE_X:{get:function(){return new ZN(-1,0,0)}},POSITIVE_Y:{get:function(){return new ZN(0,1,0)}},NEGATIVE_Y:{get:function(){return new ZN(0,-1,0)}},POSITIVE_Z:{get:function(){return new ZN(0,0,1)}},NEGATIVE_Z:{get:function(){return new ZN(0,0,-1)}},UP:{get:function(){return new ZN(0,1,0)}},ZERO:{get:function(){return new ZN}}});const QN=ZN;var tR,eR,nR,iR,rR,oR=1e-5,aR=function(t,e){this.origin=t||new QN,this.direction=e||new QN};aR.prototype={constructor:aR,intersectPlane:function(t,e){var n=t.normal.array,i=t.distance,r=this.origin.array,o=this.direction.array,a=EN.dot(n,o);if(0===a)return null;e||(e=new QN);var s=(EN.dot(n,r)-i)/a;return EN.scaleAndAdd(e.array,r,o,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=EN.dot(t.normal.array,this.direction.array);EN.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,2*-e),this.direction._dirty=!0},distanceToPoint:(rR=EN.create(),function(t){EN.sub(rR,t,this.origin.array);var e=EN.dot(rR,this.direction.array);if(e<0)return EN.distance(this.origin.array,t);var n=EN.lenSquared(rR);return Math.sqrt(n-e*e)}),intersectSphere:function(){var t=EN.create();return function(e,n,i){var r=this.origin.array,o=this.direction.array;e=e.array,EN.sub(t,e,r);var a=EN.dot(t,o),s=EN.squaredLength(t)-a*a,l=n*n;if(!(s>l)){var u=Math.sqrt(l-s),h=a-u,c=a+u;return i||(i=new QN),h<0?c<0?null:(EN.scaleAndAdd(i.array,r,o,c),i):(EN.scaleAndAdd(i.array,r,o,h),i)}}}(),intersectBoundingBox:function(t,e){var n,i,r,o,a,s,l=this.direction.array,u=this.origin.array,h=t.min.array,c=t.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(n=(h[0]-u[0])*d,i=(c[0]-u[0])*d):(i=(h[0]-u[0])*d,n=(c[0]-u[0])*d),f>=0?(r=(h[1]-u[1])*f,o=(c[1]-u[1])*f):(o=(h[1]-u[1])*f,r=(c[1]-u[1])*f),n>o||r>i)return null;if((r>n||n!=n)&&(n=r),(o=0?(a=(h[2]-u[2])*p,s=(c[2]-u[2])*p):(s=(h[2]-u[2])*p,a=(c[2]-u[2])*p),n>s||a>i)return null;if((a>n||n!=n)&&(n=a),(s=0?n:i;return e||(e=new QN),EN.scaleAndAdd(e.array,u,l,g),e},intersectTriangle:(tR=EN.create(),eR=EN.create(),nR=EN.create(),iR=EN.create(),function(t,e,n,i,r,o){var a=this.direction.array,s=this.origin.array;t=t.array,e=e.array,n=n.array,EN.sub(tR,e,t),EN.sub(eR,n,t),EN.cross(iR,eR,a);var l=EN.dot(tR,iR);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l1)return null;EN.cross(iR,tR,nR);var h=EN.dot(a,iR)/l;if(h<0||h>1||u+h>1)return null;EN.cross(iR,tR,eR);var c=-EN.dot(nR,iR)/l;return c<0?null:(r||(r=new QN),o&&QN.set(o,1-u-h,u,h),EN.scaleAndAdd(r.array,s,a,c),r)}),applyTransform:function(t){QN.add(this.direction,this.direction,this.origin),QN.transformMat4(this.origin,this.origin,t),QN.transformMat4(this.direction,this.direction,t),QN.sub(this.direction,this.direction,this.origin),QN.normalize(this.direction,this.direction)},copy:function(t){QN.copy(this.origin,t.origin),QN.copy(this.direction,t.direction)},clone:function(){var t=new aR;return t.copy(this),t}};const sR=aR;var lR={create:function(){var t=new jO(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var e=new jO(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},fromValues:function(t,e,n,i){var r=new jO(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},set:function(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},subtract:function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}};lR.sub=lR.subtract,lR.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},lR.mul=lR.multiply,lR.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},lR.div=lR.divide,lR.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},lR.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},lR.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},lR.scaleAndAdd=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t},lR.distance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+o*o)},lR.dist=lR.distance,lR.squaredDistance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return n*n+i*i+r*r+o*o},lR.sqrDist=lR.squaredDistance,lR.length=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)},lR.len=lR.length,lR.squaredLength=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r},lR.sqrLen=lR.squaredLength,lR.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},lR.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},lR.normalize=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a),t},lR.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},lR.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t[3]=s+i*(n[3]-s),t},lR.random=function(t,e){return e=e||1,t[0]=ZO(),t[1]=ZO(),t[2]=ZO(),t[3]=ZO(),lR.normalize(t,t),lR.scale(t,t,e),t},lR.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t},lR.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},lR.forEach=function(){var t=lR.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=4),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(EN.cross(dR,e,n),t[0]=dR[0],t[1]=dR[1],t[2]=dR[2],t[3]=1+i,mR.normalize(t,t))}),mR.setAxes=(gR=cR.create(),function(t,e,n,i){return gR[0]=n[0],gR[3]=n[1],gR[6]=n[2],gR[1]=i[0],gR[4]=i[1],gR[7]=i[2],gR[2]=-e[0],gR[5]=-e[1],gR[8]=-e[2],mR.normalize(t,mR.fromMat3(t,gR))}),mR.clone=uR.clone,mR.fromValues=uR.fromValues,mR.copy=uR.copy,mR.set=uR.set,mR.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},mR.setAxisAngle=function(t,e,n){n*=.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t},mR.add=uR.add,mR.multiply=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=n[0],l=n[1],u=n[2],h=n[3];return t[0]=i*h+a*s+r*u-o*l,t[1]=r*h+a*l+o*s-i*u,t[2]=o*h+a*u+i*l-r*s,t[3]=a*h-i*s-r*l-o*u,t},mR.mul=mR.multiply,mR.scale=uR.scale,mR.rotateX=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t},mR.rotateY=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s,t},mR.rotateZ=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+r*s,t[1]=r*l-i*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},mR.calculateW=function(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t},mR.dot=uR.dot,mR.lerp=uR.lerp,mR.slerp=function(t,e,n,i){var r,o,a,s,l,u=e[0],h=e[1],c=e[2],d=e[3],f=n[0],p=n[1],g=n[2],m=n[3];return(o=u*f+h*p+c*g+d*m)<0&&(o=-o,f=-f,p=-p,g=-g,m=-m),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-i)*r)/a,l=Math.sin(i*r)/a):(s=1-i,l=i),t[0]=s*u+l*f,t[1]=s*h+l*p,t[2]=s*c+l*g,t[3]=s*d+l*m,t},mR.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-i*s,t[2]=-r*s,t[3]=o*s,t},mR.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},mR.length=uR.length,mR.len=mR.length,mR.squaredLength=uR.squaredLength,mR.sqrLen=mR.squaredLength,mR.normalize=uR.normalize,mR.fromMat3=function(t,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+r]+e[3*r+o])*n,t[a]=(e[3*a+r]+e[3*r+a])*n}return t};const vR=mR;var _R,yR,xR,wR,bR=function(){this._axisX=new QN,this._axisY=new QN,this._axisZ=new QN,this.array=IN.create(),this._dirty=!0};bR.prototype={constructor:bR,setArray:function(t){for(var e=0;e0){var e=this.min,n=this.max,i=e.array,r=n.array;zR(i,t[0]),zR(r,t[0]);for(var o=1;or[0]&&(r[0]=a[0]),a[1]>r[1]&&(r[1]=a[1]),a[2]>r[2]&&(r[2]=a[2])}e._dirty=!0,n._dirty=!0}},union:function(t){var e=this.min,n=this.max;return EN.min(e.array,e.array,t.min.array),EN.max(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersection:function(t){var e=this.min,n=this.max;return EN.max(e.array,e.array,t.min.array),EN.min(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,n=this.max.array,i=t.min.array,r=t.max.array;return!(e[0]>r[0]||e[1]>r[1]||e[2]>r[2]||n[0]=r[0]&&n[1]>=r[1]&&n[2]>=r[2]},containPoint:function(t){var e=this.min.array,n=this.max.array,i=t.array;return e[0]<=i[0]&&e[1]<=i[1]&&e[2]<=i[2]&&n[0]>=i[0]&&n[1]>=i[1]&&n[2]>=i[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:(IR=EN.create(),PR=EN.create(),ER=EN.create(),OR=EN.create(),NR=EN.create(),RR=EN.create(),function(t,e){var n=t.min.array,i=t.max.array,r=e.array;return IR[0]=r[0]*n[0],IR[1]=r[1]*n[0],IR[2]=r[2]*n[0],PR[0]=r[0]*i[0],PR[1]=r[1]*i[0],PR[2]=r[2]*i[0],ER[0]=r[4]*n[1],ER[1]=r[5]*n[1],ER[2]=r[6]*n[1],OR[0]=r[4]*i[1],OR[1]=r[5]*i[1],OR[2]=r[6]*i[1],NR[0]=r[8]*n[2],NR[1]=r[9]*n[2],NR[2]=r[10]*n[2],RR[0]=r[8]*i[2],RR[1]=r[9]*i[2],RR[2]=r[10]*i[2],n=this.min.array,i=this.max.array,n[0]=Math.min(IR[0],PR[0])+Math.min(ER[0],OR[0])+Math.min(NR[0],RR[0])+r[12],n[1]=Math.min(IR[1],PR[1])+Math.min(ER[1],OR[1])+Math.min(NR[1],RR[1])+r[13],n[2]=Math.min(IR[2],PR[2])+Math.min(ER[2],OR[2])+Math.min(NR[2],RR[2])+r[14],i[0]=Math.max(IR[0],PR[0])+Math.max(ER[0],OR[0])+Math.max(NR[0],RR[0])+r[12],i[1]=Math.max(IR[1],PR[1])+Math.max(ER[1],OR[1])+Math.max(NR[1],RR[1])+r[13],i[2]=Math.max(IR[2],PR[2])+Math.max(ER[2],OR[2])+Math.max(NR[2],RR[2])+r[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(t){var e=this.min.array,n=this.max.array,i=t.array,r=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=e[2],h=n[0],c=n[1],d=n[2];if(1===i[15])e[0]=i[0]*r+i[12],e[1]=i[5]*o+i[13],n[2]=i[10]*a+i[14],n[0]=i[0]*h+i[12],n[1]=i[5]*c+i[13],e[2]=i[10]*d+i[14];else{var f=-1/a;e[0]=i[0]*r*f,e[1]=i[5]*o*f,n[2]=(i[10]*a+i[14])*f,f=-1/u,n[0]=i[0]*s*f,n[1]=i[5]*l*f,f=-1/d,e[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=EN.fromValues(0,0,0);this.vertices=t}var n=this.min.array,i=this.max.array;return kR(t[0],n[0],n[1],n[2]),kR(t[1],n[0],i[1],n[2]),kR(t[2],i[0],n[1],n[2]),kR(t[3],i[0],i[1],n[2]),kR(t[4],n[0],n[1],i[2]),kR(t[5],n[0],i[1],i[2]),kR(t[6],i[0],n[1],i[2]),kR(t[7],i[0],i[1],i[2]),this},copy:function(t){var e=this.min,n=this.max;return zR(e.array,t.min.array),zR(n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},clone:function(){var t=new BR;return t.copy(this),t}};const FR=BR;var VR,GR=0,HR=vE.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+GR++),this.position||(this.position=new QN),this.rotation||(this.rotation=new DR),this.scale||(this.scale=new QN(1,1,1)),this.worldTransform=new MR,this.localTransform=new MR,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var n=e._nodeRepository;delete n[this.name],n[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var n=this._scene;n&&n!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,n=e.indexOf(t);n<0||(e.splice(n,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=UR.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:(WR=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var t=UR.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var e=0;e=0&&w[y]>1e-4&&(EN.transformMat4(S,x,v[b[y]]),EN.scaleAndAdd(T,T,S,w[y]));M.set(_,T)}}for(_=0;_>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var n=e.get("webgl_texture");n&&t.gl.deleteTexture(n),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty($R.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty($R.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),$R.BYTE=FE,$R.UNSIGNED_BYTE=VE,$R.SHORT=GE,$R.UNSIGNED_SHORT=HE,$R.INT=UE,$R.UNSIGNED_INT=WE,$R.FLOAT=jE,$R.HALF_FLOAT=36193,$R.UNSIGNED_INT_24_8_WEBGL=34042,$R.DEPTH_COMPONENT=ZE,$R.DEPTH_STENCIL=cO,$R.ALPHA=XE,$R.RGB=qE,$R.RGBA=YE,$R.LUMINANCE=KE,$R.LUMINANCE_ALPHA=JE,$R.SRGB=35904,$R.SRGB_ALPHA=35906,$R.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,$R.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,$R.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,$R.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,$R.NEAREST=$E,$R.LINEAR=QE,$R.NEAREST_MIPMAP_NEAREST=tO,$R.LINEAR_MIPMAP_NEAREST=eO,$R.NEAREST_MIPMAP_LINEAR=nO,$R.LINEAR_MIPMAP_LINEAR=iO,$R.REPEAT=aO,$R.CLAMP_TO_EDGE=sO,$R.MIRRORED_REPEAT=lO;const QR=$R;var tk=ZR.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=ZR.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});tk.POINTS=SE,tk.LINES=ME,tk.LINE_LOOP=CE,tk.LINE_STRIP=LE,tk.TRIANGLES=AE,tk.TRIANGLE_STRIP=DE,tk.TRIANGLE_FAN=IE,tk.BACK=RE,tk.FRONT=NE,tk.FRONT_AND_BACK=kE,tk.CW=zE,tk.CCW=BE;const ek=tk;var nk={isPowerOfTwo:function(t){return!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}};const ik=nk;var rk=ik.isPowerOfTwo;function ok(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}var ak=QR.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type,r=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==QR.REPEAT&&this.wrapT!==QR.REPEAT||!this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,r?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,r?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r?this.minFilter:this.getAvailableMinFilter());var o=t.getGLExtension("EXT_texture_filter_anisotropic");(o&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var a=this.width,s=this.height,l=0;l=QR.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,n,o,i,r,0,e.pixels):t.texImage2D(t.TEXTURE_2D,n,o,i,r,0,o,a,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return rk(this.width)&&rk(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var n=xO.createImage();e&&(n.crossOrigin=e);var i=this;return n.onload=function(){i.dirty(),i.trigger("success",i)},n.onerror=function(){i.trigger("error",i)},n.src=t,this.image=n,this}});Object.defineProperty(ak.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(ak.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const sk=ak;function lk(t){return{byte:xO.Int8Array,ubyte:xO.Uint8Array,short:xO.Int16Array,ushort:xO.Uint16Array}[t]||xO.Float32Array}function uk(t){return"attr_"+t}function hk(t,e,n,i){switch(this.name=t,this.type=e,this.size=n,this.semantic=i||"",this.value=null,n){case 1:this.get=function(t){return this.value[t]},this.set=function(t,e){this.value[t]=e},this.copy=function(t,e){this.value[t]=this.value[t]};break;case 2:this.get=function(t,e){var n=this.value;return e[0]=n[2*t],e[1]=n[2*t+1],e},this.set=function(t,e){var n=this.value;n[2*t]=e[0],n[2*t+1]=e[1]},this.copy=function(t,e){var n=this.value;e*=2,n[t*=2]=n[e],n[t+1]=n[e+1]};break;case 3:this.get=function(t,e){var n=3*t,i=this.value;return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e},this.set=function(t,e){var n=3*t,i=this.value;i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2]},this.copy=function(t,e){var n=this.value;e*=3,n[t*=3]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2]};break;case 4:this.get=function(t,e){var n=this.value,i=4*t;return e[0]=n[i],e[1]=n[i+1],e[2]=n[i+2],e[3]=n[i+3],e},this.set=function(t,e){var n=this.value,i=4*t;n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3]},this.copy=function(t,e){var n=this.value;e*=4,n[t*=4]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2],n[t+3]=n[e+3]}}}function ck(t,e,n,i,r){this.name=t,this.type=e,this.buffer=n,this.size=i,this.semantic=r,this.symbol="",this.needsRemove=!1}function dk(t){this.buffer=t,this.count=0}hk.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=lk(this.type);this.value=new e(t*this.size)}},hk.prototype.fromArray=function(t){var e,n=lk(this.type);if(t[0]&&t[0].length){var i=0,r=this.size;e=new n(t.length*r);for(var o=0;o=0){e||(e=[]);var n=this.indices;return e[0]=n[3*t],e[1]=n[3*t+1],e[2]=n[3*t+2],e}},setTriangleIndices:function(t,e){var n=this.indices;n[3*t]=e[0],n[3*t+1]=e[1],n[3*t+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,n=this.vertexCount>65535?xO.Uint32Array:xO.Uint16Array;if(t[0]&&t[0].length){var i=0;e=new n(3*t.length);for(var r=0;r=0&&(e.splice(n,1),delete this.attributes[t],!0)},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var n=[],i=this.vertexCount,r=0;ro[0]&&(o[0]=s),l>o[1]&&(o[1]=l),u>o[2]&&(o[2]=u)}n._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,n=e.position.value,i=e.normal.value;if(i&&i.length===n.length)for(var r=0;r65535&&(this.indices=new xO.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,n=this.getEnabledAttributes(),i={},r=0;rthis.distance,r=1;r<8;r++)if(EN.dot(e[r].array,n)>this.distance!=i)return!0},intersectLine:(Ek=EN.create(),function(t,e,n){var i=this.distanceToPoint(t),r=this.distanceToPoint(e);if(i>0&&r>0||i<0&&r<0)return null;var o=this.normal.array,a=this.distance,s=t.array;EN.sub(Ek,e.array,t.array),EN.normalize(Ek,Ek);var l=EN.dot(o,Ek);if(0===l)return null;n||(n=new QN);var u=(EN.dot(o,s)-a)/l;return EN.scaleAndAdd(n.array,s,Ek,-u),n._dirty=!0,n}),applyTransform:(Dk=IN.create(),Ik=uR.create(),Pk=uR.create(),Pk[3]=1,function(t){t=t.array,EN.scale(Pk,this.normal.array,this.distance),uR.transformMat4(Pk,Pk,t),this.distance=EN.dot(Pk,this.normal.array),IN.invert(Dk,t),IN.transpose(Dk,Dk),Ik[3]=0,EN.copy(Ik,this.normal.array),uR.transformMat4(Ik,Ik,Dk),EN.copy(this.normal.array,Ik)}),copy:function(t){EN.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new Ok;return t.copy(this),t}};const Nk=Ok;var Rk,kk=EN.set,zk=EN.copy,Bk=EN.transformMat4,Fk=Math.min,Vk=Math.max,Gk=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new Nk);this.boundingBox=new FR,this.vertices=[];for(t=0;t<8;t++)this.vertices[t]=EN.fromValues(0,0,0)};Gk.prototype={setFromProjection:function(t){var e=this.planes,n=t.array,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],f=n[10],p=n[11],g=n[12],m=n[13],v=n[14],_=n[15];kk(e[0].normal.array,a-i,h-s,p-c),e[0].distance=-(_-g),e[0].normalize(),kk(e[1].normal.array,a+i,h+s,p+c),e[1].distance=-(_+g),e[1].normalize(),kk(e[2].normal.array,a+r,h+l,p+d),e[2].distance=-(_+m),e[2].normalize(),kk(e[3].normal.array,a-r,h-l,p-d),e[3].distance=-(_-m),e[3].normalize(),kk(e[4].normal.array,a-o,h-u,p-f),e[4].distance=-(_-v),e[4].normalize(),kk(e[5].normal.array,a+o,h+u,p+f),e[5].distance=-(_+v),e[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===_){var w=l/i,b=-v/(f-1),T=-v/(f+1),S=-T/l,M=-b/l;y.min.set(-S*w,-S,T),y.max.set(S*w,S,b),kk(x[0],-S*w,-S,T),kk(x[1],-S*w,S,T),kk(x[2],S*w,-S,T),kk(x[3],S*w,S,T),kk(x[4],-M*w,-M,b),kk(x[5],-M*w,M,b),kk(x[6],M*w,-M,b),kk(x[7],M*w,M,b)}else{var C=(-1-g)/i,L=(1-g)/i,A=(1-m)/l,D=(-1-m)/l,I=(-1-v)/f,P=(1-v)/f;y.min.set(Math.min(C,L),Math.min(D,A),Math.min(P,I)),y.max.set(Math.max(L,C),Math.max(A,D),Math.max(I,P));var E=y.min.array,O=y.max.array;kk(x[0],E[0],E[1],E[2]),kk(x[1],E[0],O[1],E[2]),kk(x[2],O[0],E[1],E[2]),kk(x[3],O[0],O[1],E[2]),kk(x[4],E[0],E[1],O[2]),kk(x[5],E[0],O[1],O[2]),kk(x[6],O[0],E[1],O[2]),kk(x[7],O[0],O[1],O[2])}},getTransformedBoundingBox:(Rk=EN.create(),function(t,e){var n=this.vertices,i=e.array,r=t.min,o=t.max,a=r.array,s=o.array,l=n[0];Bk(Rk,l,i),zk(a,Rk),zk(s,Rk);for(var u=1;u<8;u++)l=n[u],Bk(Rk,l,i),a[0]=Fk(Rk[0],a[0]),a[1]=Fk(Rk[1],a[1]),a[2]=Fk(Rk[2],a[2]),s[0]=Vk(Rk[0],s[0]),s[1]=Vk(Rk[1],s[1]),s[2]=Vk(Rk[2],s[2]);return r._dirty=!0,o._dirty=!0,t})};const Hk=Gk;var Uk,Wk=UR.extend((function(){return{projectionMatrix:new MR,invProjectionMatrix:new MR,viewMatrix:new MR,frustum:new Hk}}),(function(){this.update(!0)}),{update:function(t){UR.prototype.update.call(this,t),MR.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),MR.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){MR.copy(this.viewMatrix,t),MR.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){MR.copy(this.projectionMatrix,t),MR.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(Uk=uR.create(),function(t,e){var n=void 0!==e?e:new sR,i=t.array[0],r=t.array[1];return uR.set(Uk,i,r,-1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(n.origin.array,Uk,1/Uk[3]),uR.set(Uk,i,r,1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(Uk,Uk,1/Uk[3]),EN.sub(n.direction.array,Uk,n.origin.array),EN.normalize(n.direction.array,n.direction.array),n.direction._dirty=!0,n.origin._dirty=!0,n})});const jk=Wk;var Zk=IN.create(),Xk=IN.create(),qk={};function Yk(t){var e=[],n=Object.keys(t);n.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof Ak&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof jk?(e=this._cameraList.indexOf(t))>=0&&this._cameraList.splice(e,1):t instanceof Ak&&(e=this.lights.indexOf(t))>=0&&this.lights.splice(e,1),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},n=0;n0&&this._doUpdateRenderList(a,e,n,i,r)}},isFrustumCulled:(Jk=new FR,$k=new MR,function(t,e,n){var i=t.boundingBox;if(i||(i=t.skeleton&&t.skeleton.boundingBox?t.skeleton.boundingBox:t.geometry.boundingBox),!i)return!1;if($k.array=n,Jk.transformFrom(i,$k),t.castShadow&&this.viewBoundingBoxLastFrame.union(Jk),t.frustumCulling){if(!Jk.intersectBoundingBox(e.frustum.boundingBox))return!0;$k.array=e.projectionMatrix.array,Jk.max.array[2]>0&&Jk.min.array[2]<0&&(Jk.max.array[2]=-1e-20),Jk.applyProjection($k);var r=Jk.min.array,o=Jk.max.array;if(o[0]<-1||r[0]>1||o[1]<-1||r[1]>1||o[2]<-1||r[2]>1)return!0}return!1}),_updateLightUniforms:function(){var t=this.lights;t.sort(tz);var e=this._lightUniforms;for(var n in e)for(var i in e[n])e[n][i].value.length=0;for(var r=0;r=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new nz(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const oz=rz;var az=ik.isPowerOfTwo,sz=["px","nx","py","ny","pz","nz"],lz=QR.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type;e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var r=t.getGLExtension("EXT_texture_filter_anisotropic");(r&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var o=this.width,a=this.height,s=0;s0&&t.height>0}Object.defineProperty(lz.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(lz.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const hz=lz;var cz=jk.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=2*Math.atan(1/t[5]);this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=jk.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}});const dz=cz;var fz="framebuffer",pz="renderbuffer",gz=pz+"_width",mz=pz+"_height",vz=pz+"_attached",_z="depthtexture_attached",yz=uO,xz=hO,wz=fO,bz=dO,Tz=vE.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new JR,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(yz,this._getFrameBufferGL(t)),this._boundRenderer=t;var n=this._cache;n.put("viewport",t.viewport);var i,r,o=!1;for(var a in this._textures){o=!0;var s=this._textures[a];s&&(i=s.texture.width,r=s.texture.height,this._doAttach(t,s.texture,a,s.target))}this._width=i,this._height=r,!o&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,i,r,1);var l=n.get("attached_textures");if(l)for(var a in l)if(!this._textures[a]){var u=l[a];this._doDetach(e,a,u)}if(!n.get(_z)&&this.depthBuffer){n.miss(pz)&&n.put(pz,e.createRenderbuffer());var h=n.get(pz);i===n.get(gz)&&r===n.get(mz)||(e.bindRenderbuffer(xz,h),e.renderbufferStorage(xz,e.DEPTH_COMPONENT16,i,r),n.put(gz,i),n.put(mz,r),e.bindRenderbuffer(xz,null)),n.get(vz)||(e.framebufferRenderbuffer(yz,wz,xz,h),n.put(vz,!0))}},unbind:function(t){t.__currentFrameBuffer=null,t.gl.bindFramebuffer(yz,null),this._boundRenderer=null,this._cache.use(t.__uid__);var e=this._cache.get("viewport");e&&t.setViewport(e),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var n in this._textures){var i=this._textures[n];if(i){var r=i.texture;if(!r.NPOT&&r.useMipmap&&r.minFilter===QR.LINEAR_MIPMAP_LINEAR){var o="textureCube"===r.textureType?oO:rO;e.bindTexture(o,r.getWebGLTexture(t)),e.generateMipmap(o),e.bindTexture(o,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(yz)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(fz)&&e.put(fz,t.gl.createFramebuffer()),e.get(fz)},attach:function(t,e,n){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||bz,n=n||rO;var i,r=this._boundRenderer;if(r&&r.gl){var o=this._cache;o.use(r.__uid__),i=o.get("attached_textures")}var a=this._textures[e];if(!a||a.target!==n||a.texture!==t||!i||null==i[e]){var s=!0;r&&(s=this._doAttach(r,t,e,n),this.viewport||r.setViewport(0,0,t.width,t.height,1)),s&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=n)}},_doAttach:function(t,e,n,i){var r=t.gl,o=e.getWebGLTexture(t),a=this._cache.get("attached_textures");if(a&&a[n]){var s=a[n];if(s.texture===e&&s.target===i)return}var l=!0;if(((n=+n)===wz||n===gO)&&(t.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==ZE&&e.format!==cO&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var u=this._cache.get(pz);u&&(r.framebufferRenderbuffer(yz,wz,xz,null),r.deleteRenderbuffer(u),this._cache.put(pz,!1)),this._cache.put(vz,!1),this._cache.put(_z,!0)}return r.framebufferTexture2D(yz,n,i,o,0),a||(a={},this._cache.put("attached_textures",a)),a[n]=a[n]||{},a[n].texture=e,a[n].target=i,l},_doDetach:function(t,e,n){t.framebufferTexture2D(yz,e,n,null,0);var i=this._cache.get("attached_textures");i&&i[e]&&(i[e]=null),e!==wz&&e!==gO||this._cache.put(_z,!1)},detach:function(t,e){(this._textures[t]=null,this._boundRenderer)&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e))},dispose:function(t){var e=t.gl,n=this._cache;n.use(t.__uid__);var i=n.get(pz);i&&e.deleteRenderbuffer(i);var r=n.get(fz);r&&e.deleteFramebuffer(r),n.deleteContext(t.__uid__),this._textures={}}});Tz.DEPTH_ATTACHMENT=wz,Tz.COLOR_ATTACHMENT0=bz,Tz.STENCIL_ATTACHMENT=pO,Tz.DEPTH_STENCIL_ATTACHMENT=gO;const Sz=Tz;var Mz=["px","nx","py","ny","pz","nz"],Cz=vE.extend((function(){var t={position:new QN,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new dz({fov:90}),nx:new dz({fov:90}),py:new dz({fov:90}),ny:new dz({fov:90}),pz:new dz({fov:90}),nz:new dz({fov:90})};return e.px.lookAt(QN.POSITIVE_X,QN.NEGATIVE_Y),e.nx.lookAt(QN.NEGATIVE_X,QN.NEGATIVE_Y),e.py.lookAt(QN.POSITIVE_Y,QN.POSITIVE_Z),e.ny.lookAt(QN.NEGATIVE_Y,QN.NEGATIVE_Z),e.pz.lookAt(QN.POSITIVE_Z,QN.NEGATIVE_Y),e.nz.lookAt(QN.NEGATIVE_Z,QN.NEGATIVE_Y),t._frameBuffer=new Sz,t}),{getCamera:function(t){return this._cameras[t]},render:function(t,e,n){var i=t.gl;n||e.update();for(var r=this.texture.width,o=2*Math.atan(r/(r-.5))/Math.PI*180,a=0;a<6;a++){var s=Mz[a],l=this._cameras[s];if(QN.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}});const Lz=Cz;var Az=xk.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var t=this.heightSegments,e=this.widthSegments,n=this.attributes,i=[],r=[],o=[],a=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var h=u/e;if(i.push([2*h-1,2*l-1,0]),r&&r.push([h,l]),o&&o.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],n)}});const Rz=Nz,kz=Rz;function zz(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var Bz=zz("DXT1"),Fz=zz("DXT3"),Vz=zz("DXT5"),Gz={parse:function(t,e){var n=new Int32Array(t,0,31);if(542327876!==n[0])return null;if(4&!n(20))return null;var i,r,o=n(21),a=n[4],s=n[3],l=512&n[28],u=131072&n[2];switch(o){case Bz:i=8,r=QR.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Fz:i=16,r=QR.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Vz:i=16,r=QR.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var h=n[1]+4,c=l?6:1,d=1;u&&(d=Math.max(1,n[7]));for(var f=[],p=0;p0){var r=Math.pow(2,t[3]-128-8+i);e[n+0]=t[0]*r,e[n+1]=t[1]*r,e[n+2]=t[2]*r}else e[n+0]=0,e[n+1]=0,e[n+2]=0;return e[n+3]=1,e}function jz(t,e,n,i){for(var r,o,a=0,s=0,l=i;l>0;)if(t[s][0]=e[n++],t[s][1]=e[n++],t[s][2]=e[n++],t[s][3]=e[n++],1===t[s][0]&&1===t[s][1]&&1===t[s][2]){for(var u=t[s][3]<>>0;u>0;u--)r=t[s-1],(o=t[s])[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],s++,l--;a+=8}else s++,l--,a=0;return n}function Zz(t,e,n,i){if(i<8|i>32767)return jz(t,e,n,i);if(2!=(r=e[n++]))return jz(t,e,n-1,i);if(t[0][1]=e[n++],t[0][2]=e[n++],r=e[n++],(t[0][2]<<8>>>0|r)>>>0!==i)return null;for(var r=0;r<4;r++)for(var o=0;o128){a=(127&a)>>>0;for(var s=e[n++];a--;)t[o++][r]=s}else for(;a--;)t[o++][r]=e[n++]}return n}var Xz={parseRGBE:function(t,e,n){null==n&&(n=0);var i=new Uint8Array(t),r=i.length;if("#?"===function(t,e,n){for(var i="",r=e;r=r)){o+=2;for(var a="";o20)return console.warn("Given image is not a height map"),t}var d,f,p,g;l%(4*i)==0?(d=a.data[l],p=a.data[l+4]):l%(4*i)==4*(i-1)?(d=a.data[l-4],p=a.data[l]):(d=a.data[l-4],p=a.data[l+4]),l<4*i?(f=a.data[l],g=a.data[l+4*i]):l>i*(r-1)*4?(f=a.data[l-4*i],g=a.data[l]):(f=a.data[l-4*i],g=a.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-g+127,s.data[l+2]=255,s.data[l+3]=255}return o.putImageData(s,0,0),n},isHeightImage:function(t,e,n){if(!t||!t.width||!t.height)return!1;var i=document.createElement("canvas"),r=i.getContext("2d"),o=e||32;n=n||20,i.width=i.height=o,r.drawImage(t,0,0,o,o);for(var a=r.getImageData(0,0,o,o),s=0;sn)return!1}return!0},_fetchTexture:function(t,e,n){xO.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:n})},createChessboard:function(t,e,n,i){t=t||512,e=e||64,n=n||"black",i=i||"white";var r=Math.ceil(t/e),o=document.createElement("canvas");o.width=t,o.height=t;var a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,t,t),a.fillStyle=n;for(var s=0;s=0||(Jz.forEach((function(e){t.on(e,this[$z(e)],this)}),this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),Jz.forEach((function(e){t.off(e,this[$z(e)])}),this)},dispose:function(){this._meshes.forEach((function(t){this.detachFromMesh(t)}),this)}};const tB=Qz;var eB=jk.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=jk.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});const nB=eB;LN.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var iB=new Dz,rB=new ek({geometry:iB,frustumCulling:!1}),oB=new nB;const aB=vE.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var t=new LN(LN.source("clay.compositor.vertex"),this.fragment),e=new HO({shader:t});e.enableTexturesAll(),this.material=e}),{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||dO,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var n in this.outputs){var i=this.outputs[n];i&&e.attach(i,n)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var n=t.gl;if(e){this.bind(t,e);var i=t.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var r=[];for(var o in this.outputs)(o=+o)>=n.COLOR_ATTACHMENT0&&o<=n.COLOR_ATTACHMENT0+8&&r.push(o);i.drawBuffersEXT(r)}}this.trigger("beforerender",this,t);var a=this.clearDepth?n.DEPTH_BUFFER_BIT:0;if(n.depthMask(!0),this.clearColor){a|=n.COLOR_BUFFER_BIT,n.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&n.clearColor(s[0],s[1],s[2],s[3])}n.clear(a),this.blendWithPrevious?(n.enable(n.BLEND),this.material.transparent=!0):(n.disable(n.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){rB.material=this.material,t.renderPass([rB],oB)},dispose:function(t){}});var sB={},lB=["px","nx","py","ny","pz","nz"];sB.prefilterEnvironmentMap=function(t,e,n,i,r){r&&i||(i=sB.generateNormalDistribution(),r=sB.integrateBRDF(t,i));var o=(n=n||{}).width||64,a=n.height||64,s=n.type||e.type,l=new hz({width:o,height:a,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(o,a),h=Math.log(u)/Math.log(2)+1,c=new HO({shader:new LN({vertex:LN.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),n.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),n.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new ez;if("texture2D"===e.textureType){var p=new hz({width:o,height:a,type:s===QR.FLOAT?QR.HALF_FLOAT:s});Kz.panoramaToCubeMap(t,e,p,{encodeRGBM:n.decodeRGBM}),e=p}(d=new Rz({scene:f,material:c})).material.set("environmentMap",e);var g=new Lz({texture:l});n.encodeRGBM&&(s=l.type=QR.UNSIGNED_BYTE);for(var m=new sk({width:o,height:a,type:s}),v=new Sz({depthBuffer:!1}),_=xO[s===QR.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),r=new sk({width:512,height:256,type:QR.HALF_FLOAT,wrapS:QR.CLAMP_TO_EDGE,wrapT:QR.CLAMP_TO_EDGE,minFilter:QR.NEAREST,magFilter:QR.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",e),i.setUniform("viewportSize",[512,256]),i.attachOutput(r),i.render(t,n),n.dispose(t),r},sB.generateNormalDistribution=function(t,e){for(var n=new sk({width:t=t||256,height:e=e||1024,type:QR.FLOAT,minFilter:QR.NEAREST,magFilter:QR.NEAREST,wrapS:QR.CLAMP_TO_EDGE,wrapT:QR.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(e*t*4),r=[],o=0;o>>16)>>>0;u=(((16711935&(u=((252645135&(u=((858993459&(u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0))<<2|(3435973836&u)>>>2)>>>0))<<4|(4042322160&u)>>>4)>>>0))<<8|(4278255360&u)>>>8)>>>0)/4294967296;var h=Math.sqrt((1-u)/(1+(s*s-1)*u));r[l]=h}for(l=0;l65535?Uint32Array:Uint16Array,_=this.indices=new v(e*t*6),y=this.radius,x=this.phiStart,w=this.phiLength,b=this.thetaStart,T=this.thetaLength,S=[],M=[],C=0,L=1/(y=this.radius);for(d=0;d<=t;d++)for(c=0;c<=e;c++)u=c/e,h=d/t,a=-y*Math.cos(x+u*w)*Math.sin(b+h*T),s=y*Math.cos(b+h*T),l=y*Math.sin(x+u*w)*Math.sin(b+h*T),S[0]=a,S[1]=s,S[2]=l,M[0]=u,M[1]=h,n.set(C,S),i.set(C,M),S[0]*=L,S[1]*=L,S[2]*=L,r.set(C,S),C++;var A=e+1,D=0;for(d=0;d=0)s=a*n.length;else for(var l=0;l-1e-8&&t=1?1:function(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(MF(h)&&MF(c))MF(s)?o[0]=0:(S=-l/s)>=0&&S<=1&&(o[f++]=S);else{var p=c*c-4*h*d;if(MF(p)){var g=c/h,m=-g/2;(S=-s/a+g)>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=wF(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(S=(-s-((_=_<0?-xF(-_,SF):xF(_,SF))+(y=y<0?-xF(-y,SF):xF(y,SF))))/(3*a))>=0&&S<=1&&(o[f++]=S)}else{var x=(2*h*s-3*a*c)/(2*wF(h*h*h)),w=Math.acos(x)/3,b=wF(h),T=Math.cos(w),S=(-s-2*b*T)/(3*a),M=(m=(-s+b*(T+TF*Math.sin(w)))/(3*a),(-s+b*(T-TF*Math.sin(w)))/(3*a));S>=0&&S<=1&&(o[f++]=S),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}(0,i,o,1,t,s)&&CF(0,r,a,1,s[0])}}}var DF=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||vF,this.ondestroy=t.ondestroy||vF,this.onrestart=t.onrestart||vF,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=hF(t)?t:ZB[t]||AF(t)},t}();const IF=DF;var PF={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function EF(t){return(t=Math.round(t))<0?0:t>255?255:t}function OF(t){return t<0?0:t>1?1:t}function NF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?EF(parseFloat(e)/100*255):EF(parseInt(e,10))}function RF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?OF(parseFloat(e)/100):OF(parseFloat(e))}function kF(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function zF(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function BF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var FF=new oz(20),VF=null;function GF(t,e){VF&&BF(VF,e),VF=FF.put(t,VF||e.slice())}function HF(t,e){if(t){e=e||[];var n=FF.get(t);if(n)return BF(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in PF)return BF(e,PF[i]),GF(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(zF(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),GF(t,e),e):void zF(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(zF(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),GF(t,e),e):void zF(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?zF(e,+u[0],+u[1],+u[2],1):zF(e,0,0,0,1);h=RF(u.pop());case"rgb":return u.length>=3?(zF(e,NF(u[0]),NF(u[1]),NF(u[2]),3===u.length?h:RF(u[3])),GF(t,e),e):void zF(e,0,0,0,1);case"hsla":return 4!==u.length?void zF(e,0,0,0,1):(u[3]=RF(u[3]),UF(u,e),GF(t,e),e);case"hsl":return 3!==u.length?void zF(e,0,0,0,1):(UF(u,e),GF(t,e),e);default:return}}zF(e,0,0,0,1)}}function UF(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=RF(t[1]),r=RF(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return zF(e=e||[],EF(255*kF(a,o,n+1/3)),EF(255*kF(a,o,n)),EF(255*kF(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}new oz(100);var WF=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},jF=new function(){this.browser=new WF,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(jF.wxa=!0,jF.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?jF.worker=!0:!jF.hasGlobalWindow||"Deno"in window?(jF.node=!0,jF.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,jF);const ZF=jF;Math.round;ZF.hasGlobalWindow&&hF(window.btoa);var XF=Array.prototype.slice;function qF(t,e,n){return(e-t)*n+t}function YF(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(oF(e)){var l=function(t){return oF(t&&t[0])?2:1}(e);a=l,(1===l&&!cF(e[0])||2===l&&!cF(e[0][0]))&&(o=!0)}else if(cF(e)&&!function(t){return t!=t}(e))a=0;else if(function(t){return"string"==typeof t}(e))if(isNaN(+e)){var u=HF(e);u&&(s=u,a=3)}else a=0;else if(function(t){return null!=t.colorStops}(e)){var h=rF({},s);h.colorStops=aF(e.colorStops,(function(t){return{offset:t.offset,color:HF(t.color)}})),"linear"===e.type?a=4:function(t){return"radial"===t.type}(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=hF(n)?n:ZB[n]||AF(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=iV(i),l=nV(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?rV:t[h];if(!iV(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(iV(s))1===s?YF(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,tV(l),i),this._trackKeys.push(a)}s.addKeyframe(t,tV(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const sV=aV;var lV={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(t,e){this._animators=this._animators||[];var n;if(t){for(var i=t.split("."),r=this,o=0,a=i.length;o=0&&s.splice(t,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,n=e.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function cV(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}Object.assign(UR.prototype,uV),LN.import(hV),LN.import(AN),LN.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),LN.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),LN.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),LN.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var dV=ez.prototype.addToScene,fV=ez.prototype.removeFromScene;ez.prototype.addToScene=function(t){if(dV.call(this,t),this.__zr){var e=this.__zr;t.traverse((function(t){t.__zr=e,t.addAnimatorsToZr&&t.addAnimatorsToZr(e)}))}},ez.prototype.removeFromScene=function(t){fV.call(this,t),t.traverse((function(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}))},HO.prototype.setTextureImage=function(t,e,n,i){if(this.shader){var r,o,a=n.getZr(),s=this;return s.autoUpdateTextureStatus=!1,s.disableTexture(t),(o=e)&&"none"!==o&&(r=pV.loadTexture(e,n,i,(function(e){s.enableTexture(t),a&&a.refresh()})),s.set(t,r)),r}};var pV={};pV.Renderer=jN,pV.Node=UR,pV.Mesh=ek,pV.Shader=LN,pV.Material=HO,pV.Texture=QR,pV.Texture2D=sk,pV.Geometry=xk,pV.SphereGeometry=bB,pV.PlaneGeometry=Dz,pV.CubeGeometry=Oz,pV.AmbientLight=SB,pV.DirectionalLight=CB,pV.PointLight=AB,pV.SpotLight=IB,pV.PerspectiveCamera=dz,pV.OrthographicCamera=nB,pV.Vector2=JO,pV.Vector3=QN,pV.Vector4=NB,pV.Quaternion=DR,pV.Matrix2=BB,pV.Matrix2d=HB,pV.Matrix3=WB,pV.Matrix4=MR,pV.Plane=Nk,pV.Ray=sR,pV.BoundingBox=FR,pV.Frustum=Hk;var gV=null;function mV(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function vV(t){if((t.wrapS===QR.REPEAT||t.wrapT===QR.REPEAT)&&t.image){var e=mV(t.width),n=mV(t.height);if(e!==t.width||n!==t.height){var i=document.createElement("canvas");i.width=e,i.height=n,i.getContext("2d").drawImage(t.image,0,0,e,n),t.image=i}}}pV.loadTexture=function(t,e,n,i){"function"==typeof n&&(i=n,n={}),n=n||{};for(var r=Object.keys(n).sort(),o="",a=0;a3?e[3]=t[3]:e[3]=1,e):((e=Ri(t||"var(--ow-color-black)",e)||[0,0,0,0])[0]/=255,e[1]/=255,e[2]/=255,e)},pV.directionFromAlphaBeta=function(t,e){var n=t/180*Math.PI+Math.PI/2,i=-e/180*Math.PI+Math.PI/2,r=[],o=Math.sin(n);return r[0]=o*Math.cos(i),r[1]=-Math.cos(n),r[2]=o*Math.sin(i),r},pV.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096}return e},pV.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],pV.createShader=function(t){"ecgl.shadow"===t&&(t="ecgl.displayShadow");var e=LN.source(t+".vertex"),n=LN.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),n||console.error("Fragment shader of '%s' not exits",t);var i=new LN(e,n);return i.name=t,i},pV.createMaterial=function(t,e){e instanceof Array||(e=[e]);var n=pV.createShader(t),i=new HO({shader:n});return e.forEach((function(t){"string"==typeof t&&i.define(t)})),i},pV.setMaterialFromModel=function(t,e,n,i){e.autoUpdateTextureStatus=!1;var r=n.getModel(t+"Material"),o=r.get("detailTexture"),a=xB.firstNotNull(r.get("textureTiling"),1),s=xB.firstNotNull(r.get("textureOffset"),0);"number"==typeof a&&(a=[a,a]),"number"==typeof s&&(s=[s,s]);var l=a[0]>1||a[1]>1?pV.Texture.REPEAT:pV.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===t){var h=r.get("roughness"),c=r.get("metalness");null!=c?isNaN(c)&&(e.setTextureImage("metalnessMap",c,i,u),c=xB.firstNotNull(r.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(e.setTextureImage("roughnessMap",h,i,u),h=xB.firstNotNull(r.get("roughnessAdjust"),.5)):h=.5;var d=r.get("normalTexture");e.setTextureImage("detailMap",o,i,u),e.setTextureImage("normalMap",d,i,u),e.set({roughness:h,metalness:c,detailUvRepeat:a,detailUvOffset:s})}else if("lambert"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("color"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("hatching"===t){var f=r.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)e.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:pV.Texture.REPEAT,wrapT:pV.Texture.REPEAT});e.set({detailUvRepeat:a,detailUvOffset:s})}},pV.updateVertexAnimation=function(t,e,n,i){var r=i.get("animation"),o=i.get("animationDurationUpdate"),a=i.get("animationEasingUpdate"),s=n.shadowDepthMaterial;if(r&&e&&o>0&&e.geometry.vertexCount===n.geometry.vertexCount){n.material.define("vertex","VERTEX_ANIMATION"),n.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var n=this.zr;t.scene.traverse((function(t){t.__zr=n,t.addAnimatorsToZr&&t.addAnimatorsToZr(n)}))}},xV.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t))}},xV.prototype.removeViewsAll=function(){this.views.forEach((function(t){t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t)}),this),this.views.length=0},xV.prototype.resize=function(t,e){this.renderer.resize(t,e)},xV.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)},xV.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)},xV.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},xV.prototype.needsRefresh=function(){this.zr.refresh()},xV.prototype.refresh=function(t){this._backgroundColor=t?_V.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var i=this.pickObject(t.offsetX,t.offsetY);i&&(this._dispatchEvent(t.type,t,i),this._dispatchDataEvent(t.type,t,i));var r=this._clickToSetFocusPoint(t);if(r)r.view.setDOFFocusOnPoint(r.distance)&&this.zr.refresh()}}},xV.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,n=e.viewport,i=this.views.length-1;i>=0;i--){var r=this.views[i];if(r.hasDOF()&&r.containPoint(t.offsetX,t.offsetY)){this._picking.scene=r.scene,this._picking.camera=r.camera,e.viewport=r.viewport;var o=this._picking.pick(t.offsetX,t.offsetY,!0);if(o)return o.view=r,o}}e.viewport=n},xV.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})},xV.prototype.pickObject=function(t,e){for(var n=[],i=this.renderer,r=i.viewport,o=0;o=0&&(h.dataIndex=this._lastDataIndex,h.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0):null!=a&&a!==this._lastEventData&&(null!=this._lastEventData&&(h.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0),this._lastEventData=a,this._lastDataIndex=r,this._lastSeriesIndex=o),h.eventData=a,h.dataIndex=r,h.seriesIndex=o,(null!=a||parseInt(r,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,t,e),s&&this.zr.handler.dispatchToElement(u,"mouseover",e))},xV.prototype._dispatchToView=function(t,e){for(var n=0;nt&&a=0&&(!function(t){DV(t,"itemStyle"),DV(t,"lineStyle"),DV(t,"areaStyle"),DV(t,"label")}(e),"mapbox"===e.coordinateSystem&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))})),IV(t.xAxis3D),IV(t.yAxis3D),IV(t.zAxis3D),IV(t.grid3D),DV(t.geo3D)}));const EV={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(t){t=t||{},this.option.viewControl=this.option.viewControl||{},null!=t.alpha&&(this.option.viewControl.alpha=t.alpha),null!=t.beta&&(this.option.viewControl.beta=t.beta),null!=t.distance&&(this.option.viewControl.distance=t.distance),null!=t.center&&(this.option.viewControl.center=t.center)}},OV={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},NV={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var RV=Gc.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"var(--ow-color-fg-darker)",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});nt(RV.prototype,EV),nt(RV.prototype,OV),nt(RV.prototype,NV);const kV=RV;var zV=xB.firstNotNull,BV={left:0,middle:1,right:2};function FV(t){return t instanceof Array||(t=[t,t]),t}var VV=vE.extend((function(){return{zr:null,viewGL:null,_center:new QN,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new JO,_panVelocity:new JO,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}}),(function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach((function(t){this[t]=this[t].bind(this)}),this)}),{init:function(){var t=this.zr;t&&(t.on("mousedown",this._mouseDownHandler),t.on("globalout",this._mouseUpHandler),t.on("mousewheel",this._mouseWheelHandler),t.on("pinch",this._pinchHandler),t.animation.on("frame",this._update),t.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var t=this.zr;t&&(t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("pinch",this._pinchHandler),t.off("globalout",this._mouseUpHandler),t.dom.removeEventListener("contextmenu",this._contextMenuHandler),t.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(t){this._distance=t,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(t){this._orthoSize=t,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(t){t=Math.max(Math.min(this.maxAlpha,t),this.minAlpha),this._theta=t/180*Math.PI,this._needsUpdate=!0},setBeta:function(t){t=Math.max(Math.min(this.maxBeta,t),this.minBeta),this._phi=-t/180*Math.PI,this._needsUpdate=!0},setCenter:function(t){this._center.setArray(t)},setViewGL:function(t){this.viewGL=t},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(t,e){var n=(e=e||{}).baseDistance||0,i=e.baseOrthoSize||1,r=t.get("projection");"perspective"!==r&&"orthographic"!==r&&"isometric"!==r&&(r="perspective"),this._projection=r,this.viewGL.setProjection(r);var o=t.get("distance")+n,a=t.get("orthographicSize")+i;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach((function(e){this[e[0]]=zV(t.get(e[0]),e[1])}),this),this.minDistance+=n,this.maxDistance+=n,this.minOrthographicSize+=i,this.maxOrthographicSize+=i;var s=t.ecModel,l={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach((function(e){l[e]=zV(t.get(e),s&&s.get(e))}));var u=zV(e.alpha,t.get("alpha"))||0,h=zV(e.beta,t.get("beta"))||0,c=zV(e.center,t.get("center"))||[0,0,0];l.animation&&l.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:u,beta:h,center:c,distance:o,orthographicSize:a,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(o),this.setAlpha(u),this.setBeta(h),this.setCenter(c),this.setOrthographicSize(a)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){0},animateTo:function(t){var e=this.zr,n=this,i={},r={};return null!=t.distance&&(i.distance=this.getDistance(),r.distance=t.distance),null!=t.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),r.orthographicSize=t.orthographicSize),null!=t.alpha&&(i.alpha=this.getAlpha(),r.alpha=t.alpha),null!=t.beta&&(i.beta=this.getBeta(),r.beta=t.beta),null!=t.center&&(i.center=this.getCenter(),r.center=t.center),this._addAnimator(e.animation.animate(i).when(t.duration||1e3,r).during((function(){null!=i.alpha&&n.setAlpha(i.alpha),null!=i.beta&&n.setBeta(i.beta),null!=i.distance&&n.setDistance(i.distance),null!=i.center&&n.setCenter(i.center),null!=i.orthographicSize&&n.setOrthographicSize(i.orthographicSize),n._needsUpdate=!0}))).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),n=this._orthoSize,i=n/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-i/2,e.right=i/2,e.top=n/2,e.bottom=-n/2},_updatePan:function(t){var e=this._panVelocity,n=this._distance,i=this.getCamera(),r=i.worldTransform.y,o=i.worldTransform.x;this._center.scaleAndAdd(o,-e.x*n/200).scaleAndAdd(r,-e.y*n/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new QN,n=this._theta+Math.PI/2,i=this._phi+Math.PI/2,r=Math.sin(n);e.x=r*Math.cos(i),e.y=-Math.cos(n),e.z=r*Math.sin(i),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout((function(){e._rotating=!0}),1e3*t))},_vectorDamping:function(t,e){var n=t.len();(n*=e)<1e-4&&(n=0),t.normalize().scale(n)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),n=Math.atan2(t.x,t.z);this._theta=e,this._phi=-n,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,n=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,n)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?1===t.event.targetTouches.length&&(this._mode="rotate"):t.event.button===BV[this.rotateMouseButton]?this._mode="rotate":t.event.button===BV[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy||this._isAnimating())){var e=FV(this.panSensitivity),n=FV(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*n[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*n[1]):"pan"===this._mode&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(0!==e){var n,i=t.offsetX,r=t.offsetY;if(!this.viewGL||this.viewGL.containPoint(i,r))n="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*n*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),t.event.preventDefault()}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done((function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)})),t}});Object.defineProperty(VV.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const GV=VV,HV={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var n in e)t||!e[n].value?e[n].value=[]:e[n].value=Array.prototype.slice.call(e[n].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},UV={vec2:qO,vec3:EN,vec4:uR,mat2:kB,mat2d:VB,mat3:cR,mat4:IN,quat:vR};var WV=UV.vec3,jV=[[0,0],[1,1]],ZV=xk.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),positionPrev:new xk.Attribute("positionPrev","float",3),positionNext:new xk.Attribute("positionNext","float",3),prevPositionPrev:new xk.Attribute("prevPositionPrev","float",3),prevPosition:new xk.Attribute("prevPosition","float",3),prevPositionNext:new xk.Attribute("prevPositionNext","float",3),offset:new xk.Attribute("offset","float",1),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(WV.dist(t,e)+WV.dist(n,e)+WV.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(jV)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(jV)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?0:2*Math.max(e-1,0)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=t[2],u=e[0],h=e[1],c=e[2],d=n[0],f=n[1],p=n[2],g=i[0],m=i[1],v=i[2],_=this._getCubicCurveApproxStep(t,e,n,i),y=_*_,x=y*_,w=3*_,b=3*y,T=6*y,S=6*x,M=a-2*u+d,C=s-2*h+f,L=l-2*c+p,A=3*(u-d)-a+g,D=3*(h-f)-s+m,I=3*(c-p)-l+v,P=a,E=s,O=l,N=(u-a)*w+M*b+A*x,R=(h-s)*w+C*b+D*x,k=(c-l)*w+L*b+I*x,z=M*T+A*S,B=C*T+D*S,F=L*T+I*S,V=A*S,G=D*S,H=I*S,U=0,W=0,j=Math.ceil(1/_),Z=new Float32Array(3*(j+1)),X=(Z=[],0);for(W=0;W1&&(P=N>0?Math.min(P,g):Math.max(P,g),E=R>0?Math.min(E,m):Math.max(E,m),O=k>0?Math.min(O,v):Math.max(O,v));return this.addPolyline(Z,r,o)},addLine:function(t,e,n,i){return this.addPolyline([t,e],n,i)},addPolyline:function(t,e,n,i,r){if(t.length){var o="number"!=typeof t[0];if(null==r&&(r=o?t.length:t.length/3),!(r<2)){null==i&&(i=0),null==n&&(n=1),this._itemVertexOffsets.push(this._vertexOffset);var a,s,l=(o="number"!=typeof t[0])?"number"!=typeof e[0]:e.length/4===r,u=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,g=this._vertexOffset;n=Math.max(n,.01);for(var m=i;m1&&(u.copy(g,g-1),d.copy(g,g-1),g++):(m0&&(c.set(g-2,a),c.set(g-1,a)),u.set(g,a),u.set(g+1,a),d.set(g,s),d.set(g+1,s),f.set(g,n/2),f.set(g+1,-n/2),g+=2),this.useNativeLine)d.set(g,s),u.set(g,a),g++;else if(m>0){var y=3*this._triangleOffset;(p=this.indices)[y]=g-4,p[y+1]=g-3,p[y+2]=g-2,p[y+3]=g-3,p[y+4]=g-1,p[y+5]=g-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,w=this._vertexOffset+2*r;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(w-1,w-3),c.copy(w-2,w-4)}return this._vertexOffset=g,this._vertexOffset}}},setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=ta&&(r=this._x=0,o+=this._rowHeight+l,this._y=o,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,n),o+n+l>s)return null;t.x+=this.offsetX*this.dpr+r,t.y+=this.offsetY*this.dpr+o,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height];return[[r/a+u[0],o/s+u[1]],[(r+e)/a+u[0],(o+n)/s+u[1]]]},_fitElement:function(t,e,n){var i=t.getBoundingRect(),r=e/i.width,o=n/i.height;t.x=-i.x*r,t.y=-i.y*o,t.scaleX=r,t.scaleY=o,t.update()}},YV.prototype={clear:function(){for(var t=0;t=t)){var r=(n+this._nodeWidth)*this._dpr,o=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:r,height:o})}catch(t){this._canvas.width=r,this._canvas.height=o}var a=new qV(this._zr,n,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(a),a}},add:function(t,e,n){if(this._coords[t.id])return this._coords[t.id];var i=this._getCurrentNode().add(t,e,n);if(!i){var r=this._expand();if(!r)return;i=r.add(t,e,n)}return this._coords[t.id]=i,i},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};const KV=YV;function JV(){}JV.prototype={constructor:JV,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new _V.DirectionalLight({shadowBias:.005}),this.ambientLight=new _V.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,n=this.ambientLight,i=t.getModel("light"),r=i.getModel("main"),o=i.getModel("ambient");e.intensity=r.get("intensity"),n.intensity=o.get("intensity"),e.color=_V.parseColor(r.get("color")).slice(0,3),n.color=_V.parseColor(o.get("color")).slice(0,3);var a=r.get("alpha")||0,s=r.get("beta")||0;e.position.setArray(_V.directionFromAlphaBeta(a,s)),e.lookAt(_V.Vector3.ZERO),e.castShadow=r.get("shadow"),e.shadowResolution=_V.getShadowResolution(r.get("shadowQuality"))},updateAmbientCubemap:function(t,e,n){var i=e.getModel("light.ambientCubemap"),r=i.get("texture");if(r){this._cubemapLightsCache=this._cubemapLightsCache||{};var o=this._cubemapLightsCache[r];if(!o){var a=this;o=this._cubemapLightsCache[r]=_V.createAmbientCubemap(i.option,t,n,(function(){a._isSkyboxFromAmbientCubemap&&a._skybox.setEnvironmentMap(o.specular.cubemap),n.getZr().refresh()}))}this._lightRoot.add(o.diffuse),this._lightRoot.add(o.specular),this._currentCubemapLights=o}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,n){var i=e.get("environment"),r=this;var o=(r._skybox=r._skybox||new Rz,r._skybox);if(i&&"none"!==i)if("auto"===i)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var a=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(a),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof i&&i.colorStops||"string"==typeof i&&Ri(i)){this._isSkyboxFromAmbientCubemap=!1;var s=new _V.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(s);var l=s.image=document.createElement("canvas");l.width=l.height=16,v_(l.getContext("2d"),new Fl({shape:{x:0,y:0,width:16,height:16},style:{fill:i}})),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;s=_V.loadTexture(i,n,{anisotropic:8,flipY:!1});o.setEnvironmentMap(s),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var u=e.coordinateSystem;if(this._skybox)if(!u||!u.viewGL||"auto"===i||i.match&&i.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var h=u.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[h]("fragment","SRGB_DECODE")}}};const $V=JV;var QV=UV.vec3,tG=xk.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,n=this.getQuadVertexCount()*t,i=this.getQuadTriangleCount()*t;this.vertexCount!==n&&(e.position.init(n),e.normal.init(n),e.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=QV.create(),e=QV.create(),n=QV.create(),i=[0,3,1,3,2,1];return function(r,o){var a=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;QV.sub(t,r[1],r[0]),QV.sub(e,r[2],r[1]),QV.cross(n,t,e),QV.normalize(n,n);for(var u=0;u<4;u++)a.set(this._vertexOffset+u,r[u]),l.set(this._vertexOffset+u,o),s.set(this._vertexOffset+u,n);var h=3*this._faceOffset;for(u=0;u<6;u++)this.indices[h+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});ot(tG.prototype,HV);const eG=tG;var nG=xB.firstNotNull,iG={x:0,y:2,z:1};function rG(t,e,n){this.rootNode=new _V.Node;var i=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),r=new _V.Mesh({geometry:new eG,material:n,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(r),this.rootNode.add(i),this.faceInfo=t,this.plane=new _V.Plane,this.linesMesh=i,this.quadsMesh=r}rG.prototype.update=function(t,e,n){var i=t.coordinateSystem,r=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,a=this.quadsMesh.geometry;o.convertToDynamicArray(!0),a.convertToDynamicArray(!0),this._updateSplitLines(o,r,t,n),this._udpateSplitAreas(a,r,t,n),o.convertToTypedArray(),a.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(t,e,n,i){var r=[0,0,0],o=i<0?n.getExtentMin():n.getExtentMax();r[iG[n.dim]]=o,t.position.setArray(r),t.rotation.identity(),e.distance=-Math.abs(o),e.normal.set(0,0,0),"x"===n.dim?(t.rotation.rotateY(i*Math.PI/2),e.normal.x=-i):"z"===n.dim?(t.rotation.rotateX(-i*Math.PI/2),e.normal.y=-i):(i>0&&t.rotation.rotateY(Math.PI),e.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},rG.prototype._updateSplitLines=function(t,e,n,i){var r=i.getDevicePixelRatio();e.forEach((function(i,o){var a=i.model,s=e[1-o].getExtent();if(!i.scale.isBlank()){var l=a.getModel("splitLine",n.getModel("splitLine"));if(l.get("show")){var u=l.getModel("lineStyle"),h=u.get("color"),c=nG(u.get("opacity"),1),d=nG(u.get("width"),1);h=yt(h)?h:[h];for(var f=i.getTicksCoords({tickModel:l}),p=0,g=0;g65535?new Uint32Array(3*n):new Uint16Array(3*n))},setSpriteAlign:function(t,e,n,i,r){var o,a,s,l;switch(null==n&&(n="left"),null==i&&(i="top"),r=r||0,n){case"left":o=r,s=e[0]+r;break;case"center":case"middle":o=-e[0]/2,s=e[0]/2;break;case"right":o=-e[0]-r,s=-r}switch(i){case"bottom":a=r,l=e[1]+r;break;case"middle":a=-e[1]/2,l=e[1]/2;break;case"top":a=-e[1]-r,l=-r}var u=4*t,h=this.attributes.offset;h.set(u,[o,l]),h.set(u+1,[s,l]),h.set(u+2,[s,a]),h.set(u+3,[o,a])},addSprite:function(t,e,n,i,r,o){var a=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,n,i,r,o);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var mG=xB.firstNotNull;_V.Shader.import(gG);var vG={x:0,y:2,z:1};const _G=Dp.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var n=new _V.Material({shader:_V.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new _V.Node,this._control=new GV({zr:e.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(t){var e=new oG(t,i,n);return this.groupGL.add(e.rootNode),e}),this),this._axes=["x","y","z"].map((function(t){var e=new pG(t,i);return this.groupGL.add(e.rootNode),e}),this);var r=e.getDevicePixelRatio();this._axisLabelSurface=new KV({width:256,height:256,devicePixelRatio:r}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new KV({width:128,height:128,devicePixelRatio:r}),this._axisPointerLabelsMesh=new uG({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new _V.Node,this._sceneHelper=new $V,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,n){this._model=t,this._api=n;var i=t.coordinateSystem;i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var r=this._control;r.setViewGL(i.viewGL);var o=t.getModel("viewControl");r.setFromViewControlModel(o,0),this._axisLabelSurface.clear(),r.off("update"),t.get("show")&&(this._faces.forEach((function(i){i.update(t,e,n)}),this),this._axes.forEach((function(e){e.update(t,this._axisLabelSurface,n)}),this)),r.on("update",this._onCameraChange.bind(this,t,n),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(t),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},showAxisPointer:function(t,e,n,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(t,e,n,i){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem.viewGL;t.get("show")&&t.get("axisPointer.show")?e.on("mousemove",this._updateAxisPointerOnMousePosition,this):e.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e,n=this._model.coordinateSystem,i=n.viewGL,r=i.castRay(t.offsetX,t.offsetY,new _V.Ray),o=0;oi[1]?0:1,a=this._faces[2*n+o],s=this._faces[2*n+1-o];a.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),n=t.getAxis("y"),i=t.getAxis("z"),r=i.getExtentMax(),o=i.getExtentMin(),a=e.getExtentMin(),s=e.getExtentMax(),l=n.getExtentMax(),u=n.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?u:l,g=f[2].rootNode.invisible?r:o,m=f[0].rootNode.invisible?a:s,v=f[2].rootNode.invisible?r:o,_=f[0].rootNode.invisible?s:a,y=f[4].rootNode.invisible?u:l;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,g,p),c.position.set(m,v,0),d.position.set(_,0,y),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new _V.Vector4,new _V.Vector4],n=new _V.Vector4;this.groupGL.getWorldPosition(n),n.w=1,n.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),n.x/=n.w,n.y/=n.w,this._axes.forEach((function(i){for(var r=i.axisLineCoords,o=(i.labelsMesh.geometry,0);on.y?"bottom":"top"):(s="middle",a=h>n.x?"left":"right"),i.setSpriteAlign(a,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,n=e.dataToPoint(t),i=this._axisPointerLineMesh.geometry,r=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function a(t){return xB.firstNotNull(t.model.get("axisPointer.show"),r.get("show"))}function s(t){var e=t.model.getModel("axisPointer",r).getModel("lineStyle"),n=_V.parseColor(e.get("color")),i=mG(e.get("width"),1),o=mG(e.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;l 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var PG,EG,OG,NG,RG,kG,zG,BG=vE.extend((function(){return{softShadow:BG.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new Sz,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new LG}}),(function(){this._gaussianPassH=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new aB({fragment:LN.source("clay.sm.debug_depth")})}),{render:function(t,e,n,i){n||(n=e.getMainCamera()),this.trigger("beforerender",this,t,e,n),this._renderShadowPass(t,e,n,i),this.trigger("afterrender",this,t,e,n)},renderDebug:function(t,e){t.saveClear();var n=t.viewport,i=0,r=e||n.width/4,o=r;for(var a in this.softShadow===BG.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[a];t.setViewport(i,0,r*s.width/s.height,o),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(t),i+=r*s.width/s.height}t.setViewport(n),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===BG.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var n=this.kernelPCF;n&&n.length?e.material.define("fragment","PCF_KERNEL_SIZE",n.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var n=this;e.traverse((function(e){e.isRenderable()&&n._updateReceivers(t,e)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(a=p),this.renderDirectionalLightShadow(t,e,n,p,c,h,u)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(t,e,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(t,e,p,d);this._shadowMapNumber[p.type]++}for(var g in this._shadowMapNumber){var m=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT";for(f=0;f0?_.define("fragment",v,m):_.isDefined("fragment",v)&&_.undefine("fragment",v))}}for(f=0;f0){var x=u.map(S);if(y.directionalLightShadowMaps={value:u,type:"tv"},y.directionalLightMatrices={value:h,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},a){var w=c.slice(),b=c.slice();w.pop(),b.shift(),w.reverse(),b.reverse(),h.reverse(),y.shadowCascadeClipsNear={value:w,type:"1fv"},y.shadowCascadeClipsFar={value:b,type:"1fv"}}}if(s.length>0){var T=s.map(S);(y=e.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:T,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function S(t){return t.height}},renderDirectionalLightShadow:(PG=new Hk,EG=new MR,OG=new FR,NG=new MR,RG=new MR,kG=new MR,zG=new MR,function(t,e,n,i,r,o,a){var s=this._getDepthMaterial(i),l={getMaterial:function(t){return t.shadowDepthMaterial||s},isMaterialChanged:IG,getUniform:DG,ifRender:function(t){return t.castShadow},sortCompare:jN.opaqueSortCompare};if(!e.viewBoundingBoxLastFrame.isFinite()){var u=e.getBoundingBox();e.viewBoundingBoxLastFrame.copy(u).applyTransform(n.viewMatrix)}var h=Math.min(-e.viewBoundingBoxLastFrame.min.z,n.far),c=Math.max(-e.viewBoundingBoxLastFrame.max.z,n.near),d=this._getDirectionalLightCamera(i,e,n),f=kG.array;zG.copy(d.projectionMatrix),IN.invert(RG.array,d.worldTransform.array),IN.multiply(RG.array,RG.array,n.worldTransform.array),IN.multiply(f,zG.array,RG.array);for(var p=[],g=n instanceof dz,m=(n.near+n.far)/(n.near-n.far),v=2*n.near*n.far/(n.near-n.far),_=0;_<=i.shadowCascade;_++){var y=c*Math.pow(h/c,_/i.shadowCascade),x=c+(h-c)*_/i.shadowCascade,w=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(w),r.push(-(-w*m+v)/-w)}var b=this._getTexture(i,i.shadowCascade);a.push(b);var T=t.viewport,S=t.gl;for(this._frameBuffer.attach(b),this._frameBuffer.bind(t),S.clear(S.COLOR_BUFFER_BIT|S.DEPTH_BUFFER_BIT),_=0;_d?s>f?p[r>0?"px":"nx"]=!0:p[a>0?"pz":"nz"]=!0:d>f?p[o>0?"py":"ny"]=!0:p[a>0?"pz":"nz"]=!0}for(n=0;n0)this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}}});var GG=vE.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){"string"==typeof t&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=n.COLOR_ATTACHMENT0&&h<=n.COLOR_ATTACHMENT0+8&&u.push(h);l.drawBuffersEXT(u)}t.saveClear(),t.clearBit=wE|TE,e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),i.unbind(t)}else e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",e),this._rendering=!1,this._rendered=!0}});const jG=VG.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}});const ZG=VG.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var t=new aB({fragment:this.shader});this.pass=t}),{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var n=t.gl;for(var i in this.inputLinks){var r=(c=this.inputLinks[i]).node.getOutput(t,c.pin);this.pass.setUniform(i,r)}if(this.outputs){this.pass.outputs={};var o={};for(var a in this.outputs){var s=this.updateParameter(a,t);isNaN(s.width)&&this.updateParameter(a,t);var l=this.outputs[a],u=this._compositor.allocateTexture(s);this._outputTextures[a]=u,"string"==typeof(h=l.attachment||n.COLOR_ATTACHMENT0)&&(h=n[h]),o[h]=u}for(var h in this._compositor.getFrameBuffer().bind(t),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var n,i,r=this.outputs[t],o=r.parameters,a=r._parametersCopy;if(a||(a=r._parametersCopy={}),o)for(var s in o)"width"!==s&&"height"!==s&&(a[s]=o[s]);return n="function"==typeof o.width?o.width.call(this,e):o.width,i="function"==typeof o.height?o.height.call(this,e):o.height,n=Math.ceil(n),i=Math.ceil(i),a.width===n&&a.height===i||this._outputTextures[t]&&this._outputTextures[t].dispose(e),a.width=n,a.height=i,a},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){(this._outputReferences[t]--,0===this._outputReferences[t])&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))},clear:function(){VG.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),XG="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",qG="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",YG="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",KG="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",JG="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",$G="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",QG="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",tH="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",eH="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(t){t.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),t.import(XG),t.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),t.import(qG),t.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),t.import(YG),t.import(KG),t.import(JG),t.import($G),t.import(QG),t.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),t.import(tH),t.import(eH)}(LN);var nH=/^#source\((.*?)\)/;function iH(t,e,n){var i,r,o,a,s=t.type||"filter";if("filter"===s){var l=t.shader.trim(),u=nH.exec(l);if(u?i=LN.source(u[1].trim()):"#"===l.charAt(0)&&(i=e.shaders[l.substr(1)]),i||(i=l),!i)return}if(t.inputs)for(var h in r={},t.inputs)"string"==typeof t.inputs[h]?r[h]=t.inputs[h]:r[h]={node:t.inputs[h].node,pin:t.inputs[h].pin};if(t.outputs)for(var h in o={},t.outputs){var c=t.outputs[h];o[h]={},null!=c.attachment&&(o[h].attachment=c.attachment),null!=c.keepLastFrame&&(o[h].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(o[h].outputLastFrame=c.outputLastFrame),c.parameters&&(o[h].parameters=aH(c.parameters))}if(a="scene"===s?new WG({name:t.name,scene:n.scene,camera:n.camera,outputs:o}):"texture"===s?new jG({name:t.name,outputs:o}):new ZG({name:t.name,shader:i,inputs:r,outputs:o})){if(t.parameters)for(var h in t.parameters){"string"==typeof(d=t.parameters[h])?"#"===(d=d.trim()).charAt(0)?d=e.textures[d.substr(1)]:a.on("beforerender",sH(h,lH(d))):"function"==typeof d&&a.on("beforerender",d),a.setParameter(h,d)}if(t.defines&&a.pass)for(var h in t.defines){var d=t.defines[h];a.pass.material.define("fragment",h,d)}}return a}function rH(t,e){return t}function oH(t,e){return e}function aH(t){var e={};if(!t)return e;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(n){var i=t[n];null!=i&&("string"==typeof i&&(i=QR[i]),e[n]=i)}));var n=t.scale||1;return["width","height"].forEach((function(i){if(null!=t[i]){var r=t[i];"string"==typeof r?(r=r.trim(),e[i]=function(t,e,n){return n=n||1,function(t){var i=t.getDevicePixelRatio(),r=t.getWidth()*n,o=t.getHeight()*n;return e(r,o,i)}}(0,lH(r),n)):e[i]=r}})),e.width||(e.width=rH),e.height||(e.height=oH),null!=t.useMipmap&&(e.useMipmap=t.useMipmap),e}function sH(t,e){return function(n){var i=n.getDevicePixelRatio(),r=n.getWidth(),o=n.getHeight(),a=e(r,o,i);this.setParameter(t,a)}}function lH(t){var e=/^expr\((.*)\)$/.exec(t);if(e)try{var n=new Function("width","height","dpr","return "+e[1]);return n(1,1),n}catch(t){throw new Error("Invalid expression.")}}const uH=function(t,e){var n=new UG;e=e||{};var i={textures:{},parameters:{}};for(var r in t.parameters){var o=t.parameters[r];i.parameters[r]=aH(o)}return function(t,e,n,i){if(!t.textures)return void i({});var r={},o=0,a=!1,s=n.textureRootPath;gE.each(t.textures,(function(t,e){var n,l=t.path,u=aH(t.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(t){return gE.relative2absolute(t,s)}))),n=new hz(u);else{if("string"!=typeof l)return;s&&(l=gE.relative2absolute(l,s)),n=new sk(u)}n.load(l),o++,n.once("success",(function(){r[e]=n,0===--o&&(i(r),a=!0)}))})),0!==o||a||i(r)}(t,0,e,(function(r){i.textures=r,function(){for(var r=0;r0;)n+=i*(r%e),r=Math.floor(r/e),i/=e;return n};function cH(t){for(var e=new Uint8Array(t*t*4),n=0,i=new QN,r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),pH.prototype.setDepthTexture=function(t){this._depthTex=t},pH.prototype.setNormalTexture=function(t){this._normalTex=t,this._ssaoPass.material[t?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},pH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._ssaoPass,a=this._blurPass;o.setUniform("kernel",this._kernels[n%this._kernels.length]),o.setUniform("depthTex",this._depthTex),null!=this._normalTex&&o.setUniform("normalTex",this._normalTex),o.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new MR;MR.transpose(s,e.worldTransform),o.setUniform("projection",e.projectionMatrix.array),o.setUniform("projectionInv",e.invProjectionMatrix.array),o.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,h=this._blurTexture2;l.width=i/2,l.height=r/2,u.width=i,u.height=r,h.width=i,h.height=r,this._framebuffer.attach(l),this._framebuffer.bind(t),t.gl.clearColor(1,1,1,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),o.render(t),a.setUniform("textureSize",[i/2,r/2]),a.setUniform("projection",e.projectionMatrix.array),this._framebuffer.attach(u),a.setUniform("direction",0),a.setUniform("ssaoTexture",l),a.render(t),this._framebuffer.attach(h),a.setUniform("textureSize",[i,r]),a.setUniform("direction",1),a.setUniform("ssaoTexture",u),a.render(t),this._framebuffer.unbind(t);var c=t.clearColor;t.gl.clearColor(c[0],c[1],c[2],c[3])},pH.prototype.getTargetTexture=function(){return this._blurTexture2},pH.prototype.setParameter=function(t,e){"noiseTexSize"===t?this.setNoiseSize(e):"kernelSize"===t?this.setKernelSize(e):"intensity"===t?this._ssaoPass.material.set("intensity",e):this._ssaoPass.setUniform(t,e)},pH.prototype.setKernelSize=function(t){this._kernelSize=t,this._ssaoPass.material.define("fragment","KERNEL_SIZE",t),this._kernels=this._kernels||[];for(var e=0;e<30;e++)this._kernels[e]=fH(t,e*t,!!this._normalTex)},pH.prototype.setNoiseSize=function(t){var e=this._ssaoPass.getUniform("noiseTex");e?(e.data=cH(t),e.width=e.height=t,e.dirty()):(e=dH(t),this._ssaoPass.setUniform("noiseTex",dH(t))),this._ssaoPass.setUniform("noiseTexSize",[t,t])},pH.prototype.dispose=function(t){this._blurTexture.dispose(t),this._ssaoTexture.dispose(t),this._blurTexture2.dispose(t)};const gH=pH;function mH(t){t=t||{},this._ssrPass=new aB({fragment:LN.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new aB({fragment:LN.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new sk({type:QR.HALF_FLOAT}),this._texture2=new sk({type:QR.HALF_FLOAT}),this._texture3=new sk({type:QR.HALF_FLOAT}),this._prevTexture=new sk({type:QR.HALF_FLOAT}),this._currentTexture=new sk({type:QR.HALF_FLOAT}),this._frameBuffer=new Sz({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}LN.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),mH.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var n=t&&e;this._ssrPass.material[n?"enableTexture":"disableTexture"]("specularCubemap")},mH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._ssrTexture,s=this._texture2,l=this._texture3;a.width=this._prevTexture.width=this._currentTexture.width=r/this._downScale,a.height=this._prevTexture.height=this._currentTexture.height=o/this._downScale,s.width=l.width=r,s.height=l.height=o;var u=this._frameBuffer,h=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new MR,g=new MR;MR.transpose(p,e.worldTransform),MR.transpose(g,e.viewMatrix),h.setUniform("sourceTexture",n),h.setUniform("projection",e.projectionMatrix.array),h.setUniform("projectionInv",e.invProjectionMatrix.array),h.setUniform("toViewSpace",p.array),h.setUniform("toWorldSpace",g.array),h.setUniform("nearZ",e.near);var m=i/this._totalSamples*this._samplePerFrame;if(h.setUniform("jitterOffset",m),h.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[a.width,a.height]),d.setUniform("textureSize",[r,o]),d.setUniform("sourceTexture",n),c.setUniform("projection",e.projectionMatrix.array),d.setUniform("projection",e.projectionMatrix.array),u.attach(a),u.bind(t),h.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",a),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(t)),u.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:a),c.render(t),u.attach(l),d.setUniform("texture",s),d.render(t),u.unbind(t),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},mH.prototype.getTargetTexture=function(){return this._texture3},mH.prototype.setParameter=function(t,e){"maxIteration"===t?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)},mH.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=uB.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t},mH.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")},mH.prototype.isFinished=function(t){return!this._physicallyCorrect||t>this._totalSamples/this._samplePerFrame},mH.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const vH=mH,_H=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function yH(t,e,n,i,r){var o=t.gl;e.setUniform(o,"1i",n,r),o.activeTexture(o.TEXTURE0+r),i.isRenderable()?i.bind(t):i.unbind(t)}function xH(t,e,n,i,r){var o,a,s,l,u=t.gl;return function(r,h,c){if(!l||l.material!==r.material){var d=r.material,f=r.__program,p=d.get("roughness");null==p&&(p=1);var g=d.get("normalMap")||e,m=d.get("roughnessMap"),v=d.get("bumpMap"),_=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),w=d.get("detailUvOffset"),b=!!v&&d.isTextureEnabled("bumpMap"),T=!!m&&d.isTextureEnabled("roughnessMap"),S=d.isDefined("fragment","DOUBLE_SIDED");v=v||n,m=m||i,c!==h?(h.set("normalMap",g),h.set("bumpMap",v),h.set("roughnessMap",m),h.set("useBumpMap",b),h.set("useRoughnessMap",T),h.set("doubleSide",S),null!=_&&h.set("uvRepeat",_),null!=y&&h.set("uvOffset",y),null!=x&&h.set("detailUvRepeat",x),null!=w&&h.set("detailUvOffset",w),h.set("roughness",p)):(f.setUniform(u,"1f","roughness",p),o!==g&&yH(t,f,"normalMap",g,0),a!==v&&v&&yH(t,f,"bumpMap",v,1),s!==m&&m&&yH(t,f,"roughnessMap",m,2),null!=_&&f.setUniform(u,"2f","uvRepeat",_),null!=y&&f.setUniform(u,"2f","uvOffset",y),null!=x&&f.setUniform(u,"2f","detailUvRepeat",x),null!=w&&f.setUniform(u,"2f","detailUvOffset",w),f.setUniform(u,"1i","useBumpMap",+b),f.setUniform(u,"1i","useRoughnessMap",+T),f.setUniform(u,"1i","doubleSide",+S)),o=g,a=v,s=m,l=r}}}function wH(t){t=t||{},this._depthTex=new sk({format:QR.DEPTH_COMPONENT,type:QR.UNSIGNED_INT}),this._normalTex=new sk({type:QR.HALF_FLOAT}),this._framebuffer=new Sz,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,Sz.DEPTH_ATTACHMENT),this._normalMaterial=new HO({shader:new LN(LN.source("ecgl.normal.vertex"),LN.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=Kz.createBlank("var(--ow-color-black)"),this._defaultBumpMap=Kz.createBlank("var(--ow-color-black)"),this._defaultRoughessMap=Kz.createBlank("var(--ow-color-black)"),this._debugPass=new aB({fragment:LN.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}LN.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),wH.prototype.getDepthTexture=function(){return this._depthTex},wH.prototype.getNormalTexture=function(){return this._normalTex},wH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._depthTex,a=this._normalTex,s=this._normalMaterial;o.width=i,o.height=r,a.width=i,a.height=r;var l=e.getRenderList(n).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,n,{getMaterial:function(){return s},ifRender:function(t){return t.renderNormal},beforeRender:xH(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)},wH.prototype.renderDebug=function(t){this._debugPass.render(t)},wH.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};const bH=wH;function TH(t){t=t||{},this._edgePass=new aB({fragment:LN.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new sk({type:QR.HALF_FLOAT}),this._frameBuffer=new Sz,this._frameBuffer.attach(this._targetTexture)}TH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._targetTexture;a.width=r,a.height=o;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[r,o]),this._edgePass.setUniform("texture",n),this._edgePass.render(t),s.unbind(t)},TH.prototype.getTargetTexture=function(){return this._targetTexture},TH.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)},TH.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const SH=TH,MH={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function CH(t,e){return{color:{parameters:{width:t,height:e}}}}LN.import(XG),LN.import(qG),LN.import(YG),LN.import(KG),LN.import(JG),LN.import($G),LN.import(QG),LN.import(tH),LN.import(eH),LN.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),LN.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var LH=["composite","FXAA"];function AH(){this._width,this._height,this._dpr,this._sourceTexture=new sk({type:QR.HALF_FLOAT}),this._depthTexture=new sk({format:QR.DEPTH_COMPONENT,type:QR.UNSIGNED_INT}),this._framebuffer=new Sz,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,Sz.DEPTH_ATTACHMENT),this._normalPass=new bH,this._compositor=uH(MH);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var e=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=e,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map((function(t){return this._compositor.getNodeByName(t)}),this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=LH.map((function(t){return this._compositor.getNodeByName(t)}),this);var n={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new gH(n),this._ssrPass=new vH(n),this._edgePass=new SH(n)}AH.prototype.resize=function(t,e,n){t*=n=n||1,e*=n;var i=this._sourceTexture,r=this._depthTexture;i.width=t,i.height=e,r.width=t,r.height=e;var o={getWidth:function(){return t},getHeight:function(){return e},getDevicePixelRatio:function(){return n}};function a(t,e){if("function"==typeof t[e]){var n=t[e].__original||t[e];t[e]=function(t){return n.call(this,o)},t[e].__original=n}}this._compositor.nodes.forEach((function(t){for(var e in t.outputs){var n=t.outputs[e].parameters;n&&(a(n,"width"),a(n,"height"))}for(var i in t.parameters)a(t.parameters,i)})),this._width=t,this._height=e,this._dpr=n},AH.prototype.getWidth=function(){return this._width},AH.prototype.getHeight=function(){return this._height},AH.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},AH.prototype._getPrevNode=function(t){for(var e=LH.indexOf(t.name)-1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e-=1,n=this._finalNodesChain[e];return n},AH.prototype._getNextNode=function(t){for(var e=LH.indexOf(t.name)+1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e+=1,n=this._finalNodesChain[e];return n},AH.prototype._addChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(t.inputs.texture=e.name,n?(t.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=t.name):t.outputs=null,this._compositor.addNode(t))},AH.prototype._removeChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(n?(e.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=e.name):e.outputs=null,this._compositor.removeNode(t))},AH.prototype.updateNormal=function(t,e,n,i){this._ifRenderNormalPass()&&this._normalPass.update(t,e,n)},AH.prototype.updateSSAO=function(t,e,n,i){this._ssaoPass.update(t,n,i)},AH.prototype.enableSSAO=function(){this._enableSSAO=!0},AH.prototype.disableSSAO=function(){this._enableSSAO=!1},AH.prototype.enableSSR=function(){this._enableSSR=!0},AH.prototype.disableSSR=function(){this._enableSSR=!1},AH.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()},AH.prototype.getSourceFrameBuffer=function(){return this._framebuffer},AH.prototype.getSourceTexture=function(){return this._sourceTexture},AH.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},AH.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},AH.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()},AH.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()},AH.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()},AH.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()},AH.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0},AH.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},AH.prototype.enableEdge=function(){this._enableEdge=!0},AH.prototype.disableEdge=function(){this._enableEdge=!1},AH.prototype.setBloomIntensity=function(t){this._compositeNode.setParameter("bloomIntensity",t)},AH.prototype.setSSAOParameter=function(t,e){switch(t){case"quality":var n={low:6,medium:12,high:32,ultra:62}[e]||12;this._ssaoPass.setParameter("kernelSize",n);break;case"radius":this._ssaoPass.setParameter(t,e),this._ssaoPass.setParameter("bias",e/200);break;case"intensity":this._ssaoPass.setParameter(t,e)}},AH.prototype.setDOFParameter=function(t,e){switch(t){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(t,e);break;case"blurRadius":for(var n=0;n=this._haltonSequence.length},render:function(t,e,n){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),i.render(t),this._blendFb.unbind(t),n||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};const PH=IH;function EH(t){t=t||"perspective",this.layer=null,this.scene=new ez,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new DH,this._temporalSS=new PH,this._shadowMapPass=new FG;for(var e=[],n=0,i=0;i<30;i++){for(var r=[],o=0;o<6;o++)r.push(4*hH(n,2)-2),r.push(4*hH(n,3)-2),n++;e.push(r)}this._pcfKernels=e,this.scene.on("beforerender",(function(t,e,n){this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,n)}),this)}EH.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),"perspective"===t?this.camera instanceof dz||(this.camera=new dz,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof nB||(this.camera=new nB,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3},EH.prototype.setViewport=function(t,e,n,i,r){this.camera instanceof dz&&(this.camera.aspect=n/i),r=r||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=n,this.viewport.height=i,this.viewport.devicePixelRatio=r,this._compositor.resize(n*r,i*r),this._temporalSS.resize(n*r,i*r)},EH.prototype.containPoint=function(t,e){var n=this.viewport;return e=this.layer.renderer.getHeight()-e,t>=n.x&&e>=n.y&&t<=n.x+n.width&&e<=n.y+n.height};var OH=new JO;EH.prototype.castRay=function(t,e,n){var i=this.layer.renderer,r=i.viewport;return i.viewport=this.viewport,i.screenToNDC(t,e,OH),this.camera.castRay(OH,n),i.viewport=r,n},EH.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30},EH.prototype._doRender=function(t,e,n){var i=this.scene,r=this.camera;n=n||0,this._updateTransparent(t,i,r,n),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,i,r,!0)),this._updateShadowPCFKernel(n);var o,a=t.clearColor;(t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,r),this._compositor.updateNormal(t,i,r,this._temporalSS.getFrame())),this._updateSSAO(t,i,r,this._temporalSS.getFrame()),this._enablePostEffect)?((o=this._compositor.getSourceFrameBuffer()).bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(i,r,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,i,r,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,i,r,null,0))):this.needsTemporalSS()&&e?((o=this._temporalSS.getSourceFrameBuffer()).bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(i,r,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),t.render(i,r,!0,!0))},EH.prototype._updateTransparent=function(t,e,n,i){for(var r=new QN,o=new MR,a=n.getWorldPosition(),s=e.getRenderList(n).transparent,l=0;lthis.camera.far||t80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),l>a&&(a=l);u=Math.max(o-i,a-r)}return nU(d,f,n,i,r,u),f}function tU(t,e,n,i,r){var o,a;if(r===wU(t,e,n,i)>0)for(o=e;o=e;o-=i)a=_U(o,t[o],t[o+1],a);return a&&pU(a,a.next)&&(yU(a),a=a.next),a}function eU(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!pU(i,i.next)&&0!==fU(i.prev,i,i.next))i=i.next;else{if(yU(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function nU(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=uU(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?rU(t,i,r,o):iU(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),yU(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?nU(t=oU(t,e,n),e,n,i,r,o,2):2===a&&aU(t,e,n,i,r,o):nU(eU(t),e,n,i,r,o,1);break}}}function iU(t){var e=t.prev,n=t,i=t.next;if(fU(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(cU(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&fU(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function rU(t,e,n,i){var r=t.prev,o=t,a=t.next;if(fU(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=uU(s,l,e,n,i),d=uU(u,h,e,n,i),f=t.nextZ;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function oU(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!pU(r,o)&&gU(r,i,i.next,o)&&mU(r,o)&&mU(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),yU(i),yU(i.next),i=t=o),i=i.next}while(i!==t);return i}function aU(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&dU(a,s)){var l=vU(a,s);return a=eU(a,a.next),l=eU(l,l.next),nU(a,e,n,i,r,o),void nU(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function sU(t,e){return t.x-e.x}function lU(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&cU(on.x)&&mU(i,t)&&(n=i,d=l),i=i.next;return n}(t,e),e){var n=vU(e,t);eU(n,n.next)}}function uU(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function hU(t){var e=t,n=t;do{e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function dU(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&gU(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&mU(t,e)&&mU(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function fU(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function pU(t,e){return t.x===e.x&&t.y===e.y}function gU(t,e,n,i){return!!(pU(t,e)&&pU(n,i)||pU(t,i)&&pU(n,e))||fU(t,e,n)>0!=fU(t,e,i)>0&&fU(n,i,t)>0!=fU(n,i,e)>0}function mU(t,e){return fU(t.prev,t,t.next)<0?fU(t,e,t.next)>=0&&fU(t,t.prev,e)>=0:fU(t,e,t.prev)<0||fU(t,t.next,e)<0}function vU(t,e){var n=new xU(t.i,t.x,t.y),i=new xU(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function _U(t,e,n,i){var r=new xU(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function yU(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xU(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wU(t,e,n,i){for(var r=0,o=e,a=n-i;ol&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});var u;l=o[a].pivot+1;(u=o[a].right)>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}o=this._parts=s}else for(a=0;a=2e4},doSortTriangles:function(t,e){var n=this.indices;if(0===e){var i=this.attributes.position;t=t.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new n.constructor(n.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var r,o=0,a=0;a0,n={},i=0;i65535?new Uint32Array(3*a):new Uint16Array(3*a),d.material.shader!==e&&d.material.attachShader(e,!0),_V.setMaterialFromModel(e.__shading,d.material,t,n),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(o),this._vertexRangeOfDataIndex=new Uint32Array(2*(r-i))},_updateRegionMesh:function(t,e,n,i){for(var r=t.getData(),o=0,a=0,s=!1,l=this._polygonMesh,u=this._linesMesh,h=n;h0;b&&(w*=e.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,t,h,_,w,t.coordinateSystem.transform)),u.invisible=!b,u.material.set({color:m})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?_V.Mesh.CCW:_V.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=t.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(t){var e=t.getModel("debug.wireframe");if(e.get("show")){var n=_V.parseColor(e.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=xB.firstNotNull(e.get("lineStyle.width"),1),r=this._polygonMesh;r.geometry.generateBarycentric(),r.material.define("both","WIREFRAME_TRIANGLE"),r.material.set("wireframeLineColor",n),r.material.set("wireframeLineWidth",i)}},_onmousemove:function(t){var e=this._dataIndexOfVertex[t.triangle[0]];null==e&&(e=-1),e!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(e),this._labelsBuilder.updateLabels([e])),this._lastHoverDataIndex=e,this._polygonMesh.dataIndex=e},_onmouseout:function(t){t.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(t,e,n){var i=t.getModel("groundPlane",t);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var r=t.get("shading"),o=this._groundMaterials[r];o||(o=this._groundMaterials.lambert),_V.setMaterialFromModel(r,o,i,n),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",_V.parseColor(i.get("color"))),this._groundMesh.scale.set(e.size[0],e.size[2],1)}},_triangulation:function(t,e,n){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],o=t.coordinateSystem,a=e;a1?i:0,I[V][m]=C.points[H+2],l.set(r+V,I[V]),s?(N[0]=(C.points[H]*v[0]-_[0])/x,N[1]=(C.points[H+2]*v[m]-_[m])/x):(N[0]=(G?R:R+F)/x,N[1]=(I[V][g]*v[g]-_[g])/x),h.set(r+V,N)}kU.sub(P,I[1],I[0]),kU.sub(E,I[3],I[0]),kU.cross(O,P,E),kU.normalize(O,O);for(V=0;V<4;V++)u.set(r+V,O),f&&c.set(r+V,a);for(V=0;V<6;V++)p[3*o+V]=D[V]+r;r+=4,o+=2,R+=F}}return e.dirty(),{vertexOffset:r,triangleOffset:o}},_getRegionLinesInfo:function(t,e,n){var i=0,r=0;e.getRegionModel(t).getModel("itemStyle").get("borderWidth")>0&&e.getRegionPolygonCoords(t).forEach((function(t){var e=t.exterior,o=t.interiors;i+=n.getPolylineVertexCount(e),r+=n.getPolylineTriangleCount(e);for(var a=0;athis._endIndex)){e-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*e];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var t=this.getDisplacementTexture(),e=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==t||this._displacementScale!==e,this._displacementTexture=t,this._displacementScale=e},isDisplacementChanged:function(){return this._displacementChanged}});nt(tW.prototype,EV),nt(tW.prototype,OV),nt(tW.prototype,NV),nt(tW.prototype,qH);const eW=tW;var nW=Math.PI,iW=Math.sin,rW=Math.cos,oW=Math.tan,aW=Math.asin,sW=Math.atan2,lW=nW/180;var uW=23.4397*lW;function hW(t,e){return sW(iW(t)*rW(uW)-oW(e)*iW(uW),rW(t))}function cW(t,e,n){return sW(iW(t),rW(t)*iW(e)-oW(n)*rW(e))}function dW(t,e,n){return aW(iW(e)*iW(n)+rW(e)*rW(n)*rW(t))}function fW(t){var e,n,i=function(t){return lW*(357.5291+.98560028*t)}(t),r=function(t){return t+lW*(1.9148*iW(t)+.02*iW(2*t)+3e-4*iW(3*t))+102.9372*lW+nW}(i);return{dec:(e=r,n=0,aW(iW(n)*rW(uW)+rW(n)*iW(uW)*iW(e))),ra:hW(r,0)}}var pW={};pW.getPosition=function(t,e,n){var i=lW*-n,r=lW*e,o=function(t){return function(t){return t.valueOf()/864e5-.5+2440588}(t)-2451545}(t),a=fW(o),s=function(t,e){return lW*(280.16+360.9856235*t)-e}(o,i)-a.ra;return{azimuth:cW(s,r,a.dec),altitude:dW(s,r,a.dec)}};const gW=pW;_V.Shader.import(hV),_V.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const mW=Dp.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(t,e){this.groupGL=new _V.Node,this._sphereGeometry=new _V.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new _V.PlaneGeometry,this._earthMesh=new _V.Mesh({renderNormal:!0}),this._atmosphereMesh=new _V.Mesh,this._atmosphereGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.atmosphere.vertex"),_V.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=_V.Mesh.CW,this._lightRoot=new _V.Node,this._sceneHelper=new $V,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new GV({zr:e.getZr()}),this._control.init(),this._layerMeshes={}},render:function(t,e,n){var i=t.coordinateSystem,r=t.get("shading");i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var a="ecgl."+r;o.material&&o.material.shader.name===a||(o.material=_V.createMaterial(a)),_V.setMaterialFromModel(r,o.material,t,n),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(t){var e=o.material.get(t);e&&(e.flipY=!1)})),o.material.set("color",_V.parseColor(t.get("baseColor")));var s=.99*i.radius;if(o.scale.set(s,s,s),t.get("atmosphere.show")){o.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:t.get("atmosphere.glowPower")||6,glowColor:t.get("atmosphere.color")||"#ffffff"}),o.material.setUniforms({glowPower:t.get("atmosphere.innerGlowPower")||2,glowColor:t.get("atmosphere.color")||"#ffffff"});var l=t.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else o.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=o.material.setTextureImage("diffuseMap",t.get("baseTexture"),n,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",t.get("heightTexture"),n,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[t.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(t,n),this._displaceVertices(t,n),this._updateViewControl(t,n),this._updateLayers(t,n)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},_updateLayers:function(t,e){var n=t.coordinateSystem,i=t.get("layers"),r=n.radius,o=[],a=[],s=[],l=[];ct(i,(function(t){var i=new Ih(t),u=i.get("type"),h=_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8});if(h.surface&&h.surface.attachToMesh(this._earthMesh),"blend"===u){var c=i.get("blendTo"),d=xB.firstNotNull(i.get("intensity"),1);"emission"===c?(s.push(h),l.push(d)):(o.push(h),a.push(d))}else{var f=i.get("id"),p=this._layerMeshes[f];p||(p=this._layerMeshes[f]=new _V.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===i.get("shading")?(p.material=p.__lambertMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),p.__lambertMaterial=p.material):(p.material=p.__colorMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.color"),transparent:!0,depthMask:!1}),p.__colorMaterial=p.material),p.material.enableTexture("diffuseMap");var g=i.get("distance"),m=r+(null==g?n.radius/100:g);p.scale.set(m,m,m),r=m;var v=this._blankTexture||(this._blankTexture=_V.createBlankTexture("rgba(255, 255, 255, 0)"));p.material.set("diffuseMap",v),_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8},(function(t){t.surface&&t.surface.attachToMesh(p),p.material.set("diffuseMap",t),e.getZr().refresh()})),i.get("show")?this.groupGL.add(p):this.groupGL.remove(p)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",s.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",a),u.set("layerEmissiveMap",s),u.set("layerEmissionIntensity",l);var h=t.getModel("debug.wireframe");if(h.get("show")){u.define("both","WIREFRAME_TRIANGLE");var c=_V.parseColor(h.get("lineStyle.color")||"rgba(0,0,0,0.5)"),d=xB.firstNotNull(h.get("lineStyle.width"),1);u.set("wireframeLineWidth",d),u.set("wireframeLineColor",c)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(t,e){var n=t.coordinateSystem,i=t.getModel("viewControl"),r=(n.viewGL.camera,this);var o=this._control;o.setViewGL(n.viewGL);var a,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,a=l[1]),o.setFromViewControlModel(i,{baseDistance:n.radius,alpha:a,beta:s}),o.off("update"),o.on("update",(function(){e.dispatchAction({type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-n.radius,center:o.getCenter(),from:r.uid,globeId:t.id})}))},_displaceVertices:function(t,e){var n=t.get("displacementQuality"),i=t.get("debug.wireframe.show"),r=t.coordinateSystem;if(t.isDisplacementChanged()||n!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=n,this._showDebugWireframe=i;var o=this._sphereGeometry,a={low:100,medium:200,high:400,ultra:800}[n]||200,s=a/2;(o.widthSegments!==a||i)&&(o.widthSegments=a,o.heightSegments=s,o.build()),this._doDisplaceVertices(o,r),i&&o.generateBarycentric()}},_doDisplaceVertices:function(t,e){var n=t.attributes.position.value,i=t.attributes.texcoord0.value,r=t.__originalPosition;r&&r.length===n.length||((r=new Float32Array(n.length)).set(n),t.__originalPosition=r);for(var o=e.displacementWidth,a=e.displacementHeight,s=e.displacementData,l=0;l50&&(o=1e3);var a=[];EW.perspective(a,NW,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(a),this.viewGL.camera.decomposeProjectionMatrix();a=EW.identity([]);var s=this.dataToPoint(this.center);EW.scale(a,a,[1,-1,1]),EW.translate(a,a,[0,0,-t]),EW.rotateX(a,a,e),EW.rotateZ(a,a,-this.bearing/180*Math.PI),EW.translate(a,a,[-s[0]*this.getScale()*kW,-s[1]*this.getScale()*kW,0]),this.viewGL.camera.viewMatrix.array=a;var l=[];EW.invert(l,a),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var u,h=OW*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];u=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else u=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*kW;this.viewGL.rootNode.scale.set(this.getScale()*kW,this.getScale()*kW,u)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(t,e){return this.projectOnTileWithScale(t,this.getScale()*OW,e)},projectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1]*RW/180,o=e*(i*RW/180+RW)/(2*RW),a=e*(RW-Math.log(Math.tan(RW/4+.5*r)))/(2*RW);return(n=n||[])[0]=o,n[1]=a,n},unprojectFromTile:function(t,e){return this.unprojectOnTileWithScale(t,this.getScale()*OW,e)},unprojectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1],o=i/e*(2*RW)-RW,a=2*(Math.atan(Math.exp(RW-r/e*(2*RW)))-RW/4);return(n=n||[])[0]=180*o/RW,n[1]=180*a/RW,n},dataToPoint:function(t,e){return(e=this.projectOnTileWithScale(t,OW,e))[0]-=this._origin[0],e[1]-=this._origin[1],e[2]=isNaN(t[2])?0:t[2],isNaN(t[2])||(e[2]=t[2],this.altitudeExtent&&(e[2]-=this.altitudeExtent[0])),e}};const BW=zW;function FW(){BW.apply(this,arguments)}FW.prototype=new BW,FW.prototype.constructor=FW,FW.prototype.type="mapbox3D";function VW(t,e,n){function i(t,e){var n=e.getWidth(),i=e.getHeight(),r=e.getDevicePixelRatio();this.viewGL.setViewport(0,0,n,i,r),this.width=n,this.height=i,this.altitudeScale=t.get("altitudeScale"),this.boxHeight=t.get("boxHeight")}function r(t,e){if("auto"!==this.model.get("boxHeight")){var n=[1/0,-1/0];t.eachSeries((function(t){if(t.coordinateSystem===this){var e=t.getData(),i=t.coordDimToDataDim("alt")[0];if(i){var r=e.getDataExtent(i,!0);n[0]=Math.min(n[0],r[0]),n[1]=Math.max(n[1],r[1])}}}),this),n&&isFinite(n[1]-n[0])&&(this.altitudeExtent=n)}}return{dimensions:e.prototype.dimensions,create:function(o,a){var s=[];return o.eachComponent(t,(function(t){var n=t.__viewGL;n||(n=t.__viewGL=new NH).setRootNode(new _V.Node);var o=new e;o.viewGL=t.__viewGL,o.resize=i,o.resize(t,a),s.push(o),t.coordinateSystem=o,o.model=t,o.update=r})),o.eachSeries((function(e){if(e.get("coordinateSystem")===t){var n=e.getReferringComponents(t).models[0];if(n||(n=o.getComponent(t)),!n)throw new Error(t+' "'+xB.firstNotNull(e.get(t+"Index"),e.get(t+"Id"),0)+'" not found');e.coordinateSystem=n.coordinateSystem}})),n&&n(s,o,a),s}}}const GW=VW("mapbox3D",FW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMapboxCameraOption())}))}));Jw((function(t){t.registerComponentModel(CW),t.registerComponentView(PW),t.registerCoordinateSystem("mapbox3D",GW),t.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"mapbox3D",query:t},(function(e){e.setMapboxCameraOption(t)}))}))}));var HW=["zoom","center","pitch","bearing"],UW=Gc.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var t=this;return HW.reduce((function(e,n){return e[n]=t.get(n),e}),{})},setMaptalksCameraOption:function(t){null!=t&&HW.forEach((function(e){null!=t[e]&&(this.option[e]=t[e])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(t){this._maptalks=t}});nt(UW.prototype,OV),nt(UW.prototype,NV);const WW=UW;function jW(t,e,n,i){if(this.id=t,this.zr=e,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:n,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}jW.prototype.setUnpainted=function(){},jW.prototype.resize=function(){this._maptalks.checkSize()},jW.prototype.getMaptalks=function(){return this._maptalks},jW.prototype.clear=function(){},jW.prototype.refresh=function(){this._maptalks.checkSize()};var ZW=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];jW.prototype._initEvents=function(){var t=this.dom;this._handlers=this._handlers||{contextmenu:function(t){return t.preventDefault(),!1}},ZW.forEach((function(e){this._handlers[e]=function(n){var i={};for(var r in n)i[r]=n[r];i.bubbles=!1;var o=new n.constructor(n.type,i);"mousewheel"===e||"DOMMouseScroll"===e?t.dispatchEvent(o):t.firstElementChild.dispatchEvent(o)},this.zr.dom.addEventListener(e,this._handlers[e])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},jW.prototype.dispose=function(){ZW.forEach((function(t){this.zr.dom.removeEventListener(t,this._handlers[t])}),this),this._maptalks.remove()};const XW=jW;_V.Shader.import(IW);const qW=Dp.extend({type:"maptalks3D",__ecgl__:!0,init:function(t,e){this._groundMesh=new _V.Mesh({geometry:new _V.PlaneGeometry,material:new _V.Material({shader:new _V.Shader({vertex:_V.Shader.source("ecgl.displayShadow.vertex"),fragment:_V.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(t,e){var n=e.getZr();this._zrLayer=new XW("maptalks3D",n,t.get("center"),t.get("zoom")),n.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new _V.Node,this._sceneHelper=new $V(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),r=this._dispatchInteractAction.bind(this,e,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(t){i.on(t,r)}))},render:function(t,e,n){this._zrLayer||this._initMaptalksLayer(t,n);var i=this._zrLayer.getMaptalks(),r=t.get("urlTemplate"),o=i.getBaseLayer();r!==this._oldUrlTemplate&&(o?o.setOptions({urlTemplate:r,attribution:t.get("attribution")}):(o=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:r,subdomains:["a","b","c"],attribution:t.get("attribution")}),i.setBaseLayer(o))),this._oldUrlTemplate=r,i.setCenter(t.get("center")),i.setZoom(t.get("zoom"),{animation:!1}),i.setPitch(t.get("pitch")),i.setBearing(t.get("bearing")),t.setMaptalks(i);var a=t.coordinateSystem;a.viewGL.scene.add(this._lightRoot),a.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(a.viewGL.scene),this._sceneHelper.updateLight(t),a.viewGL.setPostEffect(t.getModel("postEffect"),n),a.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._maptalks3DModel=t},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n),t.coordinateSystem.viewGL.scene.traverse((function(t){t.material&&(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(t,e,n,i){t.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),n.getZr().refresh()},_dispatchInteractAction:function(t,e,n){var i;t.dispatchAction({type:"maptalks3DChangeCamera",pitch:e.getPitch(),zoom:(i=e.getResolution(),19-Math.log(i/YW)/Math.LN2+1),center:e.getCenter().toArray(),bearing:e.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var t=this._maptalks3DModel.coordinateSystem,e=t.dataToPoint(t.center);this._groundMesh.position.set(e[0],e[1],-.001);var n=new _V.Plane(new _V.Vector3(0,0,1),0),i=t.viewGL.camera.castRay(new _V.Vector2(-1,-1)),r=t.viewGL.camera.castRay(new _V.Vector2(1,1)),o=i.intersectPlane(n),a=r.intersectPlane(n),s=o.dist(a)/t.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(t,e){this._zrLayer&&this._zrLayer.dispose(),e.getZr().painter.delLayer(-1e3)}}),YW=12756274*Math.PI/(256*Math.pow(2,20));function KW(){BW.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}KW.prototype=new BW,KW.prototype.constructor=KW,KW.prototype.type="maptalks3D";const JW=VW("maptalks3D",KW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMaptalksCameraOption())}))}));Jw((function(t){t.registerComponentModel(WW),t.registerComponentView(qW),t.registerCoordinateSystem("maptalks3D",JW),t.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"maptalks3D",query:t},(function(e){e.setMaptalksCameraOption(t)}))}))}));var $W=UV.vec3,QW=jw.isDimensionStacked;const tj=function(t,e){var n=t.getData(),i=t.get("barSize");if(null==i){var r,o,a=e.size,s=e.getAxis("x"),l=e.getAxis("y");r="category"===s.type?.7*s.getBandWidth():.6*Math.round(a[0]/Math.sqrt(n.count())),o="category"===l.type?.7*l.getBandWidth():.6*Math.round(a[1]/Math.sqrt(n.count())),i=[r,o]}else yt(i)||(i=[i,i]);var u=e.getAxis("z").scale.getExtent(),h=function(t){var e=t[0],n=t[1];return!(e>0&&n>0||e<0&&n<0)}(u),c=["x","y","z"].map((function(e){return t.coordDimToDataDim(e)[0]})),d=QW(n,c[2]),f=d?n.getCalculationInfo("stackResultDimension"):c[2];n.each(c,(function(t,r,o,a){var s=n.get(f,a),l=d?s-o:h?0:u[0],c=e.dataToPoint([t,r,l]),p=e.dataToPoint([t,r,s]),g=$W.dist(c,p),m=[0,p[1]"+r.join("
")}(r):ze(mc(r)),a=i.getName(e),s=EU(i,e);St(s)&&s.colorStops&&(s=(s.colorStops[0]||{}).color);var l=Tc(s=s||"transparent"),u=t.name;return"\0-"===u&&(u=""),u=u?ze(u)+(n?": ":"
"):"",n?l+u+o:u+l+(a?ze(a)+": "+o:o)}function uj(t,e,n){n=n||t.getSource();var i=e||Hy(t.get("coordinateSystem"))||["x","y","z"],r=Lx(n,{dimensionsDefine:n.dimensionsDefine||t.get("dimensions"),encodeDefine:n.encodeDefine||t.get("encode"),coordDimensions:i.map((function(e){var n=t.getReferringComponents(e+"Axis3D").models[0];return{type:n&&"category"===n.get("type")?"ordinal":"float",name:e}}))});"cartesian3D"===t.get("coordinateSystem")&&r.forEach((function(e){if(i.indexOf(e.coordDim)>=0){var n=t.getReferringComponents(e.coordDim+"Axis3D").models[0];n&&"category"===n.get("type")&&(e.ordinalMeta=n.getOrdinalMeta())}}));var o=jw.enableDataStack(t,r,{byIndex:!0,stackedCoordDimension:"z"}),a=new Cx(r,t);return a.setCalculationInfo(o),a.initData(n),a}var hj=Lp.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);return null==r&&(r=this.getData().get("z",t)),r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"var(--ow-color-black)",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});nt(hj.prototype,qH);const cj=hj;var dj,fj,pj,gj,mj,vj,_j,yj,xj=UV.vec3,wj=UV.mat3,bj=xk.extend((function(){return{attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR"),prevPosition:new xk.Attribute("prevPosition","float",3),prevNormal:new xk.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(t){var e=this.enableNormal,n=this.getBarVertexCount()*t,i=this.getBarTriangleCount()*t;this.vertexCount!==n&&(this.attributes.position.init(n),e?this.attributes.normal.init(n):this.attributes.normal.value=null,this.attributes.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(n))},getBarVertexCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarVertexCount(t):this.enableNormal?24:8},getBarTriangleCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarTriangleCount(t):12},_getBevelBarVertexCount:function(t){return 4*(t+1)*(t+1)*2},_getBevelBarTriangleCount:function(t){return(4*t+3+1)*(2*t+1)*2+4},setColor:function(t,e){for(var n=this.getBarVertexCount(),i=n*(t+1),r=n*t;r0&&this.bevelSegments>0)this._addBevelBar(t,c,g,m,this.bevelSize,this.bevelSegments,v);else{xj.copy(r,c),xj.normalize(r,r),xj.cross(o,g,r),xj.normalize(o,o),xj.cross(i,r,o),xj.normalize(o,o),xj.negate(a,i),xj.negate(s,r),xj.negate(l,o),e(u[0],t,i,m[0]/2),e(u[0],u[0],o,m[2]/2),e(u[1],t,i,m[0]/2),e(u[1],u[1],l,m[2]/2),e(u[2],t,a,m[0]/2),e(u[2],u[2],l,m[2]/2),e(u[3],t,a,m[0]/2),e(u[3],u[3],o,m[2]/2),e(n,t,r,m[1]),e(u[4],n,i,m[0]/2),e(u[4],u[4],o,m[2]/2),e(u[5],n,i,m[0]/2),e(u[5],u[5],l,m[2]/2),e(u[6],n,a,m[0]/2),e(u[6],u[6],l,m[2]/2),e(u[7],n,a,m[0]/2),e(u[7],u[7],o,m[2]/2);var x=this.attributes;if(this.enableNormal){h[0]=i,h[1]=a,h[2]=r,h[3]=s,h[4]=o,h[5]=l;for(var w=this._vertexOffset,b=0;b0&&(f++,h[3]<.99&&(p=!0))}})),a.geometry.setBarCount(f);var g=n.getLayout("orient"),m=this._barIndexOfData=new Int32Array(n.count());f=0;n.each((function(t){if(n.hasValue(t)){var e=n.getItemLayout(t),i=e[0],r=e[1],a=e[2],s=4*t;h[0]=c[s++],h[1]=c[s++],h[2]=c[s++],h[3]=c[s++],h[3]>0&&(o._barMesh.geometry.addBar(i,r,g,a,h,t),m[t]=f++)}else m[t]=-1})),a.geometry.dirty(),a.geometry.updateBoundingBox();var v=a.material;v.transparent=p,v.depthMask=!p,a.geometry.sortTriangles=p,this._initHandler(t,e)},_initHandler:function(t,e){var n=t.getData(),i=this._barMesh,r="cartesian3D"===t.coordinateSystem.type;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=i.geometry.getDataIndexOfVertex(t.triangle[0]);a!==o&&(this._downplay(o),this._highlight(a),this._labelsBuilder.updateLabels([a]),r&&e.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get("x",a),n.get("y",a),n.get("z",a,!0)]})),o=a,i.dataIndex=a}),this),i.on("mouseout",(function(t){this._downplay(o),this._labelsBuilder.updateLabels(),o=-1,i.dataIndex=-1,r&&e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=e.getItemModel(t).getModel("emphasis.itemStyle"),r=i.get("color"),o=i.get("opacity");if(null==r)r=zi(EU(e,t),-.4);null==o&&(o=OU(e,t));var a=_V.parseColor(r);a[3]*=o,this._barMesh.geometry.setColor(n,a),this._api.getZr().refresh()}}},_downplay:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=EU(e,t),r=OU(e,t),o=_V.parseColor(i);o[3]*=r,this._barMesh.geometry.setColor(n,o),this._api.getZr().refresh()}}},highlight:function(t,e,n,i){this._toggleStatus("highlight",t,e,n,i)},downplay:function(t,e,n,i){this._toggleStatus("downplay",t,e,n,i)},_toggleStatus:function(t,e,n,i,r){var o=e.getData(),a=xB.queryDataIndex(o,r),s=this;null!=a?ct(sj.normalizeToArray(a),(function(e){"highlight"===t?this._highlight(e):this._downplay(e)}),this):o.each((function(e){"highlight"===t?s._highlight(e):s._downplay(e)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Mj),t.registerSeriesModel(cj),oj(t),t.registerProcessor((function(t,e){t.eachSeriesByType("bar3d",(function(t){var e=t.getData();e.filterSelf((function(t){return e.hasValue(t)}))}))}))}));const Cj=Lp.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(t,e){return uj(this)},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Lj(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||o=0){var m=3*l,v=new QN(this._points[m],this._points[m+1],this._points[m+2]);o.push({dataIndex:l,point:v,pointWorld:v.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(v)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Dj),t.registerSeriesModel(Cj),t.registerLayout((function(t,e){t.eachSeriesByType("line3D",(function(t){var e=t.getData(),n=t.coordinateSystem;if(n){if("cartesian3D"!==n.type)return void 0;var i=new Float32Array(3*e.count()),r=[],o=[],a=n.dimensions.map((function(e){return t.coordDimToDataDim(e)[0]}));n&&e.each(a,(function(t,e,a,s){r[0]=t,r[1]=e,r[2]=a,n.dataToPoint(r,o),i[3*s]=o[0],i[3*s+1]=o[1],i[3*s+2]=o[2]})),e.setLayout("points",i)}}))}))}));const Ij=Lp.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"var(--ow-color-black)",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Pj(t,e,n){(e=e||document.createElement("canvas")).width=t,e.height=t;var i=e.getContext("2d");return n&&n(i),e}var Ej={getMarginByStyle:function(t){var e=t.minMargin||0,n=0;t.stroke&&"none"!==t.stroke&&(n=null==t.lineWidth?1:t.lineWidth);var i=t.shadowBlur||0,r=t.shadowOffsetX||0,o=t.shadowOffsetY||0,a={};return a.left=Math.max(n/2,-r+i,e),a.right=Math.max(n/2,r+i,e),a.top=Math.max(n/2,-o+i,e),a.bottom=Math.max(n/2,o+i,e),a},createSymbolSprite:function(t,e,n,i){var r=function(t,e,n,i){yt(e)||(e=[e,e]);var r=Ej.getMarginByStyle(n,i),o=e[0]+r.left+r.right,a=e[1]+r.top+r.bottom,s=jv(t,0,0,e[0],e[1]),l=Math.max(o,a);s.x=r.left,s.y=r.top,o>a?s.y+=(l-a)/2:s.x+=(l-o)/2;var u=s.getBoundingRect();return s.x-=u.x,s.y-=u.y,s.setStyle(n),s.update(),s.__size=l,s}(t,e,n),o=Ej.getMarginByStyle(n);return{image:Pj(r.__size,i,(function(t){v_(t,r)})),margin:o}},createSDFFromCanvas:function(t,e,n,i){return Pj(e,i,(function(e){var i=t.getContext("2d").getImageData(0,0,t.width,t.height);e.putImageData(function(t,e,n){var i=e.width,r=e.height,o=t.canvas.width,a=t.canvas.height,s=i/o,l=r/a;function u(t){return t<128?1:-1}function h(t,o){var a=1/0;t=Math.floor(t*s);for(var h=(o=Math.floor(o*l))*i+t,c=u(e.data[4*h]),d=Math.max(o-n,0);d=2e4},doSortVertices:function(t,e){var n=this.indices,i=Nj.create();if(!n){n=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var r=0;r.05);else for(r=0;r<3;r++)this._progressiveQuickSort(3*e+r);this.dirtyIndices()},_simpleSort:function(t){var e=this._zList,n=this.indices;function i(t,n){return e[n]-e[t]}t?Array.prototype.sort.call(n,i):CU.sort(n,i,0,n.length-1)},_progressiveQuickSort:function(t){var e=this._zList,n=this.indices;this._quickSort=this._quickSort||new CU,this._quickSort.step(n,(function(t,n){return e[n]-e[t]}),t)}};var kj=UV.vec4;_V.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");var zj=_V.Mesh.extend((function(){var t=new _V.Geometry({dynamic:!0,attributes:{color:new _V.Geometry.Attribute("color","float",4,"COLOR"),position:new _V.Geometry.Attribute("position","float",3,"POSITION"),size:new _V.Geometry.Attribute("size","float",1),prevPosition:new _V.Geometry.Attribute("prevPosition","float",3),prevSize:new _V.Geometry.Attribute("prevSize","float",1)}});Object.assign(t,Rj);var e=new _V.Material({shader:_V.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});e.enableTexture("sprite"),e.define("both","VERTEX_COLOR"),e.define("both","VERTEX_SIZE");var n=new _V.Texture2D({image:document.createElement("canvas"),flipY:!1});return e.set("sprite",n),t.pick=this._pick.bind(this),{geometry:t,material:e,mode:_V.Mesh.POINTS,sizeScale:1}}),{_pick:function(t,e,n,i,r,o){var a=this._positionNDC;if(a)for(var s=n.viewport,l=2/s.width,u=2/s.height,h=this.geometry.vertexCount-1;h>=0;h--){var c,d=a[2*(c=this.geometry.indices?this.geometry.indices[h]:h)],f=a[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(t>d-p*l&&tf-p*u&&e2?(p=this._updateSymbolSprite(t,d,h,c),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(r-i);var g=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var m=function(t){const e=t.getVisual("style");if(e)return e[t.getVisual("drawType")]}(a),v=function(t){return t.getVisual("style").opacity}(a);_V.parseColor(m,g),g[3]*=v,s.set({color:g,u_Size:h.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(r-i),u.color.init(r-i),this._originalOpacity=new Float32Array(r-i);for(var _=a.getLayout("points"),y=u.position.value,x=0;x1?(a[0]=n.maxSize,a[1]=n.maxSize/n.aspect):(a[1]=n.maxSize,a[0]=n.maxSize*n.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===n.type&&(r=this._symbolSize,o=a,r&&o&&r[0]===o[0]&&r[1]===o[1])&&this._lineWidth===e.lineWidth||(Oj.createSymbolSprite(n.type,a,{fill:"#fff",lineWidth:e.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),Oj.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=n.type,this._symbolSize=a,this._lineWidth=e.lineWidth),this._spriteImageCanvas.width/n.maxSize*i},_updateMaterial:function(t,e){var n="lighter"===t.get("blendMode")?_V.additiveBlend:null,i=this._mesh.material;i.blend=n,i.set("lineWidth",e.lineWidth/20);var r=_V.parseColor(e.stroke);i.set("strokeColor",r),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(t,e,n){var i=t.getData(),r=this._mesh.geometry,o=r.attributes.position.value,a=(e=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,e,n),this._labelsBuilder.getLabelPosition=function(t,n,i){var r=3*(t-e);return[o[r],o[r+1],o[r+2]]},this._labelsBuilder.getLabelDistance=function(t,n,i){return r.attributes.size.get(t-e)/a/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,t)},_updateHandler:function(t,e,n){var i,r=t.getData(),o=this._mesh,a=this,s=-1,l=t.coordinateSystem&&"cartesian3D"===t.coordinateSystem.type;l&&(i=t.coordinateSystem.model),o.seriesIndex=t.seriesIndex,o.off("mousemove"),o.off("mouseout"),o.on("mousemove",(function(e){var u=e.vertexIndex+a._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(r,s),this.highlight(r,u),this._labelsBuilder.updateLabels([u])),l&&n.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get(t.coordDimToDataDim("x")[0],u),r.get(t.coordDimToDataDim("y")[0],u),r.get(t.coordDimToDataDim("z")[0],u)],grid3DIndex:i.componentIndex})),o.dataIndex=u,s=u}),this),o.on("mouseout",(function(t){var e=t.vertexIndex+a._startDataIndex;this.highlightOnMouseover&&(this.downplay(r,e),this._labelsBuilder.updateLabels()),s=-1,o.dataIndex=-1,l&&n.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(t,e,n){var i=t.getData();if(this._mesh){var r=this._mesh.geometry.attributes.position.value,o=i.getLayout("points");if(this.is2D)for(var a=0;athis._endDataIndex||ethis._endDataIndex||e 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const lZ=_V.Mesh.extend((function(){var t=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.trail2.vertex"),_V.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),e=new XV({dynamic:!0});return e.createAttribute("dist","float",1),e.createAttribute("distAll","float",1),e.createAttribute("start","float",1),{geometry:e,material:t,culling:!1,$ignorePicking:!0}}),{updateData:function(t,e,n){var i=t.hostModel,r=this.geometry,o=i.getModel("effect"),a=o.get("trailWidth")*e.getDevicePixelRatio(),s=o.get("trailLength"),l=i.get("effect.constantSpeed"),u=1e3*i.get("effect.period"),h=null!=l;h?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[h?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");r.trailLength=s,this.material.set("trailLength",s),r.resetOffset(),["position","positionPrev","positionNext"].forEach((function(t){r.attributes[t].value=n.attributes[t].value}));["dist","distAll","start","offset","color"].forEach((function(t){r.attributes[t].init(r.vertexCount)})),r.indices=n.indices;var d=[],f=o.get("trailColor"),p=o.get("trailOpacity"),g=null!=f,m=null!=p;this.updateWorldTransform();var v=this.worldTransform.x.len(),_=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,w=0;t.each((function(e){var i=t.getItemLayout(e),o=m?p:OU(t,e),s=EU(t,e);null==o&&(o=1),(d=_V.parseColor(g?f:s,d))[3]*=o;for(var l=c?n.getPolylineVertexCount(i):n.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),b=0,T=[],S=[],M=x;Mx&&(b+=sZ.dist(T,S)),r.attributes.dist.set(M,b),sZ.copy(S,T);w=Math.max(w,b);var C=Math.random()*(h?b:u);for(M=x;M0?1:-1)*a/2),r.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*w*s),this.material.set("spotIntensity",o.get("spotIntensity")),r.dirty()},setAnimationTime:function(t){this.material.set("time",t)}});_V.Shader.import(gG);const uZ=Fm.extend({type:"lines3D",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this._meshLinesMaterial=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new _V.Mesh({geometry:new XV,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new lZ},render:function(t,e,n){this.groupGL.add(this._linesMesh);var i=t.coordinateSystem,r=t.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(t,e,n);var o=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var a=this._trailMesh;if(a.stopAnimation(),t.get("effect.show")){this.groupGL.add(a),a.updateData(r,n,this._linesMesh.geometry),a.__time=a.__time||0;var s=36e5;this._curveEffectsAnimator=a.animate("",{loop:!0}).when(s,{__time:s}).during((function(){a.setAnimationTime(a.__time)})).start()}else this.groupGL.remove(a),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===t.get("blendMode")?_V.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var t=this._curveEffectsAnimator;t&&(t.isPaused()?t.resume():t.pause())},_updateLines:function(t,e,n){var i=t.getData(),r=t.coordinateSystem,o=this._linesMesh.geometry,a=t.get("polyline");o.expandLine=!0;var s=function(t){return null!=t.radius?t.radius:null!=t.size?Math.max(t.size[0],t.size[1],t.size[2]):100}(r);o.segmentScale=s/20;var l="lineStyle.width".split("."),u=n.getDevicePixelRatio(),h=0;i.each((function(t){var e=i.getItemModel(t).get(l);null==e&&(e=1),i.setItemVisual(t,"lineWidth",e),h=Math.max(e,h)})),o.useNativeLine=!1;var c=0,d=0;i.each((function(t){var e=i.getItemLayout(t);a?(c+=o.getPolylineVertexCount(e),d+=o.getPolylineTriangleCount(e)):(c+=o.getCubicCurveVertexCount(e[0],e[1],e[2],e[3]),d+=o.getCubicCurveTriangleCount(e[0],e[1],e[2],e[3]))})),o.setVertexCount(c),o.setTriangleCount(d),o.resetOffset();var f=[];i.each((function(t){var e=i.getItemLayout(t),n=EU(i,t),r=OU(i,t),s=i.getItemVisual(t,"lineWidth")*u;null==r&&(r=1),(f=_V.parseColor(n,f))[3]*=r,a?o.addPolyline(e,f,s):o.addCubicCurve(e[0],e[1],e[2],e[3],f,s)})),o.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function hZ(t,e){for(var n=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,t,h,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",_V.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(t,n),this._updateAnimation(t)},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new _V.Mesh({geometry:new _V.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.sm.depth.vertex"),_V.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,PU),t},_initHandler:function(t,e){var n=t.getData(),i=this._surfaceMesh,r=t.coordinateSystem;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=function(t,e){for(var n=1/0,r=-1,o=[],a=0;a=0){var s=[];i.geometry.attributes.position.get(a,s);for(var l=r.pointToData(s),u=1/0,h=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(g-1)*6),b=function(t,e,n){n[1]=t*g+e,n[0]=t*g+e+1,n[3]=(t+1)*g+e+1,n[2]=(t+1)*g+e},T=!1;if(l){var S=[],M=[],C=0;m?h.init(r.vertexCount):h.value=null;for(var L=[[],[],[]],A=[],D=[],I=mZ.create(),P=function(t,e,n){var i=3*e;return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n},E=new Float32Array(a.length),O=new Float32Array(a.length/3*4),N=0;N0;){if(Math.floor(s/h)===s/h)return[h,s/h];h--}return[h=Math.floor(Math.sqrt(s)),h]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function _Z(t,e){for(var n=[],i=0;i "+f)),h++)}var p=Lx(t,{coordDimensions:["value"]});(s=new Cx(p,n)).initData(t);var g=new Cx(["value"],n);return g.initData(u,l),r&&r(s,g),CZ({mainData:s,struct:o,structAttr:"graph",datas:{node:s,edge:g},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(i,n,this,!0,(function(t,n){t.wrapMethod("getItemModel",(function(t){const e=r._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));const i=e.getModel([]).getModel;function o(t,e){const n=i.call(this,t,e);return n.resolveParentPath=a,n}function a(t){if(t&&("label"===t[0]||"label"===t[1])){const e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}n.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=a,t.getModel=o,t}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),l=ze(l.join(" > ")),r.value&&(l+=" : "+ze(r.value)),l}return LZ.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=(this.option.categories||[]).map((function(t){return null!=t.value?t:Object.assign({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t,!0)}))},setView:function(t){null!=t.zoom&&(this.option.zoom=t.zoom),null!=t.offset&&(this.option.offset=t.offset)},setNodePosition:function(t){for(var e=0;e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(DZ.dist(t,e)+DZ.dist(n,e)+DZ.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(IZ)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(IZ)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?0:2*(e-1)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=e[0],u=e[1],h=n[0],c=n[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(t,e,n,i),g=p*p,m=g*p,v=3*p,_=3*g,y=6*g,x=6*m,w=a-2*l+h,b=s-2*u+c,T=3*(l-h)-a+d,S=3*(u-c)-s+f,M=a,C=s,L=(l-a)*v+w*_+T*m,A=(u-s)*v+b*_+S*m,D=w*y+T*x,I=b*y+S*x,P=T*x,E=S*x,O=0,N=0,R=Math.ceil(1/p),k=new Float32Array(3*(R+1)),z=(k=[],0);for(N=0;N1&&(M=L>0?Math.min(M,d):Math.max(M,d),C=A>0?Math.min(C,f):Math.max(C,f));this.addPolyline(k,r,o)},addLine:function(t,e,n,i){this.addPolyline([t,e],n,i)},addPolyline:function(){var t=DZ.create(),e=DZ.create(),n=DZ.create(),i=DZ.create(),r=[],o=[],a=[];return function(s,l,u,h,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==h&&(h=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,g=this.attributes.position,m=this.attributes.color,v=this.attributes.offset,_=this.attributes.normal,y=this.indices,x=this._vertexOffset,w=0;w1&&(g.copy(x,x-1),m.copy(x,x-1),x++);else{var S;if(w0){DZ.sub(t,r,a),DZ.sub(e,o,r),DZ.normalize(t,t),DZ.normalize(e,e),DZ.add(i,t,e),DZ.normalize(i,i);var M=u/2*Math.min(1/DZ.dot(t,i),2);n[0]=-i[1],n[1]=i[0],S=M}else DZ.sub(t,o,r),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],S=u/2}else DZ.sub(t,r,a),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],S=u/2;_.set(x,n),_.set(x+1,n),v.set(x,S),v.set(x+1,-S),DZ.copy(a,r),g.set(x,r),g.set(x+1,r),m.set(x,f),m.set(x+1,f),x+=2}if(this.useNativeLine)m.set(x,f),g.set(x,r),x++;else if(w>0){var C=3*this._faceOffset;(y=this.indices)[C]=x-4,y[C+1]=x-3,y[C+2]=x-2,y[C+3]=x-3,y[C+4]=x-1,y[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=t 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var OZ={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function NZ(t){var e={type:_V.Texture.FLOAT,minFilter:_V.Texture.NEAREST,magFilter:_V.Texture.NEAREST};this._positionSourceTex=new _V.Texture2D(e),this._positionSourceTex.flipY=!1,this._positionTex=new _V.Texture2D(e),this._positionPrevTex=new _V.Texture2D(e),this._forceTex=new _V.Texture2D(e),this._forcePrevTex=new _V.Texture2D(e),this._weightedSumTex=new _V.Texture2D(e),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new _V.Texture2D(e),this._globalSpeedPrevTex=new _V.Texture2D(e),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new aB({fragment:_V.Shader.source("clay.compositor.output")});var n=function(t){t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE)};this._edgeForceMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node1:new _V.Geometry.Attribute("node1","float",2),node2:new _V.Geometry.Attribute("node2","float",2),weight:new _V.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._weightedSumMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._framebuffer=new Sz({depthBuffer:!1}),this._dummyCamera=new _V.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}NZ.prototype.updateOption=function(t){for(var e in OZ)this[e]=OZ[e];var n=this._nodes.length;if(this.jitterTolerence=n>5e4?10:n>5e3?1:.1,this.scaling=n>100?2:10,t)for(var e in OZ)null!=t[e]&&(this[e]=t[e]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,r=0;rt},NZ.prototype._swapTexture=function(){var t=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=t;t=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=t;t=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=t},NZ.prototype._initFromSource=function(t){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(t),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(t),t.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(t)},NZ.prototype._resize=function(t,e){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(n){this[n].width=t,this[n].height=e,this[n].dirty()}),this)},NZ.prototype.dispose=function(t){this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.dispose(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.dispose(t),this._globalSpeedPrevTex.dispose(t)};const RZ=NZ;const kZ=function(){var t=function(){return new Float32Array(2)},e=function(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)},n=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t},r=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},o=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},a=function(t,e){return t[0]=e[0],t[1]=e[1],t},s=function(t,e,n){return t[0]=e,t[1]=n,t};function l(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var u=l.prototype;function h(){this.position=new Float32Array(2),this.force=t(),this.forcePrev=t(),this.mass=1,this.inDegree=0,this.outDegree=0}function c(t,e){this.source=t,this.target=e,this.weight=1}function d(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new l,this.rootRegion.centerOfMass=t(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}u.beforeUpdate=function(){for(var t=0;t=t&&this.bbox[1]<=e&&this.bbox[3]>=e},u.setBBox=function(t,e,n,i){this.bbox[0]=t,this.bbox[1]=e,this.bbox[2]=n,this.bbox[3]=i,this.size=(n-t+i-e)/2},u._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new l,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},u._addNodeToSubRegion=function(t){var e=this.findSubRegion(t.position[0],t.position[1]),n=this.bbox;if(!e){var i=(n[0]+n[2])/2,r=(n[1]+n[3])/2,o=(n[2]-n[0])/2,a=(n[3]-n[1])/2,s=t.position[0]>=i?1:0,l=t.position[1]>=r?1:0;(e=this._newSubRegion()).setBBox(s*o+n[0],l*a+n[1],(s+1)*o+n[0],(l+1)*a+n[1])}e.addNode(t)},u._updateCenterOfMass=function(t){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var e=this.centerOfMass[0]*this.mass,n=this.centerOfMass[1]*this.mass;e+=t.position[0]*t.mass,n+=t.position[1]*t.mass,this.mass+=t.mass,this.centerOfMass[0]=e/this.mass,this.centerOfMass[1]=n/this.mass};var f=d.prototype;f.initNodes=function(t,e,n){var i=e.length;this.nodes.length=0;for(var r=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(h):this.applyNodeGravity(h))}for(l=0;l0&&(m=Math.min(m/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=m;for(l=0;l0&&(_=Math.min(y*_,10)/y,i(u.position,u.position,u.force,_))}},f.applyRegionToNodeRepulsion=function(){var e=t();return function(t,n){if(t.node)this.applyNodeToNodeRepulsion(t.node,n,!0);else{o(e,n.position,t.centerOfMass);var r=e[0]*e[0]+e[1]*e[1];if(r>this.barnesHutTheta*t.size*t.size){var a=this.scaling*n.mass*t.mass/r;i(n.force,n.force,e,a)}else for(var s=0;s0)s=this.scaling*t.mass*n.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*t.mass*n.mass}}else s=this.scaling*t.mass*n.mass/a;i(t.force,t.force,e,s),i(n.force,n.force,e,-s)}}}}(),f.applyEdgeAttraction=function(){var e=t();return function(t){var r=t.source,a=t.target;o(e,r.position,a.position);var s,l,u=n(e);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence),this.preventOverlap&&(u=u-r.size-a.size)<=0||(l=this.linLogMode?-s*Math.log(u+1)/(u+1):-s,i(r.force,r.force,e,l),i(a.force,a.force,e,-l))}}(),f.applyNodeGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position);var r=n(e);i(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),f.applyNodeStrongGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position),i(t.force,t.force,e,this.gravity*t.mass)}}(),f.updateBBox=function(){for(var t=1/0,e=1/0,n=-1/0,i=-1/0,r=0;r5e4?10:o>5e3?1:.1,e.scaling=o>100?2:10,e.barnesHutOptimize=o>1e3,t)for(var n in BZ)null!=t[n]&&(e[n]=t[n]);if(!e.gravityCenter){for(var a=[1/0,1/0],s=[-1/0,-1/0],l=0;lt},FZ.prototype.getNodePosition=function(t,e){if(e||(e=new Float32Array(2*this._nodes.length)),this._positionArr)for(var n=0;n0?1.1:.9,o=Math.max(Math.min(this._zoom*r,this.maxZoom),this.minZoom);r=o/this._zoom;var a=this._convertPos(n,i),s=(a.x-this._dx)*(r-1),l=(a.y-this._dy)*(r-1);this._dx-=s,this._dy-=l,this._zoom=o,this._needsUpdate=!0}}},dispose:function(){var t=this.zr;t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("globalout",this._mouseUpHandler),t.animation.off("frame",this._update)}});const HZ=GZ;var UZ=UV.vec2;_V.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var WZ=1;const jZ=Fm.extend({type:"graphGL",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this.viewGL=new NH("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Vj(!0,e),this._forceEdgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2),color:new _V.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:_V.Mesh.LINES}),this._edgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new EZ({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new HZ({zr:e.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(t,e,n){this.groupGL.add(this._pointsBuilder.rootNode),this._model=t,this._api=n,this._initLayout(t,e,n),this._pointsBuilder.update(t,e,n),this._forceLayoutInstance instanceof RZ||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(t,n),this._control.off("update"),this._control.on("update",(function(){n.dispatchAction({type:"graphGLRoam",seriesId:t.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(xB.firstNotNull(t.get("zoom"),1)),this._control.setOffset(t.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),n.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,t.get("focusNodeAdjacency")){var r=t.get("focusNodeAdjacencyOn");"click"===r?n.getZr().on("click",this._clickHandler):"mouseover"===r&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?e!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._mouseOutHandler(t),this._lastMouseOverDataIndex=e}},_mouseOutHandler:function(t){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(t,e){var n=this._forceEdgesMesh.geometry,i=e.getEdgeData(),r=0,o=this._forceLayoutInstance,a=2*i.count();n.attributes.node.init(a),n.attributes.color.init(a),i.each((function(e){var a=t[e];n.attributes.node.set(r,o.getNodeUV(a.node1)),n.attributes.node.set(r+1,o.getNodeUV(a.node2));var s=EU(i,a.dataIndex),l=_V.parseColor(s);l[3]*=xB.firstNotNull(OU(i,a.dataIndex),1),n.attributes.color.set(r,l),n.attributes.color.set(r+1,l),r+=2})),n.dirty()},_updateMeshLinesGeometry:function(){var t=this._model.getEdgeData(),e=this._edgesMesh.geometry,n=(t=this._model.getEdgeData(),this._model.getData().getLayout("points"));e.resetOffset(),e.setVertexCount(t.count()*e.getLineVertexCount()),e.setTriangleCount(t.count()*e.getLineTriangleCount());var i=[],r=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*t.count()),this._edgeIndicesMap=new Float32Array(t.count()),t.each((function(a){var s=t.graph.getEdgeByIndex(a),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;i[0]=n[l],i[1]=n[l+1],r[0]=n[u],r[1]=n[u+1];var h=EU(t,s.dataIndex),c=_V.parseColor(h);c[3]*=xB.firstNotNull(OU(t,s.dataIndex),1);var d=t.getItemModel(s.dataIndex),f=xB.firstNotNull(d.get(o),1)*this._api.getDevicePixelRatio();e.addLine(i,r,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=a}),this),e.dirty()},_updateForceNodesGeometry:function(t){for(var e=this._pointsBuilder.getPointsMesh(),n=[],i=0;i=f&&(l._syncNodePosition(t),d=0),n.getZr().refresh(),yV((function(){p(e)}))}))};yV((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(r.layer.renderer),l._forceLayoutInstanceToDispose=null),p(u)})),this._layouting=!0}}},stopLayout:function(t,e,n,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(t),this._updateAfterLayout(t,e,n)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(t){var e=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);t.getData().setLayout("points",e),t.setNodePosition(e)},_updateAfterLayout:function(t,e,n){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(t,e,n),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(t,e,n,i){var r=this._model.getData();this._downplayAll();var o=i.dataIndex,a=r.graph,s=[],l=a.getNodeByIndex(o);s.push(l),l.edges.forEach((function(t){t.dataIndex<0||(t.node1!==l&&s.push(t.node1),t.node2!==l&&s.push(t.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(t){this._pointsBuilder.highlight(r,t.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(t){return t.dataIndex})));var u=[];l.edges.forEach((function(t){t.dataIndex>=0&&(this._highlightEdge(t.dataIndex),u.push(t))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(t,e,n,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(t){var e=this._model.getEdgeData().getItemModel(t),n=_V.parseColor(e.get("emphasis.lineStyle.color")||e.get("lineStyle.color")),i=xB.firstNotNull(e.get("emphasis.lineStyle.opacity"),e.get("lineStyle.opacity"),1);n[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],n)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(t){this._pointsBuilder.downplay(this._model.getData(),t.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(t){this._downplayEdge(t.dataIndex)}),this)},_downplayEdge:function(t){var e=this._getColor(t,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)},_setEdgeFade:function(){var t=[];return function(e,n){this._getColor(e,t),t[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)}}(),_getColor:function(t,e){for(var n=0;n<4;n++)e[n]=this._originalEdgeColors[4*t+n];return e},_fadeOutEdgesAll:function(t){this._model.getData().graph.eachEdge((function(e){this._setEdgeFade(e.dataIndex,t)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(t,e){this.viewGL.setViewport(0,0,e.getWidth(),e.getHeight(),e.getDevicePixelRatio());for(var n=this.viewGL.camera,i=t.getData().getLayout("points"),r=UZ.create(1/0,1/0),o=UZ.create(-1/0,-1/0),a=[],s=0;sn.left&&un.top)){var h=Math.max(o[0]-r[0],10),c=h/e.getWidth()*e.getHeight();h*=1.4,c*=1.4,r[0]-=.2*h,n.left=r[0],n.top=l-c/2,n.bottom=l+c/2,n.right=h+r[0],n.near=0,n.far=100}},dispose:function(){var t=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(t),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});function ZZ(t){return t instanceof Array||(t=[t,t]),t}Jw((function(t){function e(){}t.registerChartView(jZ),t.registerSeriesModel(AZ),t.registerVisual((function(t){const e={};t.eachSeriesByType("graphGL",(function(t){var n=t.getCategoriesData(),i=t.getData(),r={};n.each((function(i){var o=n.getName(i);r["ec-"+o]=i;var a=n.getItemModel(i),s=a.getModel("itemStyle").getItemStyle();s.fill||(s.fill=t.getColorFromPalette(o,e)),n.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(t){var e=this._vertexOffset;this.attributes.position.set(e,[t[0],t[1],1]),this.attributes.position.set(e+1,[t[0],t[1],-1]),this.attributes.position.set(e+2,[t[0],t[1],2]),this.attributes.position.set(e+3,[t[0],t[1],-2]),this.setTriangleIndices(this._faceOffset++,[e,e+1,e+2]),this.setTriangleIndices(this._faceOffset++,[e+1,e+2,e+3]),this._vertexOffset+=4}});LN.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var YZ=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new sk({type:QR.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};YZ.prototype={constructor:YZ,init:function(){var t={type:QR.FLOAT,minFilter:QR.NEAREST,magFilter:QR.NEAREST,useMipmap:!1};this._spawnTexture=new sk(t),this._particleTexture0=new sk(t),this._particleTexture1=new sk(t),this._frameBuffer=new Sz({depthBuffer:!1}),this._particlePass=new aB({fragment:LN.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new aB({fragment:LN.source("clay.compositor.downsample")});var e=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderPoints.vertex"),LN.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:ek.POINTS,geometry:new xk({dynamic:!0,mainAttribute:"texcoord0"})}),n=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderLines.vertex"),LN.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new qZ,culling:!1}),i=new ek({material:new HO({shader:new LN(LN.source("ecgl.color.vertex"),LN.source("ecgl.color.fragment"))}),geometry:new Dz});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=e,this._particleLinesMesh=n,this._lastFrameFullQuadMesh=i,this._camera=new nB,this._thisFrameTexture=new sk,this._lastFrameTexture=new sk},setParticleDensity:function(t,e){for(var n=new Float32Array(4*(t*e)),i=0,r=this.particleLife,o=0;o0?t[t.length-1]:this._lastFrameTexture},setRegion:function(t){this._particlePass.setUniform("region",t)},resize:function(t,e){this._lastFrameTexture.width=t*this._supersampling,this._lastFrameTexture.height=e*this._supersampling,this._thisFrameTexture.width=t*this._supersampling,this._thisFrameTexture.height=e*this._supersampling,this._width=t,this._height=e},setParticleSize:function(t){var e=this._getParticleMesh();if(t<=2)return e.material.disableTexture("spriteTexture"),void(e.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new sk),this._spriteTexture.image&&this._spriteTexture.image.width===t||(this._spriteTexture.image=function(t){var e=document.createElement("canvas");e.width=e.height=t;var n=e.getContext("2d");return n.fillStyle="#fff",n.arc(t/2,t/2,t/2,0,2*Math.PI),n.fill(),e}(t),this._spriteTexture.dirty()),e.material.transparent=!0,e.material.enableTexture("spriteTexture"),e.material.set("spriteTexture",this._spriteTexture),this._particleSize=t},setGradientTexture:function(t){var e=this._getParticleMesh().material;e[t?"enableTexture":"disableTexture"]("gradientTexture"),e.setUniform("gradientTexture",t)},setColorTextureImage:function(t,e){this._getParticleMesh().material.setTextureImage("colorTexture",t,e,{flipY:!0})},setParticleType:function(t){this._particleType=t},clearFrame:function(t){var e=this._frameBuffer;e.attach(this._lastFrameTexture),e.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),e.unbind(t)},setSupersampling:function(t){this._supersampling=t,this.resize(this._width,this._height)},_updateDownsampleTextures:function(t,e){for(var n=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/e.getDevicePixelRatio())/Math.log(2)),0),r=2,o=this._width*this._supersampling,a=this._height*this._supersampling,s=0;s=359&&(r[0]>0&&(r[0]=0),o[0]1?(e.material.shader!==this._meshLinesShader&&e.material.attachShader(this._meshLinesShader),e.mode=_V.Mesh.TRIANGLES):(e.material.shader!==this._nativeLinesShader&&e.material.attachShader(this._nativeLinesShader),e.mode=_V.Mesh.LINES),n=n||0,i=i||r.count(),s.resetOffset();var h=0,c=0,d=[],f=[],p=[],g=[],m=[],v=.3,_=.7;function y(){f[0]=d[0]*_+g[0]*v-(d[1]-g[1])*o,f[1]=d[1]*_+g[1]*v-(g[0]-d[0])*o,p[0]=d[0]*v+g[0]*_-(d[1]-g[1])*o,p[1]=d[1]*v+g[1]*_-(g[0]-d[0])*o}if(a||0!==o)for(var x=n;x{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"graphGL"===t.componentSubType?e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},n.echartsOption);return i.setOption(e.utils.deepMergeObj(r,t)),i.on("click",(t=>{const i=n.onClickElement.bind(e);return e.utils.addActionToUrl(e,t),"graph"===t.componentSubType?i("edge"===t.dataType?"link":"node",t.data):"graphGL"===t.componentSubType?i("node",t.data):"lines"===t.componentSubType?i("link",t.data.link):!t.data.cluster&&i("node",t.data.node)}),{passive:!0}),i}generateGraphOption(t,e){const n=[],i=e.config,r=t.nodes.map((t=>{const n=e.utils.fastDeepCopy(t),{nodeStyleConfig:r,nodeSizeConfig:o,nodeEmphasisConfig:a}=e.utils.getNodeStyle(t,i,"graph");n.itemStyle=r,n.symbolSize=o,n.emphasis={itemStyle:a.nodeStyle,symbolSize:a.nodeSize};let s="";return"string"==typeof t.label?s=t.label:"string"==typeof t.name?s=t.name:void 0!==t.id&&null!==t.id&&(s=String(t.id)),n.name=s,n._source=e.utils.fastDeepCopy(t),n})),o=t.links.map((t=>{const n=e.utils.fastDeepCopy(t),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,i,"graph");return n.lineStyle=r,n.emphasis={lineStyle:o.linkStyle},n})),a={...i.graphConfig.series},s={...a.label||{}};if("number"==typeof e.config.showGraphLabelsAtZoom&&e.config.showGraphLabelsAtZoom>0){const t=e.config.showGraphLabelsAtZoom;s.formatter=n=>(()=>{try{const t=e.echarts.getOption(),n=(Array.isArray(t.series)?t.series:[]).find((t=>t&&"network-graph"===t.id));return n&&"number"==typeof n.zoom?n.zoom:1}catch(t){return 1}})()>=t&&n&&n.data&&n.data.name||""}a.label=s;const l=[{...a,id:"network-graph",type:"graphGL"===i.graphConfig.series.type?"graphGL":"graph",layout:"graphGL"===i.graphConfig.series.type?"forceAtlas2":i.graphConfig.series.layout,nodes:r,links:o}];return{legend:n.length?{data:n}:void 0,series:l,...i.graphConfig.baseOptions}}generateMapOption(t,e,n=[]){const i=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];r.forEach((n=>{if(n.properties&&(t.flatNodes||(a[n.id]=e.utils.fastDeepCopy(n))),!n.properties||!n.properties._featureType||"Point"===n.properties._featureType)if(n.properties){const{location:t}=n.properties;if(t&&t.lng&&t.lat){const{nodeEmphasisConfig:r}=e.utils.getNodeStyle(n,i,"map");let o="";"string"==typeof n.label?o=n.label:"string"==typeof n.name?o=n.name:void 0!==n.id&&null!==n.id&&(o=String(n.id)),l.push({name:o,value:[t.lng,t.lat],emphasis:{itemStyle:r.nodeStyle,symbolSize:r.nodeSize},node:n,_source:e.utils.fastDeepCopy(n)})}else console.error(`Node ${n.id} position is undefined!`)}else console.error(`Node ${n.id} position is undefined!`)})),o.forEach((t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:n,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,i,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:n,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)})),l=l.concat(n);const u=[{id:"geo-map",type:"effectScatter"===i.mapOptions.nodeConfig.type?"effectScatter":"scatter",name:"nodes",coordinateSystem:"leaflet",data:l,animationDuration:1e3,label:i.mapOptions.nodeConfig.label,itemStyle:{color:t=>{if(t.data&&t.data.cluster&&t.data.itemStyle&&t.data.itemStyle.color)return t.data.itemStyle.color;if(t.data&&t.data.node&&t.data.node.category){const e=i.nodeCategories.find((e=>e.name===t.data.node.category));return e&&e.nodeStyle&&e.nodeStyle.color||i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}},symbolSize:(t,n)=>{if(n.data&&n.data.cluster)return i.mapOptions.clusterConfig&&i.mapOptions.clusterConfig.symbolSize||30;if(n.data&&n.data.node){const{nodeSizeConfig:t}=e.utils.getNodeStyle(n.data.node,i,"map");return"object"==typeof t?i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17:t}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17},emphasis:i.mapOptions.nodeConfig.emphasis},Object.assign(i.mapOptions.linkConfig,{id:"map-links",type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:i.mapTileConfig,mapOptions:i.mapOptions},series:u,...i.mapOptions.baseOptions}}_propagateGraphZoom(t){const e=t.echarts.getDom&&t.echarts.getDom();if(!e)return;const n=e.querySelector("canvas");e.addEventListener("wheel",(t=>{if(!n)return;const i=e.getBoundingClientRect();if(t.clientXi.right||t.clientYi.bottom)return;t.preventDefault();const r=n.getBoundingClientRect();n.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,view:window,clientX:r.left+r.width/2,clientY:r.top+r.height/2,deltaY:-t.deltaY,deltaMode:t.deltaMode}))}),{passive:!1})}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.utils._propagateGraphZoom(e),e.config.showGraphLabelsAtZoom>0&&e.echarts.on("graphRoam",(t=>{if(!t||!t.zoom)return;const n=e.echarts.getOption(),i=n&&n.series&&n.series[0]&&n.series[0].zoom>=e.config.showGraphLabelsAtZoom;i!==e._labelsVisible&&(e.echarts.resize({animation:!1,silent:!0}),e._labelsVisible=i)})),e.utils.setupHashChangeHandler(e),e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray"),e.event.emit("applyUrlFragmentState")}mapRender(t,e){if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');e.utils.isGeoJSON(t)&&(e.originalGeoJSON=e.utils.fastDeepCopy(t),t=e.utils.geojsonToNetjson(t));const n=e.utils.generateMapOption(t,e);if(e.utils.echartsSetOption(n,e),e.bboxData={nodes:[],links:[]},e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,n)=>g().circleMarker(n,e.config.geoOptions.style),onEachFeature:(t,n)=>{n.on("click",(()=>{const n={...t.properties};e.config.onClickElement.call(e,"Feature",n)}))}},e.config.geoOptions),e.originalGeoJSON){!function(t){if(!t.originalGeoJSON||!Array.isArray(t.originalGeoJSON.features))return;const e=t.leaflet,n=t.originalGeoJSON.features.filter((t=>t&&t.geometry&&("Polygon"===t.geometry.type||"MultiPolygon"===t.geometry.type)));if(!n.length)return;let i=e.getPane("njg-polygons");i||(i=e.createPane("njg-polygons"),i.style.zIndex=410);const r={fillColor:"#1566a9",color:"#1566a9",weight:0,fillOpacity:.6},o=g().geoJSON({type:"FeatureCollection",features:n},{pane:"njg-polygons",style:e=>{const n=e.properties&&e.properties.echartsStyle||{},i={...r,...t.config.geoOptions&&t.config.geoOptions.style};return n.areaColor&&(i.fillColor=n.areaColor),n.color&&(i.color=n.color),void 0!==n.opacity&&(i.fillOpacity=n.opacity),void 0!==n.borderWidth&&(i.weight=n.borderWidth),i},onEachFeature:(e,n)=>{n.on("click",(()=>{const n=e.properties||{};t.config.onClickElement.call(t,"Feature",n)}))},...t.config.geoOptions}).addTo(e);t.leaflet.polygonGeoJSON=o}(e);let n=null;if(e.leaflet.polygonGeoJSON&&"function"==typeof e.leaflet.polygonGeoJSON.getBounds&&(n=e.leaflet.polygonGeoJSON.getBounds()),t.nodes&&t.nodes.length){const e=t.nodes.map((t=>t.properties.location)).map((t=>[t.lat,t.lng]));n?e.forEach((t=>n.extend(t))):n=g().latLngBounds(e)}n&&n.isValid()&&e.leaflet.fitBounds(n,{padding:[20,20]})}if(e.leaflet.getZoom(){const t=e.leaflet.getZoom(),n=t>=e.config.showLabelsAtZoomLevel;e.echarts.setOption({series:[{id:"geo-map",label:{show:n},emphasis:{label:{show:n}}}]});const i=e.leaflet.getMinZoom(),r=e.leaflet.getMaxZoom(),o=document.querySelector(".leaflet-control-zoom-in"),a=document.querySelector(".leaflet-control-zoom-out");o&&a&&(Math.round(t)>=r?o.classList.add("leaflet-disabled"):o.classList.remove("leaflet-disabled"),Math.round(t)<=i?a.classList.add("leaflet-disabled"):a.classList.remove("leaflet-disabled"))})),e.leaflet.on("moveend",(async()=>{const n=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const i=await e.utils.getBBoxData.call(e,e.JSONParam,n);e.config.prepareData.call(e,i);const r=new Set(e.data.nodes.map((t=>t.id))),o=new Set(e.data.links.map((t=>t.source))),a=new Set(e.data.links.map((t=>t.target))),s=i.nodes.filter((t=>!r.has(t.id))),l=i.links.filter((t=>!o.has(t.source)&&!a.has(t.target))),u=new Set(i.nodes.map((t=>t.id))),h=e.bboxData.nodes.filter((t=>!u.has(t.id))),c=new Set(h.map((t=>t.id)));t.nodes=t.nodes.filter((t=>!c.has(t.id))),e.bboxData.nodes=e.bboxData.nodes.concat(s),e.bboxData.links=e.bboxData.links.concat(l),t={...t,nodes:t.nodes.concat(s),links:t.links.concat(l)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{const n=new Set(e.bboxData.nodes),i=new Set(e.bboxData.links);t={...t,nodes:t.nodes.filter((t=>!n.has(t))),links:t.links.filter((t=>!i.has(t)))},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]})()})),e.config.clustering&&e.config.clusteringThresholde.config.disableClusteringAtLevel&&(n=[],i=t.nodes,r=t.links),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:i,links:r},e,n)),e.echarts.on("click",(t=>{if(("scatter"===t.componentSubType||"effectScatter"===t.componentSubType)&&t.data.cluster){const n=e.leaflet.getZoom(),i=Math.min(n+2,e.leaflet.getMaxZoom());e.leaflet.setView([t.data.value[1],t.data.value[0]],i)}})),e.leaflet.on("zoomend",(()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:n,data:t.data})})),e.utils.mergeData(t,e)}e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.data.nodes&&e.data.nodes.length>0&&(e.data.nodes=e.utils.deduplicateNodesById(e.data.nodes)),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){t.nodes||(t.nodes=[]);const n=new Set;e.data.nodes.forEach((t=>{t.id&&n.add(t.id)}));const i=t.nodes.filter((t=>!t.id||(!n.has(t.id)||(console.warn(`Duplicate node ID ${t.id} detected during merge and skipped.`),!1)))),r=e.data.nodes.concat(i),o=t.links||[],a=e.data.links.concat(o);Object.assign(e.data,t,{nodes:r,links:a})}}const nX=function(t,e){const{util:n,graphic:i,matrix:r}=t,o=e.Layer.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){e.DomUtil.remove(this._container)},_update(){}});function a(t,n){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=n,this._projection=e.Projection.Mercator}function s(t,e,n,i){const{leafletModel:r,seriesModel:o}=n,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](i):null}return a.dimensions=["lng","lat"],a.prototype.dimensions=["lng","lat"],a.prototype.setZoom=function(t){this._zoom=t},a.prototype.setCenter=function(t){this._center=this._projection.project(new e.LatLng(t[1],t[0]))},a.prototype.setMapOffset=function(t){this._mapOffset=t},a.prototype.getLeaflet=function(){return this._map},a.prototype.getViewRect=function(){const t=this._api;return new i.BoundingRect(0,0,t.getWidth(),t.getHeight())},a.prototype.getRoamTransform=function(){return r.create()},a.prototype.dataToPoint=function(t){const n=new e.LatLng(t[1],t[0]),i=this._map.latLngToLayerPoint(n),r=this._mapOffset;return[i.x-r[0],i.y-r[1]]},a.prototype.pointToData=function(t){const e=this._mapOffset,n=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[n.lng,n.lat]},a.prototype.convertToPixel=n.curry(s,"dataToPoint"),a.prototype.convertFromPixel=n.curry(s,"pointToData"),a.create=function(t,n){let i;const r=[],s=n.getDom();return t.eachComponent("leaflet",(t=>{const l=n.getZr().painter.getViewportRoot();if(void 0===e)throw new Error("Leaflet api is not loaded");if(i)throw new Error("Only one leaflet component can exist");if(!t.__map){let n=s.querySelector(".ec-extension-leaflet");n&&(l.style.left="0px",l.style.top="0px",s.removeChild(n)),n=document.createElement("div"),n.style.cssText="width:100%;height:100%",n.classList.add("ec-extension-leaflet"),s.appendChild(n),t.__map=e.map(n,t.get("mapOptions"));const i=t.__map,r=t.get("tiles"),a={};let u=!1;if(r.forEach((t=>{const n=e.tileLayer(t.urlTemplate,t.options);t.label?(u||(n.addTo(i),u=!0),a[t.label]=n):n.addTo(i)})),r.length>1){const n=t.get("layerControl");e.control.layers(a,{},n).addTo(i)}const h=document.createElement("div");h.style="position: absolute;left: 0;top: 0;z-index: 100",h.appendChild(l),new o(h).addTo(i)}const u=t.__map;i=new a(u,n),r.push(i),i.setMapOffset(t.__mapOffset||[0,0]);const{center:h,zoom:c}=t.get("mapOptions");h&&c&&(i.setZoom(c),i.setCenter(h)),t.coordinateSystem=i})),t.eachSeries((t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=i)})),r},a};function iX(t,e,n){!function(t){t.extendComponentModel({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:n}=this;return i=t,r=n.center,!(i&&r&&i[0]===r[0]&&i[1]===r[1]&&e===n.zoom);var i,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}})}(t),function(t){t.extendComponentView({type:"leaflet",render(e,n,i){let r=!0;const o=e.getLeaflet(),a=i.getZr().painter.getViewportRoot().parentNode,s=e.coordinateSystem,{roam:l}=e.get("mapOptions");function u(t){if(r)return;const n=o._mapPane;let l=n.style.transform,u=0,h=0;if(l){l=l.replace("translate3d(","");let t=l.split(",");u=-parseInt(t[0],10),h=-parseInt(t[1],10)}else u=-parseInt(n.style.left,10),h=-parseInt(n.style.top,10);let c=[u,h];a.style.left=`${c[0]}px`,a.style.top=`${c[1]}px`,s.setMapOffset(c),e.__mapOffset=c,i.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function h(){r||i.dispatchAction({type:"leafletRoam"})}function c(){u()}function d(){t.getInstanceByDom(i.getDom()).resize()}l&&"scale"!==l?o.dragging.enable():o.dragging.disable(),l&&"move"!==l?(o.scrollWheelZoom.enable(),o.doubleClickZoom.enable(),o.touchZoom.enable()):(o.scrollWheelZoom.disable(),o.doubleClickZoom.disable(),o.touchZoom.disable()),this._oldMoveHandler&&o.off("move",this._oldMoveHandler),this._oldZoomHandler&&o.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&o.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&o.off("resize",this._oldResizeHandler),o.on("move",u),o.on("zoom",c),o.on("zoomend",h),o.on("resize",d),this._oldMoveHandler=u,this._oldZoomHandler=c,this._oldZoomEndHandler=h,this._oldResizeHandler=d,r=!1}})}(t),t.registerCoordinateSystem("leaflet",nX(t,e)),t.registerAction({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},((t,e)=>{e.eachComponent("leaflet",(t=>{const e=t.getLeaflet(),n=e.getCenter();t.setCenterAndZoom([n.lng,n.lat],e.getZoom())}))}))}iX.version="1.0.0";const rX=iX;const oX=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),n=document.createElement("div");n.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const i=document.createElement("span");return i.classList.add("njg-closeButton"),e.innerHTML="Info",i.innerHTML=" ✕",e.appendChild(i),t.appendChild(e),t.appendChild(n),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),i.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const n=document.querySelectorAll(".njg-infoContainer"),i=document.querySelectorAll(".njg-headerContainer");for(let t=0;t"clients"===t?"Clients":/^clients\s*\[\d+\]$/i.test(t)?t.replace(/^clients/i,"Client"):"localAddresses"===t?"Local Addresses":t.replace(/_/g," "),u=(t,e,n,i=0)=>{if(null==n||"string"==typeof n&&(""===n.trim()||/^(undefined|null)$/i.test(n.trim()))&&"0"!==n)return;if(Array.isArray(n)){if(0===n.length){const n=document.createElement("div");n.classList.add("njg-infoItems"),n.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML=l(e),o.innerHTML="[]",n.appendChild(r),n.appendChild(o),void t.appendChild(n)}if(n.every((t=>"object"!=typeof t||null===t))){const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML=n.map((t=>"string"==typeof t?t.replace(/\n/g,"
"):String(t))).join("
"),r.appendChild(o),r.appendChild(a),void t.appendChild(r)}return void n.forEach(((n,r)=>{u(t,`${e} [${r+1}]`,n,i)}))}if("object"==typeof n){if("location"===e&&"number"==typeof n.lat&&"number"==typeof n.lng){const e=document.createElement("div");e.classList.add("njg-infoItems"),e.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML="Location",o.innerHTML=`${Math.round(1e3*n.lat)/1e3}, ${Math.round(1e3*n.lng)/1e3}`,e.appendChild(r),e.appendChild(o),void t.appendChild(e)}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML="",r.appendChild(o),r.appendChild(a),t.appendChild(r),void Object.keys(n).forEach((e=>{u(t,e,n[e],i+1)}))}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e);const s="string"==typeof n?n.replace(/\n/g,"
"):String(n);a.innerHTML=s,r.appendChild(o),r.appendChild(a),t.appendChild(r)};Object.keys(e).forEach((t=>u(o,t,e[t],0))),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}};const aX=function(t,e={}){const n=t.echarts,i=echarts.graphic,r={wifi:e.colors&&e.colors.wifi||"#d35454"},o=e.radius||3,a=e.gap||8;let s=e.minZoomLevel||1.5,l=1;const u=t=>t?"number"==typeof t.clients?t.clients:Array.isArray(t.clients)?t.clients.length:0:0,h=function(){const t=n.getModel().getSeriesByIndex(0);if(!t)return null;const e=(n._chartsViews||[]).find((e=>e&&e.__model&&e.__model.uid===t.uid));return e?e.group:null}();if(!h)return{destroy(){}};const c=new i.Group({silent:!0,z:100,zlevel:1});h.add(c);const d=t&&t.config&&t.config.graphConfig&&t.config.graphConfig.series||{},f=("number"==typeof d.nodeSize?d.nodeSize:18)/2;function p(){l=function(){const t=n.getOption();return t&&t.series&&t.series[0]&&t.series[0].zoom?t.series[0].zoom:1}();const t=l>=s;c.attr("invisible",!t)}function g(){const t=n.getModel().getSeriesByIndex(0);if(!t)return;const e=t.getData();if(!e)return;if(p(),c.removeAll(),l{let s=0;if(0!==n)for(let l=0;s{p(),g()}]];return m.forEach((([t,e])=>n.on(t,e))),g(),{destroy(){m.forEach((([t,e])=>{n&&n.off&&n.off(t,e)})),c&&c.parent&&c.parent.remove(c)},setMinZoomLevel(t){s=t,g()},getMinZoomLevel:()=>s}},sX=n(936),{each:lX}=n(627),uX=n(123);rX(f,g(),{colorTool:sX,each:lX,env:uX}),window.NetJSONGraph=class{constructor(t,e={}){return this.graph=new A(t),this.config=this.initializeConfig(e),this.graph.setConfig(this.config),this.setupGraph(),this.config.onInit.call(this.graph),this.initializeECharts(),this.graph}initializeConfig(t={}){return{...t,render:"map"===t.render?eX.prototype.mapRender:eX.prototype.graphRender,onInit:this.onInit,onRender:this.onRender,onUpdate:this.onUpdate,afterUpdate:this.afterUpdate,onLoad:this.onLoad}}setupGraph(){Object.setPrototypeOf(eX.prototype,this.graph.utils),this.graph.gui=new oX(this.graph),this.graph.utils=new eX,this.graph.setUtils(),this.graph.event=this.graph.utils.createEvent()}initializeECharts(){this.graph.echarts=Ly(this.graph.el,null,{renderer:this.graph.config.svgRender?"svg":"canvas"})}onInit(){return this.config}onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config}onUpdate(){return this.config}afterUpdate(){return this.config}onLoad(){return this.config.metadata&&this.utils.isNetJSON(this.data)?(this.gui.createMetaInfoContainer(this.graph),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&this.utils.isNetJSON(this.data)&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.attachClientsOverlay=t=>aX(this,t),this.config}},window.echarts=f,window.L=g()})()})(); diff --git a/openwisp_monitoring/device/tests/test_admin.py b/openwisp_monitoring/device/tests/test_admin.py index 1cf9dbfe9..f5192ddcc 100644 --- a/openwisp_monitoring/device/tests/test_admin.py +++ b/openwisp_monitoring/device/tests/test_admin.py @@ -900,8 +900,8 @@ def test_dashboard(self): "monitoring/css/leaflet.fullscreen.css", "monitoring/css/netjsongraph.css", "leaflet/leaflet.css", - "monitoring/js/lib/netjsongraph.min.js", "monitoring/js/lib/leaflet.fullscreen.min.js", + "monitoring/js/lib/netjsongraph.echarts.min.js", "monitoring/js/device-map.js", "monitoring/js/floorplan.js", ] @@ -1241,8 +1241,8 @@ def test_mappage_admin_media_files(self): response = self.client.get(url) self.assertEqual(response.status_code, 200) static_files = [ - "monitoring/js/lib/netjsongraph.min.js", "monitoring/js/lib/leaflet.fullscreen.min.js", + "monitoring/js/lib/netjsongraph.echarts.min.js", "monitoring/css/device-map.css", "leaflet/leaflet.css", "monitoring/css/leaflet.fullscreen.css", diff --git a/openwisp_monitoring/device/tests/test_apps.py b/openwisp_monitoring/device/tests/test_apps.py index c546582f2..c88999c0e 100644 --- a/openwisp_monitoring/device/tests/test_apps.py +++ b/openwisp_monitoring/device/tests/test_apps.py @@ -30,8 +30,8 @@ def test_device_map_template_registered(self): self.assertEqual( template_config[0].get("js"), ( - "monitoring/js/lib/netjsongraph.min.js", "monitoring/js/lib/leaflet.fullscreen.min.js", + "monitoring/js/lib/netjsongraph.echarts.min.js", "monitoring/js/device-map.js", "monitoring/js/floorplan.js", ), diff --git a/openwisp_monitoring/monitoring/static/monitoring/css/chart.css b/openwisp_monitoring/monitoring/static/monitoring/css/chart.css index d22ad9c35..9aea8a1cc 100644 --- a/openwisp_monitoring/monitoring/static/monitoring/css/chart.css +++ b/openwisp_monitoring/monitoring/static/monitoring/css/chart.css @@ -110,12 +110,12 @@ #ow-chart-contents .circle > span { font-size: 0.15em; word-spacing: -0.75px; - color: rgba(0, 0, 0, 0.6) !important; + color: var(--ow-overlay-60) !important; font-size: 13px; font-weight: bold; } #ow-chart-contents b { - background-color: #000 !important; + background-color: var(--ow-color-black) !important; } .chart-heading { margin: 0; @@ -133,7 +133,7 @@ .tooltip { position: absolute; background-color: rgba(0, 0, 0, 0.7); - color: #fff; + color: var(--ow-color-white); padding: 15px !important; max-width: 500px; line-height: 1.6em; diff --git a/openwisp_monitoring/monitoring/static/monitoring/js/lib/plotly-cartesian.min.js b/openwisp_monitoring/monitoring/static/monitoring/js/lib/plotly-cartesian.min.js index a9d66ffc7..4cfed69d0 100644 --- a/openwisp_monitoring/monitoring/static/monitoring/js/lib/plotly-cartesian.min.js +++ b/openwisp_monitoring/monitoring/static/monitoring/js/lib/plotly-cartesian.min.js @@ -4,7 +4,7 @@ * All rights reserved. * Licensed under the MIT license */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o:not(.watermark)":"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":"content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;","X [data-title]:after":"content:attr(data-title);background:#69738a;color:white;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans', verdana, arial, sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":178}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":287}],3:[function(e,t,r){"use strict";t.exports=e("../src/traces/box")},{"../src/traces/box":302}],4:[function(e,t,r){"use strict";t.exports=e("../src/traces/contour")},{"../src/traces/contour":322}],5:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":160}],6:[function(e,t,r){"use strict";t.exports=e("../src/traces/heatmap")},{"../src/traces/heatmap":338}],7:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram")},{"../src/traces/histogram":356}],8:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram2d")},{"../src/traces/histogram2d":362}],9:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":366}],10:[function(e,t,r){"use strict";t.exports=e("../src/traces/image")},{"../src/traces/image":373}],11:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./box"),e("./heatmap"),e("./histogram"),e("./histogram2d"),e("./histogram2dcontour"),e("./image"),e("./pie"),e("./contour"),e("./scatterternary"),e("./violin")]),t.exports=n},{"./bar":2,"./box":3,"./contour":4,"./core":5,"./heatmap":6,"./histogram":7,"./histogram2d":8,"./histogram2dcontour":9,"./image":10,"./pie":12,"./scatterternary":13,"./violin":14}],12:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":382}],13:[function(e,t,r){"use strict";t.exports=e("../src/traces/scatterternary")},{"../src/traces/scatterternary":422}],14:[function(e,t,r){"use strict";t.exports=e("../src/traces/violin")},{"../src/traces/violin":430}],15:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},a=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var l,s=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),l=0===c.x}catch(e){l=!1}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r){if(t)e.call(r);else for(var n=e.length,a=_(e,n),i=0;i0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[t]=r,++e._eventsCount;return e}function m(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var s=new Error('Unhandled "error" event. ('+t+")");throw s.context=t,s}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===t||r[o].listener===t){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,a=e.length;n=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return x(this,e,!0)},o.prototype.rawListeners=function(e){return x(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],16:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(H,"\\$&")};var H=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function V(e){return j(e,Z),e}var q=function(e,t){return t.querySelector(e)},U=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(q=function(e,t){return Sizzle(e,t)[0]||null},U=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function X(e){return"function"==typeof e?e:function(){return q(e,this)}}function Y(e){return"function"==typeof e?e:function(){return U(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=X(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each($(r,t[r]));return this}return this.each($(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function De(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Ee(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Ie(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Re(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function z(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}Ue.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,this.l/e)},Ue.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,e*this.l)},Ue.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Xe=Ze.prototype=new Ve;function Ye(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Ye(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Xe.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Xe.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Xe.rgb=function(){return Ye(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,$e=We.prototype=new Ve;function Je(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*ze,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}$e.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},$e.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},$e.rgb=function(){return Je(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ve;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new qe(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||zt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function zt(e){return e+""}var Pt=e.time={},Dt=Date;function Et(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Et.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){It.setUTCDate.apply(this._,arguments)},setDay:function(){It.setUTCDay.apply(this._,arguments)},setFullYear:function(){It.setUTCFullYear.apply(this._,arguments)},setHours:function(){It.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){It.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){It.setUTCMinutes.apply(this._,arguments)},setMonth:function(){It.setUTCMonth.apply(this._,arguments)},setSeconds:function(){It.setUTCSeconds.apply(this._,arguments)},setTime:function(){It.setTime.apply(this._,arguments)}};var It=Date.prototype;function Rt(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Bt?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(Dt=Et);return r._=e,t(r)}finally{Dt=Date}}return r.parse=function(e){try{Dt=Et;var r=t.parse(e);return r&&r._}finally{Dt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=qt(o),h=Ut(o),g=qt(l),v=Ut(l),m=qt(s),y=Ut(s),x=qt(c),b=Ut(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Vt(e.getDate(),t,2)},e:function(e,t){return Vt(e.getDate(),t,2)},H:function(e,t){return Vt(e.getHours(),t,2)},I:function(e,t){return Vt(e.getHours()%12||12,t,2)},j:function(e,t){return Vt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Vt(e.getMilliseconds(),t,3)},m:function(e,t){return Vt(e.getMonth()+1,t,2)},M:function(e,t){return Vt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Vt(e.getSeconds(),t,2)},U:function(e,t){return Vt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Vt(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Vt(e.getFullYear()%100,t,2)},Y:function(e,t){return Vt(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:Jt,e:Jt,H:er,I:er,j:Kt,L:nr,m:$t,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Xt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Yt,Z:Qt,"%":ir};return u}Pt.year=Rt((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=Rt((function(e){var t=new Dt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=Rt((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Bt={"-":"",_:" ",0:"0"},Ht=/^\s*\d+/,jt=/^%/;function Vt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function $t(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Jt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Vt(n,"0",2)+Vt(a,"0",2)}function ir(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function zr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Er(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ir(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Rr(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Ie(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=zr([e*Oe,o*Oe]);if(s){var c=Dr(s,l),u=Dr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*ze*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Br);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Yr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=Dr(zr(f),zr(e));Rr(A);var L=Dr(a,A);Rr(L);var S=(k^_>=0?-1:1)*Ie(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter($r))}return u}}function $r(e){return e.length>1}function Jr(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:E,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=Dr(zr(e),zr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=Dr(a,i),d=Ir(a,c);Er(d,Ir(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Ir(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Ir(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=Jr(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&De(c,i,e)>0&&++t:i[1]<=n&&De(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Xr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Ie((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:E};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=zr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*z+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*ze,r*ze])}));return function(e){return zn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*ze,e[1]*ze]}function T(){a=Gr(n=En(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=zn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*ze,p*ze]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*ze,g*ze,v*ze]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function zn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function Dn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function En(e,t,r){return e?t||r?Gr(Rn(e),Fn(t,r)):Rn(e):t||r?Fn(t,r):Dn}function In(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function Rn(e){var t=In(e);return t.invert=In(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Ie(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Ie(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=ze,t[1]*=ze,t},t},Dn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=En(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=ze,e[1]*=ze}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Hn(o,i,90),u=jn(r,t,m),f=Hn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Vn,a=qn;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*ze,Math.atan2(i,Math.sqrt(n*n+a*a))*ze]}:function(){return[r*ze,n*ze]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,Un),yn};var Un={sphere:E,point:E,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}Un.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),Un.point=n},Un.lineEnd=function(){Un.point=Un.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Xn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Yn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return $n;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&De(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=Jn(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=za(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Da(r.edge,c,h,b),s.edge=za(c,e,null,b),r.edge=za(e,h,null,b),La(t),La(r)}else s.edge=za(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ra(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ea(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Ha(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ha(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=Ja.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ye(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return Je(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ei(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(Di(e,(function(e){e.children&&(e.value=0)})),Ei(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Yi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return $i(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function $i(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function Ji(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return $i(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ei(l,(function(e){e.r=+u(e.value)})),Ei(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(e){e.r+=f})),Ei(l,no),Ei(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);Di(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ei(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Ie(v/c*Math.sin(m))),l&&(A=Ie(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&qo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var z=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&qo(w,T,k,M)===1-p^z){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function Uo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Xo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Xo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Xo(e){return e.length>1?e.join("L"):e+"Z"}function Yo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Vn,t=qn,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=X(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",z);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",E):L.on("mousemove.brush",P).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function z(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Bl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Bl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Bl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Bl(e){return new Date(e)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Rl,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Rl.toString,Pt.second=Rt((function(e){return new Dt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=Rt((function(e){return new Dt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=Rt((function(e){var t=e.getTimezoneOffset()/60;return new Dt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=Rt((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Hl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Vl=El.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),ql={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Bl)},floor:O,ceil:O};jl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),jl,Vl)};var Ul=jl.map((function(e){return[e[0].utc,e[1]]})),Gl=Il.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Xl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}Ul.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),Ul,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Xl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],17:[function(e,t,r){(function(n,a){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o:not(.watermark)":"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":"content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;","X [data-title]:after":"content:attr(data-title);background:#69738a;color:white;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans', verdana, arial, sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solidvar(--ow-color-white);z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":178}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":287}],3:[function(e,t,r){"use strict";t.exports=e("../src/traces/box")},{"../src/traces/box":302}],4:[function(e,t,r){"use strict";t.exports=e("../src/traces/contour")},{"../src/traces/contour":322}],5:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":160}],6:[function(e,t,r){"use strict";t.exports=e("../src/traces/heatmap")},{"../src/traces/heatmap":338}],7:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram")},{"../src/traces/histogram":356}],8:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram2d")},{"../src/traces/histogram2d":362}],9:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":366}],10:[function(e,t,r){"use strict";t.exports=e("../src/traces/image")},{"../src/traces/image":373}],11:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./box"),e("./heatmap"),e("./histogram"),e("./histogram2d"),e("./histogram2dcontour"),e("./image"),e("./pie"),e("./contour"),e("./scatterternary"),e("./violin")]),t.exports=n},{"./bar":2,"./box":3,"./contour":4,"./core":5,"./heatmap":6,"./histogram":7,"./histogram2d":8,"./histogram2dcontour":9,"./image":10,"./pie":12,"./scatterternary":13,"./violin":14}],12:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":382}],13:[function(e,t,r){"use strict";t.exports=e("../src/traces/scatterternary")},{"../src/traces/scatterternary":422}],14:[function(e,t,r){"use strict";t.exports=e("../src/traces/violin")},{"../src/traces/violin":430}],15:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},a=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var l,s=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),l=0===c.x}catch(e){l=!1}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r){if(t)e.call(r);else for(var n=e.length,a=_(e,n),i=0;i0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[t]=r,++e._eventsCount;return e}function m(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var s=new Error('Unhandled "error" event. ('+t+")");throw s.context=t,s}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===t||r[o].listener===t){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,a=e.length;n=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return x(this,e,!0)},o.prototype.rawListeners=function(e){return x(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],16:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(H,"\\$&")};var H=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function V(e){return j(e,Z),e}var q=function(e,t){return t.querySelector(e)},U=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(q=function(e,t){return Sizzle(e,t)[0]||null},U=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function X(e){return"function"==typeof e?e:function(){return q(e,this)}}function Y(e){return"function"==typeof e?e:function(){return U(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=X(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each($(r,t[r]));return this}return this.each($(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function De(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Ee(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Ie(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Re(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function z(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}Ue.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,this.l/e)},Ue.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,e*this.l)},Ue.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Xe=Ze.prototype=new Ve;function Ye(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Ye(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Xe.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Xe.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Xe.rgb=function(){return Ye(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,$e=We.prototype=new Ve;function Je(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*ze,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}$e.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},$e.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},$e.rgb=function(){return Je(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ve;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new qe(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||zt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function zt(e){return e+""}var Pt=e.time={},Dt=Date;function Et(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Et.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){It.setUTCDate.apply(this._,arguments)},setDay:function(){It.setUTCDay.apply(this._,arguments)},setFullYear:function(){It.setUTCFullYear.apply(this._,arguments)},setHours:function(){It.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){It.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){It.setUTCMinutes.apply(this._,arguments)},setMonth:function(){It.setUTCMonth.apply(this._,arguments)},setSeconds:function(){It.setUTCSeconds.apply(this._,arguments)},setTime:function(){It.setTime.apply(this._,arguments)}};var It=Date.prototype;function Rt(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Bt?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(Dt=Et);return r._=e,t(r)}finally{Dt=Date}}return r.parse=function(e){try{Dt=Et;var r=t.parse(e);return r&&r._}finally{Dt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=qt(o),h=Ut(o),g=qt(l),v=Ut(l),m=qt(s),y=Ut(s),x=qt(c),b=Ut(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Vt(e.getDate(),t,2)},e:function(e,t){return Vt(e.getDate(),t,2)},H:function(e,t){return Vt(e.getHours(),t,2)},I:function(e,t){return Vt(e.getHours()%12||12,t,2)},j:function(e,t){return Vt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Vt(e.getMilliseconds(),t,3)},m:function(e,t){return Vt(e.getMonth()+1,t,2)},M:function(e,t){return Vt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Vt(e.getSeconds(),t,2)},U:function(e,t){return Vt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Vt(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Vt(e.getFullYear()%100,t,2)},Y:function(e,t){return Vt(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:Jt,e:Jt,H:er,I:er,j:Kt,L:nr,m:$t,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Xt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Yt,Z:Qt,"%":ir};return u}Pt.year=Rt((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=Rt((function(e){var t=new Dt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=Rt((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Bt={"-":"",_:" ",0:"0"},Ht=/^\s*\d+/,jt=/^%/;function Vt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function $t(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Jt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Vt(n,"0",2)+Vt(a,"0",2)}function ir(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function zr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Er(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ir(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Rr(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Ie(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=zr([e*Oe,o*Oe]);if(s){var c=Dr(s,l),u=Dr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*ze*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Br);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Yr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=Dr(zr(f),zr(e));Rr(A);var L=Dr(a,A);Rr(L);var S=(k^_>=0?-1:1)*Ie(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter($r))}return u}}function $r(e){return e.length>1}function Jr(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:E,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=Dr(zr(e),zr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=Dr(a,i),d=Ir(a,c);Er(d,Ir(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Ir(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Ir(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=Jr(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&De(c,i,e)>0&&++t:i[1]<=n&&De(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Xr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Ie((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:E};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=zr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*z+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*ze,r*ze])}));return function(e){return zn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*ze,e[1]*ze]}function T(){a=Gr(n=En(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=zn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*ze,p*ze]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*ze,g*ze,v*ze]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function zn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function Dn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function En(e,t,r){return e?t||r?Gr(Rn(e),Fn(t,r)):Rn(e):t||r?Fn(t,r):Dn}function In(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function Rn(e){var t=In(e);return t.invert=In(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Ie(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Ie(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=ze,t[1]*=ze,t},t},Dn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=En(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=ze,e[1]*=ze}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Hn(o,i,90),u=jn(r,t,m),f=Hn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Vn,a=qn;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*ze,Math.atan2(i,Math.sqrt(n*n+a*a))*ze]}:function(){return[r*ze,n*ze]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,Un),yn};var Un={sphere:E,point:E,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}Un.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),Un.point=n},Un.lineEnd=function(){Un.point=Un.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Xn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Yn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return $n;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&De(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=Jn(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=za(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Da(r.edge,c,h,b),s.edge=za(c,e,null,b),r.edge=za(e,h,null,b),La(t),La(r)}else s.edge=za(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ra(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ea(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Ha(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ha(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=Ja.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ye(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return Je(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ei(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(Di(e,(function(e){e.children&&(e.value=0)})),Ei(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Yi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return $i(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function $i(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function Ji(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return $i(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ei(l,(function(e){e.r=+u(e.value)})),Ei(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(e){e.r+=f})),Ei(l,no),Ei(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);Di(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ei(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Ie(v/c*Math.sin(m))),l&&(A=Ie(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&qo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var z=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&qo(w,T,k,M)===1-p^z){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function Uo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Xo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Xo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Xo(e){return e.length>1?e.join("L"):e+"Z"}function Yo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Vn,t=qn,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=X(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",z);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",E):L.on("mousemove.brush",P).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function z(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Bl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Bl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Bl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Bl(e){return new Date(e)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Rl,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Rl.toString,Pt.second=Rt((function(e){return new Dt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=Rt((function(e){return new Dt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=Rt((function(e){var t=e.getTimezoneOffset()/60;return new Dt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=Rt((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Hl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Vl=El.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),ql={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Bl)},floor:O,ceil:O};jl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),jl,Vl)};var Ul=jl.map((function(e){return[e[0].utc,e[1]]})),Gl=Il.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Xl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}Ul.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),Ul,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Xl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],17:[function(e,t,r){(function(n,a){ /*! * @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) @@ -18,4 +18,4 @@ * @license MIT * @preserve Project Home: https://github.com/voidqk/polybooljs */ -var n,a=e("./lib/build-log"),i=e("./lib/epsilon"),o=e("./lib/intersecter"),l=e("./lib/segment-chainer"),s=e("./lib/segment-selector"),c=e("./lib/geojson"),u=!1,f=i();function d(e,t,r){var a=n.segments(e),i=n.segments(t),o=r(n.combine(a,i));return n.polygon(o)}n={buildLog:function(e){return!0===e?u=a():!1===e&&(u=!1),!1!==u&&u.list},epsilon:function(e){return f.epsilon(e)},segments:function(e){var t=o(!0,f,u);return e.regions.forEach(t.addRegion),{segments:t.calculate(e.inverted),inverted:e.inverted}},combine:function(e,t){return{combined:o(!1,f,u).calculate(e.segments,e.inverted,t.segments,t.inverted),inverted1:e.inverted,inverted2:t.inverted}},selectUnion:function(e){return{segments:s.union(e.combined,u),inverted:e.inverted1||e.inverted2}},selectIntersect:function(e){return{segments:s.intersect(e.combined,u),inverted:e.inverted1&&e.inverted2}},selectDifference:function(e){return{segments:s.difference(e.combined,u),inverted:e.inverted1&&!e.inverted2}},selectDifferenceRev:function(e){return{segments:s.differenceRev(e.combined,u),inverted:!e.inverted1&&e.inverted2}},selectXor:function(e){return{segments:s.xor(e.combined,u),inverted:e.inverted1!==e.inverted2}},polygon:function(e){return{regions:l(e.segments,f,u),inverted:e.inverted}},polygonFromGeoJSON:function(e){return c.toPolygon(n,e)},polygonToGeoJSON:function(e){return c.fromPolygon(n,f,e)},union:function(e,t){return d(e,t,n.selectUnion)},intersect:function(e,t){return d(e,t,n.selectIntersect)},difference:function(e,t){return d(e,t,n.selectDifference)},differenceRev:function(e,t){return d(e,t,n.selectDifferenceRev)},xor:function(e,t){return d(e,t,n.selectXor)}},"object"==typeof window&&(window.PolyBool=n),t.exports=n},{"./lib/build-log":27,"./lib/epsilon":28,"./lib/geojson":29,"./lib/intersecter":30,"./lib/segment-chainer":32,"./lib/segment-selector":33}],27:[function(e,t,r){t.exports=function(){var e,t=0,r=!1;function n(t,r){return e.list.push({type:t,data:r?JSON.parse(JSON.stringify(r)):void 0}),e}return e={list:[],segmentId:function(){return t++},checkIntersection:function(e,t){return n("check",{seg1:e,seg2:t})},segmentChop:function(e,t){return n("div_seg",{seg:e,pt:t}),n("chop",{seg:e,pt:t})},statusRemove:function(e){return n("pop_seg",{seg:e})},segmentUpdate:function(e){return n("seg_update",{seg:e})},segmentNew:function(e,t){return n("new_seg",{seg:e,primary:t})},segmentRemove:function(e){return n("rem_seg",{seg:e})},tempStatus:function(e,t,r){return n("temp_status",{seg:e,above:t,below:r})},rewind:function(e){return n("rewind",{seg:e})},status:function(e,t,r){return n("status",{seg:e,above:t,below:r})},vert:function(t){return t===r?e:(r=t,n("vert",{x:t}))},log:function(e){return"string"!=typeof e&&(e=JSON.stringify(e,!1," ")),n("log",{txt:e})},reset:function(){return n("reset")},selected:function(e){return n("selected",{segs:e})},chainStart:function(e){return n("chain_start",{seg:e})},chainRemoveHead:function(e,t){return n("chain_rem_head",{index:e,pt:t})},chainRemoveTail:function(e,t){return n("chain_rem_tail",{index:e,pt:t})},chainNew:function(e,t){return n("chain_new",{pt1:e,pt2:t})},chainMatch:function(e){return n("chain_match",{index:e})},chainClose:function(e){return n("chain_close",{index:e})},chainAddHead:function(e,t){return n("chain_add_head",{index:e,pt:t})},chainAddTail:function(e,t){return n("chain_add_tail",{index:e,pt:t})},chainConnect:function(e,t){return n("chain_con",{index1:e,index2:t})},chainReverse:function(e){return n("chain_rev",{index:e})},chainJoin:function(e,t){return n("chain_join",{index1:e,index2:t})},done:function(){return n("done")}}}},{}],28:[function(e,t,r){t.exports=function(e){"number"!=typeof e&&(e=1e-10);var t={epsilon:function(t){return"number"==typeof t&&(e=t),e},pointAboveOrOnLine:function(t,r,n){var a=r[0],i=r[1],o=n[0],l=n[1],s=t[0];return(o-a)*(t[1]-i)-(l-i)*(s-a)>=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],29:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[D(i(e).toString(16)),D(i(t).toString(16)),D(i(r).toString(16)),D(I(n))];if(a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:E(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function z(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function D(e){return 1==e.length?"0"+e:""+e}function E(e){return e<=1&&(e=100*e+"%"),e}function I(t){return e.round(255*parseFloat(t)).toString(16)}function R(e){return P(e)/255}var F,N,B,H=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",B="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function j(e){return!!H.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],36:[function(e,t,r){"use strict";t.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],37:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;t.exports=o("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:a({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":212,"../../plots/cartesian/constants":228,"../../plots/font_attributes":250,"./arrow_paths":36}],38:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref);t._extremes={},r&&l(t,r),n&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":178,"../../plots/cartesian/axes":222,"./draw":43}],39:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var U=!1,G=["x","y"],Z=0;Z1)&&(ee===K?((ce=te.r2fraction(t["a"+J]))<0||ce>1)&&(U=!0):U=!0),X=te._offset+te.r2p(t[J]),Q=.5}else"x"===J?(W=t[J],X=b.l+b.w*W):(W=1-t[J],X=b.t+b.h*W),Q=t.showarrow?.5:W;if(t.showarrow){se.head=X;var ue=t["a"+J];$=ne*j(.5,t.xanchor)-ae*j(.5,t.yanchor),ee===K?(se.tail=te._offset+te.r2p(ue),Y=$):(se.tail=X+ue,Y=$+ue),se.text=se.tail+$;var fe=x["x"===J?"width":"height"];if("paper"===K&&(se.head=o.constrain(se.head,1,fe-1)),"pixel"===ee){var de=-Math.max(se.tail-3,se.text),pe=Math.min(se.tail+3,se.text)-fe;de>0?(se.tail+=de,se.text+=de):pe>0&&(se.tail-=pe,se.text-=pe)}se.tail+=le,se.head+=le}else Y=$=ie*j(Q,oe),se.text=X+$;se.text+=le,$+=le,Y+=le,t["_"+J+"padplus"]=ie/2+Y,t["_"+J+"padminus"]=ie/2-Y,t["_"+J+"size"]=ie,t["_"+J+"shift"]=$}if(U)D.remove();else{var he=0,ge=0;if("left"!==t.align&&(he=(w-m)*("center"===t.align?.5:1)),"top"!==t.valign&&(ge=(P-y)*("middle"===t.valign?.5:1)),u)n.select("svg").attr({x:R+he-1,y:R+ge}).call(c.setClipUrl,N?A:null,e);else{var ve=R+ge-h.top,me=R+he-h.left;V.call(f.positionText,me,ve).call(c.setClipUrl,N?A:null,e)}B.select("rect").call(c.setRect,R,R,w,P),F.call(c.setRect,E/2,E/2,I-E,H-E),D.call(c.setTranslate,Math.round(L.x.text-I/2),Math.round(L.y.text-H/2)),O.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var ye,xe=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),z=+F.attr("width"),P=+F.attr("height"),E=m-.5*z,I=E+z,R=y-.5*P,N=R+P,B=[[E,R,E,N],[E,N,I,N],[I,N,I,R],[I,R,E,R]].map(A);if(!B.reduce((function(e,t){return e^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){B.forEach((function(e){var t=o.segmentsIntersect(d,h,u,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,h=t.y)}));var H=t.arrowwidth,j=t.arrowcolor,V=t.arrowside,q=C.append("g").style({opacity:s.opacity(j)}).classed("annotation-arrow-g",!0),U=q.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",H+"px").call(s.stroke,s.rgb(j));if(g(U,V,t),_.annotationPosition&&U.node().parentNode&&!i){var G=u,Z=f;if(t.standoff){var X=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=t.standoff*(d-u)/X,Z+=t.standoff*(h-f)/X}var Y,W,Q=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",H+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:Q.node(),gd:e,prepFn:function(){var e=c.getTranslate(D);Y=e.x,W=e.y,l&&l.autorange&&T(l._name+".autorange",!0),v&&v.autorange&&T(v._name+".autorange",!0)},moveFn:function(e,r){var n=w(Y,W),a=n[0]+e,i=n[1]+r;D.call(c.setTranslate,a,i),k("x",l?l.p2r(l.r2p(t.x)+e):t.x+e/b.w),k("y",v?v.p2r(v.r2p(t.y)+r):t.y-r/b.h),t.axref===t.xref&&k("ax",l.p2r(l.r2p(t.ax)+e)),t.ayref===t.yref&&k("ay",v.p2r(v.r2p(t.ay)+r)),q.attr("transform","translate("+e+","+r+")"),O.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&xe(0,0),z)p.init({element:D.node(),gd:e,prepFn:function(){ye=O.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?k("ax",l.p2r(l.r2p(t.ax)+e)):k("ax",t.ax+e),t.ayref===t.yref?k("ay",v.p2r(v.r2p(t.ay)+r)):k("ay",t.ay+r),xe(e,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(t.x)+e);else{var s=t._xsize/b.w,c=t.x+(t._xshift-t.xshift)/b.w-s/2;a=p.align(c+e/b.w,s,0,1,t.xanchor)}if(v)o=v.p2r(v.r2p(t.y)+r);else{var u=t._ysize/b.h,f=t.y-(t._yshift+t.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,t.yanchor)}k("x",a),k("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,t.xanchor,t.yanchor))}O.attr({transform:"translate("+e+","+r+")"+ye}),d(D,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",q(n))},doneFn:function(){d(D),a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=t.indexOf("end")>=0,m=f.backoff*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},l={x:+e.attr("x2"),y:+e.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void z();if(m){if(m*m>x*x+b*b)return void z();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,e.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void z();var T=y*Math.cos(s),k=y*Math.sin(s);o.x-=T,o.y-=k,e.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":253,"../annotations/draw":43}],50:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(Y)/Math.LN10));Z*=W*c.roundUp(Y/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[V+B,V+R-B],G.setScale(),e.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var Q,$=e.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),J=e.select("."+k.cbaxis),K=0;function ee(n,a){var i={propContainer:G,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+k.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var e,r=s.l+(t.x+F)*s.w,n=G.title.font.size;e="top"===M?(1-(V+R-B))*s.h+s.t+3+.75*n:(1-(V+B))*s.h+s.t-3-.25*n,ee(G._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=e.select("."+k.cbtitle),o=i.select("text"),u=[-t.outlinewidth/2,t.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===M)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}e.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),J.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=e.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(z);m.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(e,t){return e-t}));m.each((function(e,i){var o=[0===i?A[0]:(z[i]+z[i-1])/2,i===z.length-1?A[1]:(z[i]+z[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:H,width:Math.max(D,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)d.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=S(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=e.select("."+k.cblines).selectAll("path."+k.cbline).data(v.color&&v.width?P:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(e){n.select(this).attr("d","M"+H+","+(Math.round(G.c2p(e))+v.width/2%1)+"h"+D).call(d.lineGroupStyle,v.width,L(e),v.dash)})),J.selectAll("g."+G._id+"tick,path").remove();var b=H+D+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),w=l.calcTicks(G),T=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:J,path:l.makeTickPath(G,b,C),transFn:T}),l.drawLabels(r,G,{vals:w,layer:J,transFn:T,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var e=G.title.font.size,t=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+e*(G.showticklabels?1:.5):-10-e*(G.showticklabels?.5:0));ee("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=D+t.outlinewidth/2+d.bBox(J.node()).width;if((Q=$.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=$.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?d.bBox(o).width:d.bBox($.node()).right-H-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=q-U;e.select("."+k.cbbg).attr({x:H-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:U-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,t.bgcolor).call(p.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+k.cboutline).attr({x:H,y:U+t.ypad+("top"===M?K:0),width:Math.max(D,2),height:Math.max(c-2*t.ypad-K,2)}).call(p.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var u=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[t.yanchor],g=T[t.yanchor];"pixels"===t.lenmode?(f.y=t.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=t.y+t.len*h,f.yb=t.y-t.len*g);var v=w[t.xanchor],m=T[t.xanchor];if("pixels"===t.thicknessmode)f.x=t.x,f.l=l*v,f.r=l*m;else{var y=l-D;f.l=y*v,f.r=y*m,f.xl=t.x-t.thickness*v,f.xr=t.x+t.thickness*m}i.autoMargin(r,t._id,f)}],r)}(r,t,e);v&&v.then&&(e._promises||[]).push(v),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),f(e)},moveFn:function(r,o){e.attr("transform",n+" translate("+r+","+o+")"),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);f(e,c)},doneFn:function(){if(f(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":154,"../../lib":178,"../../lib/extend":173,"../../lib/setcursor":197,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../plots/cartesian/axis_defaults":224,"../../plots/cartesian/layout_attributes":236,"../../plots/cartesian/position_defaults":239,"../../plots/plots":256,"../../registry":269,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,d3:16,tinycolor2:35}],57:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":178}],58:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":193,"../colorbar/attributes":53,"./scales.js":67}],60:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":178,"./helpers":63,"fast-isnumeric":18}],61:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],69:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":178}],70:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],71:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":178,"../../plots/cartesian/constants":228,"./align":68,"./cursor":69,"./unhover":72,"has-hover":20,"has-passive-events":21,"mouse-event-offset":24}],72:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":171,"../../lib/events":172,"../../lib/throttle":200,"../fx/constants":86}],73:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],74:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=e("../../lib/svg_text_utils"),f=e("../../constants/xmlns_namespaces"),d=e("../../constants/alignment").LINE_SPACING,p=e("../../constants/interactions").DESELECTDIM,h=e("../../traces/scatter/subtypes"),g=e("../../traces/scatter/make_bubble_size_func"),v=e("../../components/fx/helpers").appendArrayPointValue,m=t.exports={};m.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},m.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},m.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},m.setRect=function(e,t,r,n,a){e.call(m.setPosition,t,r).call(m.setSize,n,a)},m.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);m.translatePoint(e,a,t,r)}))},m.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},m.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){m.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},m.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),m.dashLine(t,s,o)},m.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(e,t,r){r=+r||0,t=m.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},m.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},m.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},m.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var y=e("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(e){var t=y[e],r=t.n;m.symbolList.push(r,e,r+100,e+"-open"),m.symbolNames[r]=e,m.symbolFuncs[r]=t.f,t.needLine&&(m.symbolNeedLines[r]=!0),t.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,e+"-dot",r+300,e+"-open-dot"),t.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(e,t){var r=e%100;return m.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(e){if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=m.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=x||e>=400?0:Math.floor(Math.max(e,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:_},horizontalreversed:{node:"linearGradient",attrs:_,reversed:!0},vertical:{node:"linearGradient",attrs:w},verticalreversed:{node:"linearGradient",attrs:w,reversed:!0}};m.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=k[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},m.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},m.pointStyle=function(e,t,r){if(e.size()){var a=m.makePointStyleFns(t);e.each((function(e){m.singlePointStyle(e,n.select(this),t,a,r)}))}},m.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=m.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",b(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,y=e.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=e.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+e.i),m.gradient(t,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},m.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=m.tryColorscale(r,""),t.lineScale=m.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=h.isBubble(e)?g(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,m.makeSelectedPointStyleFns(e)),t},m.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:h?f:p*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},m.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,p))},t},m.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",b(m.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}m.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=m.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var f=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};v(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=L(e,t),y=a?a(e):e.tc||t.textfont.color;i.call(m.font,e.tf||t.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,e.mrc)}else i.remove()}))}},m.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=L(e,t);l.fill(a,i),A(a,o,s,e.mrc2||e.mrc)}))}};function S(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}m.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},z=0),r&&(m.savedBBoxes[r]=v),z++,c.extendFlat({},v)},m.setClipUrl=function(e,t,r){e.attr("clip-path",D(t,r))},m.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},m.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+t+", "+r+")").trim(),e[a]("transform",i),i},m.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},m.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+t+", "+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;m.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":" scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var I=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);e=1===t&&1===r?[]:["translate("+o+","+l+")","scale("+t+","+r+")","translate("+-o+","+-l+")"],s&&e.push(s),a.attr("transform",e.join(" "))}}))}},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":178,"../../lib/svg_text_utils":199,"../../registry":269,"../../traces/scatter/make_bubble_size_func":406,"../../traces/scatter/subtypes":413,"../color":52,"../colorscale":64,"./symbol_defs":75,d3:16,"fast-isnumeric":18,tinycolor2:35}],75:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0}}},{d3:16}],76:[function(e,t,r){"use strict";t.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],77:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":413,"../drawing":74,d3:16,"fast-isnumeric":18}],82:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":52,d3:16}],83:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":173,"../../plots/font_attributes":250,"./layout_attributes":93}],84:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>w[0]._length)return d.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+w[0]._offset,E="xval"in t?g.flat(s,t.xval):g.p2c(b,K),I="yval"in t?g.flat(s,t.yval):g.p2c(w,ee),!a(E[0])||!a(I[0]))return o.warn("Fx.hover failed",t,e),d.unhoverRaw(e,t)}var re=1/0;function ne(e,r){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),m&&0!==Y&&0===W.length){G.distance=Y,G.index=!1;var d=B._module.hoverPoints(G,q,U,"closest",u._hoverlayer);if(d&&(d=d.filter((function(e){return e.spikeDistance<=Y}))),d&&d.length){var p,h=d.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=ie(v),(!$.vLinePoint||$.vLinePoint.spikeDistance>p.spikeDistance)&&($.vLinePoint=p))}var y=d.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=ie(x),(!$.hLinePoint||$.hLinePoint.spikeDistance>p.spikeDistance)&&($.hLinePoint=p))}}}}}function ae(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&J&&W.length>1,Me=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Ae={hovermode:C,rotateLabels:ke,bgColor:Me,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Le=S(W,Ae,e);g.isUnifiedHover(C)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],T=w.datum;T.offset=w.dp,T.del=w.del}}}(Le,ke?"xa":"ya",u),O(Le,ke));if(t.target&&t.target.tagName){var Se=h.getComponentMethod("annotations","hasClickToShow")(e,be);c(n.select(t.target),Se?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,xe))return;xe&&e.emit("plotly_unhover",{event:t,points:xe});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:w,xvals:E,yvals:I})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||f.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,t.gd),c=0,u=0;return s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function S(e,t,r){var a=r._fullLayout,i=t.hovermode,l=t.rotateLabels,c=t.bgColor,d=t.container,p=t.outerContainer,h=t.commonLabelOpts||{},b=t.fontFamily||v.HOVERFONT,_=t.fontSize||v.HOVERFONTSIZE,w=e[0],T=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",O=w[S],z=(String(O)||"").split(" ")[0],P=p.node().getBoundingClientRect(),D=P.top,E=P.width,I=P.height,R=void 0!==O&&w.distance<=t.hoverdistance&&("x"===i||"y"===i);if(R){var F,N,B=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-k)+",0L"+S+","+A+k+"v"+A+(2*M+x.height)+"H-"+S+"V"+A+k+"H"+(S-2*k)+"Z")):l.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,z,P;"right"===L.side?(C="start",z=1,P="",m=T._offset+T._length):(C="end",z=-1,P="-",m=T._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+P+k+","+k+"V"+(M+x.height/2)+"h"+P+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+P+k+"V-"+k+"Z");var E,I=x.height/2,R=D-x.top-I,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=re:K+=2*M;var ne=te.height+2*M,ae=J+ne>=I;return ne<=I&&(J<=D?J=L._offset+2*M:ae&&(J=I-ne)),ee.attr("transform","translate("+K+","+J+")"),ee}var ie=d.selectAll("g.hovertext").data(e,(function(e){return A(e)}));return ie.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(f.fill,f.addOpacity(c,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(u.font,b,_)})),ie.exit().remove(),ie.each((function(e){var t=n.select(this).attr("transform",""),o=e.bgcolor||e.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(e.color)?e.color:f.defaultLine,c),h=e.borderColor||f.contrast(d),g=C(e,R,i,a,O,t),v=g[0],m=g[1],y=t.select("text.nums").call(u.font,e.fontFamily||b,e.fontSize||_,e.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=t.select("text.name"),T=0,A=0;if(m&&m!==v){w.call(u.font,e.fontFamily||b,e.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();T=L.width+2*M,A=L.height+2*M}else w.remove(),t.select("rect").remove();t.select("path").style({fill:d,stroke:h});var S,z,P=y.node().getBoundingClientRect(),F=e.xa._offset+(e.x0+e.x1)/2,N=e.ya._offset+(e.y0+e.y1)/2,B=Math.abs(e.x1-e.x0),H=Math.abs(e.y1-e.y0),j=P.width+k+M+T;if(e.ty0=D-P.top,e.bx=P.width+2*M,e.by=Math.max(P.height+2*M,A),e.anchor="start",e.txwidth=P.width,e.tx2width=T,e.offset=0,l)e.pos=F,S=N+H/2+j<=I,z=N-H/2-j>=0,"top"!==e.idealAlign&&S||!z?S?(N+=H/2,e.anchor="start"):e.anchor="middle":(N-=H/2,e.anchor="end");else if(e.pos=N,S=F+B/2+j<=E,z=F-B/2-j>=0,"left"!==e.idealAlign&&S||!z)if(S)F+=B/2,e.anchor="start";else{e.anchor="middle";var V=j/2,q=F+V-E,U=F-V;q>0&&(F-=q),U<0&&(F+=-U)}else F-=B/2,e.anchor="end";y.attr("text-anchor",e.anchor),T&&w.attr("text-anchor",e.anchor),t.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),ie}function C(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=E(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(L,(function(t,r){return l=E(r,e.nameLength),""}))),[s,l]}function O(e,t){e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),i=e.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(k+M),f=c+l*(e.txwidth+M),d=0,p=e.offset;"middle"===i&&(c-=e.tx2width/2,f+=e.txwidth/2+M),t&&(p*=-T,d=e.offset*w),r.select("path").attr("d","middle"===i?"M-"+(e.bx/2+e.tx2width/2)+","+(p-e.by/2)+"h"+e.bx+"v"+e.by+"h-"+e.bx+"Z":"M0,0L"+(o*k+d)+","+(k+p)+"v"+(e.by/2-k)+"h"+o*e.bx+"v-"+e.by+"H"+(o*k+d)+"V"+(p-k)+"Z");var h=c+d,g=p+e.ty0-e.by/2+M,v=e.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-e.bx/2-e.tx2width/2+M:-e.bx-M):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?e.bx/2-e.tx2width/2-M:e.bx+M)),a.call(s.positionText,h,g),e.tx2width&&(r.select("text.name").call(s.positionText,f+l*M+d,p+e.ty0-e.by/2+M),r.select("rect").call(u.setRect,f+(l-1)*e.tx2width/2+d,p-e.by/2-1,e.tx2width,e.by+2))}))}function z(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:p.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:p.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=p.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+p.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=p.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+p.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var h=e.hoverinfo||e.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===h.indexOf("y")&&(e.yLabel=void 0),-1===h.indexOf("z")&&(e.zLabel=void 0),-1===h.indexOf("text")&&(e.text=void 0),-1===h.indexOf("name")&&(e.name=void 0)),e}function P(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!t.hLinePoint,h=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(h){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var z,P,D=i.readability(O.color,g)<1.5?f.contrast(g):O.color,E=n.spikemode,I=n.spikethickness,R=n.spikecolor||D,F=p.getPxPosition(e,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(z=F,P=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),z=s.t+(1-B)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:z,y2:P,"stroke-width":I,stroke:R,"stroke-dasharray":u.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:z,y2:P,"stroke-width":I+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?I:-I),r:I,fill:R}).classed("spikeline",!0)}}}function D(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function E(e,t){return s.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":178,"../../lib/events":172,"../../lib/override_cursor":189,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../registry":269,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,d3:16,"fast-isnumeric":18,tinycolor2:35}],90:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":178,"../color":52,"./helpers":88}],91:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":178,"../../plot_api/plot_template":212,"../../plots/layout_attributes":254,"../../registry":269,"./attributes":102,"./helpers":108}],105:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?T(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){e.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}}))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var z=a.ensureSingle(C,"text","legendtitletext");z.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,O.font).text(O.text),M(z,C,e,t)}var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),D=C.selectAll("g.groups").data(d);D.enter().append("g").attr("class","groups"),D.exit().remove();var E=D.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+h),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,O=0;r.each((function(e){var t=e[0].width+d;C=Math.max(C,t),O+=t})),x=null;var z=0;if(s){var P=0,D=0,E=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+t),t+=n,e=Math.max(e,d+r[0].width)})),P=Math.max(P,t);var r=e+h;r+u+D>a._maxWidth&&(z=Math.max(z,D),D=0,E+=P+a.tracegroupgap,P=t),c.setTranslate(this,D,E),D+=r})),a._width=Math.max(z,D)+u,a._height=E+P+g}else{var I=r.size(),R=O+f+(I-1)*ha._maxWidth&&(z=Math.max(z,H),N=0,B+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+B+t/2+h),H=N+r+h,N+=n,F=Math.max(F,t)})),R?(a._width=N+f,a._height=F+g):(a._width=Math.max(z,H)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=e._context.edits,V=j.legendText||j.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=V?d:x||d+e[0].width;l||(a+=h/2),c.setRect(t,0,-r/2,a,r)}))}(e,D,E,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var z=t._effHeight;t._main||(z=t._height),S.attr({width:t._width-b,height:z-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:z-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var D,E,I,R=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-R-2*p.scrollBarMargin,N=t._height-t._effHeight,B=F/N,H=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+H}),c.setClipUrl(C,f,e),q(H,R,B),g.on("wheel",(function(){q(H=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),R,B),0!==H&&H!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;D="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,I=H})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(E="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,q(H=function(e,t,r){var n=(r-t)/B+e;return a.constrain(n,0,N)}(I,D,E),R,B))}));P.call(j);var V=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(D=e.changedTouches[0].clientY,I=H)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(E=e.changedTouches[0].clientY,q(H=function(e,t,r){var n=(t-r)/B+e;return a.constrain(n,0,N)}(I,D,E),R,B))}));C.call(V)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function q(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":154,"../../lib":178,"../../lib/events":172,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../../registry":269,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,d3:16}],106:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return h?n:Math.min(a,r)};function v(e,t,r){var i=e[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=g(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(t,r.mlc||s.color)}))}function m(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var o=r.valign,l=e[0].lineHeight,s=e[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([e]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",e[0]),u?f.call(l.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;o.gradient(e,t,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,v(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(e){v(e,this,"funnel")})).each((function(e){v(e,this)})).each((function(e){var r=e[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,t)}}))})).each((function(e){m(e,this,"funnelarea")})).each((function(e){m(e,this,"pie")})).each((function(e){var r,a,l=e[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=f||m,k=p||v,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[e]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",M+"h30v6h-30z").call(f?o.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+u.uid;o.gradient(e,t,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+u.uid;o.lineGroupStyle(e),o.gradient(e,t,r,d(b),x,"stroke")}})})).each((function(e){var r,a,l=e[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(e){return l._distinct&&l.index&&e[l.index]?e[l.index]:e[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,t),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":178,"../../registry":269,"../../traces/pie/helpers":381,"../../traces/pie/style_one":387,"../../traces/scatter/subtypes":413,"../color":52,"../colorscale/helpers":63,"../drawing":74,d3:16}],111:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=R[r+1];else if(e=n.pmax)t=R[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");X(n),Q(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),Z.moveFn="move"===D?Y:W,Z.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),$(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;$(l)}};function X(r){if(m(e))D=null;else if(R)D="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),D=s.split("-")[0]}}function Y(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(j(e)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=U(T+a)):(s=function(e){return U(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else E?N("xanchor",r.xanchor=q(x+n)):(N("x0",r.x0=q(c+n)),N("x1",r.x1=q(v+n))),I?N("yanchor",r.yanchor=U(T+a)):(N("y0",r.y0=U(f+a)),N("y1",r.y1=U(y+a)));t.attr("d",_(e,r)),Q(l,r)}function W(n,a){if(F){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(j(e)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=U(T+a)):(s=function(e){return U(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(R){if("resize-over-start-point"===D){var u=c+n,d=I?f-a:f+a;N("x0",r.x0=E?u:q(u)),N("y0",r.y0=I?d:U(d))}else if("resize-over-end-point"===D){var p=v+n,h=I?y-a:y+a;N("x1",r.x1=E?p:q(p)),N("y1",r.y1=I?h:U(h))}}else{var m=function(e){return-1!==D.indexOf(e)},b=m("n"),G=m("s"),Z=m("w"),X=m("e"),Y=b?k+a:k,W=G?M+a:M,$=Z?A+n:A,J=X?L+n:L;I&&(b&&(Y=k-a),G&&(W=M-a)),(!I&&W-Y>10||I&&Y-W>10)&&(N(S,r[S]=I?Y:U(Y)),N(C,r[C]=I?W:U(W))),J-$>10&&(N(O,r[O]=E?$:q($)),N(z,r[z]=E?J:q(J)))}t.attr("d",_(e,r)),Q(l,r)}function Q(e,t){(E||I)&&function(){var r="path"!==t.type,n=e.selectAll(".visual-cue").data([0]);n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var i=j(E?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=V(I?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&I){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function $(e){e.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=X}(e,E,s,t,r,D):!0===s.editable&&E.style("pointer-events",z||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,E)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getFromId(e,t.xref),v=i.getFromId(e,t.yref),m=e._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(e){return p._offset+p.r2p(r(e,!0))}):n=function(e){return m.l+m.w*e},v?(o=g.shapePositionToRange(v),l=function(e){return v._offset+v.r2p(o(e,!0))}):l=function(e){return m.t+m.h*(1-e)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var y=n(t.xanchor);s=y+t.x0,c=y+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var x=l(t.yanchor);u=x-t.y0,f=x-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+t._dims.currentValueTotalHeight+")")}}function L(e,t){var r=e._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,t))}function S(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",u.railTouchRectClass,(function(n){n.call(k,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(e,t){var r=t._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(e,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[u.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,g(t))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];t.attr("transform","translate("+v+")")}}}return E.call(I),P&&(L?E.on(".opacity",null):(k=0,M=!0,E.text(m).on("mouseover.opacity",(function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)}))),E.call(u.makeEditable,{gd:e}).on("edit",(function(t){void 0!==y?o.call("_guiRestyle",e,v,t,y):o.call("_guiRelayout",e,v,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(e){this.text(e||" ").call(u.positionText,b.x,b.y)}))),E.classed("js-placeholder",M),w}}},{"../../constants/alignment":154,"../../constants/interactions":157,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../../registry":269,"../color":52,"../drawing":74,d3:16,"fast-isnumeric":18}],148:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:c,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":173,"../../plot_api/edit_types":205,"../../plot_api/plot_template":212,"../../plots/font_attributes":250,"../../plots/pad_attributes":255,"../color/attributes":51}],149:[function(e,t,r){"use strict";t.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],150:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["x","y"]),o("xanchor"),o("yanchor"),o("pad.t"),o("pad.r"),o("pad.b"),o("pad.l"),n.coerceFont(o,"font",r.font),o("bgcolor",r.paper_bgcolor),o("bordercolor"),o("borderwidth"))}function c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":178,"../../plots/array_container_defaults":218,"./attributes":148,"./constants":149}],151:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[0]:[]);if(o.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+f.headerGroupClassName).each(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,z=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,D=h+g,E=v;D+z>s&&(D=s-z);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=I.attr({rx:l.barRadius,ry:l.barRadius,x:D,y:E,width:z,height:P}),this._vbarYMin=E+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,N=O?f+z+.5:f+.5,B=d-.5,H=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+R).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){var V=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault()})).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),O&&this.vbar.on(".drag",null).call(q)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":178,"../color":52,"../drawing":74,d3:16}],154:[function(e,t,r){"use strict";t.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,CAP_SHIFT:.7,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],155:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format"}},{}],156:[function(e,t,r){"use strict";t.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],157:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],158:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],159:[function(e,t,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],160:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],163:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],164:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":185}],165:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var z=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=z.newDate(k,z.toMonthIndex(k,M,P),A)}else O=z.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var D=new Date(Date.UTC(2e3,M,A,L,S));return D.setUTCFullYear(k),D.getUTCMonth()!==M||D.getUTCDate()!==A?u:D.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":185}],177:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],178:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../constants/numerical"),o=i.FP_SAFE,l=i.BADNUM,s=t.exports={};s.nestedProperty=e("./nested_property"),s.keyedContainer=e("./keyed_container"),s.relativeAttr=e("./relative_attr"),s.isPlainObject=e("./is_plain_object"),s.toLogRange=e("./to_log_range"),s.relinkPrivateKeys=e("./relink_private");var c=e("./array");s.isTypedArray=c.isTypedArray,s.isArrayOrTypedArray=c.isArrayOrTypedArray,s.isArray1D=c.isArray1D,s.ensureArray=c.ensureArray,s.concat=c.concat,s.maxRowLength=c.maxRowLength,s.minRowLength=c.minRowLength;var u=e("./mod");s.mod=u.mod,s.modHalf=u.modHalf;var f=e("./coerce");s.valObjectMeta=f.valObjectMeta,s.coerce=f.coerce,s.coerce2=f.coerce2,s.coerceFont=f.coerceFont,s.coerceHoverinfo=f.coerceHoverinfo,s.coerceSelectionMarkerOpacity=f.coerceSelectionMarkerOpacity,s.validate=f.validate;var d=e("./dates");s.dateTime2ms=d.dateTime2ms,s.isDateTime=d.isDateTime,s.ms2DateTime=d.ms2DateTime,s.ms2DateTimeLocal=d.ms2DateTimeLocal,s.cleanDate=d.cleanDate,s.isJSDate=d.isJSDate,s.formatDate=d.formatDate,s.incrementMonth=d.incrementMonth,s.dateTick0=d.dateTick0,s.dfltRange=d.dfltRange,s.findExactDates=d.findExactDates,s.MIN_MS=d.MIN_MS,s.MAX_MS=d.MAX_MS;var p=e("./search");s.findBin=p.findBin,s.sorterAsc=p.sorterAsc,s.sorterDes=p.sorterDes,s.distinctVals=p.distinctVals,s.roundUp=p.roundUp,s.sort=p.sort,s.findIndexOfMin=p.findIndexOfMin;var h=e("./stats");s.aggNums=h.aggNums,s.len=h.len,s.mean=h.mean,s.median=h.median,s.midRange=h.midRange,s.variance=h.variance,s.stdev=h.stdev,s.interp=h.interp;var g=e("./matrix");s.init2dArray=g.init2dArray,s.transposeRagged=g.transposeRagged,s.dot=g.dot,s.translationMatrix=g.translationMatrix,s.rotationMatrix=g.rotationMatrix,s.rotationXYMatrix=g.rotationXYMatrix,s.apply2DTransform=g.apply2DTransform,s.apply2DTransform2=g.apply2DTransform2;var v=e("./angles");s.deg2rad=v.deg2rad,s.rad2deg=v.rad2deg,s.angleDelta=v.angleDelta,s.angleDist=v.angleDist,s.isFullCircle=v.isFullCircle,s.isAngleInsideSector=v.isAngleInsideSector,s.isPtInsideSector=v.isPtInsideSector,s.pathArc=v.pathArc,s.pathSector=v.pathSector,s.pathAnnulus=v.pathAnnulus;var m=e("./anchor_utils");s.isLeftAnchor=m.isLeftAnchor,s.isCenterAnchor=m.isCenterAnchor,s.isRightAnchor=m.isRightAnchor,s.isTopAnchor=m.isTopAnchor,s.isMiddleAnchor=m.isMiddleAnchor,s.isBottomAnchor=m.isBottomAnchor;var y=e("./geometry2d");s.segmentsIntersect=y.segmentsIntersect,s.segmentDistance=y.segmentDistance,s.getTextLocation=y.getTextLocation,s.clearLocationCache=y.clearLocationCache,s.getVisibleSegment=y.getVisibleSegment,s.findPointOnPath=y.findPointOnPath;var x=e("./extend");s.extendFlat=x.extendFlat,s.extendDeep=x.extendDeep,s.extendDeepAll=x.extendDeepAll,s.extendDeepNoArrays=x.extendDeepNoArrays;var b=e("./loggers");s.log=b.log,s.warn=b.warn,s.error=b.error;var _=e("./regex");s.counterRegex=_.counter;var w=e("./throttle");s.throttle=w.throttle,s.throttleDone=w.done,s.clearThrottle=w.clear;var T=e("./dom");function k(e){var t={};for(var r in e)for(var n=e[r],a=0;ao?l:a(e)?Number(e):l:l},s.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(a(e)&&e>=0&&e%1==0)},s.noop=e("./noop"),s.identity=e("./identity"),s.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},s.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},s.simpleMap=function(e,t,r,n){for(var a=e.length,i=new Array(a),o=0;o=Math.pow(2,r)?a>10?(s.warn("randstr failed uniqueness"),c):e(t,r,n,(a||0)+1):c},s.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},s.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},s.syncOrAsync=function(e,t,r){var n;function a(){return s.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,s.promiseError);return r&&r(t)},s.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},s.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},s.fillArray=function(e,t,r,n){if(n=n||s.identity,s.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},s.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var C=/^\w*$/;s.templateString=function(e,t){var r={};return e.replace(s.TEMPLATE_STRING_REGEX,(function(e,n){var a;return C.test(n)?a=t[n]:(r[n]=r[n]||s.nestedProperty(t,n).get,a=r[n]()),s.isValidTextValue(a)?a:""}))};var O={max:10,count:0,name:"hovertemplate"};s.hovertemplateString=function(){return D.apply(O,arguments)};var z={max:10,count:0,name:"texttemplate"};s.texttemplateString=function(){return D.apply(z,arguments)};var P=/^[:|\|]/;function D(e,t,r){var a=this,i=arguments;t||(t={});var o={};return e.replace(s.TEMPLATE_STRING_REGEX,(function(e,l,c){var u,f,d,p;for(d=3;d=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var E=2e9;s.seedPseudoRandom=function(){E=2e9},s.pseudoRandom=function(){var e=E;return E=(69069*E+1)%4294967296,Math.abs(E-e)<429496729?s.pseudoRandom():E/4294967296},s.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=s.extractOption(e,t,"htx","hovertext");if(s.isValidTextValue(a))return n(a);var i=s.extractOption(e,t,"tx","text");return s.isValidTextValue(i)?n(i):void 0},s.isValidTextValue=function(e){return e||0===e},s.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},s.ensureUniformFontSize=function(e,t){var r=s.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":176,"./identity":177,"./is_plain_object":179,"./keyed_container":180,"./localize":181,"./loggers":182,"./make_trace_groups":183,"./matrix":184,"./mod":185,"./nested_property":186,"./noop":187,"./notifier":188,"./push_unique":191,"./regex":193,"./relative_attr":194,"./relink_private":195,"./search":196,"./stats":198,"./throttle":200,"./to_log_range":201,d3:16,"fast-isnumeric":18}],179:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],180:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":210,"./notifier":188}],183:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:16}],184:[function(e,t,r){"use strict";r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],186:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":158,"./matrix":184}],191:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function c(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,u,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(u=h>=0?r?o:l:r?c:s,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e){var t=e.slice();t.sort(r.sorterAsc);for(var n=t.length-1,a=t[n]-t[0]||1,i=a/(n||1)/1e4,o=[t[0]],l=0;lt[l]+i&&(a=Math.min(a,t[l+1]-t[l]),o.push(t[l+1]));return{vals:o,minDiff:a}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":165,"fast-isnumeric":18}],199:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=e("../constants/xmlns_namespaces"),o=e("../constants/alignment").LINE_SPACING;function l(e,t){return e.node().getBoundingClientRect()[t]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,M){var A=e.text(),S=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),C=n.select(e.node().parentNode);if(!C.empty()){var O=e.attr("class")?e.attr("class").split(" ")[0]:"text";return O+="-math",C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove(),e.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),S?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),i={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return z(),void t();var s=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=e.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+e.attr("x")-f*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],h=-(r||l(e,"height"))/4;"y"===O[0]?(s.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===O[0]?o.attr({x:e.attr("x"),y:h-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+e.attr("y")+h-d/2}),M&&M.call(e,s),t(s)}))}))):z(),e}function z(){C.empty()||(O=e.attr("class")+"-math",C.select("svg."+O).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(i.svg,"tspan");n.select(t).attr({class:"line",dy:c*o+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var l=1;l doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}y.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(v),O=0;O|>|>)/g;var f={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&L(n)}var k=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(e){return e.replace(A,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):M[t])||e}))}function S(e,t,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=e.node().getBoundingClientRect(),c=t.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(e){e=e.replace(g," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(v),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],201:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":18}],202:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],203:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],204:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),z=[],P=-1,D=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?z.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(z[x],1),O&&O.splice(z[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===P)E=L;else{for(D=Math.max(C.length,D),E=[],x=0;x=P);x++)E.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),D(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&D(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))throw new Error("update must be a key:value object");if("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");for(var i in D(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function q(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(U(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,q,[e,a.undoit],q,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function U(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,X=/^[xyz]axis[0-9]*\.autorange$/,Y=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=B(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(V(t),p=Object.keys(t),n=0;n0&&"string"!=typeof D.parts[I];)I--;var R=D.parts[I],F=D.parts[I-1]+"."+R,H=D.parts.slice(0,I).join("."),j=l(e.layout,H).get(),q=l(s,H).get(),U=D.get();if(void 0!==E){k[P]=E,L[P]="reverse"===R?E:N(U);var G=f.getLayoutValObject(s,D.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(E){S("autosize",null);var $="height"===P?"width":"height";S($,s[$])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))z(F),l(s,H+"._inputRange").set(null);else if(F.match(X)){z(F),l(s,H+"._inputRange").set(null);var J=l(s,H).get();J._inputDomain&&(J._input.domain=J._inputDomain.slice())}else F.match(Y)&&l(s,H+"._inputDomain").set(null);if("type"===R){var K=j,ee="linear"===q.type&&"log"===E,te="log"===q.type&&"linear"===E;if(ee||te){if(K&&K.range)if(q.autorange)ee&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var re=K.range[0],ne=K.range[1];ee?(re<=0&&ne<=0&&S(H+".autorange",!0),re<=0?re=ne/1e6:ne<=0&&(ne=re/1e6),S(H+".range[0]",Math.log(re)/Math.LN10),S(H+".range[1]",Math.log(ne)/Math.LN10)):(S(H+".range[0]",Math.pow(10,re)),S(H+".range[1]",Math.pow(10,ne)))}else S(H+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[D.parts[0]]&&"radialaxis"===D.parts[1]&&delete s[D.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,q,E,S),u.getComponentMethod("images","convertCoords")(e,q,E,S)}else S(H+".autorange",!0),S(H+".range",null);l(s,H+"._inputRange").set(null)}else if(R.match(A)){var ae=l(s,P).get(),ie=(E||{}).type;ie&&"-"!==ie||(ie="linear"),u.getComponentMethod("annotations","convertCoords")(e,ae,ie,S),u.getComponentMethod("images","convertCoords")(e,ae,ie,S)}var oe=w.containerArrayMatch(P);if(oe){r=oe.array,n=oe.index;var le=oe.property,se=G||{editType:"calc"};""!==n&&""===le&&(w.isAddVal(E)?L[P]=null:w.isRemoveVal(E)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,se),m[r]||(m[r]={});var ce=m[r][n];ce||(ce=m[r][n]={}),ce[le]=E,delete t[P]}else"reverse"===R?(j.range?j.range.reverse():(S(H+".autorange",!0),j.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===E||"select"===E)&&"lasso"!==U&&"select"!==U||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,D.set(E))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}var ue=s._axisConstraintGroups||[];for(C in O)for(n=0;n1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[v]).name+'" with a frame whose name of type "number" also equates to "'+v+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===L&&o.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":178,"../plots/attributes":219}],213:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,z=l.plotgroup;if(y(C,O,L)){var P=z.node(),D=l.bg=o.ensureSingle(z,"rect","bg");P.insertBefore(D.node(),P.childNodes[0]),A.push(a)}else z.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,I,R,F,N,B,H,j,V,q,U,G,Z,X=v._bgLayer.selectAll(".bg").data(M);for(X.enter().append("rect").classed("bg",!0),X.exit().remove(),X.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":178,"../plots/attributes":219,"../plots/plots":256,"./plot_config":210,"./plot_schema":211,"./plot_template":212}],215:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":178,"../plots/plots":256,"../snapshot/helpers":273,"../snapshot/svgtoimg":275,"../snapshot/tosvg":277,"../version":435,"./plot_api":209,"fast-isnumeric":18}],216:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,z=Array.isArray(k);if(z&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(z?Math.min(P,k[A].length):P);M++)L=z?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=M-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/M>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/M));if(d===p){var C=d-1,O=d+1;if(T)if(0===d)i=[0,1];else{var z=(d>0?f:u).reduce((function(e,t){return Math.max(e,o(t))}),0),P=d/(1-Math.min(.5,z/M));i=d>0?[0,P]:[P,0]}else i=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(M-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function s(e){var t=e._length/20;return"domain"===e.constrain&&e._inputDomain&&(t*=(e._inputDomain[1]-e._inputDomain[0])/(e.domain[1]-e.domain[0])),function(e){return e.pad+(e.extrapad?t:0)}}function c(e,t){var r,n,a,i=t._id,o=e._fullData,l=e._fullLayout,s=[],c=[];function d(e,t){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function p(e){return n(e)&&Math.abs(e)=t}t.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(e,t){if(t.setScale(),t.autorange){t.range=l(e,t),t._r=t.range.slice(),t._rl=a.simpleMap(t._r,t.r2l);var r=t._input,n={};n[t._attr+".range"]=t.range,n[t._attr+".autorange"]=t.autorange,o.call("_storeDirectGUIEdit",e.layout,e._fullLayout._preGUI,n),r.range=t.range.slice(),r.autorange=t.autorange}var i=t._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[t._name];s&&"auto"===s.rangemode&&(s.range=l(e,t)),i._input.rangeslider[t._name]=a.extendFlat({},s)}},findExtremes:function(e,t,r){r||(r={});e._m||e.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=t.length,b=r.padded||!1,_=r.tozero&&("linear"===e.type||"-"===e.type),w="log"===e.type,T=!1,k=r.vpadLinearized||!1;function M(e){if(Array.isArray(e))return T=!0,function(t){return Math.max(Number(e[t]||0),0)};var t=Math.max(Number(e||0),0);return function(){return t}}var A=M((e._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=P;a--)z(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":158,"../../lib":178,"../../registry":269,"fast-isnumeric":18}],222:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../components/titles"),u=e("../../components/color"),f=e("../../components/drawing"),d=e("./layout_attributes"),p=e("./clean_ticks"),h=e("../../constants/numerical"),g=h.ONEAVGYEAR,v=h.ONEAVGMONTH,m=h.ONEDAY,y=h.ONEHOUR,x=h.ONEMIN,b=h.ONESEC,_=h.MINUS_SIGN,w=h.BADNUM,T=e("../../constants/alignment"),k=T.MID_SHIFT,M=T.CAP_SHIFT,A=T.LINE_SPACING,L=T.OPPOSITE_SIDE,S=t.exports={};S.setConvert=e("./set_convert");var C=e("./axis_autotype"),O=e("./axis_ids");S.id2name=O.id2name,S.name2id=O.name2id,S.cleanId=O.cleanId,S.list=O.list,S.listIds=O.listIds,S.getFromId=O.getFromId,S.getFromTrace=O.getFromTrace;var z=e("./autorange");S.getAutoRange=z.getAutoRange,S.findExtremes=z.findExtremes,S.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(e,t,u,c)},S.coercePosition=function(e,t,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=S.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},S.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:S.getFromId(t,r).cleanPos)(e)},S.redrawComponents=function(e,t){t=t||S.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},S.saveRangeInitial=function(e,t){for(var r=S.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=S.tickIncrement(e,"M6","reverse")+1.5*m:i.exactMonths>.8?e=S.tickIncrement(e,"M1","reverse")+15.5*m:e-=m/2;var s=S.tickIncrement(e,r);if(s<=n)return s}return e}(x,e,y,c,i)),v=x,0;v<=u;)v=S.tickIncrement(v,y,!1,i);return{start:t.c2r(x,0,i),end:t.c2r(v,0,i),size:y,_dataSpan:u-c}},S.prepTicks=function(e){var t=l.simpleMap(e.range,e.r2l);if("auto"===e.tickmode||!e.dtick){var r,n=e.nticks;n||("category"===e.type||"multicategory"===e.type?(r=e.tickfont?1.2*(e.tickfont.size||12):15,n=e._length/r):(r="y"===e._id.charAt(0)?40:80,n=l.constrain(e._length/r,4,9)+1),"radialaxis"===e._name&&(n*=2)),"array"===e.tickmode&&(n*=100),e._roughDTick=(Math.abs(t[1]-t[0])-(e._lBreaks||0))/n,S.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}e.tick0||(e.tick0="date"===e.type?"2000-01-01":0),"date"===e.type&&e.dtick<.1&&(e.dtick=.1),q(e)},S.calcTicks=function(e){S.prepTicks(e);var t=l.simpleMap(e.range,e.r2l);if("array"===e.tickmode)return function(e){var t=e.tickvals,r=e.ticktext,n=new Array(t.length),a=l.simpleMap(e.range,e.r2l),i=1.0001*a[0]-1e-4*a[1],o=1.0001*a[1]-1e-4*a[0],s=Math.min(i,o),c=Math.max(i,o),u=0;Array.isArray(r)||(r=[]);var f="category"===e.type?e.d2l_noadd:e.d2l;"log"===e.type&&"L"!==String(e.dtick).charAt(0)&&(e.dtick="L"+Math.pow(10,Math.floor(Math.min(e.range[0],e.range[1]))-1));for(var d=0;ds&&p=n:a<=n)&&!(o.length>r||a===t);a=S.tickIncrement(a,e.dtick,i,e.calendar)){t=a;var l=!1;s&&a!==(0|a)&&(l=!0),o.push({minor:l,value:a})}}(),e.rangebreaks){if("auto"===e.tickmode)for(var c=0;c=d.min&&u2){for(var h,g=2*(e.tickfont?e.tickfont.size:12),v=[],m=i?1:-1,y=i?p-1:0,x=i?0:p-1;m*x<=m*y;x+=m){var b=e.c2p(o[x].value);(void 0===h||Math.abs(b-h)>g)&&(h=b,v.push(o[x]))}o=v.reverse()}}oe(e)&&360===Math.abs(t[1]-t[0])&&o.pop(),e._tmax=(o[o.length-1]||{}).value,e._prevDateHead="",e._inCalcTicks=!0;for(var _=new Array(o.length),T=0;T10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=m&&i<=10||t>=15*m)e._tickround="d";else if(t>=x&&i<=16||t>=y)e._tickround="M";else if(t>=b&&i<=19||t>=x)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(Z(e.exponentformat)&&!X(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function U(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}S.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar);var i=2*t;i>g?(t/=g,r=n(10),e.dtick="M"+12*V(t,r,I)):i>v?(t/=v,e.dtick="M"+V(t,1,R)):i>m?(e.dtick=V(t,m,e._hasDayOfWeekBreaks?[1,7,14]:N),e.tick0=l.dateTick0(e.calendar,!0)):i>y?e.dtick=V(t,y,R):i>x?e.dtick=V(t,x,F):i>b?e.dtick=V(t,b,F):(r=n(10),e.dtick=V(t,r,I))}else if("log"===e.type){e.tick0=0;var o=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(o[1]-o[0])<1){var s=1.5*Math.abs((o[1]-o[0])/t);t=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/s,r=n(10),e.dtick="L"+V(t,r,I)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):oe(e)?(e.tick0=0,r=1,e.dtick=V(t,r,j)):(e.tick0=0,r=n(10),e.dtick=V(t,r,I));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var c=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(c)}},S.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return e+o*t;var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?H:B,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},S.tickFirst=function(e){var t=e.r2l||Number,r=l.simpleMap(e.range,t),i=r[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=Y(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||Z(p)&&X(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":_)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":_)+d:(t.text=Y(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):oe(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=Y(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=Y(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=_+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=Y(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},S.hoverLabelText=function(e,t,r){if(r!==w&&r!==t)return S.hoverLabelText(e,t)+" - "+S.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=S.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":_+a:a};var G=["f","p","n","\u03bc","m","","k","M","G","T"];function Z(e){return"SI"===e||"B"===e}function X(e){return e>14||e<-15}function Y(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=S.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};q(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,_);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":Z(s)&&(e+=G[c/3+5]));return i?_+e:e}function W(e,t){for(var r=[],n={},a=0;a1&&r=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-u:0,f)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=t._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==d._dfltTitle[h]&&(n[s]+=$(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[c]+=f),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}Y&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,ee(t),n),i.autoMargin(e,te(t),a),i.autoMargin(e,re(t),l)})),r.skipTitle||Y&&"bottom"===t.side||Z.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+$(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,u,d,p=S.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,u="top"===t.side?p-r:p+r):(u=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(d={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(Z)}}function J(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=K(this),t=f.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},S.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},S.makeTransFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.x))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.x))+")"}},S.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},S.makeLabelFns=function(e,t,r){var n=e._id.charAt(0),i="boundaries"!==e.tickson&&"outside"===e.ticks,o=0,s=0;if(i&&(o+=e.ticklen),r&&"outside"===e.ticks){var c=l.deg2rad(r);o=e.ticklen*Math.cos(c)+1,s=e.ticklen*Math.sin(c)}e.showticklabels&&(i||e.showline)&&(o+=.2*e.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(e.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===e.side?1:-1,u=s*p,f=t+o*p,d="bottom"===e.side?1:-.2,h.xFn=function(e){return e.dx+u},h.yFn=function(e){return e.dy+f+e.fontSize*d},h.anchorFn=function(e,t){return a(t)&&0!==t&&180!==t?t*p<0?"end":"start":"middle"},h.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side?-n:0}):"y"===n&&(p="right"===e.side?1:-1,u=o,f=-s*p,d=90===Math.abs(e.tickangle)?.5:0,h.xFn=function(e){return e.dx+t+(u+e.fontSize*d)*p},h.yFn=function(e){return e.dy+f+e.fontSize*k},h.anchorFn=function(t,r){return a(r)&&90===Math.abs(r)?"middle":"right"===e.side?"start":"end"},h.heightFn=function(t,r,n){return(r*="left"===e.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},S.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.layer.selectAll("path."+n).data(t.ticks?r.vals:[],Q);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,t.tickcolor).style("stroke-width",f.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},S.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&S.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;l1)for(n=1;n2*o}(e,t)?"date":function(e){for(var t=Math.max(1,(e.length-1)/1e3),r=0,n=0,o={},l=0;l2*r}(e)?"category":function(e){if(!e)return!1;for(var t=0;t=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.getAxisGroup=function(e,t){for(var r=e._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;ns*x)||T)for(r=0;rD&&Rz&&(z=R);p/=(z-O)/(2*P),O=c.l2r(O),z=c.l2r(z),c.range=c._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function F(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function N(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+t+", "+r+")").attr("d","M0,0Z")}function B(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),H(e,t,a,i)}function H(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function j(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(e){O&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),O=!1)}function q(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,C)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function U(e,t,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(j(a),2!==e||he||je(),pe)i.indexOf("select")>-1&&M(r,a,W,Q,t.id,Se),i.indexOf("event")>-1&&f.click(a,r,t.id);else if(1===e&&he){var l=g?H:z,c="s"===g||"w"===O?0:1,u=l._name+".range["+c+"]",d=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===O&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(me).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function ze(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,t+ye)),a=Math.max(0,Math.min(ee,r+xe)),i=Math.abs(n-ye),o=Math.abs(a-xe);function l(){ke="",be.r=be.l,be.t=be.b,Ae.attr("d","M0,0Z")}if(be.l=Math.min(ye,n),be.r=Math.max(ye,n),be.t=Math.min(xe,a),be.b=Math.max(xe,a),te.isSubplotConstrained)i>C||o>C?(ke="xy",i/K>o/ee?(o=i*ee/K,xe>a?be.t=xe-o:be.b=xe+o):(i=o*K/ee,ye>n?be.l=ye-i:be.r=ye+i),Ae.attr("d",q(be))):l();else if(re.isSubplotConstrained)if(i>C||o>C){ke="xy";var s=Math.min(be.l/K,(ee-be.b)/ee),c=Math.max(be.r/K,(ee-be.t)/ee);be.l=s*K,be.r=c*K,be.b=(1-s)*ee,be.t=(1-c)*ee,Ae.attr("d",q(be))}else l();else!ae||og[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":178,"fast-isnumeric":18}],240:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)]}},{"../../constants/alignment":154}],241:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,z=C.axValue,P=C.getTransform;function D(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=H(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function B(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function j(e,t,r){var n,i,o,l;for(n=0;n=0)X._fullLayout._deactivateShape(X);else if(!H){var r=Y.clickmode;b.done(de).then((function(){if(b.clear(de),2===e){for(se.remove(),w=0;w-1&&D(t,X,a.xaxes,a.yaxes,a.subplot,a,se),"event"===r&&X.emit("plotly_selected",void 0);l.click(X,t)})).catch(y.error)}},a.doneFn=function(){fe.remove(),b.done(de).then((function(){b.clear(de),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=le,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pe)})).catch(y.error),H&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:D}},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":178,"../../lib/clear_gl_canvases":167,"../../lib/polygon":190,"../../lib/throttle":200,"../../plot_api/subroutines":213,"../../registry":269,"./axis_ids":225,"./constants":228,"./handle_outline":232,"./helpers":233,polybooljs:26}],242:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../lib"),o=i.cleanNumber,l=i.ms2DateTime,s=i.dateTime2ms,c=i.ensureNumber,u=i.isArrayOrTypedArray,f=e("../../constants/numerical"),d=f.FP_SAFE,p=f.BADNUM,h=f.LOG_CLIP,g=f.ONEDAY,v=f.ONEHOUR,m=f.ONEMIN,y=f.ONESEC,x=e("./axis_ids"),b=e("./constants"),_=b.HOUR_PATTERN,w=b.WEEKDAY_PATTERN;function T(e){return Math.pow(10,e)}function k(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",f=r.charAt(0);function M(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*h*Math.abs(n-a))}return p}function A(t,r,n){var o=s(t,n||e.calendar);if(o===p){if(!a(t))return p;t=+t;var l=Math.floor(10*i.mod(t+.05,1)),c=Math.round(t-l/10);o=s(new Date(c))+l/10}return o}function L(t,r,n){return l(t,r,n||e.calendar)}function S(t){return e._categories[Math.round(t)]}function C(t){if(k(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return p}function O(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=O(e);return void 0!==t?t:a(e)?+e:void 0}function P(e,t,r){return n.round(r+t*e,2)}function D(e,t,r){return(e-r)/t}var E=function(t){return a(t)?P(t,e._m,e._b):p},I=function(t){return D(t,e._m,e._b)};if(e.rangebreaks){var R="y"===f;E=function(t){if(!a(t))return p;var r=e._rangebreaks.length;if(!r)return P(t,e._m,e._b);var n=R;e.range[0]>e.range[1]&&(n=!n);for(var i=n?-1:1,o=i*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?P(t,e._m2,f):0},I=function(t){var r=e._rangebreaks.length;if(!r)return D(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return D(t,e._m2,e._B[n])}}e.c2l="log"===e.type?M:c,e.l2c="log"===e.type?T:c,e.l2p=E,e.p2l=I,e.c2p="log"===e.type?function(e,t){return E(M(e,t))}:E,e.p2c="log"===e.type?function(e){return T(I(e))}:I,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=o,e.c2d=e.c2r=e.l2d=e.l2r=c,e.d2p=e.r2p=function(t){return e.l2p(o(t))},e.p2d=e.p2r=I,e.cleanPos=c):"log"===e.type?(e.d2r=e.d2l=function(e,t){return M(o(e),t)},e.r2d=e.r2c=function(e){return T(o(e))},e.d2c=e.r2l=o,e.c2d=e.l2r=c,e.c2r=M,e.l2d=T,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return T(I(e))},e.r2p=function(t){return e.l2p(o(t))},e.p2r=I,e.cleanPos=c):"date"===e.type?(e.d2r=e.r2d=i.identity,e.d2c=e.r2c=e.d2l=e.r2l=A,e.c2d=e.c2r=e.l2d=e.l2r=L,e.d2p=e.r2p=function(t,r,n){return e.l2p(A(t,0,n))},e.p2d=e.p2r=function(e,t,r){return L(I(e),t,r)},e.cleanPos=function(t){return i.cleanDate(t,p,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=C,e.r2d=e.c2d=e.l2d=S,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=c,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return S(I(e))},e.r2p=e.d2p,e.p2r=I,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:c(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=S,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=O,e.l2r=e.c2r=c,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return S(I(e))},e.r2p=e.d2p,e.p2r=I,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:c(e)},e.setupMultiCategory=function(n){var a,o,l=e._traceIndices,s=t._axisMatchGroups;if(s&&s.length&&0===e._categories.length)for(a=0;ad&&(l[n]=d),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else i.nestedProperty(e,t).set(o)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=x.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),d="y"===f;if((d?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(d?u:c)),l=0;la&&(a+=7,la&&(a+=24,l=n&&l=n&&tl.max||nl.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":74,"../../lib":178,"../../registry":269,"./axes":222,d3:16}],247:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){y.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&u.text()?" - ":"")}},y.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=y.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var _=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],w=["year","month","dayMonth","dayMonthYear"];function T(e,t){var r=e._context.locale,n=!1,a={};function o(e){for(var r=!0,i=0;i1&&D.length>1){for(i.getComponentMethod("grid","sizeDefaults")(c,l),o=0;o15&&D.length>15&&0===l.shapes.length&&0===l.images.length,l._hasCartesian=l._has("cartesian"),l._hasGeo=l._has("geo"),l._hasGL3D=l._has("gl3d"),l._hasGL2D=l._has("gl2d"),l._hasTernary=l._has("ternary"),l._hasPie=l._has("pie"),y.linkSubplots(f,l,u,a),y.cleanPlot(f,l,u,a),a._zoomlayer&&!e._dragging&&d({_fullLayout:a}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),i=Math.round(f*i)}}var d=y.layoutAttributes.width.min,p=y.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-i)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=i)),e._initialAutoSize||(e._initialAutoSize={width:n,height:i}),y.sanitizeMargins(r)},y.supplyLayoutModuleDefaults=function(e,t,r,n){var a,o,l,c=i.componentsRegistry,u=t._basePlotModules,f=i.subplotsRegistry.cartesian;for(a in c)(l=c[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(i.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(s.subplotSort);for(o=0;o.5*n.width&&(s.log("Margin push",t,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(s.log("Margin push",t,"is too big in y, dropping"),r.b=r.t=0);var c=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[t]={l:{val:c,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[t]=1}else delete a[t],delete i[t];if(!n._replotting)return y.doAutoMargin(e)}},y.doAutoMargin=function(e){var t=e._fullLayout;t._size||(t._size={}),L(t);var r=t._size,n=t.margin,o=s.extendFlat({},r),l=n.l,c=n.r,u=n.t,f=n.b,d=t.width,p=t.height,h=t._pushmargin,g=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:c},t:{val:1,size:u},b:{val:0,size:f}},h){var x=h[m].l||{},b=h[m].b||{},_=x.val,w=x.size,T=b.val,k=b.size;for(var M in h){if(a(w)&&h[M].r){var A=h[M].r.val,S=h[M].r.size;if(A>_){var C=(w*A+(S-d)*_)/(A-_),O=(S*(1-_)+(w-d)*(1-A))/(A-_);C>=0&&O>=0&&d-(C+O)>0&&C+O>l+c&&(l=C,c=O)}}if(a(k)&&h[M].t){var z=h[M].t.val,P=h[M].t.size;if(z>T){var D=(k*z+(P-p)*T)/(z-T),E=(P*(1-T)+(k-p)*(1-z))/(z-T);D>=0&&E>=0&&p-(E+D)>0&&D+E>f+u&&(f=D,u=E)}}}}}if(r.l=Math.round(l),r.r=Math.round(c),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!t._replotting&&y.didMarginChange(o,r)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var I=3*(1+Object.keys(g).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return i.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var o=0,l=0;function s(){return o++,function(){l++,n||l!==o||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return i.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],o=s.syncOrAsync(a,e);return o&&o.then||(o=Promise.resolve()),o.then((function(){return e}))}y.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},y.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&y.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,c=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(s.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!s.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):s.isTypedArray(e)?s.simpleMap(e,s.identity):s.isJSDate(e)?s.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};return t||(f.layout=u(l)),e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),c&&(f.frames=u(c)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},y.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;l--)if(o[l].enabled){r._indexToPoints=o[l]._indexToPoints;break}n&&n.calc&&(i=n.calc(e,r))}Array.isArray(i)&&i[0]||(i=[{x:u,y:u}]),i[0].t||(i[0].t={}),i[0].trace=r,h[t]=i}}for(z(c,d,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var z=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(z=Math.max(Math.round(z),1)),C[2]||(C[2]=z);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var D=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(E)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var B=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:I,elements:B,reverseOrder:d.legend.reverseOrder})})();var H=I.node().getBBox();x=Math.min(d.width-H.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(H?H.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),e.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var V=e.select("g.title-group text").style(N).text(d.title.text),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var U=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=U.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}U.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function X(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);U.call(Y).attr({transform:"rotate("+d.radialAxis.orientation+")"}),U.selectAll(".domain").style(F),U.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),U.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+X(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var $=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=X(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&$.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var J=n.max(R.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));I.attr({transform:"translate("+[x+J,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data((function(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){var e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":154,"../../../lib":178,d3:16}],261:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":52,"../../../lib":178,"./micropolar":260,"./undo_manager":262,d3:16}],262:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a=u&&(p.min=0,g.min=0,v.min=0,e.aaxis&&delete e.aaxis.min,e.baxis&&delete e.baxis.min,e.caxis&&delete e.caxis.min)}function h(e,t,r,n){var a=f[t._name];function o(r,n){return i.coerce(e,t,a,r,n)}o("uirevision",n.uirevision),t.type="linear";var d=o("color"),p=d!==a.color.dflt?d:r.font.color,h=t._name.charAt(0).toUpperCase(),g="Component "+h,v=o("title.text",g);t._hovertitle=v===g?v:h,i.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(e,t,o,"linear"),l(e,t,o,"linear",{}),s(e,t,o,{outerTicks:!0}),o("showticklabels")&&(i.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(e,t,o,{dfltColor:d,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:a}),o("hoverformat"),o("layer")}t.exports=function(e,t,r){o(e,t,r,{type:"ternary",attributes:f,handleDefaults:p,font:t.font,paper_bgcolor:t.paper_bgcolor})}},{"../../components/color":52,"../../lib":178,"../../plot_api/plot_template":212,"../cartesian/line_grid_defaults":238,"../cartesian/tick_label_defaults":243,"../cartesian/tick_mark_defaults":244,"../cartesian/tick_value_defaults":245,"../subplot_defaults":263,"./layout_attributes":266}],268:[function(e,t,r){"use strict";var n=e("d3"),a=e("tinycolor2"),i=e("../../registry"),o=e("../../lib"),l=o._,s=e("../../components/color"),c=e("../../components/drawing"),u=e("../cartesian/set_convert"),f=e("../../lib/extend").extendFlat,d=e("../plots"),p=e("../cartesian/axes"),h=e("../../components/dragelement"),g=e("../../components/fx"),v=e("../../components/dragelement/helpers"),m=v.freeMode,y=v.rectMode,x=e("../../components/titles"),b=e("../cartesian/select").prepSelect,_=e("../cartesian/select").selectOnClick,w=e("../cartesian/select").clearSelect,T=e("../cartesian/select").clearSelectionsCache,k=e("../cartesian/constants");function M(e,t){this.id=e.id,this.graphDiv=e.graphDiv,this.init(t),this.makeFramework(t),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}t.exports=M;var A=M.prototype;A.init=function(e){this.container=e._ternarylayer,this.defs=e._defs,this.layoutId=e._uid,this.traceHash={},this.layers={}},A.plot=function(e,t){var r=t[this.id],n=t._size;this._hasClipOnAxisFalse=!1;for(var a=0;aL*x?a=(i=x)*L:i=(a=y)/L,o=v*a/y,l=m*i/x,r=t.l+t.w*h-a/2,n=t.t+t.h*(1-g)-i/2,d.x0=r,d.y0=n,d.w=a,d.h=i,d.sum=b,d.xaxis={type:"linear",range:[_+2*T-b,b-_-2*w],domain:[h-o/2,h+o/2],_id:"x"},u(d.xaxis,d.graphDiv._fullLayout),d.xaxis.setScale(),d.xaxis.isPtWithinRange=function(e){return e.a>=d.aaxis.range[0]&&e.a<=d.aaxis.range[1]&&e.b>=d.baxis.range[1]&&e.b<=d.baxis.range[0]&&e.c>=d.caxis.range[1]&&e.c<=d.caxis.range[0]},d.yaxis={type:"linear",range:[_,b-w-T],domain:[g-l/2,g+l/2],_id:"y"},u(d.yaxis,d.graphDiv._fullLayout),d.yaxis.setScale(),d.yaxis.isPtWithinRange=function(){return!0};var k=d.yaxis.domain[0],M=d.aaxis=f({},e.aaxis,{range:[_,b-w-T],side:"left",tickangle:(+e.aaxis.tickangle||0)-30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(M,d.graphDiv._fullLayout),M.setScale();var A=d.baxis=f({},e.baxis,{range:[b-_-T,w],side:"bottom",domain:d.xaxis.domain,anchor:"free",position:0,_id:"x",_length:a});u(A,d.graphDiv._fullLayout),A.setScale();var S=d.caxis=f({},e.caxis,{range:[b-_-w,T],side:"right",tickangle:(+e.caxis.tickangle||0)+30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(S,d.graphDiv._fullLayout),S.setScale();var C="M"+r+","+(n+i)+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDef.select("path").attr("d",C),d.layers.plotbg.select("path").attr("d",C);var O="M0,"+i+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDefRelative.select("path").attr("d",O);var z="translate("+r+","+n+")";d.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",z),d.clipDefRelative.select("path").attr("transform",null);var P="translate("+(r-A._offset)+","+(n+i)+")";d.layers.baxis.attr("transform",P),d.layers.bgrid.attr("transform",P);var D="translate("+(r+a/2)+","+n+")rotate(30)translate(0,"+-M._offset+")";d.layers.aaxis.attr("transform",D),d.layers.agrid.attr("transform",D);var E="translate("+(r+a/2)+","+n+")rotate(-30)translate(0,"+-S._offset+")";d.layers.caxis.attr("transform",E),d.layers.cgrid.attr("transform",E),d.drawAxes(!0),d.layers.aline.select("path").attr("d",M.showline?"M"+r+","+(n+i)+"l"+a/2+",-"+i:"M0,0").call(s.stroke,M.linecolor||"#000").style("stroke-width",(M.linewidth||0)+"px"),d.layers.bline.select("path").attr("d",A.showline?"M"+r+","+(n+i)+"h"+a:"M0,0").call(s.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),d.layers.cline.select("path").attr("d",S.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+i:"M0,0").call(s.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px"),d.graphDiv._context.staticPlot||d.initInteractions(),c.setClipUrl(d.layers.frontplot,d._hasClipOnAxisFalse?null:d.clipId,d.graphDiv)},A.drawAxes=function(e){var t=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,a=this.aaxis,i=this.baxis,o=this.caxis;if(this.drawAx(a),this.drawAx(i),this.drawAx(o),e){var s=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;n["a-title"]=x.draw(t,"a"+r,{propContainer:a,propName:this.id+".aaxis.title",placeholder:l(t,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-a.title.font.size/3-s,"text-anchor":"middle"}}),n["b-title"]=x.draw(t,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:l(t,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*i.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=x.draw(t,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:l(t,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},A.drawAx=function(e){var t,r=this.graphDiv,n=e._name,a=n.charAt(0),i=e._id,l=this.layers[n],s=a+"tickLayout",c=(t=e).ticks+String(t.ticklen)+String(t.showticklabels);this[s]!==c&&(l.selectAll("."+i+"tick").remove(),this[s]=c),e.setScale();var u=p.calcTicks(e),f=p.clipEnds(e,u),d=p.makeTransFn(e),h=p.getTickSigns(e)[2],g=o.deg2rad(30),v=h*(e.linewidth||1)/2,m=h*e.ticklen,y=this.w,x=this.h,b="b"===a?"M0,"+v+"l"+Math.sin(g)*m+","+Math.cos(g)*m:"M"+v+",0l"+Math.cos(g)*m+","+-Math.sin(g)*m,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[a];p.drawTicks(r,e,{vals:"inside"===e.ticks?f:u,layer:l,path:b,transFn:d,crisp:!1}),p.drawGrid(r,e,{vals:f,layer:this.layers[a+"grid"],path:_,transFn:d,crisp:!1}),p.drawLabels(r,e,{vals:u,layer:l,transFn:d,labelFns:p.makeLabelFns(e,0,30)})};var S=k.MINZOOM/2+.87,C="m-0.87,.5h"+S+"v3h-"+(S+5.2)+"l"+(S/2+2.6)+",-"+(.87*S+4.5)+"l2.6,1.5l-"+S/2+","+.87*S+"Z",O="m0.87,.5h-"+S+"v3h"+(S+5.2)+"l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-2.6,1.5l"+S/2+","+.87*S+"Z",z="m0,1l"+S/2+","+.87*S+"l2.6,-1.5l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-"+(S/2+2.6)+","+(.87*S+4.5)+"l2.6,1.5l"+S/2+",-"+.87*S+"Z",P=!0;function D(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}A.clearSelect=function(){T(this.dragOptions),w(this.dragOptions.gd)},A.initInteractions=function(){var e,t,r,n,u,f,d,p,v,x,w=this,T=w.layers.plotbg.select("path").node(),M=w.graphDiv,A=M._fullLayout._zoomlayer;function S(e){var t={};return t[w.id+".aaxis.min"]=e.a,t[w.id+".baxis.min"]=e.b,t[w.id+".caxis.min"]=e.c,t}function E(e,t){var r=M._fullLayout.clickmode;D(M),2===e&&(M.emit("plotly_doubleclick",null),i.call("_guiRelayout",M,S({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===e&&_(t,M,[w.xaxis],[w.yaxis],w.id,w.dragOptions),r.indexOf("event")>-1&&g.click(M,t,w.id)}function I(e,t){return 1-t/w.h}function R(e,t){return 1-(e+(w.h-t)/Math.sqrt(3))/w.w}function F(e,t){return(e-(w.h-t)/Math.sqrt(3))/w.w}function N(a,i){var o=e+a,l=t+i,s=Math.max(0,Math.min(1,I(0,t),I(0,l))),c=Math.max(0,Math.min(1,R(e,t),R(o,l))),h=Math.max(0,Math.min(1,F(e,t),F(o,l))),g=(s/2+h)*w.w,m=(1-s/2-c)*w.w,y=(g+m)/2,b=m-g,_=(1-s)*w.h,T=_-b/L;b.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),x.transition().style("opacity",1).duration(200),p=!0),M.emit("plotly_relayouting",S(u))}function B(){D(M),u!==r&&(i.call("_guiRelayout",M,S(u)),P&&M.data&&M._context.showTips&&(o.notifier(l(M,"Double-click to zoom back out"),"long"),P=!1))}function H(e,t){var n=e/w.xaxis._m,a=t/w.yaxis._m,i=[(u={a:r.a-a,b:r.b+(n+a)/2,c:r.c-(n-a)/2}).a,u.b,u.c].sort(),o=i.indexOf(u.a),l=i.indexOf(u.b),s=i.indexOf(u.c);i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),u={a:i[o],b:i[l],c:i[s]},t=(r.a-u.a)*w.yaxis._m,e=(r.c-u.c-r.b+u.b)*w.xaxis._m);var f="translate("+(w.x0+e)+","+(w.y0+t)+")";w.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",f);var d="translate("+-e+","+-t+")";w.clipDefRelative.select("path").attr("transform",d),w.aaxis.range=[u.a,w.sum-u.b-u.c],w.baxis.range=[w.sum-u.a-u.c,u.b],w.caxis.range=[w.sum-u.a-u.b,u.c],w.drawAxes(!1),w._hasClipOnAxisFalse&&w.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints,w),M.emit("plotly_relayouting",S(u))}function j(){i.call("_guiRelayout",M,S(u))}this.dragOptions={element:T,gd:M,plotinfo:{id:w.id,domain:M._fullLayout[w.id].domain,xaxis:w.xaxis,yaxis:w.yaxis},subplot:w.id,prepFn:function(i,o,l){w.dragOptions.xaxes=[w.xaxis],w.dragOptions.yaxes=[w.yaxis];var c=w.dragOptions.dragmode=M._fullLayout.dragmode;m(c)?w.dragOptions.minDrag=1:w.dragOptions.minDrag=void 0,"zoom"===c?(w.dragOptions.moveFn=N,w.dragOptions.clickFn=E,w.dragOptions.doneFn=B,function(i,o,l){var c=T.getBoundingClientRect();e=o-c.left,t=l-c.top,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,n=w.aaxis.range[1]-r.a,f=a(w.graphDiv._fullLayout[w.id].bgcolor).getLuminance(),d="M0,"+w.h+"L"+w.w/2+", 0L"+w.w+","+w.h+"Z",p=!1,v=A.append("path").attr("class","zoombox").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:f>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",d),x=A.append("path").attr("class","zoombox-corners").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:s.background,stroke:s.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),w.clearSelect(M)}(0,o,l)):"pan"===c?(w.dragOptions.moveFn=H,w.dragOptions.clickFn=E,w.dragOptions.doneFn=j,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,w.clearSelect(M)):(y(c)||m(c))&&b(i,o,l,w.dragOptions,c)}},T.onmousemove=function(e){g.hover(M,e,w.id),M._fullLayout._lasthover=T,M._fullLayout._hoversubplot=w.id},T.onmouseout=function(e){M._dragging||h.unhover(M,e)},h.init(this.dragOptions)}},{"../../components/color":52,"../../components/dragelement":71,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/titles":147,"../../lib":178,"../../lib/extend":173,"../../registry":269,"../cartesian/axes":222,"../cartesian/constants":228,"../cartesian/select":241,"../cartesian/set_convert":242,"../plots":256,d3:16,tinycolor2:35}],269:[function(e,t,r){"use strict";var n=e("./lib/loggers"),a=e("./lib/noop"),i=e("./lib/push_unique"),o=e("./lib/is_plain_object"),l=e("./lib/dom").addStyleRule,s=e("./lib/extend"),c=e("./plots/attributes"),u=e("./plots/layout_attributes"),f=s.extendFlat,d=s.extendDeepAll;function p(e){var t=e.name,a=e.categories,i=e.meta;if(r.modules[t])n.log("Type "+t+" already registered");else{r.subplotsRegistry[e.basePlotModule.name]||function(e){var t=e.name;if(r.subplotsRegistry[t])return void n.log("Plot type "+t+" already registered.");for(var a in m(e),r.subplotsRegistry[t]=e,r.componentsRegistry)b(a,e.name)}(e.basePlotModule);for(var o={},s=0;s-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":159,"../lib":178,d3:16}],278:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var z=g[e.index],P=v.base?z.b+z.s:z.s;e[f+"0"]=e[f+"1"]=C.c2p(z[f],!0),e[f+"LabelVal"]=P;var D=m.extents[m.extents.round(z.p)];return e[u+"0"]=S.c2p(y?T(z):D[0],!0),e[u+"1"]=S.c2p(y?k(z):D[1],!0),e[u+"LabelVal"]=z.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.spikeDistance=(L(z)+function(e){return M(_(e),w(e))}(z))/2-b,e[u+"Spike"]=S.c2p(z.p,!0),o(z,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":52,"../../components/fx":92,"../../constants/numerical":158,"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"./helpers":285}],287:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":235,"../scatter/marker_colorbar":407,"./arrays_to_calcdata":278,"./attributes":279,"./calc":280,"./cross_trace_calc":282,"./defaults":283,"./event_data":284,"./hover":286,"./layout_attributes":288,"./layout_defaults":289,"./plot":290,"./select":291,"./style":293}],288:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],289:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?U:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?U(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,B,I),B=G(B,N,I),H=G(H,j,!I),j=G(j,H,!I)}var Z=M(i.ensureSingle(P,"path"),z,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((B-N)*(j-H))?"M0,0Z":"M"+N+","+H+"V"+j+"H"+B+"V"+H+"Z").call(s.setClipUrl,t.layerClipId,e),!z.uniformtext.mode&&R){var X=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,X,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function z(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,D="h"===P.orientation,E=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var I="stack"===v.mode||"relative"===v.mode,R=n[a],F=!I||R._outmost;if(!E||"none"===w||(R.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,B=h.getBarColor(n[a],P),H=h.getInsideTextFont(P,a,N,B),j=h.getOutsideTextFont(P,a,N),V=r.datum();D?"log"===T.type&&V.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(Y/G);G>0&&Z>0&&(Q||$||J)?w="inside":(w="outside",q.remove(),q=null)}else w="inside";if(!q){X=i.ensureUniformFontSize(e,"outside"===w?j:H);var K=(q=z(r,E,X)).attr("transform");if(q.attr("transform",""),U=s.bBox(q.node()),G=U.width,Z=U.height,q.attr("transform",K),G<=0||Z<=0)return void q.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,U,{isHorizontal:D,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,U,{isHorizontal:D,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=X.size,d(P.type,ee,O),R.transform=ee,M(q,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,B,H,j,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var H=!1===f.cliponaxis;s.setClipUrl(c,H?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx/helpers":88,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../registry":269,"./attributes":279,"./constants":281,"./helpers":285,"./style":293,"./uniform_text":295,d3:16,"fast-isnumeric":18}],291:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":52,"../../components/drawing":74,"../../lib":178,"../../registry":269,"./attributes":279,"./helpers":285,"./uniform_text":295,d3:16}],294:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63}],295:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=oA.uf};if(t._hasPreCompStats){var F=t[y],N=function(e){return m.d2c((t[e]||[])[r])},B=1/0,H=-1/0;for(r=0;r=A.q1&&A.q3>=A.med){var V=N("lowerfence");A.lf=V!==o&&V<=A.q1?V:d(A,S,C);var q=N("upperfence");A.uf=q!==o&&q>=A.q3?q:p(A,S,C);var U=N("mean");A.mean=U!==o?U:C?i.mean(S,C):(A.q1+A.q3)/2;var G=N("sd");A.sd=U!==o&&G>=0?G:C?i.stdev(S,C,A.mean):A.q3-A.q1,A.lo=h(A),A.uo=g(A);var Z=N("notchspan");Z=Z!==o&&Z>0?Z:v(A,C),A.ln=A.med-Z,A.un=A.med+Z;var X=A.lf,Y=A.uf;t.boxpoints&&S.length&&(X=Math.min(X,S[0]),Y=Math.max(Y,S[C-1])),t.notched&&(X=Math.min(X,A.ln),Y=Math.max(Y,A.un)),A.min=X,A.max=Y}else{var W;i.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+A.q1,"median = "+A.med,"q3 = "+A.q3].join("\n")),W=A.med!==o?A.med:A.q1!==o?A.q3!==o?(A.q1+A.q3)/2:A.q1:A.q3!==o?A.q3:0,A.med=W,A.q1=A.q3=W,A.lf=A.uf=W,A.mean=A.sd=W,A.ln=A.un=W,A.min=A.max=W}B=Math.min(B,A.min),H=Math.max(H,A.max),A.pts2=L.filter(R),k.push(A)}}t._extremes[m._id]=a.findExtremes(m,[B,H],{padded:!0})}else{var Q=m.makeCalcdata(t,y),$=function(e,t){for(var r=e.length,n=new Array(r+1),a=0;a=0&&ee0){var oe,le;if((A={}).pos=A[b]=E[r],L=A.pts=K[r].sort(u),C=(S=A[y]=L.map(f)).length,A.min=S[0],A.max=S[C-1],A.mean=i.mean(S,C),A.sd=i.stdev(S,C,A.mean),A.med=i.interp(S,.5),C%2&&(ae||ie))ae?(oe=S.slice(0,C/2),le=S.slice(C/2+1)):ie&&(oe=S.slice(0,C/2+1),le=S.slice(C/2)),A.q1=i.interp(oe,.5),A.q3=i.interp(le,.5);else A.q1=i.interp(S,.25),A.q3=i.interp(S,.75);A.lf=d(A,S,C),A.uf=p(A,S,C),A.lo=h(A),A.uo=g(A);var se=v(A,C);A.ln=A.med-se,A.un=A.med+se,te=Math.min(te,A.ln),re=Math.max(re,A.un),A.pts2=L.filter(R),k.push(A)}t._extremes[m._id]=a.findExtremes(m,t.notched?Q.concat([te,re]):Q,{padded:!0})}return function(e,t){if(i.isArrayOrTypedArray(t.selectedpoints))for(var r=0;r0?(k[0].t={num:_[M],dPos:I,posLetter:b,valLetter:y,labels:{med:l(e,"median:"),min:l(e,"min:"),q1:l(e,"q1:"),q3:l(e,"q3:"),max:l(e,"max:"),mean:"sd"===t.boxmean?l(e,"mean \xb1 \u03c3:"):l(e,"mean:"),lf:l(e,"lower fence:"),uf:l(e,"upper fence:")}},_[M]++,k):[{t:{empty:!0}}]};var s={text:"tx",hovertext:"htx"};function c(e,t,r){for(var n in s)i.isArrayOrTypedArray(t[n])&&(Array.isArray(r)?i.isArrayOrTypedArray(t[n][r[0]])&&(e[s[n]]=t[n][r[0]][r[1]]):e[s[n]]=t[n][r])}function u(e,t){return e.v-t.v}function f(e){return e.v}function d(e,t,r){return 0===r?e.q1:Math.min(e.q1,t[Math.min(i.findBin(2.5*e.q1-1.5*e.q3,t,!0)+1,r-1)])}function p(e,t,r){return 0===r?e.q3:Math.max(e.q3,t[Math.max(i.findBin(2.5*e.q3-1.5*e.q1,t),0)])}function h(e){return 4*e.q1-3*e.q3}function g(e){return 4*e.q3-3*e.q1}function v(e,t){return 0===t?0:1.57*(e.q3-e.q1)/Math.sqrt(t)}},{"../../constants/numerical":158,"../../lib":178,"../../plots/cartesian/axes":222,"fast-isnumeric":18}],298:[function(e,t,r){"use strict";var n=e("../../plots/cartesian/axes"),a=e("../../lib"),i=e("../../plots/cartesian/axis_ids").getAxisGroup,o=["v","h"];function l(e,t,r,o){var l,s,c,u=t.calcdata,f=t._fullLayout,d=o._id,p=d.charAt(0),h=[],g=0;for(l=0;l1,b=1-f[e+"gap"],_=1-f[e+"groupgap"];for(l=0;l0){var U=S.pointpos,G=S.jitter,Z=S.marker.size/2,X=0;U+G>=0&&((X=V*(U+G))>A?(q=!0,H=Z,N=X):X>R&&(H=Z,N=A)),X<=A&&(N=A);var Y=0;U-G<=0&&((Y=-V*(U-G))>L?(q=!0,j=Z,B=Y):Y>F&&(j=Z,B=L)),Y<=L&&(B=L)}else N=A,B=L;var W=new Array(c.length);for(s=0;s0?(v="v",m=x>0?Math.min(_,b):Math.min(b)):x>0?(v="h",m=Math.min(_)):m=0;if(m){t._length=m;var M=r("orientation",v);t._hasPreCompStats?"v"===M&&0===x?(r("x0",0),r("dx",1)):"h"===M&&0===y&&(r("y0",0),r("dy",1)):"v"===M&&0===x?r("x0"):"h"===M&&0===y&&r("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(e,t,["x","y"],i)}else t.visible=!1}function u(e,t,r,a){var i=a.prefix,o=n.coerce2(e,t,s,"marker.outliercolor"),l=r("marker.line.outliercolor"),c="outliers";t._hasPreCompStats?c="all":(o||l)&&(c="suspectedoutliers");var u=r(i+"points",c);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",t.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",t.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete t.marker;var f=r("hoveron");"all"!==f&&-1===f.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(t,r)}t.exports={supplyDefaults:function(e,t,r,a){function o(r,a){return n.coerce(e,t,s,r,a)}if(c(e,t,o,a),!1!==t.visible){var l=t._hasPreCompStats;l&&(o("lowerfence"),o("upperfence")),o("line.color",(e.marker||{}).color||r),o("line.width"),o("fillcolor",i.addOpacity(t.line.color,.5));var f=!1;if(l){var d=o("mean"),p=o("sd");d&&d.length&&(f=!0,p&&p.length&&(f="sd"))}o("boxmean",f),o("whiskerwidth"),o("width"),o("quartilemethod");var h=!1;if(l){var g=o("notchspan");g&&g.length&&(h=!0)}else n.validate(e.notchwidth,s.notchwidth)&&(h=!0);o("notched",h)&&o("notchwidth"),u(e,t,o,{prefix:"box"})}},crossTraceDefaults:function(e,t){var r,a;function i(e){return n.coerce(a._input,a,s,e)}for(var l=0;le.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(e,t,r,i){var o,l,s=t.pos,c=t.val,u=i.bPos,f=i.bPosPxOffset||0,d=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var p=e.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);p.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),p.exit().remove(),p.each((function(e){var t=s.c2l(e.pos+u,!0),a=s.l2p(t)+f,i=s.l2p(t-o)+f,p=s.l2p(t+l)+f,h=c.c2p(e.mean,!0),g=c.c2p(e.mean-e.sd,!0),v=c.c2p(e.mean+e.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+h+","+i+"V"+p+("sd"===d?"m0,0L"+g+","+a+"L"+h+","+i+"L"+v+","+a+"Z":"")):n.select(this).attr("d","M"+i+","+h+"H"+p+("sd"===d?"m0,0L"+a+","+g+"L"+i+","+h+"L"+a+","+v+"Z":""))}))}t.exports={plot:function(e,t,r,i){var c=t.xaxis,u=t.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(e){var t,r,a=n.select(this),i=e[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(t=u,r=c):(t=c,r=u),o(a,{pos:t,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:t,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":74,"../../lib":178,d3:16}],306:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n,a=e.cd,i=e.xaxis,o=e.yaxis,l=[];if(!1===t)for(r=0;ro.level||o.starts.length&&i===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var l=n.x.length,s=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&d===u)&&(n.prefixBoundary=!0);break;case"][":f=Math.min(p[0],p[1]),d=Math.max(p[0],p[1]),fc&&(n.prefixBoundary=!0)}}}},{}],311:[function(e,t,r){"use strict";var n=e("../../components/colorscale"),a=e("./make_color_map"),i=e("./end_plus");t.exports={min:"zmin",max:"zmax",calc:function(e,t,r){var o=t.contours,l=t.line,s=o.size||1,c=o.coloring,u=a(t,{isColorbar:!0});if("heatmap"===c){var f=n.extractOpts(t);r._fillgradient=f.reversescale?n.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:l.color,width:!1!==o.showlines?l.width:0,dash:l.dash},r._levels={start:o.start,end:i(o),size:s}}}},{"../../components/colorscale":64,"./end_plus":319,"./make_color_map":324}],312:[function(e,t,r){"use strict";t.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],313:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./label_defaults"),i=e("../../components/color"),o=i.addOpacity,l=i.opacity,s=e("../../constants/filter_ops"),c=s.CONSTRAINT_REDUCTION,u=s.COMPARISON_OPS2;t.exports=function(e,t,r,i,s,f){var d,p,h,g=t.contours,v=r("contours.operation");(g._operation=c[v],function(e,t){var r;-1===u.indexOf(t.operation)?(e("contours.value",[0,1]),Array.isArray(t.value)?t.value.length>2?t.value=t.value.slice(2):0===t.length?t.value=[0,1]:t.length<2?(r=parseFloat(t.value[0]),t.value=[r,r+1]):t.value=[parseFloat(t.value[0]),parseFloat(t.value[1])]:n(t.value)&&(r=parseFloat(t.value),t.value=[r,r+1])):(e("contours.value",0),n(t.value)||(Array.isArray(t.value)?t.value=parseFloat(t.value[0]):t.value=0))}(r,g),"="===v?d=g.showlines=!0:(d=r("contours.showlines"),h=r("fillcolor",o((e.line||{}).color||s,.5))),d)&&(p=r("line.color",h&&l(h)?o(t.fillcolor,1):s),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,p,f)}},{"../../components/color":52,"../../constants/filter_ops":156,"./label_defaults":323,"fast-isnumeric":18}],314:[function(e,t,r){"use strict";var n=e("../../constants/filter_ops"),a=e("fast-isnumeric");function i(e,t){var r,i=Array.isArray(t);function o(e){return a(e)?+e:null}return-1!==n.COMPARISON_OPS2.indexOf(e)?r=o(i?t[0]:t):-1!==n.INTERVAL_OPS.indexOf(e)?r=i?[o(t[0]),o(t[1])]:[o(t),o(t)]:-1!==n.SET_OPS.indexOf(e)&&(r=i?t.map(o):[o(t)]),r}function o(e){return function(t){t=i(e,t);var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]);return{start:r,end:n,size:n-r}}}function l(e){return function(t){return{start:t=i(e,t),end:1/0,size:1/0}}}t.exports={"[]":o("[]"),"][":o("]["),">":l(">"),"<":l("<"),"=":l("=")}},{"../../constants/filter_ops":156,"fast-isnumeric":18}],315:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,l=r("contours.size");!(o?t.autocontour=!0:r("autocontour",!1))&&l||r("ncontours")}},{}],316:[function(e,t,r){"use strict";var n=e("../../lib");function a(e){return n.extendFlat({},e,{edgepaths:n.extendDeep([],e.edgepaths),paths:n.extendDeep([],e.paths),starts:n.extendDeep([],e.starts)})}t.exports=function(e,t){var r,i,o,l=function(e){return e.reverse()},s=function(e){return e};switch(t){case"=":case"<":return e;case">":for(1!==e.length&&n.warn("Contour data invalid for the specified inequality operation."),i=e[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",e);break}return s}},{"../../lib":178,"./constraint_mapping":314,"./end_plus":319}],319:[function(e,t,r){"use strict";t.exports=function(e){return e.end+e.size/1e6}},{}],320:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./constants");function i(e,t,r,n){return Math.abs(e[0]-t[0])20&&t?208===e||1114===e?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==a.BOTTOMSTART.indexOf(e)?i=1:-1!==a.LEFTSTART.indexOf(e)?n=1:-1!==a.TOPSTART.indexOf(e)?i=-1:n=-1;return[n,i]}(f,r,t),p=[l(e,t,[-d[0],-d[1]])],h=e.z.length,g=e.z[0].length,v=t.slice(),m=d.slice();for(c=0;c<1e4;c++){if(f>20?(f=a.CHOOSESADDLE[f][(d[0]||d[1])<0?0:1],e.crossings[u]=a.SADDLEREMAINDER[f]):delete e.crossings[u],!(d=a.NEWDELTA[f])){n.log("Found bad marching index:",f,t,e.level);break}p.push(l(e,t,d)),t[0]+=d[0],t[1]+=d[1],u=t.join(","),i(p[p.length-1],p[p.length-2],o,s)&&p.pop();var y=d[0]&&(t[0]<0||t[0]>g-2)||d[1]&&(t[1]<0||t[1]>h-2);if(t[0]===v[0]&&t[1]===v[1]&&d[0]===m[0]&&d[1]===m[1]||r&&y)break;f=e.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,L,S,C,O,z,P,D,E=i(p[0],p[p.length-1],o,s),I=0,R=.2*e.smoothing,F=[],N=0;for(c=1;c=N;c--)if((x=F[c])=N&&x+F[b]A&&L--,e.edgepaths[L]=C.concat(p,S));break}V||(e.edgepaths[A]=p.concat(S))}for(A=0;Ae?0:1)+(t[0][1]>e?0:2)+(t[1][1]>e?0:4)+(t[1][0]>e?0:8);return 5===r||10===r?e>(t[0][0]+t[0][1]+t[1][0]+t[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}t.exports=function(e){var t,r,i,o,l,s,c,u,f,d=e[0].z,p=d.length,h=d[0].length,g=2===p||2===h;for(r=0;r=0&&(n=y,l=s):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,l=s):a.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,l>=0)break;f+="L"+n}if(l===e.edgepaths.length){a.log("unclosed perimeter path");break}d=l,(h=-1===p.indexOf(d))&&(d=p[0],f+="Z")}for(d=0;dn.center?n.right-l:l-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(s>n.middle?n.bottom-s:s-n.top)/(Math.abs(f)+Math.cos(c)*o);if(d<1||p<1)return 1/0;var h=m.EDGECOST*(1/(d-1)+1/(p-1));h+=m.ANGLECOST*c*c;for(var g=l-u,v=s-f,y=l+u,x=s+f,b=0;b2*m.MAXCOST)break;p&&(l/=2),s=(o=c-l/2)+1.5*l}if(d<=m.MAXCOST)return u},r.addLabelData=function(e,t,r,n){var a=t.fontSize,i=t.width+a/3,o=Math.max(0,t.height-a/3),l=e.x,s=e.y,c=e.theta,u=Math.sin(c),f=Math.cos(c),d=function(e,t){return[l+e*f-t*u,s+e*u+t*f]},p=[d(-i/2,-o/2),d(-i/2,o/2),d(i/2,o/2),d(i/2,-o/2)];r.push({text:t.text,x:l,y:s,dy:t.dy,theta:c,level:t.level,width:i,height:o}),n.push(p)},r.drawLabels=function(e,t,r,i,o){var s=e.selectAll("text").data(t,(function(e){return e.text+","+e.x+","+e.y+","+e.theta}));if(s.exit().remove(),s.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(e){var t=e.x+Math.sin(e.theta)*e.dy,a=e.y-Math.cos(e.theta)*e.dy;n.select(this).text(e.text).attr({x:t,y:a,transform:"rotate("+180*e.theta/Math.PI+" "+t+" "+a+")"}).call(l.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),e._input.contours||(e._input.contours={}),a.extendFlat(e._input.contours,{start:r.start,end:r.end,size:r.size}),e._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,f=r.end,d=e._input.contours;if(u>f&&(r.start=d.start=f,f=r.end=d.end=u,u=r.start),!(r.size>0))c=u===f?1:i(u,f,e.ncontours).dtick,d.size=r.size=c}}},{"../../lib":178,"../../plots/cartesian/axes":222}],328:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/drawing"),i=e("../heatmap/style"),o=e("./make_color_map");t.exports=function(e){var t=n.select(e).selectAll("g.contour");t.style("opacity",(function(e){return e[0].trace.opacity})),t.each((function(e){var t=n.select(this),r=e[0].trace,i=r.contours,l=r.line,s=i.size||1,c=i.start,u="constraint"===i.type,f=!u&&"lines"===i.coloring,d=!u&&"fill"===i.coloring,p=f||d?o(r):null;t.selectAll("g.contourlevel").each((function(e){n.select(this).selectAll("path").call(a.lineGroupStyle,l.width,f?p(e.level):l.color,l.dash)}));var h=i.labelfont;if(t.selectAll("g.contourlabels text").each((function(e){a.font(n.select(this),{family:h.family,size:h.size,color:h.color||(f?p(e.level):l.color)})})),u)t.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(d){var g;t.selectAll("g.contourfill path").style("fill",(function(e){return void 0===g&&(g=e.level),p(e.level+.5*s)})),void 0===g&&(g=c),t.selectAll("g.contourbg path").style("fill",p(g-.5*s))}})),i(e)}},{"../../components/drawing":74,"../heatmap/style":342,"./make_color_map":324,d3:16}],329:[function(e,t,r){"use strict";var n=e("../../components/colorscale/defaults"),a=e("./label_defaults");t.exports=function(e,t,r,i,o){var l,s=r("contours.coloring"),c="";"fill"===s&&(l=r("contours.showlines")),!1!==l&&("lines"!==s&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==s&&(!0!==e.showlegend&&(t.showlegend=!1),t._dfltShowLegend=!1,n(e,t,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,c,o)}},{"../../components/colorscale/defaults":62,"./label_defaults":323}],330:[function(e,t,r){"use strict";var n=e("../scatter/attributes"),a=e("../../plots/attributes"),i=e("../../plots/template_attributes").hovertemplateAttrs,o=e("../../components/colorscale/attributes"),l=(e("../../constants/docs").FORMAT_LINK,e("../../lib/extend").extendFlat);t.exports=l({z:{valType:"data_array",editType:"calc"},x:l({},n.x,{impliedEdits:{xtype:"array"}}),x0:l({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:l({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:l({},n.y,{impliedEdits:{ytype:"array"}}),y0:l({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:l({},n.dy,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:i(),showlegend:l({},a.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":59,"../../constants/docs":155,"../../lib/extend":173,"../../plots/attributes":219,"../../plots/template_attributes":264,"../scatter/attributes":389}],331:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib"),i=e("../../plots/cartesian/axes"),o=e("../histogram2d/calc"),l=e("../../components/colorscale/calc"),s=e("./convert_column_xyz"),c=e("./clean_2d_array"),u=e("./interp2d"),f=e("./find_empties"),d=e("./make_bound_array");t.exports=function(e,t){var r,p,h,g,v,m,y,x,b,_=i.getFromId(e,t.xaxis||"x"),w=i.getFromId(e,t.yaxis||"y"),T=n.traceIs(t,"contour"),k=n.traceIs(t,"histogram"),M=n.traceIs(t,"gl2d"),A=T?"best":t.zsmooth;if(_._minDtick=0,w._minDtick=0,k)r=(b=o(e,t)).x,p=b.x0,h=b.dx,g=b.y,v=b.y0,m=b.dy,y=b.z;else{var L=t.z;a.isArray1D(L)?(s(t,_,w,"x","y",["z"]),r=t._x,g=t._y,L=t._z):(r=t._x=t.x?_.makeCalcdata(t,"x"):[],g=t._y=t.y?w.makeCalcdata(t,"y"):[]),p=t.x0,h=t.dx,v=t.y0,m=t.dy,y=c(L,t,_,w),(T||t.connectgaps)&&(t._emptypoints=f(y),u(y,t._emptypoints))}function S(e){A=t._input.zsmooth=t.zsmooth=!1,a.warn('cannot use zsmooth: "fast": '+e)}if("fast"===A)if("log"===_.type||"log"===w.type)S("log axis found");else if(!k){if(r.length){var C=(r[r.length-1]-r[0])/(r.length-1),O=Math.abs(C/100);for(x=0;xO){S("x scale is not linear");break}}if(g.length&&"fast"===A){var z=(g[g.length-1]-g[0])/(g.length-1),P=Math.abs(z/100);for(x=0;xP){S("y scale is not linear");break}}}var D=a.maxRowLength(y),E="scaled"===t.xtype?"":r,I=d(t,E,p,h,D,_),R="scaled"===t.ytype?"":g,F=d(t,R,v,m,y.length,w);M||(t._extremes[_._id]=i.findExtremes(_,I),t._extremes[w._id]=i.findExtremes(w,F));var N={x:I,y:F,z:y,text:t._text||t.text,hovertext:t._hovertext||t.hovertext};if(E&&E.length===I.length-1&&(N.xCenter=E),R&&R.length===F.length-1&&(N.yCenter=R),k&&(N.xRanges=b.xRanges,N.yRanges=b.yRanges,N.pts=b.pts),T||l(e,t,{vals:y,cLetter:"z"}),T&&t.contours&&"heatmap"===t.contours.coloring){var B={type:"contour"===t.type?"heatmap":"histogram2d",xcalendar:t.xcalendar,ycalendar:t.ycalendar};N.xfill=d(B,E,p,h,D,_),N.yfill=d(B,R,v,m,y.length,w)}return[N]}},{"../../components/colorscale/calc":60,"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"../histogram2d/calc":359,"./clean_2d_array":332,"./convert_column_xyz":334,"./find_empties":336,"./interp2d":339,"./make_bound_array":340}],332:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("../../constants/numerical").BADNUM;t.exports=function(e,t,r,o){var l,s,c,u,f,d;function p(e){if(n(e))return+e}if(t&&t.transpose){for(l=0,f=0;f=0;o--)(l=((f[[(r=(i=d[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[i]=[r,a,l],d.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(i in s)f[i]=s[i],u.push(s[i])}return u.sort((function(e,t){return t[2]-e[2]}))}},{"../../lib":178}],337:[function(e,t,r){"use strict";var n=e("../../components/fx"),a=e("../../lib"),i=e("../../plots/cartesian/axes"),o=e("../../components/colorscale").extractOpts;t.exports=function(e,t,r,l,s,c){var u,f,d,p,h=e.cd[0],g=h.trace,v=e.xa,m=e.ya,y=h.x,x=h.y,b=h.z,_=h.xCenter,w=h.yCenter,T=h.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==e.index){try{d=Math.round(e.index[1]),p=Math.round(e.index[0])}catch(t){return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",e.index)}if(d<0||d>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(t-y[0],t-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var L;for(M=[2*y[0]-y[1]],L=1;Lg&&(m=Math.max(m,Math.abs(e[i][o]-h)/(v-g))))}return m}t.exports=function(e,t){var r,a=1;for(o(e,t),r=0;r.01;r++)a=o(e,t,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),e}},{"../../lib":178}],340:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib").isArrayOrTypedArray;t.exports=function(e,t,r,i,o,l){var s,c,u,f=[],d=n.traceIs(e,"contour"),p=n.traceIs(e,"histogram"),h=n.traceIs(e,"gl2d");if(a(t)&&t.length>1&&!p&&"category"!==l.type){var g=t.length;if(!(g<=o))return d?t.slice(0,o):t.slice(0,o+1);if(d||h)f=t.slice(0,o);else if(1===o)f=[t[0]-.5,t[0]+.5];else{for(f=[1.5*t[0]-.5*t[1]],u=1;u0;)d=p.c2p(T[y]),y--;for(d0;)m=h.c2p(k[y]),y--;if(m0&&(i=!0);for(var s=0;si){var o=i-r[e];return r[e]=i,o}}return 0},max:function(e,t,r,a){var i=a[t];if(n(i)){if(i=Number(i),!n(r[e]))return r[e]=i,i;if(r[e]c?e>o?e>1.1*a?a:e>1.1*i?i:o:e>l?l:e>s?s:c:Math.pow(10,Math.floor(Math.log(e)/Math.LN10))}function p(e,t,r,n,i,l){if(n&&e>o){var s=h(t,i,l),c=h(r,i,l),u=e===a?0:1;return s[u]!==c[u]}return Math.floor(r/e)-Math.floor(t/e)>.1}function h(e,t,r){var n=t.c2d(e,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}t.exports=function(e,t,r,n,i){var l,s,c=-1.1*t,d=-.1*t,p=e-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(t,r){var o=n.c2d(t,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(H=o.tickIncrement(H,b.size,!0,p)),E.start=r.l2r(H),F||a.nestedProperty(t,m+".start").set(E.start)}var j=b.end,V=r.r2l(D.end),q=void 0!==V;if((b.endFound||q)&&V!==r.r2l(j)){var U=q?V:a.aggNums(Math.max,null,h);E.end=r.l2r(U),q||a.nestedProperty(t,m+".start").set(E.end)}var G="autobin"+l;return!1===t._input[G]&&(t._input[m]=a.extendFlat({},t[m]||{}),delete t._input[G],delete t[G]),[E,h]}t.exports={calc:function(e,t){var r,i,p,h,g=[],v=[],m=o.getFromId(e,"h"===t.orientation?t.yaxis:t.xaxis),y="h"===t.orientation?"y":"x",x={x:"y",y:"x"}[y],b=t[y+"calendar"],_=t.cumulative,w=d(e,t,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],z=0,P=t.histnorm,D=t.histfunc,E=-1!==P.indexOf("density");_.enabled&&E&&(P=P.replace(/ ?density$/,""),E=!1);var I,R="max"===D||"min"===D?null:0,F=s.count,N=c[P],B=!1,H=function(e){return m.r2c(e,0,b)};for(a.isArrayOrTypedArray(t[x])&&"count"!==D&&(I=t[x],B="avg"===D,F=s[D]),r=H(T.start),p=H(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===t){for(n=1;n=0;n--)e[n]+=e[n+1];"exclude"===r&&(e.push(0),e.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),$=[],J=0,K=Q-1;for(r=0;r=J;r--)if(v[r]){K=r;break}for(r=J;r<=K;r++)if(n(g[r])&&n(v[r])){var ee={p:g[r],s:v[r],b:0};_.enabled||(ee.pts=O[r],G?ee.ph0=ee.ph1=O[r].length?k[O[r][0]]:g[r]:(t._computePh=!0,ee.ph0=q(A[r]),ee.ph1=q(A[r+1],!0))),$.push(ee)}return 1===$.length&&($[0].width1=o.tickIncrement($[0].p,T.size,!1,b)-$[0].p),l($,t),a.isArrayOrTypedArray(t.selectedpoints)&&a.tagSelected($,t,Y),$},calcAllAutoBins:d}},{"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"../bar/arrays_to_calcdata":278,"./average":346,"./bin_functions":348,"./bin_label_vals":349,"./norm_functions":357,"fast-isnumeric":18}],351:[function(e,t,r){"use strict";t.exports={eventDataKeys:["binNumber"]}},{}],352:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axis_ids"),i=e("../../registry").traceIs,o=e("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=a.getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];t.exports=function(e,t){var r,f,d,p,h,g,v,m=t._histogramBinOpts={},y=[],x={},b=[];function _(e,t){return n.coerce(r._input,r,r._module.attributes,e,t)}function w(e){return"v"===e.orientation?"x":"y"}function T(e,r,i){var o=e.uid+"__"+i;r||(r=o);var l=function(e,r){return a.getFromTrace({_fullLayout:t},e,r).type}(e,i),s=e[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(e),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",e.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",e.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[e],dirs:[i],axType:l,calendar:e[i+"calendar"]||""}),e["_"+i+"bingroup"]=r}for(h=0;hL&&T.splice(L,T.length-L),A.length>L&&A.splice(L,A.length-L);var S=[],C=[],O=[],z="string"==typeof w.size,P="string"==typeof M.size,D=[],E=[],I=z?D:w,R=P?E:M,F=0,N=[],B=[],H=t.histnorm,j=t.histfunc,V=-1!==H.indexOf("density"),q="max"===j||"min"===j?null:0,U=i.count,G=o[H],Z=!1,X=[],Y=[],W="z"in t?t.z:"marker"in t&&Array.isArray(t.marker.color)?t.marker.color:"";W&&"count"!==j&&(Z="avg"===j,U=i[j]);var Q=w.size,$=x(w.start),J=x(w.end)+($-a.tickIncrement($,Q,!1,m))/1e6;for(r=$;r=0&&p=0&&h0||n.inbox(r-o.y0,r-(o.y0+o.h*l.dy),0)>0)){var u=Math.floor((t-o.x0)/l.dx),f=Math.floor(Math.abs(r-o.y0)/l.dy);if(o.z[f][u]){var d,p=o.hi||l.hoverinfo;if(p){var h=p.split("+");-1!==h.indexOf("all")&&(h=["color"]),-1!==h.indexOf("color")&&(d=!0)}var g,v=l.colormodel,m=v.length,y=l._scaler(o.z[f][u]),x=i.colormodel[v].suffix,b=[];(l.hovertemplate||d)&&(b.push("["+[y[0]+x[0],y[1]+x[1],y[2]+x[2]].join(", ")),4===m&&b.push(", "+y[3]+x[3]),b.push("]"),b=b.join(""),e.extraText=v.toUpperCase()+": "+b),Array.isArray(l.hovertext)&&Array.isArray(l.hovertext[f])?g=l.hovertext[f][u]:Array.isArray(l.text)&&Array.isArray(l.text[f])&&(g=l.text[f][u]);var _=c.c2p(o.y0+(f+.5)*l.dy),w=o.x0+(u+.5)*l.dx,T=o.y0+(f+.5)*l.dy,k="["+o.z[f][u].slice(0,l.colormodel.length).join(", ")+"]";return[a.extendFlat(e,{index:[f,u],x0:s.c2p(o.x0+u*l.dx),x1:s.c2p(o.x0+(u+1)*l.dx),y0:_,y1:_,color:y,xVal:w,xLabelVal:w,yVal:T,yLabelVal:T,zLabelVal:k,text:g,hovertemplateLabels:{zLabel:k,colorLabel:b,"color[0]Label":y[0]+x[0],"color[1]Label":y[1]+x[1],"color[2]Label":y[2]+x[2],"color[3]Label":y[3]+x[3]}})]}}}},{"../../components/fx":92,"../../lib":178,"./constants":369}],373:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),calc:e("./calc"),plot:e("./plot"),style:e("./style"),hoverPoints:e("./hover"),eventData:e("./event_data"),moduleType:"trace",name:"image",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":235,"./attributes":367,"./calc":368,"./defaults":370,"./event_data":371,"./hover":372,"./plot":374,"./style":375}],374:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../constants/xmlns_namespaces"),o=e("./constants");t.exports=function(e,t,r,l){var s=t.xaxis,c=t.yaxis;a.makeTraceGroups(l,r,"im").each((function(e){var t,r,l,u,f,d,p=n.select(this),h=e[0],g=h.trace,v=h.z,m=h.x0,y=h.y0,x=h.w,b=h.h,_=g.dx,w=g.dy;for(d=0;void 0===t&&d0;)r=s.c2p(m+d*_),d--;for(d=0;void 0===u&&d0;)f=c.c2p(y+d*w),d--;r0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":178,"../../plots/domain":249,"../bar/defaults":283,"./attributes":376,"fast-isnumeric":18}],380:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":88}],381:[function(e,t,r){"use strict";var n=e("../../lib");r.formatPiePercent=function(e,t){var r=(100*e).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=e.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:h.castOption(b.bgcolor,e.pts)||e.color,borderColor:h.castOption(b.bordercolor,e.pts),fontFamily:h.castOption(_.family,e.pts),fontSize:h.castOption(_.size,e.pts),fontColor:h.castOption(_.color,e.pts),nameLength:h.castOption(b.namelength,e.pts),textAlign:h.castOption(b.align,e.pts),hovertemplate:h.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[g(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[g(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[g(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[g(e,a)],i.click(t,n.event))}))}function y(e,t,r){var n=h.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=h.castOption(e._input.textfont.color,t.pts));var a=h.castOption(e.insidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.insidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function x(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=_(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=w(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.width/e.height,o=M(i,n,t,r);return{scale:2*o/e.height,rCenter:T(i,o/t),rotate:k(a)}}function w(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.height/e.width,o=M(i,n,t,r);return{scale:2*o/e.width,rCenter:T(i,o/t),rotate:k(a+Math.PI/2)}}function T(e,t){return Math.cos(t)-e*t}function k(e){return(180/Math.PI*e+720)%180-90}function M(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function A(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function L(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function S(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=O(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=C(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function C(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function O(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function z(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:h.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:h.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=h.getFirstFilled(a.text,t.pts);(v(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function E(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;d("pie",r),x(t,e),z(t,i);var u=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var u=n.select(this),d=t[0],p=d.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=o.rotation*Math.PI/180,s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(t),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(t);g.enter().append("g").classed("slice",!0),g.exit().remove();var v=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,v[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=d.cx,u=d.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(m,e,t),p.pull){var w=+h.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===d.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}D(e,a,d);var S=h.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),v=s.ensureUniformFontSize(e,"outside"===S?function(e,t,r){var n=h.castOption(e.outsidetextfont.color,t.pts)||h.castOption(e.textfont.color,t.pts)||r.color,a=h.castOption(e.outsidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.outsidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,v).call(c.convertToTspans,e);var m,_=l.bBox(g.node());if("outside"===S)m=L(_,a);else if(m=b(_,a,d),"auto"===S&&m.scale<1){var w=s.ensureUniformFontSize(e,p.outsidetextfont);g.call(l.font,w),m=L(_=l.bBox(g.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:P(d.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=u+k[1]*m.rCenter+(m.y||0),E(m,_),m.outside){var M=m.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}m.fontSize=v.size,f(p.type,m,r),t[i].transform=m,g.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*d.r+","+n*d.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=s.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,p.title.font).call(c.convertToTspans,e),t="middle center"===p.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(d):S(d,i),r.attr("transform","translate("+t.x+","+t.y+")"+(t.scale<1?"scale("+t.scale+")":"")+"translate("+t.tx+","+t.ty+")")})),x&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,g;function v(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?e.yLabelMin:e.yLabelMax,v=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-g;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(h.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(v+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?v:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=l.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-d.r)/i.w,C=(.5*M-d.r)/i.h;a.autoMargin(e,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(d.cx-d.r-w.left,0),r:Math.max(w.right-(d.cx+d.r),0),b:Math.max(w.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:D,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:S,prerenderTitles:x,layoutAreas:z,attachFxHandlers:m,computeTransform:E}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx":92,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../bar/constants":281,"../bar/uniform_text":295,"./event_data":380,"./helpers":381,d3:16}],386:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":295,"./style_one":387,d3:16}],387:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":52,"./helpers":381}],388:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rl&&M[v].gap;)v--;for(y=M[v].s,h=M.length-1;h>v;h--)M[h].s=y;for(;lA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],396:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./stack_defaults"),u=e("./marker_defaults"),f=e("./line_defaults"),d=e("./line_shape_defaults"),p=e("./text_defaults"),h=e("./fillcolor_defaults");t.exports=function(e,t,r,g){function v(r,a){return n.coerce(e,t,i,r,a)}var m=s(e,t,g,v);if(m||(t.visible=!1),t.visible){var y=c(e,t,g,v),x=!y&&mG!=(F=P[O][1])>=G&&(E=P[O-1][0],I=P[O][0],F-R&&(D=E+(I-E)*(G-R)/(F-R),j=Math.min(j,D),V=Math.max(V,D)));j=Math.max(j,0),V=Math.min(V,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:j,x1:V,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":52,"../../components/fx":92,"../../lib":178,"../../registry":269,"./get_trace_color":399}],401:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":235,"./arrays_to_calcdata":388,"./attributes":389,"./calc":390,"./cross_trace_calc":394,"./cross_trace_defaults":395,"./defaults":396,"./format_labels":398,"./hover":400,"./marker_colorbar":407,"./plot":409,"./select":410,"./style":412,"./subtypes":413}],402:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":178}],403:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,z=L._length,P=S._length,D=t.connectGaps,E=t.baseTolerance,I=t.shape,R="linear"===I,F=t.fill&&"none"!==t.fill,N=[],B=f.minTolerance,H=e.length,j=new Array(H),V=0;function q(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*z*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function U(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===j[V-1][0],a=r===j[V-1][1];if(!n||!a)if(V>1){var i=t===j[V-2][0],o=r===j[V-2][1];n&&(t===te||t===re)&&i?o?V--:j[V-1]=e:a&&(r===ne||r===ae)&&o?i?V--:j[V-1]=e:j[V++]=e}else j[V++]=e}function ue(e){j[V-1][0]!==e[0]&&j[V-1][1]!==e[1]&&ce([W,Q]),ce(e),$=null,W=Q=0}function fe(e){if(M=e[0]/z,A=e[1]/P,X=e[0]re?re:0,Y=e[1]ae?ae:0,X||Y){if(V)if($){var t=K($,e);t.length>1&&(ue(t[0]),j[V++]=t[1])}else J=K(j[V-1],e)[0],j[V++]=J;else j[V++]=[X||e[0],Y||e[1]];var r=j[V-1];X&&Y&&(r[0]!==X||r[1]!==Y)?($&&(W!==X&&Q!==Y?ce(W&&Q?(n=$,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||X,Q||Y]):W&&Q&&ce([W,Q])),ce([X,Y])):W-X&&Q-Y&&ce([X||W,Y||Q]),$=e,W=X,Q=Y}else $&&ue(K($,e)[0]),j[V++]=e;var n,a,i,o}for("linear"===I||"spline"===I?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[3]);o&&(!n||Math.abs(o.x-r[0][0])>1||Math.abs(o.y-r[0][1])>1)&&(o=[o.x,o.y],n&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}$&&ce([W||$[0],Q||$[1]]),N.push(j.slice(0,V))}return N}},{"../../constants/numerical":158,"../../lib":178,"./constants":393}],404:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],405:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":18}],407:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],408:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":413}],409:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var z,P,D="",E=[],I=_._prevtrace;I&&(D=I._prevRevpath||"",C=I._nextFill,E=I._polygons);var R,F,N,B,H,j,V,q="",U="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):R=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),V=_._polygons=new Array(G.length),v=0;v1){var r=n.select(this);if(r.datum(f),e)y(r.style("opacity",0).attr("d",z).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",z),s.singleLineStyle(f,a)}}}}}var X=M.selectAll(".js-line").data(G);y(X.exit()).style("opacity",0).remove(),X.each(Z(!1)),X.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(X,r.layerClipId,e),G.length?(S?(S.datum(f),B&&j&&(O?("y"===O?B[1]=j[1]=b.c2p(0,!0):"x"===O&&(B[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+B+"L"+q.substr(1)).call(s.singleFillStyle)):y(S).attr("d",q+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&D?("tonext"===_.fill?y(C).attr("d",q+"Z"+D+"Z").call(s.singleFillStyle):y(C).attr("d",q+"L"+D.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=U,_._prevPolygons=V):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?$:Q:_&&!w&&(v=J),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var Y=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,Y,e),s.setClipUrl(L,Y,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function $(e){return e.filter((function(e){return e.vis}))}function J(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":74,"../../lib":178,"../../lib/polygon":190,"../../registry":269,"./line_points":403,"./link_traces":405,"./subtypes":413,d3:16}],410:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r"),o.hovertemplate=d.hovertemplate,i}function x(e,t){m.push(e._hovertitle+": "+t)}}},{"../scatter/hover":400}],422:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../scatter/marker_colorbar"),formatLabels:e("./format_labels"),calc:e("./calc"),plot:e("./plot"),style:e("../scatter/style").style,styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("../scatter/select"),eventData:e("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:e("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":265,"../scatter/marker_colorbar":407,"../scatter/select":410,"../scatter/style":412,"./attributes":416,"./calc":417,"./defaults":418,"./event_data":419,"./format_labels":420,"./hover":421,"./plot":423}],423:[function(e,t,r){"use strict";var n=e("../scatter/plot");t.exports=function(e,t,r){var a=t.plotContainer;a.select(".scatterlayer").selectAll("*").remove();var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:a,layerClipId:t._hasClipOnAxisFalse?t.clipIdRelative:null},o=t.layers.frontplot.select("g.scatterlayer");n(e,i,r,o)}},{"../scatter/plot":409}],424:[function(e,t,r){"use strict";var n=e("../box/attributes"),a=e("../../lib/extend").extendFlat;t.exports={y:n.y,x:n.x,x0:n.x0,y0:n.y0,name:a({},n.name,{}),orientation:a({},n.orientation,{}),bandwidth:{valType:"number",min:0,editType:"calc"},scalegroup:{valType:"string",dflt:"",editType:"calc"},scalemode:{valType:"enumerated",values:["width","count"],dflt:"width",editType:"calc"},spanmode:{valType:"enumerated",values:["soft","hard","manual"],dflt:"soft",editType:"calc"},span:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,points:a({},n.boxpoints,{}),jitter:a({},n.jitter,{}),pointpos:a({},n.pointpos,{}),width:a({},n.width,{}),marker:n.marker,text:n.text,hovertext:n.hovertext,hovertemplate:n.hovertemplate,box:{visible:{valType:"boolean",dflt:!1,editType:"plot"},width:{valType:"number",min:0,max:1,dflt:.25,editType:"plot"},fillcolor:{valType:"color",editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"plot"},meanline:{visible:{valType:"boolean",dflt:!1,editType:"plot"},color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"plot"},side:{valType:"enumerated",values:["both","positive","negative"],dflt:"both",editType:"calc"},offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"}}},{"../../lib/extend":173,"../box/attributes":296}],425:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("../box/calc"),o=e("./helpers"),l=e("../../constants/numerical").BADNUM;function s(e,t,r){var a=t.max-t.min;if(!a)return e.bandwidth?e.bandwidth:0;if(e.bandwidth)return Math.max(e.bandwidth,a/1e4);var i=r.length,o=n.stdev(r,i-1,t.mean);return Math.max(function(e,t,r){return 1.059*Math.min(t,r/1.349)*Math.pow(e,-.2)}(i,o,t.q3-t.q1),a/100)}function c(e,t,r,n){var i,o=e.spanmode,s=e.span||[],c=[t.min,t.max],u=[t.min-2*n,t.max+2*n];function f(n){var a=s[n],i="multicategory"===r.type?r.r2c(a):r.d2c(a,0,e[t.valLetter+"calendar"]);return i===l?u[n]:i}var d={type:"linear",range:i="soft"===o?u:"hard"===o?c:[f(0),f(1)]};return a.setConvert(d),d.cleanRange(),i}t.exports=function(e,t){var r=i(e,t);if(r[0].t.empty)return r;for(var l=e._fullLayout,u=a.getFromId(e,t["h"===t.orientation?"xaxis":"yaxis"]),f=1/0,d=-1/0,p=0,h=0,g=0;g0){var y,x,b,_,w,T=e.xa,k=e.ya;"h"===d.orientation?(w=t,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=f[e.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},e),L=_.c2p(w,!0),S=o.getKdeValue(M,d,w),C=o.getPositionOnKdePath(M,d,L),O=b._offset,z=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=L,A[x+"Label"]=x+": "+a.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+S.toFixed(3),A.spikeDistance=m[0].spikeDistance;var P=y+"Spike";A[P]=m[0][P],m[0].spikeDistance=void 0,m[0][P]=void 0,A.hovertemplate=!1,v.push(A),(u={stroke:e.color})[y+"1"]=n.constrain(O+C[0],O,O+z),u[y+"2"]=n.constrain(O+C[1],O,O+z),u[x+"1"]=u[x+"2"]=_._offset+L}}h&&(v=v.concat(m))}-1!==p.indexOf("points")&&(c=i.hoverOnPoints(e,t,r));var D=s.selectAll(".violinline-"+d.uid).data(u?[0]:[]);return D.enter().append("line").classed("violinline-"+d.uid,!0).attr("stroke-width",1.5),D.exit().remove(),D.attr(u),"closest"===l?c?[c]:v:c?(v.push(c),v):v}},{"../../lib":178,"../../plots/cartesian/axes":222,"../box/hover":301,"./helpers":428}],430:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style"),styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("../box/select"),moduleType:"trace",name:"violin",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":235,"../box/defaults":299,"../box/select":306,"../scatter/style":412,"./attributes":424,"./calc":425,"./cross_trace_calc":426,"./defaults":427,"./hover":429,"./layout_attributes":431,"./layout_defaults":432,"./plot":433,"./style":434}],431:[function(e,t,r){"use strict";var n=e("../box/layout_attributes"),a=e("../../lib").extendFlat;t.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":178,"../box/layout_attributes":303}],432:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes"),i=e("../box/layout_defaults");t.exports=function(e,t,r){i._supply(e,t,r,(function(r,i){return n.coerce(e,t,a,r,i)}),"violin")}},{"../../lib":178,"../box/layout_defaults":304,"./layout_attributes":431}],433:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../components/drawing"),o=e("../box/plot"),l=e("../scatter/line_points"),s=e("./helpers");t.exports=function(e,t,r,c){var u=e._fullLayout,f=t.xaxis,d=t.yaxis;function p(e){var t=l(e,{xaxis:f,yaxis:d,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return i.smoothopen(t[0],1)}a.makeTraceGroups(c,r,"trace violins").each((function(e){var r=n.select(this),i=e[0],l=i.t,c=i.trace;if(!0!==c.visible||l.empty)r.remove();else{var h=l.bPos,g=l.bdPos,v=t[l.valLetter+"axis"],m=t[l.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(a.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(e){var t,r,a,i,o,s,f,d,_=n.select(this),w=e.density,T=w.length,k=m.c2l(e.pos+h,!0),M=m.l2p(k);if(c.width)t=l.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];t="count"===c.scalemode?A.maxKDE/g*(A.maxCount/e.pts.length):A.maxKDE/g}if(x){for(f=new Array(T),o=0;o=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],29:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[D(i(e).toString(16)),D(i(t).toString(16)),D(i(r).toString(16)),D(I(n))];if(a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:E(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","var(--ow-color-black)"],r))};var L=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function z(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function D(e){return 1==e.length?"0"+e:""+e}function E(e){return e<=1&&(e=100*e+"%"),e}function I(t){return e.round(255*parseFloat(t)).toString(16)}function R(e){return P(e)/255}var F,N,B,H=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",B="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function j(e){return!!H.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],36:[function(e,t,r){"use strict";t.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],37:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;t.exports=o("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:a({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":212,"../../plots/cartesian/constants":228,"../../plots/font_attributes":250,"./arrow_paths":36}],38:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref);t._extremes={},r&&l(t,r),n&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":178,"../../plots/cartesian/axes":222,"./draw":43}],39:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var U=!1,G=["x","y"],Z=0;Z1)&&(ee===K?((ce=te.r2fraction(t["a"+J]))<0||ce>1)&&(U=!0):U=!0),X=te._offset+te.r2p(t[J]),Q=.5}else"x"===J?(W=t[J],X=b.l+b.w*W):(W=1-t[J],X=b.t+b.h*W),Q=t.showarrow?.5:W;if(t.showarrow){se.head=X;var ue=t["a"+J];$=ne*j(.5,t.xanchor)-ae*j(.5,t.yanchor),ee===K?(se.tail=te._offset+te.r2p(ue),Y=$):(se.tail=X+ue,Y=$+ue),se.text=se.tail+$;var fe=x["x"===J?"width":"height"];if("paper"===K&&(se.head=o.constrain(se.head,1,fe-1)),"pixel"===ee){var de=-Math.max(se.tail-3,se.text),pe=Math.min(se.tail+3,se.text)-fe;de>0?(se.tail+=de,se.text+=de):pe>0&&(se.tail-=pe,se.text-=pe)}se.tail+=le,se.head+=le}else Y=$=ie*j(Q,oe),se.text=X+$;se.text+=le,$+=le,Y+=le,t["_"+J+"padplus"]=ie/2+Y,t["_"+J+"padminus"]=ie/2-Y,t["_"+J+"size"]=ie,t["_"+J+"shift"]=$}if(U)D.remove();else{var he=0,ge=0;if("left"!==t.align&&(he=(w-m)*("center"===t.align?.5:1)),"top"!==t.valign&&(ge=(P-y)*("middle"===t.valign?.5:1)),u)n.select("svg").attr({x:R+he-1,y:R+ge}).call(c.setClipUrl,N?A:null,e);else{var ve=R+ge-h.top,me=R+he-h.left;V.call(f.positionText,me,ve).call(c.setClipUrl,N?A:null,e)}B.select("rect").call(c.setRect,R,R,w,P),F.call(c.setRect,E/2,E/2,I-E,H-E),D.call(c.setTranslate,Math.round(L.x.text-I/2),Math.round(L.y.text-H/2)),O.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var ye,xe=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),z=+F.attr("width"),P=+F.attr("height"),E=m-.5*z,I=E+z,R=y-.5*P,N=R+P,B=[[E,R,E,N],[E,N,I,N],[I,N,I,R],[I,R,E,R]].map(A);if(!B.reduce((function(e,t){return e^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){B.forEach((function(e){var t=o.segmentsIntersect(d,h,u,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,h=t.y)}));var H=t.arrowwidth,j=t.arrowcolor,V=t.arrowside,q=C.append("g").style({opacity:s.opacity(j)}).classed("annotation-arrow-g",!0),U=q.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",H+"px").call(s.stroke,s.rgb(j));if(g(U,V,t),_.annotationPosition&&U.node().parentNode&&!i){var G=u,Z=f;if(t.standoff){var X=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=t.standoff*(d-u)/X,Z+=t.standoff*(h-f)/X}var Y,W,Q=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",H+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:Q.node(),gd:e,prepFn:function(){var e=c.getTranslate(D);Y=e.x,W=e.y,l&&l.autorange&&T(l._name+".autorange",!0),v&&v.autorange&&T(v._name+".autorange",!0)},moveFn:function(e,r){var n=w(Y,W),a=n[0]+e,i=n[1]+r;D.call(c.setTranslate,a,i),k("x",l?l.p2r(l.r2p(t.x)+e):t.x+e/b.w),k("y",v?v.p2r(v.r2p(t.y)+r):t.y-r/b.h),t.axref===t.xref&&k("ax",l.p2r(l.r2p(t.ax)+e)),t.ayref===t.yref&&k("ay",v.p2r(v.r2p(t.ay)+r)),q.attr("transform","translate("+e+","+r+")"),O.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&xe(0,0),z)p.init({element:D.node(),gd:e,prepFn:function(){ye=O.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?k("ax",l.p2r(l.r2p(t.ax)+e)):k("ax",t.ax+e),t.ayref===t.yref?k("ay",v.p2r(v.r2p(t.ay)+r)):k("ay",t.ay+r),xe(e,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(t.x)+e);else{var s=t._xsize/b.w,c=t.x+(t._xshift-t.xshift)/b.w-s/2;a=p.align(c+e/b.w,s,0,1,t.xanchor)}if(v)o=v.p2r(v.r2p(t.y)+r);else{var u=t._ysize/b.h,f=t.y-(t._yshift+t.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,t.yanchor)}k("x",a),k("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,t.xanchor,t.yanchor))}O.attr({transform:"translate("+e+","+r+")"+ye}),d(D,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",q(n))},doneFn:function(){d(D),a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=t.indexOf("end")>=0,m=f.backoff*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},l={x:+e.attr("x2"),y:+e.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void z();if(m){if(m*m>x*x+b*b)return void z();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,e.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void z();var T=y*Math.cos(s),k=y*Math.sin(s);o.x-=T,o.y-=k,e.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":253,"../annotations/draw":43}],50:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(Y)/Math.LN10));Z*=W*c.roundUp(Y/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[V+B,V+R-B],G.setScale(),e.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var Q,$=e.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),J=e.select("."+k.cbaxis),K=0;function ee(n,a){var i={propContainer:G,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+k.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var e,r=s.l+(t.x+F)*s.w,n=G.title.font.size;e="top"===M?(1-(V+R-B))*s.h+s.t+3+.75*n:(1-(V+B))*s.h+s.t-3-.25*n,ee(G._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=e.select("."+k.cbtitle),o=i.select("text"),u=[-t.outlinewidth/2,t.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===M)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}e.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),J.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=e.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(z);m.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(e,t){return e-t}));m.each((function(e,i){var o=[0===i?A[0]:(z[i]+z[i-1])/2,i===z.length-1?A[1]:(z[i]+z[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:H,width:Math.max(D,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)d.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=S(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=e.select("."+k.cblines).selectAll("path."+k.cbline).data(v.color&&v.width?P:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(e){n.select(this).attr("d","M"+H+","+(Math.round(G.c2p(e))+v.width/2%1)+"h"+D).call(d.lineGroupStyle,v.width,L(e),v.dash)})),J.selectAll("g."+G._id+"tick,path").remove();var b=H+D+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),w=l.calcTicks(G),T=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:J,path:l.makeTickPath(G,b,C),transFn:T}),l.drawLabels(r,G,{vals:w,layer:J,transFn:T,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var e=G.title.font.size,t=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+e*(G.showticklabels?1:.5):-10-e*(G.showticklabels?.5:0));ee("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=D+t.outlinewidth/2+d.bBox(J.node()).width;if((Q=$.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=$.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?d.bBox(o).width:d.bBox($.node()).right-H-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=q-U;e.select("."+k.cbbg).attr({x:H-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:U-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,t.bgcolor).call(p.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+k.cboutline).attr({x:H,y:U+t.ypad+("top"===M?K:0),width:Math.max(D,2),height:Math.max(c-2*t.ypad-K,2)}).call(p.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var u=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[t.yanchor],g=T[t.yanchor];"pixels"===t.lenmode?(f.y=t.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=t.y+t.len*h,f.yb=t.y-t.len*g);var v=w[t.xanchor],m=T[t.xanchor];if("pixels"===t.thicknessmode)f.x=t.x,f.l=l*v,f.r=l*m;else{var y=l-D;f.l=y*v,f.r=y*m,f.xl=t.x-t.thickness*v,f.xr=t.x+t.thickness*m}i.autoMargin(r,t._id,f)}],r)}(r,t,e);v&&v.then&&(e._promises||[]).push(v),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),f(e)},moveFn:function(r,o){e.attr("transform",n+" translate("+r+","+o+")"),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);f(e,c)},doneFn:function(){if(f(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":154,"../../lib":178,"../../lib/extend":173,"../../lib/setcursor":197,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../plots/cartesian/axis_defaults":224,"../../plots/cartesian/layout_attributes":236,"../../plots/cartesian/position_defaults":239,"../../plots/plots":256,"../../registry":269,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,d3:16,tinycolor2:35}],57:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":178}],58:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":193,"../colorbar/attributes":53,"./scales.js":67}],60:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":178,"./helpers":63,"fast-isnumeric":18}],61:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],69:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":178}],70:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],71:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":178,"../../plots/cartesian/constants":228,"./align":68,"./cursor":69,"./unhover":72,"has-hover":20,"has-passive-events":21,"mouse-event-offset":24}],72:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":171,"../../lib/events":172,"../../lib/throttle":200,"../fx/constants":86}],73:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],74:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=e("../../lib/svg_text_utils"),f=e("../../constants/xmlns_namespaces"),d=e("../../constants/alignment").LINE_SPACING,p=e("../../constants/interactions").DESELECTDIM,h=e("../../traces/scatter/subtypes"),g=e("../../traces/scatter/make_bubble_size_func"),v=e("../../components/fx/helpers").appendArrayPointValue,m=t.exports={};m.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},m.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},m.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},m.setRect=function(e,t,r,n,a){e.call(m.setPosition,t,r).call(m.setSize,n,a)},m.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);m.translatePoint(e,a,t,r)}))},m.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},m.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){m.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},m.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),m.dashLine(t,s,o)},m.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(e,t,r){r=+r||0,t=m.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},m.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},m.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},m.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var y=e("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(e){var t=y[e],r=t.n;m.symbolList.push(r,e,r+100,e+"-open"),m.symbolNames[r]=e,m.symbolFuncs[r]=t.f,t.needLine&&(m.symbolNeedLines[r]=!0),t.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,e+"-dot",r+300,e+"-open-dot"),t.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(e,t){var r=e%100;return m.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(e){if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=m.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=x||e>=400?0:Math.floor(Math.max(e,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:_},horizontalreversed:{node:"linearGradient",attrs:_,reversed:!0},vertical:{node:"linearGradient",attrs:w},verticalreversed:{node:"linearGradient",attrs:w,reversed:!0}};m.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=k[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},m.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},m.pointStyle=function(e,t,r){if(e.size()){var a=m.makePointStyleFns(t);e.each((function(e){m.singlePointStyle(e,n.select(this),t,a,r)}))}},m.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=m.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",b(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,y=e.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=e.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+e.i),m.gradient(t,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},m.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=m.tryColorscale(r,""),t.lineScale=m.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=h.isBubble(e)?g(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,m.makeSelectedPointStyleFns(e)),t},m.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:h?f:p*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},m.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,p))},t},m.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",b(m.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}m.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=m.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var f=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};v(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=L(e,t),y=a?a(e):e.tc||t.textfont.color;i.call(m.font,e.tf||t.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,e.mrc)}else i.remove()}))}},m.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=L(e,t);l.fill(a,i),A(a,o,s,e.mrc2||e.mrc)}))}};function S(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}m.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},z=0),r&&(m.savedBBoxes[r]=v),z++,c.extendFlat({},v)},m.setClipUrl=function(e,t,r){e.attr("clip-path",D(t,r))},m.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},m.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+t+", "+r+")").trim(),e[a]("transform",i),i},m.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},m.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+t+", "+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;m.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":" scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var I=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);e=1===t&&1===r?[]:["translate("+o+","+l+")","scale("+t+","+r+")","translate("+-o+","+-l+")"],s&&e.push(s),a.attr("transform",e.join(" "))}}))}},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":178,"../../lib/svg_text_utils":199,"../../registry":269,"../../traces/scatter/make_bubble_size_func":406,"../../traces/scatter/subtypes":413,"../color":52,"../colorscale":64,"./symbol_defs":75,d3:16,"fast-isnumeric":18,tinycolor2:35}],75:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0}}},{d3:16}],76:[function(e,t,r){"use strict";t.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],77:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":413,"../drawing":74,d3:16,"fast-isnumeric":18}],82:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":52,d3:16}],83:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":173,"../../plots/font_attributes":250,"./layout_attributes":93}],84:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>w[0]._length)return d.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+w[0]._offset,E="xval"in t?g.flat(s,t.xval):g.p2c(b,K),I="yval"in t?g.flat(s,t.yval):g.p2c(w,ee),!a(E[0])||!a(I[0]))return o.warn("Fx.hover failed",t,e),d.unhoverRaw(e,t)}var re=1/0;function ne(e,r){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),m&&0!==Y&&0===W.length){G.distance=Y,G.index=!1;var d=B._module.hoverPoints(G,q,U,"closest",u._hoverlayer);if(d&&(d=d.filter((function(e){return e.spikeDistance<=Y}))),d&&d.length){var p,h=d.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=ie(v),(!$.vLinePoint||$.vLinePoint.spikeDistance>p.spikeDistance)&&($.vLinePoint=p))}var y=d.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=ie(x),(!$.hLinePoint||$.hLinePoint.spikeDistance>p.spikeDistance)&&($.hLinePoint=p))}}}}}function ae(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&J&&W.length>1,Me=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Ae={hovermode:C,rotateLabels:ke,bgColor:Me,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Le=S(W,Ae,e);g.isUnifiedHover(C)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],T=w.datum;T.offset=w.dp,T.del=w.del}}}(Le,ke?"xa":"ya",u),O(Le,ke));if(t.target&&t.target.tagName){var Se=h.getComponentMethod("annotations","hasClickToShow")(e,be);c(n.select(t.target),Se?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,xe))return;xe&&e.emit("plotly_unhover",{event:t,points:xe});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:w,xvals:E,yvals:I})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||f.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,t.gd),c=0,u=0;return s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function S(e,t,r){var a=r._fullLayout,i=t.hovermode,l=t.rotateLabels,c=t.bgColor,d=t.container,p=t.outerContainer,h=t.commonLabelOpts||{},b=t.fontFamily||v.HOVERFONT,_=t.fontSize||v.HOVERFONTSIZE,w=e[0],T=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",O=w[S],z=(String(O)||"").split(" ")[0],P=p.node().getBoundingClientRect(),D=P.top,E=P.width,I=P.height,R=void 0!==O&&w.distance<=t.hoverdistance&&("x"===i||"y"===i);if(R){var F,N,B=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-k)+",0L"+S+","+A+k+"v"+A+(2*M+x.height)+"H-"+S+"V"+A+k+"H"+(S-2*k)+"Z")):l.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,z,P;"right"===L.side?(C="start",z=1,P="",m=T._offset+T._length):(C="end",z=-1,P="-",m=T._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+P+k+","+k+"V"+(M+x.height/2)+"h"+P+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+P+k+"V-"+k+"Z");var E,I=x.height/2,R=D-x.top-I,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=re:K+=2*M;var ne=te.height+2*M,ae=J+ne>=I;return ne<=I&&(J<=D?J=L._offset+2*M:ae&&(J=I-ne)),ee.attr("transform","translate("+K+","+J+")"),ee}var ie=d.selectAll("g.hovertext").data(e,(function(e){return A(e)}));return ie.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(f.fill,f.addOpacity(c,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(u.font,b,_)})),ie.exit().remove(),ie.each((function(e){var t=n.select(this).attr("transform",""),o=e.bgcolor||e.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(e.color)?e.color:f.defaultLine,c),h=e.borderColor||f.contrast(d),g=C(e,R,i,a,O,t),v=g[0],m=g[1],y=t.select("text.nums").call(u.font,e.fontFamily||b,e.fontSize||_,e.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=t.select("text.name"),T=0,A=0;if(m&&m!==v){w.call(u.font,e.fontFamily||b,e.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();T=L.width+2*M,A=L.height+2*M}else w.remove(),t.select("rect").remove();t.select("path").style({fill:d,stroke:h});var S,z,P=y.node().getBoundingClientRect(),F=e.xa._offset+(e.x0+e.x1)/2,N=e.ya._offset+(e.y0+e.y1)/2,B=Math.abs(e.x1-e.x0),H=Math.abs(e.y1-e.y0),j=P.width+k+M+T;if(e.ty0=D-P.top,e.bx=P.width+2*M,e.by=Math.max(P.height+2*M,A),e.anchor="start",e.txwidth=P.width,e.tx2width=T,e.offset=0,l)e.pos=F,S=N+H/2+j<=I,z=N-H/2-j>=0,"top"!==e.idealAlign&&S||!z?S?(N+=H/2,e.anchor="start"):e.anchor="middle":(N-=H/2,e.anchor="end");else if(e.pos=N,S=F+B/2+j<=E,z=F-B/2-j>=0,"left"!==e.idealAlign&&S||!z)if(S)F+=B/2,e.anchor="start";else{e.anchor="middle";var V=j/2,q=F+V-E,U=F-V;q>0&&(F-=q),U<0&&(F+=-U)}else F-=B/2,e.anchor="end";y.attr("text-anchor",e.anchor),T&&w.attr("text-anchor",e.anchor),t.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),ie}function C(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=E(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(L,(function(t,r){return l=E(r,e.nameLength),""}))),[s,l]}function O(e,t){e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),i=e.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(k+M),f=c+l*(e.txwidth+M),d=0,p=e.offset;"middle"===i&&(c-=e.tx2width/2,f+=e.txwidth/2+M),t&&(p*=-T,d=e.offset*w),r.select("path").attr("d","middle"===i?"M-"+(e.bx/2+e.tx2width/2)+","+(p-e.by/2)+"h"+e.bx+"v"+e.by+"h-"+e.bx+"Z":"M0,0L"+(o*k+d)+","+(k+p)+"v"+(e.by/2-k)+"h"+o*e.bx+"v-"+e.by+"H"+(o*k+d)+"V"+(p-k)+"Z");var h=c+d,g=p+e.ty0-e.by/2+M,v=e.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-e.bx/2-e.tx2width/2+M:-e.bx-M):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?e.bx/2-e.tx2width/2-M:e.bx+M)),a.call(s.positionText,h,g),e.tx2width&&(r.select("text.name").call(s.positionText,f+l*M+d,p+e.ty0-e.by/2+M),r.select("rect").call(u.setRect,f+(l-1)*e.tx2width/2+d,p-e.by/2-1,e.tx2width,e.by+2))}))}function z(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:p.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:p.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=p.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+p.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=p.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+p.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var h=e.hoverinfo||e.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===h.indexOf("y")&&(e.yLabel=void 0),-1===h.indexOf("z")&&(e.zLabel=void 0),-1===h.indexOf("text")&&(e.text=void 0),-1===h.indexOf("name")&&(e.name=void 0)),e}function P(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!t.hLinePoint,h=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(h){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var z,P,D=i.readability(O.color,g)<1.5?f.contrast(g):O.color,E=n.spikemode,I=n.spikethickness,R=n.spikecolor||D,F=p.getPxPosition(e,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(z=F,P=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),z=s.t+(1-B)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:z,y2:P,"stroke-width":I,stroke:R,"stroke-dasharray":u.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:z,y2:P,"stroke-width":I+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?I:-I),r:I,fill:R}).classed("spikeline",!0)}}}function D(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function E(e,t){return s.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":178,"../../lib/events":172,"../../lib/override_cursor":189,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../registry":269,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,d3:16,"fast-isnumeric":18,tinycolor2:35}],90:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":178,"../color":52,"./helpers":88}],91:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":178,"../../plot_api/plot_template":212,"../../plots/layout_attributes":254,"../../registry":269,"./attributes":102,"./helpers":108}],105:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?T(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){e.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}}))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var z=a.ensureSingle(C,"text","legendtitletext");z.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,O.font).text(O.text),M(z,C,e,t)}var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),D=C.selectAll("g.groups").data(d);D.enter().append("g").attr("class","groups"),D.exit().remove();var E=D.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+h),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,O=0;r.each((function(e){var t=e[0].width+d;C=Math.max(C,t),O+=t})),x=null;var z=0;if(s){var P=0,D=0,E=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+t),t+=n,e=Math.max(e,d+r[0].width)})),P=Math.max(P,t);var r=e+h;r+u+D>a._maxWidth&&(z=Math.max(z,D),D=0,E+=P+a.tracegroupgap,P=t),c.setTranslate(this,D,E),D+=r})),a._width=Math.max(z,D)+u,a._height=E+P+g}else{var I=r.size(),R=O+f+(I-1)*ha._maxWidth&&(z=Math.max(z,H),N=0,B+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+B+t/2+h),H=N+r+h,N+=n,F=Math.max(F,t)})),R?(a._width=N+f,a._height=F+g):(a._width=Math.max(z,H)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=e._context.edits,V=j.legendText||j.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=V?d:x||d+e[0].width;l||(a+=h/2),c.setRect(t,0,-r/2,a,r)}))}(e,D,E,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var z=t._effHeight;t._main||(z=t._height),S.attr({width:t._width-b,height:z-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:z-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var D,E,I,R=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-R-2*p.scrollBarMargin,N=t._height-t._effHeight,B=F/N,H=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+H}),c.setClipUrl(C,f,e),q(H,R,B),g.on("wheel",(function(){q(H=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),R,B),0!==H&&H!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;D="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,I=H})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(E="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,q(H=function(e,t,r){var n=(r-t)/B+e;return a.constrain(n,0,N)}(I,D,E),R,B))}));P.call(j);var V=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(D=e.changedTouches[0].clientY,I=H)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(E=e.changedTouches[0].clientY,q(H=function(e,t,r){var n=(t-r)/B+e;return a.constrain(n,0,N)}(I,D,E),R,B))}));C.call(V)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function q(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":154,"../../lib":178,"../../lib/events":172,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../../registry":269,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,d3:16}],106:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return h?n:Math.min(a,r)};function v(e,t,r){var i=e[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=g(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(t,r.mlc||s.color)}))}function m(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var o=r.valign,l=e[0].lineHeight,s=e[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([e]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",e[0]),u?f.call(l.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;o.gradient(e,t,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,v(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(e){v(e,this,"funnel")})).each((function(e){v(e,this)})).each((function(e){var r=e[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,t)}}))})).each((function(e){m(e,this,"funnelarea")})).each((function(e){m(e,this,"pie")})).each((function(e){var r,a,l=e[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=f||m,k=p||v,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[e]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",M+"h30v6h-30z").call(f?o.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+u.uid;o.gradient(e,t,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+u.uid;o.lineGroupStyle(e),o.gradient(e,t,r,d(b),x,"stroke")}})})).each((function(e){var r,a,l=e[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(e){return l._distinct&&l.index&&e[l.index]?e[l.index]:e[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,t),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":178,"../../registry":269,"../../traces/pie/helpers":381,"../../traces/pie/style_one":387,"../../traces/scatter/subtypes":413,"../color":52,"../colorscale/helpers":63,"../drawing":74,d3:16}],111:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=R[r+1];else if(e=n.pmax)t=R[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");X(n),Q(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),Z.moveFn="move"===D?Y:W,Z.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),$(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;$(l)}};function X(r){if(m(e))D=null;else if(R)D="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),D=s.split("-")[0]}}function Y(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(j(e)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=U(T+a)):(s=function(e){return U(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else E?N("xanchor",r.xanchor=q(x+n)):(N("x0",r.x0=q(c+n)),N("x1",r.x1=q(v+n))),I?N("yanchor",r.yanchor=U(T+a)):(N("y0",r.y0=U(f+a)),N("y1",r.y1=U(y+a)));t.attr("d",_(e,r)),Q(l,r)}function W(n,a){if(F){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(j(e)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=U(T+a)):(s=function(e){return U(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(R){if("resize-over-start-point"===D){var u=c+n,d=I?f-a:f+a;N("x0",r.x0=E?u:q(u)),N("y0",r.y0=I?d:U(d))}else if("resize-over-end-point"===D){var p=v+n,h=I?y-a:y+a;N("x1",r.x1=E?p:q(p)),N("y1",r.y1=I?h:U(h))}}else{var m=function(e){return-1!==D.indexOf(e)},b=m("n"),G=m("s"),Z=m("w"),X=m("e"),Y=b?k+a:k,W=G?M+a:M,$=Z?A+n:A,J=X?L+n:L;I&&(b&&(Y=k-a),G&&(W=M-a)),(!I&&W-Y>10||I&&Y-W>10)&&(N(S,r[S]=I?Y:U(Y)),N(C,r[C]=I?W:U(W))),J-$>10&&(N(O,r[O]=E?$:q($)),N(z,r[z]=E?J:q(J)))}t.attr("d",_(e,r)),Q(l,r)}function Q(e,t){(E||I)&&function(){var r="path"!==t.type,n=e.selectAll(".visual-cue").data([0]);n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"var(--ow-color-black)","stroke-width":1}).classed("visual-cue",!0);var i=j(E?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=V(I?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&I){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function $(e){e.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=X}(e,E,s,t,r,D):!0===s.editable&&E.style("pointer-events",z||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,E)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getFromId(e,t.xref),v=i.getFromId(e,t.yref),m=e._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(e){return p._offset+p.r2p(r(e,!0))}):n=function(e){return m.l+m.w*e},v?(o=g.shapePositionToRange(v),l=function(e){return v._offset+v.r2p(o(e,!0))}):l=function(e){return m.t+m.h*(1-e)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var y=n(t.xanchor);s=y+t.x0,c=y+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var x=l(t.yanchor);u=x-t.y0,f=x-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+t._dims.currentValueTotalHeight+")")}}function L(e,t){var r=e._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,t))}function S(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",u.railTouchRectClass,(function(n){n.call(k,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(e,t){var r=t._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(e,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[u.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,g(t))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];t.attr("transform","translate("+v+")")}}}return E.call(I),P&&(L?E.on(".opacity",null):(k=0,M=!0,E.text(m).on("mouseover.opacity",(function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)}))),E.call(u.makeEditable,{gd:e}).on("edit",(function(t){void 0!==y?o.call("_guiRestyle",e,v,t,y):o.call("_guiRelayout",e,v,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(e){this.text(e||" ").call(u.positionText,b.x,b.y)}))),E.classed("js-placeholder",M),w}}},{"../../constants/alignment":154,"../../constants/interactions":157,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../../registry":269,"../color":52,"../drawing":74,d3:16,"fast-isnumeric":18}],148:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:c,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":173,"../../plot_api/edit_types":205,"../../plot_api/plot_template":212,"../../plots/font_attributes":250,"../../plots/pad_attributes":255,"../color/attributes":51}],149:[function(e,t,r){"use strict";t.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],150:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["x","y"]),o("xanchor"),o("yanchor"),o("pad.t"),o("pad.r"),o("pad.b"),o("pad.l"),n.coerceFont(o,"font",r.font),o("bgcolor",r.paper_bgcolor),o("bordercolor"),o("borderwidth"))}function c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":178,"../../plots/array_container_defaults":218,"./attributes":148,"./constants":149}],151:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[0]:[]);if(o.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+f.headerGroupClassName).each(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,z=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,D=h+g,E=v;D+z>s&&(D=s-z);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=I.attr({rx:l.barRadius,ry:l.barRadius,x:D,y:E,width:z,height:P}),this._vbarYMin=E+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,N=O?f+z+.5:f+.5,B=d-.5,H=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+R).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){var V=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault()})).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),O&&this.vbar.on(".drag",null).call(q)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":178,"../color":52,"../drawing":74,d3:16}],154:[function(e,t,r){"use strict";t.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,CAP_SHIFT:.7,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],155:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format"}},{}],156:[function(e,t,r){"use strict";t.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],157:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],158:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],159:[function(e,t,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],160:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],163:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],164:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":185}],165:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var z=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=z.newDate(k,z.toMonthIndex(k,M,P),A)}else O=z.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var D=new Date(Date.UTC(2e3,M,A,L,S));return D.setUTCFullYear(k),D.getUTCMonth()!==M||D.getUTCDate()!==A?u:D.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":185}],177:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],178:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../constants/numerical"),o=i.FP_SAFE,l=i.BADNUM,s=t.exports={};s.nestedProperty=e("./nested_property"),s.keyedContainer=e("./keyed_container"),s.relativeAttr=e("./relative_attr"),s.isPlainObject=e("./is_plain_object"),s.toLogRange=e("./to_log_range"),s.relinkPrivateKeys=e("./relink_private");var c=e("./array");s.isTypedArray=c.isTypedArray,s.isArrayOrTypedArray=c.isArrayOrTypedArray,s.isArray1D=c.isArray1D,s.ensureArray=c.ensureArray,s.concat=c.concat,s.maxRowLength=c.maxRowLength,s.minRowLength=c.minRowLength;var u=e("./mod");s.mod=u.mod,s.modHalf=u.modHalf;var f=e("./coerce");s.valObjectMeta=f.valObjectMeta,s.coerce=f.coerce,s.coerce2=f.coerce2,s.coerceFont=f.coerceFont,s.coerceHoverinfo=f.coerceHoverinfo,s.coerceSelectionMarkerOpacity=f.coerceSelectionMarkerOpacity,s.validate=f.validate;var d=e("./dates");s.dateTime2ms=d.dateTime2ms,s.isDateTime=d.isDateTime,s.ms2DateTime=d.ms2DateTime,s.ms2DateTimeLocal=d.ms2DateTimeLocal,s.cleanDate=d.cleanDate,s.isJSDate=d.isJSDate,s.formatDate=d.formatDate,s.incrementMonth=d.incrementMonth,s.dateTick0=d.dateTick0,s.dfltRange=d.dfltRange,s.findExactDates=d.findExactDates,s.MIN_MS=d.MIN_MS,s.MAX_MS=d.MAX_MS;var p=e("./search");s.findBin=p.findBin,s.sorterAsc=p.sorterAsc,s.sorterDes=p.sorterDes,s.distinctVals=p.distinctVals,s.roundUp=p.roundUp,s.sort=p.sort,s.findIndexOfMin=p.findIndexOfMin;var h=e("./stats");s.aggNums=h.aggNums,s.len=h.len,s.mean=h.mean,s.median=h.median,s.midRange=h.midRange,s.variance=h.variance,s.stdev=h.stdev,s.interp=h.interp;var g=e("./matrix");s.init2dArray=g.init2dArray,s.transposeRagged=g.transposeRagged,s.dot=g.dot,s.translationMatrix=g.translationMatrix,s.rotationMatrix=g.rotationMatrix,s.rotationXYMatrix=g.rotationXYMatrix,s.apply2DTransform=g.apply2DTransform,s.apply2DTransform2=g.apply2DTransform2;var v=e("./angles");s.deg2rad=v.deg2rad,s.rad2deg=v.rad2deg,s.angleDelta=v.angleDelta,s.angleDist=v.angleDist,s.isFullCircle=v.isFullCircle,s.isAngleInsideSector=v.isAngleInsideSector,s.isPtInsideSector=v.isPtInsideSector,s.pathArc=v.pathArc,s.pathSector=v.pathSector,s.pathAnnulus=v.pathAnnulus;var m=e("./anchor_utils");s.isLeftAnchor=m.isLeftAnchor,s.isCenterAnchor=m.isCenterAnchor,s.isRightAnchor=m.isRightAnchor,s.isTopAnchor=m.isTopAnchor,s.isMiddleAnchor=m.isMiddleAnchor,s.isBottomAnchor=m.isBottomAnchor;var y=e("./geometry2d");s.segmentsIntersect=y.segmentsIntersect,s.segmentDistance=y.segmentDistance,s.getTextLocation=y.getTextLocation,s.clearLocationCache=y.clearLocationCache,s.getVisibleSegment=y.getVisibleSegment,s.findPointOnPath=y.findPointOnPath;var x=e("./extend");s.extendFlat=x.extendFlat,s.extendDeep=x.extendDeep,s.extendDeepAll=x.extendDeepAll,s.extendDeepNoArrays=x.extendDeepNoArrays;var b=e("./loggers");s.log=b.log,s.warn=b.warn,s.error=b.error;var _=e("./regex");s.counterRegex=_.counter;var w=e("./throttle");s.throttle=w.throttle,s.throttleDone=w.done,s.clearThrottle=w.clear;var T=e("./dom");function k(e){var t={};for(var r in e)for(var n=e[r],a=0;ao?l:a(e)?Number(e):l:l},s.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(a(e)&&e>=0&&e%1==0)},s.noop=e("./noop"),s.identity=e("./identity"),s.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},s.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},s.simpleMap=function(e,t,r,n){for(var a=e.length,i=new Array(a),o=0;o=Math.pow(2,r)?a>10?(s.warn("randstr failed uniqueness"),c):e(t,r,n,(a||0)+1):c},s.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},s.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},s.syncOrAsync=function(e,t,r){var n;function a(){return s.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,s.promiseError);return r&&r(t)},s.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},s.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},s.fillArray=function(e,t,r,n){if(n=n||s.identity,s.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},s.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var C=/^\w*$/;s.templateString=function(e,t){var r={};return e.replace(s.TEMPLATE_STRING_REGEX,(function(e,n){var a;return C.test(n)?a=t[n]:(r[n]=r[n]||s.nestedProperty(t,n).get,a=r[n]()),s.isValidTextValue(a)?a:""}))};var O={max:10,count:0,name:"hovertemplate"};s.hovertemplateString=function(){return D.apply(O,arguments)};var z={max:10,count:0,name:"texttemplate"};s.texttemplateString=function(){return D.apply(z,arguments)};var P=/^[:|\|]/;function D(e,t,r){var a=this,i=arguments;t||(t={});var o={};return e.replace(s.TEMPLATE_STRING_REGEX,(function(e,l,c){var u,f,d,p;for(d=3;d=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var E=2e9;s.seedPseudoRandom=function(){E=2e9},s.pseudoRandom=function(){var e=E;return E=(69069*E+1)%4294967296,Math.abs(E-e)<429496729?s.pseudoRandom():E/4294967296},s.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=s.extractOption(e,t,"htx","hovertext");if(s.isValidTextValue(a))return n(a);var i=s.extractOption(e,t,"tx","text");return s.isValidTextValue(i)?n(i):void 0},s.isValidTextValue=function(e){return e||0===e},s.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},s.ensureUniformFontSize=function(e,t){var r=s.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":176,"./identity":177,"./is_plain_object":179,"./keyed_container":180,"./localize":181,"./loggers":182,"./make_trace_groups":183,"./matrix":184,"./mod":185,"./nested_property":186,"./noop":187,"./notifier":188,"./push_unique":191,"./regex":193,"./relative_attr":194,"./relink_private":195,"./search":196,"./stats":198,"./throttle":200,"./to_log_range":201,d3:16,"fast-isnumeric":18}],179:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],180:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":210,"./notifier":188}],183:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:16}],184:[function(e,t,r){"use strict";r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],186:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":158,"./matrix":184}],191:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function c(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,u,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(u=h>=0?r?o:l:r?c:s,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e){var t=e.slice();t.sort(r.sorterAsc);for(var n=t.length-1,a=t[n]-t[0]||1,i=a/(n||1)/1e4,o=[t[0]],l=0;lt[l]+i&&(a=Math.min(a,t[l+1]-t[l]),o.push(t[l+1]));return{vals:o,minDiff:a}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":165,"fast-isnumeric":18}],199:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=e("../constants/xmlns_namespaces"),o=e("../constants/alignment").LINE_SPACING;function l(e,t){return e.node().getBoundingClientRect()[t]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,M){var A=e.text(),S=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),C=n.select(e.node().parentNode);if(!C.empty()){var O=e.attr("class")?e.attr("class").split(" ")[0]:"text";return O+="-math",C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove(),e.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),S?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),i={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return z(),void t();var s=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=e.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+e.attr("x")-f*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],h=-(r||l(e,"height"))/4;"y"===O[0]?(s.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===O[0]?o.attr({x:e.attr("x"),y:h-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+e.attr("y")+h-d/2}),M&&M.call(e,s),t(s)}))}))):z(),e}function z(){C.empty()||(O=e.attr("class")+"-math",C.select("svg."+O).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(i.svg,"tspan");n.select(t).attr({class:"line",dy:c*o+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var l=1;l doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}y.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(v),O=0;O|>|>)/g;var f={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&L(n)}var k=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(e){return e.replace(A,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):M[t])||e}))}function S(e,t,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=e.node().getBoundingClientRect(),c=t.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(e){e=e.replace(g," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(v),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],201:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":18}],202:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],203:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],204:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),z=[],P=-1,D=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?z.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(z[x],1),O&&O.splice(z[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===P)E=L;else{for(D=Math.max(C.length,D),E=[],x=0;x=P);x++)E.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),D(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&D(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))throw new Error("update must be a key:value object");if("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");for(var i in D(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function q(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(U(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,q,[e,a.undoit],q,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function U(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,X=/^[xyz]axis[0-9]*\.autorange$/,Y=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=B(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(V(t),p=Object.keys(t),n=0;n0&&"string"!=typeof D.parts[I];)I--;var R=D.parts[I],F=D.parts[I-1]+"."+R,H=D.parts.slice(0,I).join("."),j=l(e.layout,H).get(),q=l(s,H).get(),U=D.get();if(void 0!==E){k[P]=E,L[P]="reverse"===R?E:N(U);var G=f.getLayoutValObject(s,D.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(E){S("autosize",null);var $="height"===P?"width":"height";S($,s[$])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))z(F),l(s,H+"._inputRange").set(null);else if(F.match(X)){z(F),l(s,H+"._inputRange").set(null);var J=l(s,H).get();J._inputDomain&&(J._input.domain=J._inputDomain.slice())}else F.match(Y)&&l(s,H+"._inputDomain").set(null);if("type"===R){var K=j,ee="linear"===q.type&&"log"===E,te="log"===q.type&&"linear"===E;if(ee||te){if(K&&K.range)if(q.autorange)ee&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var re=K.range[0],ne=K.range[1];ee?(re<=0&&ne<=0&&S(H+".autorange",!0),re<=0?re=ne/1e6:ne<=0&&(ne=re/1e6),S(H+".range[0]",Math.log(re)/Math.LN10),S(H+".range[1]",Math.log(ne)/Math.LN10)):(S(H+".range[0]",Math.pow(10,re)),S(H+".range[1]",Math.pow(10,ne)))}else S(H+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[D.parts[0]]&&"radialaxis"===D.parts[1]&&delete s[D.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,q,E,S),u.getComponentMethod("images","convertCoords")(e,q,E,S)}else S(H+".autorange",!0),S(H+".range",null);l(s,H+"._inputRange").set(null)}else if(R.match(A)){var ae=l(s,P).get(),ie=(E||{}).type;ie&&"-"!==ie||(ie="linear"),u.getComponentMethod("annotations","convertCoords")(e,ae,ie,S),u.getComponentMethod("images","convertCoords")(e,ae,ie,S)}var oe=w.containerArrayMatch(P);if(oe){r=oe.array,n=oe.index;var le=oe.property,se=G||{editType:"calc"};""!==n&&""===le&&(w.isAddVal(E)?L[P]=null:w.isRemoveVal(E)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,se),m[r]||(m[r]={});var ce=m[r][n];ce||(ce=m[r][n]={}),ce[le]=E,delete t[P]}else"reverse"===R?(j.range?j.range.reverse():(S(H+".autorange",!0),j.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===E||"select"===E)&&"lasso"!==U&&"select"!==U||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,D.set(E))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}var ue=s._axisConstraintGroups||[];for(C in O)for(n=0;n1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[v]).name+'" with a frame whose name of type "number" also equates to "'+v+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===L&&o.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":178,"../plots/attributes":219}],213:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,z=l.plotgroup;if(y(C,O,L)){var P=z.node(),D=l.bg=o.ensureSingle(z,"rect","bg");P.insertBefore(D.node(),P.childNodes[0]),A.push(a)}else z.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,I,R,F,N,B,H,j,V,q,U,G,Z,X=v._bgLayer.selectAll(".bg").data(M);for(X.enter().append("rect").classed("bg",!0),X.exit().remove(),X.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":178,"../plots/attributes":219,"../plots/plots":256,"./plot_config":210,"./plot_schema":211,"./plot_template":212}],215:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":178,"../plots/plots":256,"../snapshot/helpers":273,"../snapshot/svgtoimg":275,"../snapshot/tosvg":277,"../version":435,"./plot_api":209,"fast-isnumeric":18}],216:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,z=Array.isArray(k);if(z&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(z?Math.min(P,k[A].length):P);M++)L=z?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=M-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/M>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/M));if(d===p){var C=d-1,O=d+1;if(T)if(0===d)i=[0,1];else{var z=(d>0?f:u).reduce((function(e,t){return Math.max(e,o(t))}),0),P=d/(1-Math.min(.5,z/M));i=d>0?[0,P]:[P,0]}else i=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(M-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function s(e){var t=e._length/20;return"domain"===e.constrain&&e._inputDomain&&(t*=(e._inputDomain[1]-e._inputDomain[0])/(e.domain[1]-e.domain[0])),function(e){return e.pad+(e.extrapad?t:0)}}function c(e,t){var r,n,a,i=t._id,o=e._fullData,l=e._fullLayout,s=[],c=[];function d(e,t){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function p(e){return n(e)&&Math.abs(e)=t}t.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(e,t){if(t.setScale(),t.autorange){t.range=l(e,t),t._r=t.range.slice(),t._rl=a.simpleMap(t._r,t.r2l);var r=t._input,n={};n[t._attr+".range"]=t.range,n[t._attr+".autorange"]=t.autorange,o.call("_storeDirectGUIEdit",e.layout,e._fullLayout._preGUI,n),r.range=t.range.slice(),r.autorange=t.autorange}var i=t._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[t._name];s&&"auto"===s.rangemode&&(s.range=l(e,t)),i._input.rangeslider[t._name]=a.extendFlat({},s)}},findExtremes:function(e,t,r){r||(r={});e._m||e.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=t.length,b=r.padded||!1,_=r.tozero&&("linear"===e.type||"-"===e.type),w="log"===e.type,T=!1,k=r.vpadLinearized||!1;function M(e){if(Array.isArray(e))return T=!0,function(t){return Math.max(Number(e[t]||0),0)};var t=Math.max(Number(e||0),0);return function(){return t}}var A=M((e._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=P;a--)z(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":158,"../../lib":178,"../../registry":269,"fast-isnumeric":18}],222:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../components/titles"),u=e("../../components/color"),f=e("../../components/drawing"),d=e("./layout_attributes"),p=e("./clean_ticks"),h=e("../../constants/numerical"),g=h.ONEAVGYEAR,v=h.ONEAVGMONTH,m=h.ONEDAY,y=h.ONEHOUR,x=h.ONEMIN,b=h.ONESEC,_=h.MINUS_SIGN,w=h.BADNUM,T=e("../../constants/alignment"),k=T.MID_SHIFT,M=T.CAP_SHIFT,A=T.LINE_SPACING,L=T.OPPOSITE_SIDE,S=t.exports={};S.setConvert=e("./set_convert");var C=e("./axis_autotype"),O=e("./axis_ids");S.id2name=O.id2name,S.name2id=O.name2id,S.cleanId=O.cleanId,S.list=O.list,S.listIds=O.listIds,S.getFromId=O.getFromId,S.getFromTrace=O.getFromTrace;var z=e("./autorange");S.getAutoRange=z.getAutoRange,S.findExtremes=z.findExtremes,S.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(e,t,u,c)},S.coercePosition=function(e,t,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=S.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},S.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:S.getFromId(t,r).cleanPos)(e)},S.redrawComponents=function(e,t){t=t||S.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},S.saveRangeInitial=function(e,t){for(var r=S.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=S.tickIncrement(e,"M6","reverse")+1.5*m:i.exactMonths>.8?e=S.tickIncrement(e,"M1","reverse")+15.5*m:e-=m/2;var s=S.tickIncrement(e,r);if(s<=n)return s}return e}(x,e,y,c,i)),v=x,0;v<=u;)v=S.tickIncrement(v,y,!1,i);return{start:t.c2r(x,0,i),end:t.c2r(v,0,i),size:y,_dataSpan:u-c}},S.prepTicks=function(e){var t=l.simpleMap(e.range,e.r2l);if("auto"===e.tickmode||!e.dtick){var r,n=e.nticks;n||("category"===e.type||"multicategory"===e.type?(r=e.tickfont?1.2*(e.tickfont.size||12):15,n=e._length/r):(r="y"===e._id.charAt(0)?40:80,n=l.constrain(e._length/r,4,9)+1),"radialaxis"===e._name&&(n*=2)),"array"===e.tickmode&&(n*=100),e._roughDTick=(Math.abs(t[1]-t[0])-(e._lBreaks||0))/n,S.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}e.tick0||(e.tick0="date"===e.type?"2000-01-01":0),"date"===e.type&&e.dtick<.1&&(e.dtick=.1),q(e)},S.calcTicks=function(e){S.prepTicks(e);var t=l.simpleMap(e.range,e.r2l);if("array"===e.tickmode)return function(e){var t=e.tickvals,r=e.ticktext,n=new Array(t.length),a=l.simpleMap(e.range,e.r2l),i=1.0001*a[0]-1e-4*a[1],o=1.0001*a[1]-1e-4*a[0],s=Math.min(i,o),c=Math.max(i,o),u=0;Array.isArray(r)||(r=[]);var f="category"===e.type?e.d2l_noadd:e.d2l;"log"===e.type&&"L"!==String(e.dtick).charAt(0)&&(e.dtick="L"+Math.pow(10,Math.floor(Math.min(e.range[0],e.range[1]))-1));for(var d=0;ds&&p=n:a<=n)&&!(o.length>r||a===t);a=S.tickIncrement(a,e.dtick,i,e.calendar)){t=a;var l=!1;s&&a!==(0|a)&&(l=!0),o.push({minor:l,value:a})}}(),e.rangebreaks){if("auto"===e.tickmode)for(var c=0;c=d.min&&u2){for(var h,g=2*(e.tickfont?e.tickfont.size:12),v=[],m=i?1:-1,y=i?p-1:0,x=i?0:p-1;m*x<=m*y;x+=m){var b=e.c2p(o[x].value);(void 0===h||Math.abs(b-h)>g)&&(h=b,v.push(o[x]))}o=v.reverse()}}oe(e)&&360===Math.abs(t[1]-t[0])&&o.pop(),e._tmax=(o[o.length-1]||{}).value,e._prevDateHead="",e._inCalcTicks=!0;for(var _=new Array(o.length),T=0;T10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=m&&i<=10||t>=15*m)e._tickround="d";else if(t>=x&&i<=16||t>=y)e._tickround="M";else if(t>=b&&i<=19||t>=x)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(Z(e.exponentformat)&&!X(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function U(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}S.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar);var i=2*t;i>g?(t/=g,r=n(10),e.dtick="M"+12*V(t,r,I)):i>v?(t/=v,e.dtick="M"+V(t,1,R)):i>m?(e.dtick=V(t,m,e._hasDayOfWeekBreaks?[1,7,14]:N),e.tick0=l.dateTick0(e.calendar,!0)):i>y?e.dtick=V(t,y,R):i>x?e.dtick=V(t,x,F):i>b?e.dtick=V(t,b,F):(r=n(10),e.dtick=V(t,r,I))}else if("log"===e.type){e.tick0=0;var o=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(o[1]-o[0])<1){var s=1.5*Math.abs((o[1]-o[0])/t);t=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/s,r=n(10),e.dtick="L"+V(t,r,I)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):oe(e)?(e.tick0=0,r=1,e.dtick=V(t,r,j)):(e.tick0=0,r=n(10),e.dtick=V(t,r,I));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var c=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(c)}},S.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return e+o*t;var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?H:B,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},S.tickFirst=function(e){var t=e.r2l||Number,r=l.simpleMap(e.range,t),i=r[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=Y(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||Z(p)&&X(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":_)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":_)+d:(t.text=Y(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):oe(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=Y(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=Y(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=_+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=Y(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},S.hoverLabelText=function(e,t,r){if(r!==w&&r!==t)return S.hoverLabelText(e,t)+" - "+S.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=S.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":_+a:a};var G=["f","p","n","\u03bc","m","","k","M","G","T"];function Z(e){return"SI"===e||"B"===e}function X(e){return e>14||e<-15}function Y(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=S.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};q(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,_);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":Z(s)&&(e+=G[c/3+5]));return i?_+e:e}function W(e,t){for(var r=[],n={},a=0;a1&&r=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-u:0,f)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=t._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==d._dfltTitle[h]&&(n[s]+=$(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[c]+=f),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}Y&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,ee(t),n),i.autoMargin(e,te(t),a),i.autoMargin(e,re(t),l)})),r.skipTitle||Y&&"bottom"===t.side||Z.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+$(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,u,d,p=S.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,u="top"===t.side?p-r:p+r):(u=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(d={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(Z)}}function J(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=K(this),t=f.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},S.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},S.makeTransFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.x))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.x))+")"}},S.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},S.makeLabelFns=function(e,t,r){var n=e._id.charAt(0),i="boundaries"!==e.tickson&&"outside"===e.ticks,o=0,s=0;if(i&&(o+=e.ticklen),r&&"outside"===e.ticks){var c=l.deg2rad(r);o=e.ticklen*Math.cos(c)+1,s=e.ticklen*Math.sin(c)}e.showticklabels&&(i||e.showline)&&(o+=.2*e.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(e.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===e.side?1:-1,u=s*p,f=t+o*p,d="bottom"===e.side?1:-.2,h.xFn=function(e){return e.dx+u},h.yFn=function(e){return e.dy+f+e.fontSize*d},h.anchorFn=function(e,t){return a(t)&&0!==t&&180!==t?t*p<0?"end":"start":"middle"},h.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side?-n:0}):"y"===n&&(p="right"===e.side?1:-1,u=o,f=-s*p,d=90===Math.abs(e.tickangle)?.5:0,h.xFn=function(e){return e.dx+t+(u+e.fontSize*d)*p},h.yFn=function(e){return e.dy+f+e.fontSize*k},h.anchorFn=function(t,r){return a(r)&&90===Math.abs(r)?"middle":"right"===e.side?"start":"end"},h.heightFn=function(t,r,n){return(r*="left"===e.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},S.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.layer.selectAll("path."+n).data(t.ticks?r.vals:[],Q);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,t.tickcolor).style("stroke-width",f.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},S.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&S.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;l1)for(n=1;n2*o}(e,t)?"date":function(e){for(var t=Math.max(1,(e.length-1)/1e3),r=0,n=0,o={},l=0;l2*r}(e)?"category":function(e){if(!e)return!1;for(var t=0;t=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.getAxisGroup=function(e,t){for(var r=e._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;ns*x)||T)for(r=0;rD&&Rz&&(z=R);p/=(z-O)/(2*P),O=c.l2r(O),z=c.l2r(z),c.range=c._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function F(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function N(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+t+", "+r+")").attr("d","M0,0Z")}function B(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),H(e,t,a,i)}function H(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function j(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(e){O&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),O=!1)}function q(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,C)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function U(e,t,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(j(a),2!==e||he||je(),pe)i.indexOf("select")>-1&&M(r,a,W,Q,t.id,Se),i.indexOf("event")>-1&&f.click(a,r,t.id);else if(1===e&&he){var l=g?H:z,c="s"===g||"w"===O?0:1,u=l._name+".range["+c+"]",d=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===O&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(me).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function ze(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,t+ye)),a=Math.max(0,Math.min(ee,r+xe)),i=Math.abs(n-ye),o=Math.abs(a-xe);function l(){ke="",be.r=be.l,be.t=be.b,Ae.attr("d","M0,0Z")}if(be.l=Math.min(ye,n),be.r=Math.max(ye,n),be.t=Math.min(xe,a),be.b=Math.max(xe,a),te.isSubplotConstrained)i>C||o>C?(ke="xy",i/K>o/ee?(o=i*ee/K,xe>a?be.t=xe-o:be.b=xe+o):(i=o*K/ee,ye>n?be.l=ye-i:be.r=ye+i),Ae.attr("d",q(be))):l();else if(re.isSubplotConstrained)if(i>C||o>C){ke="xy";var s=Math.min(be.l/K,(ee-be.b)/ee),c=Math.max(be.r/K,(ee-be.t)/ee);be.l=s*K,be.r=c*K,be.b=(1-s)*ee,be.t=(1-c)*ee,Ae.attr("d",q(be))}else l();else!ae||og[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":178,"fast-isnumeric":18}],240:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)]}},{"../../constants/alignment":154}],241:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,z=C.axValue,P=C.getTransform;function D(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=H(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function B(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function j(e,t,r){var n,i,o,l;for(n=0;n=0)X._fullLayout._deactivateShape(X);else if(!H){var r=Y.clickmode;b.done(de).then((function(){if(b.clear(de),2===e){for(se.remove(),w=0;w-1&&D(t,X,a.xaxes,a.yaxes,a.subplot,a,se),"event"===r&&X.emit("plotly_selected",void 0);l.click(X,t)})).catch(y.error)}},a.doneFn=function(){fe.remove(),b.done(de).then((function(){b.clear(de),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=le,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pe)})).catch(y.error),H&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:D}},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":178,"../../lib/clear_gl_canvases":167,"../../lib/polygon":190,"../../lib/throttle":200,"../../plot_api/subroutines":213,"../../registry":269,"./axis_ids":225,"./constants":228,"./handle_outline":232,"./helpers":233,polybooljs:26}],242:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../lib"),o=i.cleanNumber,l=i.ms2DateTime,s=i.dateTime2ms,c=i.ensureNumber,u=i.isArrayOrTypedArray,f=e("../../constants/numerical"),d=f.FP_SAFE,p=f.BADNUM,h=f.LOG_CLIP,g=f.ONEDAY,v=f.ONEHOUR,m=f.ONEMIN,y=f.ONESEC,x=e("./axis_ids"),b=e("./constants"),_=b.HOUR_PATTERN,w=b.WEEKDAY_PATTERN;function T(e){return Math.pow(10,e)}function k(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",f=r.charAt(0);function M(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*h*Math.abs(n-a))}return p}function A(t,r,n){var o=s(t,n||e.calendar);if(o===p){if(!a(t))return p;t=+t;var l=Math.floor(10*i.mod(t+.05,1)),c=Math.round(t-l/10);o=s(new Date(c))+l/10}return o}function L(t,r,n){return l(t,r,n||e.calendar)}function S(t){return e._categories[Math.round(t)]}function C(t){if(k(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return p}function O(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=O(e);return void 0!==t?t:a(e)?+e:void 0}function P(e,t,r){return n.round(r+t*e,2)}function D(e,t,r){return(e-r)/t}var E=function(t){return a(t)?P(t,e._m,e._b):p},I=function(t){return D(t,e._m,e._b)};if(e.rangebreaks){var R="y"===f;E=function(t){if(!a(t))return p;var r=e._rangebreaks.length;if(!r)return P(t,e._m,e._b);var n=R;e.range[0]>e.range[1]&&(n=!n);for(var i=n?-1:1,o=i*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?P(t,e._m2,f):0},I=function(t){var r=e._rangebreaks.length;if(!r)return D(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return D(t,e._m2,e._B[n])}}e.c2l="log"===e.type?M:c,e.l2c="log"===e.type?T:c,e.l2p=E,e.p2l=I,e.c2p="log"===e.type?function(e,t){return E(M(e,t))}:E,e.p2c="log"===e.type?function(e){return T(I(e))}:I,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=o,e.c2d=e.c2r=e.l2d=e.l2r=c,e.d2p=e.r2p=function(t){return e.l2p(o(t))},e.p2d=e.p2r=I,e.cleanPos=c):"log"===e.type?(e.d2r=e.d2l=function(e,t){return M(o(e),t)},e.r2d=e.r2c=function(e){return T(o(e))},e.d2c=e.r2l=o,e.c2d=e.l2r=c,e.c2r=M,e.l2d=T,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return T(I(e))},e.r2p=function(t){return e.l2p(o(t))},e.p2r=I,e.cleanPos=c):"date"===e.type?(e.d2r=e.r2d=i.identity,e.d2c=e.r2c=e.d2l=e.r2l=A,e.c2d=e.c2r=e.l2d=e.l2r=L,e.d2p=e.r2p=function(t,r,n){return e.l2p(A(t,0,n))},e.p2d=e.p2r=function(e,t,r){return L(I(e),t,r)},e.cleanPos=function(t){return i.cleanDate(t,p,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=C,e.r2d=e.c2d=e.l2d=S,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=c,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return S(I(e))},e.r2p=e.d2p,e.p2r=I,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:c(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=S,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=O,e.l2r=e.c2r=c,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return S(I(e))},e.r2p=e.d2p,e.p2r=I,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:c(e)},e.setupMultiCategory=function(n){var a,o,l=e._traceIndices,s=t._axisMatchGroups;if(s&&s.length&&0===e._categories.length)for(a=0;ad&&(l[n]=d),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else i.nestedProperty(e,t).set(o)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=x.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),d="y"===f;if((d?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(d?u:c)),l=0;la&&(a+=7,la&&(a+=24,l=n&&l=n&&tl.max||nl.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":74,"../../lib":178,"../../registry":269,"./axes":222,d3:16}],247:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){y.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&u.text()?" - ":"")}},y.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=y.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var _=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],w=["year","month","dayMonth","dayMonthYear"];function T(e,t){var r=e._context.locale,n=!1,a={};function o(e){for(var r=!0,i=0;i1&&D.length>1){for(i.getComponentMethod("grid","sizeDefaults")(c,l),o=0;o15&&D.length>15&&0===l.shapes.length&&0===l.images.length,l._hasCartesian=l._has("cartesian"),l._hasGeo=l._has("geo"),l._hasGL3D=l._has("gl3d"),l._hasGL2D=l._has("gl2d"),l._hasTernary=l._has("ternary"),l._hasPie=l._has("pie"),y.linkSubplots(f,l,u,a),y.cleanPlot(f,l,u,a),a._zoomlayer&&!e._dragging&&d({_fullLayout:a}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),i=Math.round(f*i)}}var d=y.layoutAttributes.width.min,p=y.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-i)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=i)),e._initialAutoSize||(e._initialAutoSize={width:n,height:i}),y.sanitizeMargins(r)},y.supplyLayoutModuleDefaults=function(e,t,r,n){var a,o,l,c=i.componentsRegistry,u=t._basePlotModules,f=i.subplotsRegistry.cartesian;for(a in c)(l=c[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(i.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(s.subplotSort);for(o=0;o.5*n.width&&(s.log("Margin push",t,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(s.log("Margin push",t,"is too big in y, dropping"),r.b=r.t=0);var c=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[t]={l:{val:c,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[t]=1}else delete a[t],delete i[t];if(!n._replotting)return y.doAutoMargin(e)}},y.doAutoMargin=function(e){var t=e._fullLayout;t._size||(t._size={}),L(t);var r=t._size,n=t.margin,o=s.extendFlat({},r),l=n.l,c=n.r,u=n.t,f=n.b,d=t.width,p=t.height,h=t._pushmargin,g=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:c},t:{val:1,size:u},b:{val:0,size:f}},h){var x=h[m].l||{},b=h[m].b||{},_=x.val,w=x.size,T=b.val,k=b.size;for(var M in h){if(a(w)&&h[M].r){var A=h[M].r.val,S=h[M].r.size;if(A>_){var C=(w*A+(S-d)*_)/(A-_),O=(S*(1-_)+(w-d)*(1-A))/(A-_);C>=0&&O>=0&&d-(C+O)>0&&C+O>l+c&&(l=C,c=O)}}if(a(k)&&h[M].t){var z=h[M].t.val,P=h[M].t.size;if(z>T){var D=(k*z+(P-p)*T)/(z-T),E=(P*(1-T)+(k-p)*(1-z))/(z-T);D>=0&&E>=0&&p-(E+D)>0&&D+E>f+u&&(f=D,u=E)}}}}}if(r.l=Math.round(l),r.r=Math.round(c),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!t._replotting&&y.didMarginChange(o,r)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var I=3*(1+Object.keys(g).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return i.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var o=0,l=0;function s(){return o++,function(){l++,n||l!==o||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return i.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],o=s.syncOrAsync(a,e);return o&&o.then||(o=Promise.resolve()),o.then((function(){return e}))}y.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},y.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&y.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,c=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(s.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!s.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):s.isTypedArray(e)?s.simpleMap(e,s.identity):s.isJSDate(e)?s.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};return t||(f.layout=u(l)),e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),c&&(f.frames=u(c)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},y.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;l--)if(o[l].enabled){r._indexToPoints=o[l]._indexToPoints;break}n&&n.calc&&(i=n.calc(e,r))}Array.isArray(i)&&i[0]||(i=[{x:u,y:u}]),i[0].t||(i[0].t={}),i[0].trace=r,h[t]=i}}for(z(c,d,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var z=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(z=Math.max(Math.round(z),1)),C[2]||(C[2]=z);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var D=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(E)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var B=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:I,elements:B,reverseOrder:d.legend.reverseOrder})})();var H=I.node().getBBox();x=Math.min(d.width-H.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(H?H.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),e.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var V=e.select("g.title-group text").style(N).text(d.title.text),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var U=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=U.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}U.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function X(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);U.call(Y).attr({transform:"rotate("+d.radialAxis.orientation+")"}),U.selectAll(".domain").style(F),U.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),U.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+X(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var $=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=X(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&$.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var J=n.max(R.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));I.attr({transform:"translate("+[x+J,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data((function(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){var e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":154,"../../../lib":178,d3:16}],261:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":52,"../../../lib":178,"./micropolar":260,"./undo_manager":262,d3:16}],262:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a=u&&(p.min=0,g.min=0,v.min=0,e.aaxis&&delete e.aaxis.min,e.baxis&&delete e.baxis.min,e.caxis&&delete e.caxis.min)}function h(e,t,r,n){var a=f[t._name];function o(r,n){return i.coerce(e,t,a,r,n)}o("uirevision",n.uirevision),t.type="linear";var d=o("color"),p=d!==a.color.dflt?d:r.font.color,h=t._name.charAt(0).toUpperCase(),g="Component "+h,v=o("title.text",g);t._hovertitle=v===g?v:h,i.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(e,t,o,"linear"),l(e,t,o,"linear",{}),s(e,t,o,{outerTicks:!0}),o("showticklabels")&&(i.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(e,t,o,{dfltColor:d,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:a}),o("hoverformat"),o("layer")}t.exports=function(e,t,r){o(e,t,r,{type:"ternary",attributes:f,handleDefaults:p,font:t.font,paper_bgcolor:t.paper_bgcolor})}},{"../../components/color":52,"../../lib":178,"../../plot_api/plot_template":212,"../cartesian/line_grid_defaults":238,"../cartesian/tick_label_defaults":243,"../cartesian/tick_mark_defaults":244,"../cartesian/tick_value_defaults":245,"../subplot_defaults":263,"./layout_attributes":266}],268:[function(e,t,r){"use strict";var n=e("d3"),a=e("tinycolor2"),i=e("../../registry"),o=e("../../lib"),l=o._,s=e("../../components/color"),c=e("../../components/drawing"),u=e("../cartesian/set_convert"),f=e("../../lib/extend").extendFlat,d=e("../plots"),p=e("../cartesian/axes"),h=e("../../components/dragelement"),g=e("../../components/fx"),v=e("../../components/dragelement/helpers"),m=v.freeMode,y=v.rectMode,x=e("../../components/titles"),b=e("../cartesian/select").prepSelect,_=e("../cartesian/select").selectOnClick,w=e("../cartesian/select").clearSelect,T=e("../cartesian/select").clearSelectionsCache,k=e("../cartesian/constants");function M(e,t){this.id=e.id,this.graphDiv=e.graphDiv,this.init(t),this.makeFramework(t),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}t.exports=M;var A=M.prototype;A.init=function(e){this.container=e._ternarylayer,this.defs=e._defs,this.layoutId=e._uid,this.traceHash={},this.layers={}},A.plot=function(e,t){var r=t[this.id],n=t._size;this._hasClipOnAxisFalse=!1;for(var a=0;aL*x?a=(i=x)*L:i=(a=y)/L,o=v*a/y,l=m*i/x,r=t.l+t.w*h-a/2,n=t.t+t.h*(1-g)-i/2,d.x0=r,d.y0=n,d.w=a,d.h=i,d.sum=b,d.xaxis={type:"linear",range:[_+2*T-b,b-_-2*w],domain:[h-o/2,h+o/2],_id:"x"},u(d.xaxis,d.graphDiv._fullLayout),d.xaxis.setScale(),d.xaxis.isPtWithinRange=function(e){return e.a>=d.aaxis.range[0]&&e.a<=d.aaxis.range[1]&&e.b>=d.baxis.range[1]&&e.b<=d.baxis.range[0]&&e.c>=d.caxis.range[1]&&e.c<=d.caxis.range[0]},d.yaxis={type:"linear",range:[_,b-w-T],domain:[g-l/2,g+l/2],_id:"y"},u(d.yaxis,d.graphDiv._fullLayout),d.yaxis.setScale(),d.yaxis.isPtWithinRange=function(){return!0};var k=d.yaxis.domain[0],M=d.aaxis=f({},e.aaxis,{range:[_,b-w-T],side:"left",tickangle:(+e.aaxis.tickangle||0)-30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(M,d.graphDiv._fullLayout),M.setScale();var A=d.baxis=f({},e.baxis,{range:[b-_-T,w],side:"bottom",domain:d.xaxis.domain,anchor:"free",position:0,_id:"x",_length:a});u(A,d.graphDiv._fullLayout),A.setScale();var S=d.caxis=f({},e.caxis,{range:[b-_-w,T],side:"right",tickangle:(+e.caxis.tickangle||0)+30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(S,d.graphDiv._fullLayout),S.setScale();var C="M"+r+","+(n+i)+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDef.select("path").attr("d",C),d.layers.plotbg.select("path").attr("d",C);var O="M0,"+i+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDefRelative.select("path").attr("d",O);var z="translate("+r+","+n+")";d.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",z),d.clipDefRelative.select("path").attr("transform",null);var P="translate("+(r-A._offset)+","+(n+i)+")";d.layers.baxis.attr("transform",P),d.layers.bgrid.attr("transform",P);var D="translate("+(r+a/2)+","+n+")rotate(30)translate(0,"+-M._offset+")";d.layers.aaxis.attr("transform",D),d.layers.agrid.attr("transform",D);var E="translate("+(r+a/2)+","+n+")rotate(-30)translate(0,"+-S._offset+")";d.layers.caxis.attr("transform",E),d.layers.cgrid.attr("transform",E),d.drawAxes(!0),d.layers.aline.select("path").attr("d",M.showline?"M"+r+","+(n+i)+"l"+a/2+",-"+i:"M0,0").call(s.stroke,M.linecolor||"var(--ow-color-black)").style("stroke-width",(M.linewidth||0)+"px"),d.layers.bline.select("path").attr("d",A.showline?"M"+r+","+(n+i)+"h"+a:"M0,0").call(s.stroke,A.linecolor||"var(--ow-color-black)").style("stroke-width",(A.linewidth||0)+"px"),d.layers.cline.select("path").attr("d",S.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+i:"M0,0").call(s.stroke,S.linecolor||"var(--ow-color-black)").style("stroke-width",(S.linewidth||0)+"px"),d.graphDiv._context.staticPlot||d.initInteractions(),c.setClipUrl(d.layers.frontplot,d._hasClipOnAxisFalse?null:d.clipId,d.graphDiv)},A.drawAxes=function(e){var t=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,a=this.aaxis,i=this.baxis,o=this.caxis;if(this.drawAx(a),this.drawAx(i),this.drawAx(o),e){var s=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;n["a-title"]=x.draw(t,"a"+r,{propContainer:a,propName:this.id+".aaxis.title",placeholder:l(t,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-a.title.font.size/3-s,"text-anchor":"middle"}}),n["b-title"]=x.draw(t,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:l(t,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*i.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=x.draw(t,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:l(t,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},A.drawAx=function(e){var t,r=this.graphDiv,n=e._name,a=n.charAt(0),i=e._id,l=this.layers[n],s=a+"tickLayout",c=(t=e).ticks+String(t.ticklen)+String(t.showticklabels);this[s]!==c&&(l.selectAll("."+i+"tick").remove(),this[s]=c),e.setScale();var u=p.calcTicks(e),f=p.clipEnds(e,u),d=p.makeTransFn(e),h=p.getTickSigns(e)[2],g=o.deg2rad(30),v=h*(e.linewidth||1)/2,m=h*e.ticklen,y=this.w,x=this.h,b="b"===a?"M0,"+v+"l"+Math.sin(g)*m+","+Math.cos(g)*m:"M"+v+",0l"+Math.cos(g)*m+","+-Math.sin(g)*m,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[a];p.drawTicks(r,e,{vals:"inside"===e.ticks?f:u,layer:l,path:b,transFn:d,crisp:!1}),p.drawGrid(r,e,{vals:f,layer:this.layers[a+"grid"],path:_,transFn:d,crisp:!1}),p.drawLabels(r,e,{vals:u,layer:l,transFn:d,labelFns:p.makeLabelFns(e,0,30)})};var S=k.MINZOOM/2+.87,C="m-0.87,.5h"+S+"v3h-"+(S+5.2)+"l"+(S/2+2.6)+",-"+(.87*S+4.5)+"l2.6,1.5l-"+S/2+","+.87*S+"Z",O="m0.87,.5h-"+S+"v3h"+(S+5.2)+"l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-2.6,1.5l"+S/2+","+.87*S+"Z",z="m0,1l"+S/2+","+.87*S+"l2.6,-1.5l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-"+(S/2+2.6)+","+(.87*S+4.5)+"l2.6,1.5l"+S/2+",-"+.87*S+"Z",P=!0;function D(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}A.clearSelect=function(){T(this.dragOptions),w(this.dragOptions.gd)},A.initInteractions=function(){var e,t,r,n,u,f,d,p,v,x,w=this,T=w.layers.plotbg.select("path").node(),M=w.graphDiv,A=M._fullLayout._zoomlayer;function S(e){var t={};return t[w.id+".aaxis.min"]=e.a,t[w.id+".baxis.min"]=e.b,t[w.id+".caxis.min"]=e.c,t}function E(e,t){var r=M._fullLayout.clickmode;D(M),2===e&&(M.emit("plotly_doubleclick",null),i.call("_guiRelayout",M,S({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===e&&_(t,M,[w.xaxis],[w.yaxis],w.id,w.dragOptions),r.indexOf("event")>-1&&g.click(M,t,w.id)}function I(e,t){return 1-t/w.h}function R(e,t){return 1-(e+(w.h-t)/Math.sqrt(3))/w.w}function F(e,t){return(e-(w.h-t)/Math.sqrt(3))/w.w}function N(a,i){var o=e+a,l=t+i,s=Math.max(0,Math.min(1,I(0,t),I(0,l))),c=Math.max(0,Math.min(1,R(e,t),R(o,l))),h=Math.max(0,Math.min(1,F(e,t),F(o,l))),g=(s/2+h)*w.w,m=(1-s/2-c)*w.w,y=(g+m)/2,b=m-g,_=(1-s)*w.h,T=_-b/L;b.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),x.transition().style("opacity",1).duration(200),p=!0),M.emit("plotly_relayouting",S(u))}function B(){D(M),u!==r&&(i.call("_guiRelayout",M,S(u)),P&&M.data&&M._context.showTips&&(o.notifier(l(M,"Double-click to zoom back out"),"long"),P=!1))}function H(e,t){var n=e/w.xaxis._m,a=t/w.yaxis._m,i=[(u={a:r.a-a,b:r.b+(n+a)/2,c:r.c-(n-a)/2}).a,u.b,u.c].sort(),o=i.indexOf(u.a),l=i.indexOf(u.b),s=i.indexOf(u.c);i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),u={a:i[o],b:i[l],c:i[s]},t=(r.a-u.a)*w.yaxis._m,e=(r.c-u.c-r.b+u.b)*w.xaxis._m);var f="translate("+(w.x0+e)+","+(w.y0+t)+")";w.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",f);var d="translate("+-e+","+-t+")";w.clipDefRelative.select("path").attr("transform",d),w.aaxis.range=[u.a,w.sum-u.b-u.c],w.baxis.range=[w.sum-u.a-u.c,u.b],w.caxis.range=[w.sum-u.a-u.b,u.c],w.drawAxes(!1),w._hasClipOnAxisFalse&&w.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints,w),M.emit("plotly_relayouting",S(u))}function j(){i.call("_guiRelayout",M,S(u))}this.dragOptions={element:T,gd:M,plotinfo:{id:w.id,domain:M._fullLayout[w.id].domain,xaxis:w.xaxis,yaxis:w.yaxis},subplot:w.id,prepFn:function(i,o,l){w.dragOptions.xaxes=[w.xaxis],w.dragOptions.yaxes=[w.yaxis];var c=w.dragOptions.dragmode=M._fullLayout.dragmode;m(c)?w.dragOptions.minDrag=1:w.dragOptions.minDrag=void 0,"zoom"===c?(w.dragOptions.moveFn=N,w.dragOptions.clickFn=E,w.dragOptions.doneFn=B,function(i,o,l){var c=T.getBoundingClientRect();e=o-c.left,t=l-c.top,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,n=w.aaxis.range[1]-r.a,f=a(w.graphDiv._fullLayout[w.id].bgcolor).getLuminance(),d="M0,"+w.h+"L"+w.w/2+", 0L"+w.w+","+w.h+"Z",p=!1,v=A.append("path").attr("class","zoombox").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:f>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",d),x=A.append("path").attr("class","zoombox-corners").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:s.background,stroke:s.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),w.clearSelect(M)}(0,o,l)):"pan"===c?(w.dragOptions.moveFn=H,w.dragOptions.clickFn=E,w.dragOptions.doneFn=j,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,w.clearSelect(M)):(y(c)||m(c))&&b(i,o,l,w.dragOptions,c)}},T.onmousemove=function(e){g.hover(M,e,w.id),M._fullLayout._lasthover=T,M._fullLayout._hoversubplot=w.id},T.onmouseout=function(e){M._dragging||h.unhover(M,e)},h.init(this.dragOptions)}},{"../../components/color":52,"../../components/dragelement":71,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/titles":147,"../../lib":178,"../../lib/extend":173,"../../registry":269,"../cartesian/axes":222,"../cartesian/constants":228,"../cartesian/select":241,"../cartesian/set_convert":242,"../plots":256,d3:16,tinycolor2:35}],269:[function(e,t,r){"use strict";var n=e("./lib/loggers"),a=e("./lib/noop"),i=e("./lib/push_unique"),o=e("./lib/is_plain_object"),l=e("./lib/dom").addStyleRule,s=e("./lib/extend"),c=e("./plots/attributes"),u=e("./plots/layout_attributes"),f=s.extendFlat,d=s.extendDeepAll;function p(e){var t=e.name,a=e.categories,i=e.meta;if(r.modules[t])n.log("Type "+t+" already registered");else{r.subplotsRegistry[e.basePlotModule.name]||function(e){var t=e.name;if(r.subplotsRegistry[t])return void n.log("Plot type "+t+" already registered.");for(var a in m(e),r.subplotsRegistry[t]=e,r.componentsRegistry)b(a,e.name)}(e.basePlotModule);for(var o={},s=0;s-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":159,"../lib":178,d3:16}],278:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var z=g[e.index],P=v.base?z.b+z.s:z.s;e[f+"0"]=e[f+"1"]=C.c2p(z[f],!0),e[f+"LabelVal"]=P;var D=m.extents[m.extents.round(z.p)];return e[u+"0"]=S.c2p(y?T(z):D[0],!0),e[u+"1"]=S.c2p(y?k(z):D[1],!0),e[u+"LabelVal"]=z.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.spikeDistance=(L(z)+function(e){return M(_(e),w(e))}(z))/2-b,e[u+"Spike"]=S.c2p(z.p,!0),o(z,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":52,"../../components/fx":92,"../../constants/numerical":158,"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"./helpers":285}],287:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":235,"../scatter/marker_colorbar":407,"./arrays_to_calcdata":278,"./attributes":279,"./calc":280,"./cross_trace_calc":282,"./defaults":283,"./event_data":284,"./hover":286,"./layout_attributes":288,"./layout_defaults":289,"./plot":290,"./select":291,"./style":293}],288:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],289:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?U:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?U(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,B,I),B=G(B,N,I),H=G(H,j,!I),j=G(j,H,!I)}var Z=M(i.ensureSingle(P,"path"),z,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((B-N)*(j-H))?"M0,0Z":"M"+N+","+H+"V"+j+"H"+B+"V"+H+"Z").call(s.setClipUrl,t.layerClipId,e),!z.uniformtext.mode&&R){var X=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,X,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function z(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,D="h"===P.orientation,E=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var I="stack"===v.mode||"relative"===v.mode,R=n[a],F=!I||R._outmost;if(!E||"none"===w||(R.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,B=h.getBarColor(n[a],P),H=h.getInsideTextFont(P,a,N,B),j=h.getOutsideTextFont(P,a,N),V=r.datum();D?"log"===T.type&&V.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(Y/G);G>0&&Z>0&&(Q||$||J)?w="inside":(w="outside",q.remove(),q=null)}else w="inside";if(!q){X=i.ensureUniformFontSize(e,"outside"===w?j:H);var K=(q=z(r,E,X)).attr("transform");if(q.attr("transform",""),U=s.bBox(q.node()),G=U.width,Z=U.height,q.attr("transform",K),G<=0||Z<=0)return void q.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,U,{isHorizontal:D,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,U,{isHorizontal:D,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=X.size,d(P.type,ee,O),R.transform=ee,M(q,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,B,H,j,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var H=!1===f.cliponaxis;s.setClipUrl(c,H?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx/helpers":88,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/cartesian/axes":222,"../../registry":269,"./attributes":279,"./constants":281,"./helpers":285,"./style":293,"./uniform_text":295,d3:16,"fast-isnumeric":18}],291:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":52,"../../components/drawing":74,"../../lib":178,"../../registry":269,"./attributes":279,"./helpers":285,"./uniform_text":295,d3:16}],294:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63}],295:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=oA.uf};if(t._hasPreCompStats){var F=t[y],N=function(e){return m.d2c((t[e]||[])[r])},B=1/0,H=-1/0;for(r=0;r=A.q1&&A.q3>=A.med){var V=N("lowerfence");A.lf=V!==o&&V<=A.q1?V:d(A,S,C);var q=N("upperfence");A.uf=q!==o&&q>=A.q3?q:p(A,S,C);var U=N("mean");A.mean=U!==o?U:C?i.mean(S,C):(A.q1+A.q3)/2;var G=N("sd");A.sd=U!==o&&G>=0?G:C?i.stdev(S,C,A.mean):A.q3-A.q1,A.lo=h(A),A.uo=g(A);var Z=N("notchspan");Z=Z!==o&&Z>0?Z:v(A,C),A.ln=A.med-Z,A.un=A.med+Z;var X=A.lf,Y=A.uf;t.boxpoints&&S.length&&(X=Math.min(X,S[0]),Y=Math.max(Y,S[C-1])),t.notched&&(X=Math.min(X,A.ln),Y=Math.max(Y,A.un)),A.min=X,A.max=Y}else{var W;i.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+A.q1,"median = "+A.med,"q3 = "+A.q3].join("\n")),W=A.med!==o?A.med:A.q1!==o?A.q3!==o?(A.q1+A.q3)/2:A.q1:A.q3!==o?A.q3:0,A.med=W,A.q1=A.q3=W,A.lf=A.uf=W,A.mean=A.sd=W,A.ln=A.un=W,A.min=A.max=W}B=Math.min(B,A.min),H=Math.max(H,A.max),A.pts2=L.filter(R),k.push(A)}}t._extremes[m._id]=a.findExtremes(m,[B,H],{padded:!0})}else{var Q=m.makeCalcdata(t,y),$=function(e,t){for(var r=e.length,n=new Array(r+1),a=0;a=0&&ee0){var oe,le;if((A={}).pos=A[b]=E[r],L=A.pts=K[r].sort(u),C=(S=A[y]=L.map(f)).length,A.min=S[0],A.max=S[C-1],A.mean=i.mean(S,C),A.sd=i.stdev(S,C,A.mean),A.med=i.interp(S,.5),C%2&&(ae||ie))ae?(oe=S.slice(0,C/2),le=S.slice(C/2+1)):ie&&(oe=S.slice(0,C/2+1),le=S.slice(C/2)),A.q1=i.interp(oe,.5),A.q3=i.interp(le,.5);else A.q1=i.interp(S,.25),A.q3=i.interp(S,.75);A.lf=d(A,S,C),A.uf=p(A,S,C),A.lo=h(A),A.uo=g(A);var se=v(A,C);A.ln=A.med-se,A.un=A.med+se,te=Math.min(te,A.ln),re=Math.max(re,A.un),A.pts2=L.filter(R),k.push(A)}t._extremes[m._id]=a.findExtremes(m,t.notched?Q.concat([te,re]):Q,{padded:!0})}return function(e,t){if(i.isArrayOrTypedArray(t.selectedpoints))for(var r=0;r0?(k[0].t={num:_[M],dPos:I,posLetter:b,valLetter:y,labels:{med:l(e,"median:"),min:l(e,"min:"),q1:l(e,"q1:"),q3:l(e,"q3:"),max:l(e,"max:"),mean:"sd"===t.boxmean?l(e,"mean \xb1 \u03c3:"):l(e,"mean:"),lf:l(e,"lower fence:"),uf:l(e,"upper fence:")}},_[M]++,k):[{t:{empty:!0}}]};var s={text:"tx",hovertext:"htx"};function c(e,t,r){for(var n in s)i.isArrayOrTypedArray(t[n])&&(Array.isArray(r)?i.isArrayOrTypedArray(t[n][r[0]])&&(e[s[n]]=t[n][r[0]][r[1]]):e[s[n]]=t[n][r])}function u(e,t){return e.v-t.v}function f(e){return e.v}function d(e,t,r){return 0===r?e.q1:Math.min(e.q1,t[Math.min(i.findBin(2.5*e.q1-1.5*e.q3,t,!0)+1,r-1)])}function p(e,t,r){return 0===r?e.q3:Math.max(e.q3,t[Math.max(i.findBin(2.5*e.q3-1.5*e.q1,t),0)])}function h(e){return 4*e.q1-3*e.q3}function g(e){return 4*e.q3-3*e.q1}function v(e,t){return 0===t?0:1.57*(e.q3-e.q1)/Math.sqrt(t)}},{"../../constants/numerical":158,"../../lib":178,"../../plots/cartesian/axes":222,"fast-isnumeric":18}],298:[function(e,t,r){"use strict";var n=e("../../plots/cartesian/axes"),a=e("../../lib"),i=e("../../plots/cartesian/axis_ids").getAxisGroup,o=["v","h"];function l(e,t,r,o){var l,s,c,u=t.calcdata,f=t._fullLayout,d=o._id,p=d.charAt(0),h=[],g=0;for(l=0;l1,b=1-f[e+"gap"],_=1-f[e+"groupgap"];for(l=0;l0){var U=S.pointpos,G=S.jitter,Z=S.marker.size/2,X=0;U+G>=0&&((X=V*(U+G))>A?(q=!0,H=Z,N=X):X>R&&(H=Z,N=A)),X<=A&&(N=A);var Y=0;U-G<=0&&((Y=-V*(U-G))>L?(q=!0,j=Z,B=Y):Y>F&&(j=Z,B=L)),Y<=L&&(B=L)}else N=A,B=L;var W=new Array(c.length);for(s=0;s0?(v="v",m=x>0?Math.min(_,b):Math.min(b)):x>0?(v="h",m=Math.min(_)):m=0;if(m){t._length=m;var M=r("orientation",v);t._hasPreCompStats?"v"===M&&0===x?(r("x0",0),r("dx",1)):"h"===M&&0===y&&(r("y0",0),r("dy",1)):"v"===M&&0===x?r("x0"):"h"===M&&0===y&&r("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(e,t,["x","y"],i)}else t.visible=!1}function u(e,t,r,a){var i=a.prefix,o=n.coerce2(e,t,s,"marker.outliercolor"),l=r("marker.line.outliercolor"),c="outliers";t._hasPreCompStats?c="all":(o||l)&&(c="suspectedoutliers");var u=r(i+"points",c);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",t.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",t.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete t.marker;var f=r("hoveron");"all"!==f&&-1===f.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(t,r)}t.exports={supplyDefaults:function(e,t,r,a){function o(r,a){return n.coerce(e,t,s,r,a)}if(c(e,t,o,a),!1!==t.visible){var l=t._hasPreCompStats;l&&(o("lowerfence"),o("upperfence")),o("line.color",(e.marker||{}).color||r),o("line.width"),o("fillcolor",i.addOpacity(t.line.color,.5));var f=!1;if(l){var d=o("mean"),p=o("sd");d&&d.length&&(f=!0,p&&p.length&&(f="sd"))}o("boxmean",f),o("whiskerwidth"),o("width"),o("quartilemethod");var h=!1;if(l){var g=o("notchspan");g&&g.length&&(h=!0)}else n.validate(e.notchwidth,s.notchwidth)&&(h=!0);o("notched",h)&&o("notchwidth"),u(e,t,o,{prefix:"box"})}},crossTraceDefaults:function(e,t){var r,a;function i(e){return n.coerce(a._input,a,s,e)}for(var l=0;le.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(e,t,r,i){var o,l,s=t.pos,c=t.val,u=i.bPos,f=i.bPosPxOffset||0,d=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var p=e.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);p.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),p.exit().remove(),p.each((function(e){var t=s.c2l(e.pos+u,!0),a=s.l2p(t)+f,i=s.l2p(t-o)+f,p=s.l2p(t+l)+f,h=c.c2p(e.mean,!0),g=c.c2p(e.mean-e.sd,!0),v=c.c2p(e.mean+e.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+h+","+i+"V"+p+("sd"===d?"m0,0L"+g+","+a+"L"+h+","+i+"L"+v+","+a+"Z":"")):n.select(this).attr("d","M"+i+","+h+"H"+p+("sd"===d?"m0,0L"+a+","+g+"L"+i+","+h+"L"+a+","+v+"Z":""))}))}t.exports={plot:function(e,t,r,i){var c=t.xaxis,u=t.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(e){var t,r,a=n.select(this),i=e[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(t=u,r=c):(t=c,r=u),o(a,{pos:t,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:t,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":74,"../../lib":178,d3:16}],306:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n,a=e.cd,i=e.xaxis,o=e.yaxis,l=[];if(!1===t)for(r=0;ro.level||o.starts.length&&i===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var l=n.x.length,s=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&d===u)&&(n.prefixBoundary=!0);break;case"][":f=Math.min(p[0],p[1]),d=Math.max(p[0],p[1]),fc&&(n.prefixBoundary=!0)}}}},{}],311:[function(e,t,r){"use strict";var n=e("../../components/colorscale"),a=e("./make_color_map"),i=e("./end_plus");t.exports={min:"zmin",max:"zmax",calc:function(e,t,r){var o=t.contours,l=t.line,s=o.size||1,c=o.coloring,u=a(t,{isColorbar:!0});if("heatmap"===c){var f=n.extractOpts(t);r._fillgradient=f.reversescale?n.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:l.color,width:!1!==o.showlines?l.width:0,dash:l.dash},r._levels={start:o.start,end:i(o),size:s}}}},{"../../components/colorscale":64,"./end_plus":319,"./make_color_map":324}],312:[function(e,t,r){"use strict";t.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],313:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./label_defaults"),i=e("../../components/color"),o=i.addOpacity,l=i.opacity,s=e("../../constants/filter_ops"),c=s.CONSTRAINT_REDUCTION,u=s.COMPARISON_OPS2;t.exports=function(e,t,r,i,s,f){var d,p,h,g=t.contours,v=r("contours.operation");(g._operation=c[v],function(e,t){var r;-1===u.indexOf(t.operation)?(e("contours.value",[0,1]),Array.isArray(t.value)?t.value.length>2?t.value=t.value.slice(2):0===t.length?t.value=[0,1]:t.length<2?(r=parseFloat(t.value[0]),t.value=[r,r+1]):t.value=[parseFloat(t.value[0]),parseFloat(t.value[1])]:n(t.value)&&(r=parseFloat(t.value),t.value=[r,r+1])):(e("contours.value",0),n(t.value)||(Array.isArray(t.value)?t.value=parseFloat(t.value[0]):t.value=0))}(r,g),"="===v?d=g.showlines=!0:(d=r("contours.showlines"),h=r("fillcolor",o((e.line||{}).color||s,.5))),d)&&(p=r("line.color",h&&l(h)?o(t.fillcolor,1):s),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,p,f)}},{"../../components/color":52,"../../constants/filter_ops":156,"./label_defaults":323,"fast-isnumeric":18}],314:[function(e,t,r){"use strict";var n=e("../../constants/filter_ops"),a=e("fast-isnumeric");function i(e,t){var r,i=Array.isArray(t);function o(e){return a(e)?+e:null}return-1!==n.COMPARISON_OPS2.indexOf(e)?r=o(i?t[0]:t):-1!==n.INTERVAL_OPS.indexOf(e)?r=i?[o(t[0]),o(t[1])]:[o(t),o(t)]:-1!==n.SET_OPS.indexOf(e)&&(r=i?t.map(o):[o(t)]),r}function o(e){return function(t){t=i(e,t);var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]);return{start:r,end:n,size:n-r}}}function l(e){return function(t){return{start:t=i(e,t),end:1/0,size:1/0}}}t.exports={"[]":o("[]"),"][":o("]["),">":l(">"),"<":l("<"),"=":l("=")}},{"../../constants/filter_ops":156,"fast-isnumeric":18}],315:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,l=r("contours.size");!(o?t.autocontour=!0:r("autocontour",!1))&&l||r("ncontours")}},{}],316:[function(e,t,r){"use strict";var n=e("../../lib");function a(e){return n.extendFlat({},e,{edgepaths:n.extendDeep([],e.edgepaths),paths:n.extendDeep([],e.paths),starts:n.extendDeep([],e.starts)})}t.exports=function(e,t){var r,i,o,l=function(e){return e.reverse()},s=function(e){return e};switch(t){case"=":case"<":return e;case">":for(1!==e.length&&n.warn("Contour data invalid for the specified inequality operation."),i=e[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",e);break}return s}},{"../../lib":178,"./constraint_mapping":314,"./end_plus":319}],319:[function(e,t,r){"use strict";t.exports=function(e){return e.end+e.size/1e6}},{}],320:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./constants");function i(e,t,r,n){return Math.abs(e[0]-t[0])20&&t?208===e||1114===e?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==a.BOTTOMSTART.indexOf(e)?i=1:-1!==a.LEFTSTART.indexOf(e)?n=1:-1!==a.TOPSTART.indexOf(e)?i=-1:n=-1;return[n,i]}(f,r,t),p=[l(e,t,[-d[0],-d[1]])],h=e.z.length,g=e.z[0].length,v=t.slice(),m=d.slice();for(c=0;c<1e4;c++){if(f>20?(f=a.CHOOSESADDLE[f][(d[0]||d[1])<0?0:1],e.crossings[u]=a.SADDLEREMAINDER[f]):delete e.crossings[u],!(d=a.NEWDELTA[f])){n.log("Found bad marching index:",f,t,e.level);break}p.push(l(e,t,d)),t[0]+=d[0],t[1]+=d[1],u=t.join(","),i(p[p.length-1],p[p.length-2],o,s)&&p.pop();var y=d[0]&&(t[0]<0||t[0]>g-2)||d[1]&&(t[1]<0||t[1]>h-2);if(t[0]===v[0]&&t[1]===v[1]&&d[0]===m[0]&&d[1]===m[1]||r&&y)break;f=e.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,L,S,C,O,z,P,D,E=i(p[0],p[p.length-1],o,s),I=0,R=.2*e.smoothing,F=[],N=0;for(c=1;c=N;c--)if((x=F[c])=N&&x+F[b]A&&L--,e.edgepaths[L]=C.concat(p,S));break}V||(e.edgepaths[A]=p.concat(S))}for(A=0;Ae?0:1)+(t[0][1]>e?0:2)+(t[1][1]>e?0:4)+(t[1][0]>e?0:8);return 5===r||10===r?e>(t[0][0]+t[0][1]+t[1][0]+t[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}t.exports=function(e){var t,r,i,o,l,s,c,u,f,d=e[0].z,p=d.length,h=d[0].length,g=2===p||2===h;for(r=0;r=0&&(n=y,l=s):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,l=s):a.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,l>=0)break;f+="L"+n}if(l===e.edgepaths.length){a.log("unclosed perimeter path");break}d=l,(h=-1===p.indexOf(d))&&(d=p[0],f+="Z")}for(d=0;dn.center?n.right-l:l-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(s>n.middle?n.bottom-s:s-n.top)/(Math.abs(f)+Math.cos(c)*o);if(d<1||p<1)return 1/0;var h=m.EDGECOST*(1/(d-1)+1/(p-1));h+=m.ANGLECOST*c*c;for(var g=l-u,v=s-f,y=l+u,x=s+f,b=0;b2*m.MAXCOST)break;p&&(l/=2),s=(o=c-l/2)+1.5*l}if(d<=m.MAXCOST)return u},r.addLabelData=function(e,t,r,n){var a=t.fontSize,i=t.width+a/3,o=Math.max(0,t.height-a/3),l=e.x,s=e.y,c=e.theta,u=Math.sin(c),f=Math.cos(c),d=function(e,t){return[l+e*f-t*u,s+e*u+t*f]},p=[d(-i/2,-o/2),d(-i/2,o/2),d(i/2,o/2),d(i/2,-o/2)];r.push({text:t.text,x:l,y:s,dy:t.dy,theta:c,level:t.level,width:i,height:o}),n.push(p)},r.drawLabels=function(e,t,r,i,o){var s=e.selectAll("text").data(t,(function(e){return e.text+","+e.x+","+e.y+","+e.theta}));if(s.exit().remove(),s.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(e){var t=e.x+Math.sin(e.theta)*e.dy,a=e.y-Math.cos(e.theta)*e.dy;n.select(this).text(e.text).attr({x:t,y:a,transform:"rotate("+180*e.theta/Math.PI+" "+t+" "+a+")"}).call(l.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),e._input.contours||(e._input.contours={}),a.extendFlat(e._input.contours,{start:r.start,end:r.end,size:r.size}),e._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,f=r.end,d=e._input.contours;if(u>f&&(r.start=d.start=f,f=r.end=d.end=u,u=r.start),!(r.size>0))c=u===f?1:i(u,f,e.ncontours).dtick,d.size=r.size=c}}},{"../../lib":178,"../../plots/cartesian/axes":222}],328:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/drawing"),i=e("../heatmap/style"),o=e("./make_color_map");t.exports=function(e){var t=n.select(e).selectAll("g.contour");t.style("opacity",(function(e){return e[0].trace.opacity})),t.each((function(e){var t=n.select(this),r=e[0].trace,i=r.contours,l=r.line,s=i.size||1,c=i.start,u="constraint"===i.type,f=!u&&"lines"===i.coloring,d=!u&&"fill"===i.coloring,p=f||d?o(r):null;t.selectAll("g.contourlevel").each((function(e){n.select(this).selectAll("path").call(a.lineGroupStyle,l.width,f?p(e.level):l.color,l.dash)}));var h=i.labelfont;if(t.selectAll("g.contourlabels text").each((function(e){a.font(n.select(this),{family:h.family,size:h.size,color:h.color||(f?p(e.level):l.color)})})),u)t.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(d){var g;t.selectAll("g.contourfill path").style("fill",(function(e){return void 0===g&&(g=e.level),p(e.level+.5*s)})),void 0===g&&(g=c),t.selectAll("g.contourbg path").style("fill",p(g-.5*s))}})),i(e)}},{"../../components/drawing":74,"../heatmap/style":342,"./make_color_map":324,d3:16}],329:[function(e,t,r){"use strict";var n=e("../../components/colorscale/defaults"),a=e("./label_defaults");t.exports=function(e,t,r,i,o){var l,s=r("contours.coloring"),c="";"fill"===s&&(l=r("contours.showlines")),!1!==l&&("lines"!==s&&(c=r("line.color","var(--ow-color-black)")),r("line.width",.5),r("line.dash")),"none"!==s&&(!0!==e.showlegend&&(t.showlegend=!1),t._dfltShowLegend=!1,n(e,t,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,c,o)}},{"../../components/colorscale/defaults":62,"./label_defaults":323}],330:[function(e,t,r){"use strict";var n=e("../scatter/attributes"),a=e("../../plots/attributes"),i=e("../../plots/template_attributes").hovertemplateAttrs,o=e("../../components/colorscale/attributes"),l=(e("../../constants/docs").FORMAT_LINK,e("../../lib/extend").extendFlat);t.exports=l({z:{valType:"data_array",editType:"calc"},x:l({},n.x,{impliedEdits:{xtype:"array"}}),x0:l({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:l({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:l({},n.y,{impliedEdits:{ytype:"array"}}),y0:l({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:l({},n.dy,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:i(),showlegend:l({},a.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":59,"../../constants/docs":155,"../../lib/extend":173,"../../plots/attributes":219,"../../plots/template_attributes":264,"../scatter/attributes":389}],331:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib"),i=e("../../plots/cartesian/axes"),o=e("../histogram2d/calc"),l=e("../../components/colorscale/calc"),s=e("./convert_column_xyz"),c=e("./clean_2d_array"),u=e("./interp2d"),f=e("./find_empties"),d=e("./make_bound_array");t.exports=function(e,t){var r,p,h,g,v,m,y,x,b,_=i.getFromId(e,t.xaxis||"x"),w=i.getFromId(e,t.yaxis||"y"),T=n.traceIs(t,"contour"),k=n.traceIs(t,"histogram"),M=n.traceIs(t,"gl2d"),A=T?"best":t.zsmooth;if(_._minDtick=0,w._minDtick=0,k)r=(b=o(e,t)).x,p=b.x0,h=b.dx,g=b.y,v=b.y0,m=b.dy,y=b.z;else{var L=t.z;a.isArray1D(L)?(s(t,_,w,"x","y",["z"]),r=t._x,g=t._y,L=t._z):(r=t._x=t.x?_.makeCalcdata(t,"x"):[],g=t._y=t.y?w.makeCalcdata(t,"y"):[]),p=t.x0,h=t.dx,v=t.y0,m=t.dy,y=c(L,t,_,w),(T||t.connectgaps)&&(t._emptypoints=f(y),u(y,t._emptypoints))}function S(e){A=t._input.zsmooth=t.zsmooth=!1,a.warn('cannot use zsmooth: "fast": '+e)}if("fast"===A)if("log"===_.type||"log"===w.type)S("log axis found");else if(!k){if(r.length){var C=(r[r.length-1]-r[0])/(r.length-1),O=Math.abs(C/100);for(x=0;xO){S("x scale is not linear");break}}if(g.length&&"fast"===A){var z=(g[g.length-1]-g[0])/(g.length-1),P=Math.abs(z/100);for(x=0;xP){S("y scale is not linear");break}}}var D=a.maxRowLength(y),E="scaled"===t.xtype?"":r,I=d(t,E,p,h,D,_),R="scaled"===t.ytype?"":g,F=d(t,R,v,m,y.length,w);M||(t._extremes[_._id]=i.findExtremes(_,I),t._extremes[w._id]=i.findExtremes(w,F));var N={x:I,y:F,z:y,text:t._text||t.text,hovertext:t._hovertext||t.hovertext};if(E&&E.length===I.length-1&&(N.xCenter=E),R&&R.length===F.length-1&&(N.yCenter=R),k&&(N.xRanges=b.xRanges,N.yRanges=b.yRanges,N.pts=b.pts),T||l(e,t,{vals:y,cLetter:"z"}),T&&t.contours&&"heatmap"===t.contours.coloring){var B={type:"contour"===t.type?"heatmap":"histogram2d",xcalendar:t.xcalendar,ycalendar:t.ycalendar};N.xfill=d(B,E,p,h,D,_),N.yfill=d(B,R,v,m,y.length,w)}return[N]}},{"../../components/colorscale/calc":60,"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"../histogram2d/calc":359,"./clean_2d_array":332,"./convert_column_xyz":334,"./find_empties":336,"./interp2d":339,"./make_bound_array":340}],332:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("../../constants/numerical").BADNUM;t.exports=function(e,t,r,o){var l,s,c,u,f,d;function p(e){if(n(e))return+e}if(t&&t.transpose){for(l=0,f=0;f=0;o--)(l=((f[[(r=(i=d[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[i]=[r,a,l],d.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(i in s)f[i]=s[i],u.push(s[i])}return u.sort((function(e,t){return t[2]-e[2]}))}},{"../../lib":178}],337:[function(e,t,r){"use strict";var n=e("../../components/fx"),a=e("../../lib"),i=e("../../plots/cartesian/axes"),o=e("../../components/colorscale").extractOpts;t.exports=function(e,t,r,l,s,c){var u,f,d,p,h=e.cd[0],g=h.trace,v=e.xa,m=e.ya,y=h.x,x=h.y,b=h.z,_=h.xCenter,w=h.yCenter,T=h.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==e.index){try{d=Math.round(e.index[1]),p=Math.round(e.index[0])}catch(t){return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",e.index)}if(d<0||d>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(t-y[0],t-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var L;for(M=[2*y[0]-y[1]],L=1;Lg&&(m=Math.max(m,Math.abs(e[i][o]-h)/(v-g))))}return m}t.exports=function(e,t){var r,a=1;for(o(e,t),r=0;r.01;r++)a=o(e,t,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),e}},{"../../lib":178}],340:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib").isArrayOrTypedArray;t.exports=function(e,t,r,i,o,l){var s,c,u,f=[],d=n.traceIs(e,"contour"),p=n.traceIs(e,"histogram"),h=n.traceIs(e,"gl2d");if(a(t)&&t.length>1&&!p&&"category"!==l.type){var g=t.length;if(!(g<=o))return d?t.slice(0,o):t.slice(0,o+1);if(d||h)f=t.slice(0,o);else if(1===o)f=[t[0]-.5,t[0]+.5];else{for(f=[1.5*t[0]-.5*t[1]],u=1;u0;)d=p.c2p(T[y]),y--;for(d0;)m=h.c2p(k[y]),y--;if(m0&&(i=!0);for(var s=0;si){var o=i-r[e];return r[e]=i,o}}return 0},max:function(e,t,r,a){var i=a[t];if(n(i)){if(i=Number(i),!n(r[e]))return r[e]=i,i;if(r[e]c?e>o?e>1.1*a?a:e>1.1*i?i:o:e>l?l:e>s?s:c:Math.pow(10,Math.floor(Math.log(e)/Math.LN10))}function p(e,t,r,n,i,l){if(n&&e>o){var s=h(t,i,l),c=h(r,i,l),u=e===a?0:1;return s[u]!==c[u]}return Math.floor(r/e)-Math.floor(t/e)>.1}function h(e,t,r){var n=t.c2d(e,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}t.exports=function(e,t,r,n,i){var l,s,c=-1.1*t,d=-.1*t,p=e-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(t,r){var o=n.c2d(t,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(H=o.tickIncrement(H,b.size,!0,p)),E.start=r.l2r(H),F||a.nestedProperty(t,m+".start").set(E.start)}var j=b.end,V=r.r2l(D.end),q=void 0!==V;if((b.endFound||q)&&V!==r.r2l(j)){var U=q?V:a.aggNums(Math.max,null,h);E.end=r.l2r(U),q||a.nestedProperty(t,m+".start").set(E.end)}var G="autobin"+l;return!1===t._input[G]&&(t._input[m]=a.extendFlat({},t[m]||{}),delete t._input[G],delete t[G]),[E,h]}t.exports={calc:function(e,t){var r,i,p,h,g=[],v=[],m=o.getFromId(e,"h"===t.orientation?t.yaxis:t.xaxis),y="h"===t.orientation?"y":"x",x={x:"y",y:"x"}[y],b=t[y+"calendar"],_=t.cumulative,w=d(e,t,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],z=0,P=t.histnorm,D=t.histfunc,E=-1!==P.indexOf("density");_.enabled&&E&&(P=P.replace(/ ?density$/,""),E=!1);var I,R="max"===D||"min"===D?null:0,F=s.count,N=c[P],B=!1,H=function(e){return m.r2c(e,0,b)};for(a.isArrayOrTypedArray(t[x])&&"count"!==D&&(I=t[x],B="avg"===D,F=s[D]),r=H(T.start),p=H(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===t){for(n=1;n=0;n--)e[n]+=e[n+1];"exclude"===r&&(e.push(0),e.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),$=[],J=0,K=Q-1;for(r=0;r=J;r--)if(v[r]){K=r;break}for(r=J;r<=K;r++)if(n(g[r])&&n(v[r])){var ee={p:g[r],s:v[r],b:0};_.enabled||(ee.pts=O[r],G?ee.ph0=ee.ph1=O[r].length?k[O[r][0]]:g[r]:(t._computePh=!0,ee.ph0=q(A[r]),ee.ph1=q(A[r+1],!0))),$.push(ee)}return 1===$.length&&($[0].width1=o.tickIncrement($[0].p,T.size,!1,b)-$[0].p),l($,t),a.isArrayOrTypedArray(t.selectedpoints)&&a.tagSelected($,t,Y),$},calcAllAutoBins:d}},{"../../lib":178,"../../plots/cartesian/axes":222,"../../registry":269,"../bar/arrays_to_calcdata":278,"./average":346,"./bin_functions":348,"./bin_label_vals":349,"./norm_functions":357,"fast-isnumeric":18}],351:[function(e,t,r){"use strict";t.exports={eventDataKeys:["binNumber"]}},{}],352:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axis_ids"),i=e("../../registry").traceIs,o=e("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=a.getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];t.exports=function(e,t){var r,f,d,p,h,g,v,m=t._histogramBinOpts={},y=[],x={},b=[];function _(e,t){return n.coerce(r._input,r,r._module.attributes,e,t)}function w(e){return"v"===e.orientation?"x":"y"}function T(e,r,i){var o=e.uid+"__"+i;r||(r=o);var l=function(e,r){return a.getFromTrace({_fullLayout:t},e,r).type}(e,i),s=e[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(e),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",e.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",e.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[e],dirs:[i],axType:l,calendar:e[i+"calendar"]||""}),e["_"+i+"bingroup"]=r}for(h=0;hL&&T.splice(L,T.length-L),A.length>L&&A.splice(L,A.length-L);var S=[],C=[],O=[],z="string"==typeof w.size,P="string"==typeof M.size,D=[],E=[],I=z?D:w,R=P?E:M,F=0,N=[],B=[],H=t.histnorm,j=t.histfunc,V=-1!==H.indexOf("density"),q="max"===j||"min"===j?null:0,U=i.count,G=o[H],Z=!1,X=[],Y=[],W="z"in t?t.z:"marker"in t&&Array.isArray(t.marker.color)?t.marker.color:"";W&&"count"!==j&&(Z="avg"===j,U=i[j]);var Q=w.size,$=x(w.start),J=x(w.end)+($-a.tickIncrement($,Q,!1,m))/1e6;for(r=$;r=0&&p=0&&h0||n.inbox(r-o.y0,r-(o.y0+o.h*l.dy),0)>0)){var u=Math.floor((t-o.x0)/l.dx),f=Math.floor(Math.abs(r-o.y0)/l.dy);if(o.z[f][u]){var d,p=o.hi||l.hoverinfo;if(p){var h=p.split("+");-1!==h.indexOf("all")&&(h=["color"]),-1!==h.indexOf("color")&&(d=!0)}var g,v=l.colormodel,m=v.length,y=l._scaler(o.z[f][u]),x=i.colormodel[v].suffix,b=[];(l.hovertemplate||d)&&(b.push("["+[y[0]+x[0],y[1]+x[1],y[2]+x[2]].join(", ")),4===m&&b.push(", "+y[3]+x[3]),b.push("]"),b=b.join(""),e.extraText=v.toUpperCase()+": "+b),Array.isArray(l.hovertext)&&Array.isArray(l.hovertext[f])?g=l.hovertext[f][u]:Array.isArray(l.text)&&Array.isArray(l.text[f])&&(g=l.text[f][u]);var _=c.c2p(o.y0+(f+.5)*l.dy),w=o.x0+(u+.5)*l.dx,T=o.y0+(f+.5)*l.dy,k="["+o.z[f][u].slice(0,l.colormodel.length).join(", ")+"]";return[a.extendFlat(e,{index:[f,u],x0:s.c2p(o.x0+u*l.dx),x1:s.c2p(o.x0+(u+1)*l.dx),y0:_,y1:_,color:y,xVal:w,xLabelVal:w,yVal:T,yLabelVal:T,zLabelVal:k,text:g,hovertemplateLabels:{zLabel:k,colorLabel:b,"color[0]Label":y[0]+x[0],"color[1]Label":y[1]+x[1],"color[2]Label":y[2]+x[2],"color[3]Label":y[3]+x[3]}})]}}}},{"../../components/fx":92,"../../lib":178,"./constants":369}],373:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),calc:e("./calc"),plot:e("./plot"),style:e("./style"),hoverPoints:e("./hover"),eventData:e("./event_data"),moduleType:"trace",name:"image",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":235,"./attributes":367,"./calc":368,"./defaults":370,"./event_data":371,"./hover":372,"./plot":374,"./style":375}],374:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../constants/xmlns_namespaces"),o=e("./constants");t.exports=function(e,t,r,l){var s=t.xaxis,c=t.yaxis;a.makeTraceGroups(l,r,"im").each((function(e){var t,r,l,u,f,d,p=n.select(this),h=e[0],g=h.trace,v=h.z,m=h.x0,y=h.y0,x=h.w,b=h.h,_=g.dx,w=g.dy;for(d=0;void 0===t&&d0;)r=s.c2p(m+d*_),d--;for(d=0;void 0===u&&d0;)f=c.c2p(y+d*w),d--;r0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":178,"../../plots/domain":249,"../bar/defaults":283,"./attributes":376,"fast-isnumeric":18}],380:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":88}],381:[function(e,t,r){"use strict";var n=e("../../lib");r.formatPiePercent=function(e,t){var r=(100*e).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=e.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:h.castOption(b.bgcolor,e.pts)||e.color,borderColor:h.castOption(b.bordercolor,e.pts),fontFamily:h.castOption(_.family,e.pts),fontSize:h.castOption(_.size,e.pts),fontColor:h.castOption(_.color,e.pts),nameLength:h.castOption(b.namelength,e.pts),textAlign:h.castOption(b.align,e.pts),hovertemplate:h.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[g(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[g(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[g(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[g(e,a)],i.click(t,n.event))}))}function y(e,t,r){var n=h.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=h.castOption(e._input.textfont.color,t.pts));var a=h.castOption(e.insidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.insidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function x(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=_(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=w(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.width/e.height,o=M(i,n,t,r);return{scale:2*o/e.height,rCenter:T(i,o/t),rotate:k(a)}}function w(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.height/e.width,o=M(i,n,t,r);return{scale:2*o/e.width,rCenter:T(i,o/t),rotate:k(a+Math.PI/2)}}function T(e,t){return Math.cos(t)-e*t}function k(e){return(180/Math.PI*e+720)%180-90}function M(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function A(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function L(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function S(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=O(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=C(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function C(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function O(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function z(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:h.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:h.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=h.getFirstFilled(a.text,t.pts);(v(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function E(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;d("pie",r),x(t,e),z(t,i);var u=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var u=n.select(this),d=t[0],p=d.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=o.rotation*Math.PI/180,s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(t),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(t);g.enter().append("g").classed("slice",!0),g.exit().remove();var v=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,v[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=d.cx,u=d.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(m,e,t),p.pull){var w=+h.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===d.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}D(e,a,d);var S=h.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),v=s.ensureUniformFontSize(e,"outside"===S?function(e,t,r){var n=h.castOption(e.outsidetextfont.color,t.pts)||h.castOption(e.textfont.color,t.pts)||r.color,a=h.castOption(e.outsidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.outsidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,v).call(c.convertToTspans,e);var m,_=l.bBox(g.node());if("outside"===S)m=L(_,a);else if(m=b(_,a,d),"auto"===S&&m.scale<1){var w=s.ensureUniformFontSize(e,p.outsidetextfont);g.call(l.font,w),m=L(_=l.bBox(g.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:P(d.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=u+k[1]*m.rCenter+(m.y||0),E(m,_),m.outside){var M=m.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}m.fontSize=v.size,f(p.type,m,r),t[i].transform=m,g.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*d.r+","+n*d.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=s.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,p.title.font).call(c.convertToTspans,e),t="middle center"===p.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(d):S(d,i),r.attr("transform","translate("+t.x+","+t.y+")"+(t.scale<1?"scale("+t.scale+")":"")+"translate("+t.tx+","+t.ty+")")})),x&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,g;function v(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?e.yLabelMin:e.yLabelMax,v=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-g;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(h.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(v+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?v:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=l.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-d.r)/i.w,C=(.5*M-d.r)/i.h;a.autoMargin(e,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(d.cx-d.r-w.left,0),r:Math.max(w.right-(d.cx+d.r),0),b:Math.max(w.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:D,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:S,prerenderTitles:x,layoutAreas:z,attachFxHandlers:m,computeTransform:E}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx":92,"../../lib":178,"../../lib/svg_text_utils":199,"../../plots/plots":256,"../bar/constants":281,"../bar/uniform_text":295,"./event_data":380,"./helpers":381,d3:16}],386:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":295,"./style_one":387,d3:16}],387:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":52,"./helpers":381}],388:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rl&&M[v].gap;)v--;for(y=M[v].s,h=M.length-1;h>v;h--)M[h].s=y;for(;lA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],396:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./stack_defaults"),u=e("./marker_defaults"),f=e("./line_defaults"),d=e("./line_shape_defaults"),p=e("./text_defaults"),h=e("./fillcolor_defaults");t.exports=function(e,t,r,g){function v(r,a){return n.coerce(e,t,i,r,a)}var m=s(e,t,g,v);if(m||(t.visible=!1),t.visible){var y=c(e,t,g,v),x=!y&&mG!=(F=P[O][1])>=G&&(E=P[O-1][0],I=P[O][0],F-R&&(D=E+(I-E)*(G-R)/(F-R),j=Math.min(j,D),V=Math.max(V,D)));j=Math.max(j,0),V=Math.min(V,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:j,x1:V,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":52,"../../components/fx":92,"../../lib":178,"../../registry":269,"./get_trace_color":399}],401:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":235,"./arrays_to_calcdata":388,"./attributes":389,"./calc":390,"./cross_trace_calc":394,"./cross_trace_defaults":395,"./defaults":396,"./format_labels":398,"./hover":400,"./marker_colorbar":407,"./plot":409,"./select":410,"./style":412,"./subtypes":413}],402:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":178}],403:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,z=L._length,P=S._length,D=t.connectGaps,E=t.baseTolerance,I=t.shape,R="linear"===I,F=t.fill&&"none"!==t.fill,N=[],B=f.minTolerance,H=e.length,j=new Array(H),V=0;function q(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*z*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function U(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===j[V-1][0],a=r===j[V-1][1];if(!n||!a)if(V>1){var i=t===j[V-2][0],o=r===j[V-2][1];n&&(t===te||t===re)&&i?o?V--:j[V-1]=e:a&&(r===ne||r===ae)&&o?i?V--:j[V-1]=e:j[V++]=e}else j[V++]=e}function ue(e){j[V-1][0]!==e[0]&&j[V-1][1]!==e[1]&&ce([W,Q]),ce(e),$=null,W=Q=0}function fe(e){if(M=e[0]/z,A=e[1]/P,X=e[0]re?re:0,Y=e[1]ae?ae:0,X||Y){if(V)if($){var t=K($,e);t.length>1&&(ue(t[0]),j[V++]=t[1])}else J=K(j[V-1],e)[0],j[V++]=J;else j[V++]=[X||e[0],Y||e[1]];var r=j[V-1];X&&Y&&(r[0]!==X||r[1]!==Y)?($&&(W!==X&&Q!==Y?ce(W&&Q?(n=$,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||X,Q||Y]):W&&Q&&ce([W,Q])),ce([X,Y])):W-X&&Q-Y&&ce([X||W,Y||Q]),$=e,W=X,Q=Y}else $&&ue(K($,e)[0]),j[V++]=e;var n,a,i,o}for("linear"===I||"spline"===I?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[3]);o&&(!n||Math.abs(o.x-r[0][0])>1||Math.abs(o.y-r[0][1])>1)&&(o=[o.x,o.y],n&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}$&&ce([W||$[0],Q||$[1]]),N.push(j.slice(0,V))}return N}},{"../../constants/numerical":158,"../../lib":178,"./constants":393}],404:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],405:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":18}],407:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],408:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":413}],409:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var z,P,D="",E=[],I=_._prevtrace;I&&(D=I._prevRevpath||"",C=I._nextFill,E=I._polygons);var R,F,N,B,H,j,V,q="",U="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):R=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),V=_._polygons=new Array(G.length),v=0;v1){var r=n.select(this);if(r.datum(f),e)y(r.style("opacity",0).attr("d",z).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",z),s.singleLineStyle(f,a)}}}}}var X=M.selectAll(".js-line").data(G);y(X.exit()).style("opacity",0).remove(),X.each(Z(!1)),X.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(X,r.layerClipId,e),G.length?(S?(S.datum(f),B&&j&&(O?("y"===O?B[1]=j[1]=b.c2p(0,!0):"x"===O&&(B[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+B+"L"+q.substr(1)).call(s.singleFillStyle)):y(S).attr("d",q+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&D?("tonext"===_.fill?y(C).attr("d",q+"Z"+D+"Z").call(s.singleFillStyle):y(C).attr("d",q+"L"+D.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=U,_._prevPolygons=V):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?$:Q:_&&!w&&(v=J),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var Y=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,Y,e),s.setClipUrl(L,Y,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function $(e){return e.filter((function(e){return e.vis}))}function J(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":74,"../../lib":178,"../../lib/polygon":190,"../../registry":269,"./line_points":403,"./link_traces":405,"./subtypes":413,d3:16}],410:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r"),o.hovertemplate=d.hovertemplate,i}function x(e,t){m.push(e._hovertitle+": "+t)}}},{"../scatter/hover":400}],422:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../scatter/marker_colorbar"),formatLabels:e("./format_labels"),calc:e("./calc"),plot:e("./plot"),style:e("../scatter/style").style,styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("../scatter/select"),eventData:e("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:e("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":265,"../scatter/marker_colorbar":407,"../scatter/select":410,"../scatter/style":412,"./attributes":416,"./calc":417,"./defaults":418,"./event_data":419,"./format_labels":420,"./hover":421,"./plot":423}],423:[function(e,t,r){"use strict";var n=e("../scatter/plot");t.exports=function(e,t,r){var a=t.plotContainer;a.select(".scatterlayer").selectAll("*").remove();var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:a,layerClipId:t._hasClipOnAxisFalse?t.clipIdRelative:null},o=t.layers.frontplot.select("g.scatterlayer");n(e,i,r,o)}},{"../scatter/plot":409}],424:[function(e,t,r){"use strict";var n=e("../box/attributes"),a=e("../../lib/extend").extendFlat;t.exports={y:n.y,x:n.x,x0:n.x0,y0:n.y0,name:a({},n.name,{}),orientation:a({},n.orientation,{}),bandwidth:{valType:"number",min:0,editType:"calc"},scalegroup:{valType:"string",dflt:"",editType:"calc"},scalemode:{valType:"enumerated",values:["width","count"],dflt:"width",editType:"calc"},spanmode:{valType:"enumerated",values:["soft","hard","manual"],dflt:"soft",editType:"calc"},span:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,points:a({},n.boxpoints,{}),jitter:a({},n.jitter,{}),pointpos:a({},n.pointpos,{}),width:a({},n.width,{}),marker:n.marker,text:n.text,hovertext:n.hovertext,hovertemplate:n.hovertemplate,box:{visible:{valType:"boolean",dflt:!1,editType:"plot"},width:{valType:"number",min:0,max:1,dflt:.25,editType:"plot"},fillcolor:{valType:"color",editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"plot"},meanline:{visible:{valType:"boolean",dflt:!1,editType:"plot"},color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"plot"},side:{valType:"enumerated",values:["both","positive","negative"],dflt:"both",editType:"calc"},offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"}}},{"../../lib/extend":173,"../box/attributes":296}],425:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("../box/calc"),o=e("./helpers"),l=e("../../constants/numerical").BADNUM;function s(e,t,r){var a=t.max-t.min;if(!a)return e.bandwidth?e.bandwidth:0;if(e.bandwidth)return Math.max(e.bandwidth,a/1e4);var i=r.length,o=n.stdev(r,i-1,t.mean);return Math.max(function(e,t,r){return 1.059*Math.min(t,r/1.349)*Math.pow(e,-.2)}(i,o,t.q3-t.q1),a/100)}function c(e,t,r,n){var i,o=e.spanmode,s=e.span||[],c=[t.min,t.max],u=[t.min-2*n,t.max+2*n];function f(n){var a=s[n],i="multicategory"===r.type?r.r2c(a):r.d2c(a,0,e[t.valLetter+"calendar"]);return i===l?u[n]:i}var d={type:"linear",range:i="soft"===o?u:"hard"===o?c:[f(0),f(1)]};return a.setConvert(d),d.cleanRange(),i}t.exports=function(e,t){var r=i(e,t);if(r[0].t.empty)return r;for(var l=e._fullLayout,u=a.getFromId(e,t["h"===t.orientation?"xaxis":"yaxis"]),f=1/0,d=-1/0,p=0,h=0,g=0;g0){var y,x,b,_,w,T=e.xa,k=e.ya;"h"===d.orientation?(w=t,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=f[e.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},e),L=_.c2p(w,!0),S=o.getKdeValue(M,d,w),C=o.getPositionOnKdePath(M,d,L),O=b._offset,z=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=L,A[x+"Label"]=x+": "+a.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+S.toFixed(3),A.spikeDistance=m[0].spikeDistance;var P=y+"Spike";A[P]=m[0][P],m[0].spikeDistance=void 0,m[0][P]=void 0,A.hovertemplate=!1,v.push(A),(u={stroke:e.color})[y+"1"]=n.constrain(O+C[0],O,O+z),u[y+"2"]=n.constrain(O+C[1],O,O+z),u[x+"1"]=u[x+"2"]=_._offset+L}}h&&(v=v.concat(m))}-1!==p.indexOf("points")&&(c=i.hoverOnPoints(e,t,r));var D=s.selectAll(".violinline-"+d.uid).data(u?[0]:[]);return D.enter().append("line").classed("violinline-"+d.uid,!0).attr("stroke-width",1.5),D.exit().remove(),D.attr(u),"closest"===l?c?[c]:v:c?(v.push(c),v):v}},{"../../lib":178,"../../plots/cartesian/axes":222,"../box/hover":301,"./helpers":428}],430:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style"),styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("../box/select"),moduleType:"trace",name:"violin",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":235,"../box/defaults":299,"../box/select":306,"../scatter/style":412,"./attributes":424,"./calc":425,"./cross_trace_calc":426,"./defaults":427,"./hover":429,"./layout_attributes":431,"./layout_defaults":432,"./plot":433,"./style":434}],431:[function(e,t,r){"use strict";var n=e("../box/layout_attributes"),a=e("../../lib").extendFlat;t.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":178,"../box/layout_attributes":303}],432:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes"),i=e("../box/layout_defaults");t.exports=function(e,t,r){i._supply(e,t,r,(function(r,i){return n.coerce(e,t,a,r,i)}),"violin")}},{"../../lib":178,"../box/layout_defaults":304,"./layout_attributes":431}],433:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../components/drawing"),o=e("../box/plot"),l=e("../scatter/line_points"),s=e("./helpers");t.exports=function(e,t,r,c){var u=e._fullLayout,f=t.xaxis,d=t.yaxis;function p(e){var t=l(e,{xaxis:f,yaxis:d,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return i.smoothopen(t[0],1)}a.makeTraceGroups(c,r,"trace violins").each((function(e){var r=n.select(this),i=e[0],l=i.t,c=i.trace;if(!0!==c.visible||l.empty)r.remove();else{var h=l.bPos,g=l.bdPos,v=t[l.valLetter+"axis"],m=t[l.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(a.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(e){var t,r,a,i,o,s,f,d,_=n.select(this),w=e.density,T=w.length,k=m.c2l(e.pos+h,!0),M=m.l2p(k);if(c.width)t=l.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];t="count"===c.scalemode?A.maxKDE/g*(A.maxCount/e.pts.length):A.maxKDE/g}if(x){for(f=new Array(T),o=0;o s.type === "scatter" || s.type === "effectScatter", @@ -814,7 +815,8 @@ def test_mobile_location_updates_on_dashboard_map(self): const item = series.data.find(d => d.name === "Test-Location"); if (!item) return false; return item.value; - """) + """ + ) ) except TimeoutException: self.fail("Failed to retrieve mobile location data") @@ -828,7 +830,8 @@ def test_mobile_location_updates_on_dashboard_map(self): location.save() try: series_value = WebDriverWait(self.web_driver, 5).until( - lambda d: d.execute_script(""" + lambda d: d.execute_script( + """ const options = window._owGeoMap.echarts.getOption(); const series = options.series.find( (s) => s.type === "scatter" || s.type === "effectScatter", @@ -836,7 +839,8 @@ def test_mobile_location_updates_on_dashboard_map(self): const item = series.data.find(d => d.name === "Test-Location"); if (!item) return false; return item.value; - """) + """ + ) ) except TimeoutException: self.fail("Failed to retrieve updated mobile location data") @@ -889,7 +893,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): sleep(0.3) # Wait for JS animation try: series_locations = WebDriverWait(self.web_driver, 5).until( - lambda d: d.execute_script(""" + lambda d: d.execute_script( + """ const options = window._owGeoMap.echarts.getOption(); const series = options.series.find( (s) => s.type === "scatter" || s.type === "effectScatter", @@ -898,7 +903,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): const org2_location = series.data.find(l => l.name === "Org2-Location") if (!org1_location || !org2_location) return false; return {org1_location, org2_location} - """) + """ + ) ) except TimeoutException: self.fail("Failed to retrieve org location data from superuser") @@ -926,7 +932,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): sleep(0.3) # Wait for JS animation try: series_locations = WebDriverWait(org1_driver, 5).until( - lambda d: d.execute_script(""" + lambda d: d.execute_script( + """ const options = window._owGeoMap.echarts.getOption(); const series = options.series.find( (s) => s.type === "scatter" || s.type === "effectScatter", @@ -936,7 +943,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): if (!org1_location) return false; if (org2_location !== undefined) return false; return {org1_location, org2_location} - """) + """ + ) ) except TimeoutException: self.fail("Failed to retrieve org1 location data from org1 user") @@ -963,7 +971,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): sleep(0.3) # Wait for JS animation try: series_locations = WebDriverWait(org2_driver, 5).until( - lambda d: d.execute_script(""" + lambda d: d.execute_script( + """ const options = window._owGeoMap.echarts.getOption(); const series = options.series.find( (s) => s.type === "scatter" || s.type === "effectScatter", @@ -973,7 +982,8 @@ def test_mobile_location_updates_on_dashboard_map_with_org_isolation(self): if (org1_location !== undefined) return false; if (!org2_location) return false; return {org1_location, org2_location} - """) + """ + ) ) except TimeoutException: self.fail("Failed to retrieve org2 location data from org2 user")