diff --git a/dashboard-frontend/src/pages/GaugeSites.tsx b/dashboard-frontend/src/pages/GaugeSites.tsx index 379aee4..6bb8b6f 100644 --- a/dashboard-frontend/src/pages/GaugeSites.tsx +++ b/dashboard-frontend/src/pages/GaugeSites.tsx @@ -106,7 +106,7 @@ export default function GaugeSites() { {adding && } -
+
@@ -121,7 +121,7 @@ export default function GaugeSites() { - + {rows.map(r => editing === r.site_id ? ( ) : ( - + @@ -204,15 +204,15 @@ function RowEditor({ draft, setDraft, onSave, onCancel, adding, feedSource }: { } } return ( -
+
@@ -129,7 +129,7 @@ export default function GaugeSites() {
{r.site_id} {r.gauge_name} {r.lat.toFixed(3)},{r.lon.toFixed(3)}
@@ -94,13 +94,13 @@ export default function TownAnchors() { - + {rows.map(r => editing === r.anchor_id ? ( ) : ( - + @@ -126,13 +126,13 @@ function RowEditor({ draft, setDraft, onSave, onCancel, adding }: { }) { const upd = (k: keyof TownAnchor, v: unknown) => setDraft({ ...draft, [k]: v }) return ( -
+
- +
diff --git a/meshai/dashboard/static/assets/index-8oP3B9c2.css b/meshai/dashboard/static/assets/index-BC90GDxp.css similarity index 58% rename from meshai/dashboard/static/assets/index-8oP3B9c2.css rename to meshai/dashboard/static/assets/index-BC90GDxp.css index 5f48927..766911d 100644 --- a/meshai/dashboard/static/assets/index-8oP3B9c2.css +++ b/meshai/dashboard/static/assets/index-BC90GDxp.css @@ -1 +1 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-m-6{margin:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[40vh\]{height:40vh}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[85vh\]{max-height:85vh}.min-h-\[36px\]{min-height:36px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[190px\]{width:190px}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-\[2px\]{width:2px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 30 30 / var(--tw-divide-opacity, 1))}.divide-slate-700\/60>:not([hidden])~:not([hidden]){border-color:#33415599}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#f59e0b\],.border-accent{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-accent-dim\/30{border-color:#d977064d}.border-accent\/30{border-color:#f59e0b4d}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 30 30 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e1e1e80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-sky-400{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-sky-400\/30{border-color:#38bdf84d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-accent{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#000000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d0d\]{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1420\]{--tw-bg-opacity: 1;background-color:rgb(13 20 32 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e1e1e\]{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]\/50{background-color:#1e2a3a80}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]\/10{background-color:#f59e0b1a}.bg-\[\#f59e0b\]\/20{background-color:#f59e0b33}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#f59e0b1a}.bg-accent\/20{background-color:#f59e0b33}.bg-accent\/5{background-color:#f59e0b0d}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0d0d0de6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-400\/10{background-color:#38bdf81a}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-\[\#555\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\[\#666\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.text-\[\#777\]{--tw-text-opacity: 1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.text-\[\#e0e0e0\]{--tw-text-opacity: 1;color:rgb(224 224 224 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\],.text-accent{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-200\/80{color:#fef08acc}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#f59e0b\]{accent-color:#f59e0b}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#111;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#111}::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#2a2a2a}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]\/50:hover{background-color:#1e2a3a80}.hover\:bg-\[\#2a3a4a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 58 74 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#f59e0b\]\/10:hover,.hover\:bg-accent\/10:hover{background-color:#f59e0b1a}.hover\:bg-accent\/80:hover{background-color:#f59e0bcc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-500\/10:hover{background-color:#64748b1a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-\[\#d97706\]:hover{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-\[\#f59e0b\]:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} +@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-m-6{margin:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[40vh\]{height:40vh}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[85vh\]{max-height:85vh}.min-h-\[36px\]{min-height:36px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[190px\]{width:190px}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-\[2px\]{width:2px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 30 30 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#f59e0b\],.border-accent{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-accent-dim\/30{border-color:#d977064d}.border-accent\/30{border-color:#f59e0b4d}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 30 30 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e1e1e80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-sky-400{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-sky-400\/30{border-color:#38bdf84d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-accent{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#000000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d0d\]{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1420\]{--tw-bg-opacity: 1;background-color:rgb(13 20 32 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e1e1e\]{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]\/50{background-color:#1e2a3a80}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]\/10{background-color:#f59e0b1a}.bg-\[\#f59e0b\]\/20{background-color:#f59e0b33}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#f59e0b1a}.bg-accent\/20{background-color:#f59e0b33}.bg-accent\/5{background-color:#f59e0b0d}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0d0d0de6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-400\/10{background-color:#38bdf81a}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/50{background-color:#1e293b80}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-\[\#555\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\[\#666\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.text-\[\#777\]{--tw-text-opacity: 1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.text-\[\#e0e0e0\]{--tw-text-opacity: 1;color:rgb(224 224 224 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\],.text-accent{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-200\/80{color:#fef08acc}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#f59e0b\]{accent-color:#f59e0b}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#111;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#111}::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#2a2a2a}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]\/50:hover{background-color:#1e2a3a80}.hover\:bg-\[\#2a3a4a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 58 74 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#f59e0b\]\/10:hover,.hover\:bg-accent\/10:hover{background-color:#f59e0b1a}.hover\:bg-accent\/80:hover{background-color:#f59e0bcc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-500\/10:hover{background-color:#64748b1a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-\[\#d97706\]:hover{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-\[\#f59e0b\]:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/meshai/dashboard/static/assets/index-cJev-9xo.js b/meshai/dashboard/static/assets/index-D5IfmtDv.js similarity index 98% rename from meshai/dashboard/static/assets/index-cJev-9xo.js rename to meshai/dashboard/static/assets/index-D5IfmtDv.js index d367b74..7b09958 100644 --- a/meshai/dashboard/static/assets/index-cJev-9xo.js +++ b/meshai/dashboard/static/assets/index-D5IfmtDv.js @@ -448,7 +448,7 @@ yyyy`);var n=to(t),i=r?"getUTC":"get",a=n[i+"FullYear"](),o=n[i+"Month"]()+1,s=n `:"";function n(i){var a=i.children,o=i.tag,s=i.attrs,l=i.text;return $ne(o,s)+(o!=="style"?hn(l):l||"")+(a?""+r+ae(a,function(u){return n(u)}).join(r)+r:"")+Yne(o)}return n(e)}function Xne(e,t,r){r=r||{};var n=r.newline?` `:"",i=" {"+n,a=n+"}",o=ae(Qe(e),function(l){return l+i+ae(Qe(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+a}).join(n),s=ae(Qe(t),function(l){return"@keyframes "+l+i+ae(Qe(t[l]),function(u){return u+i+ae(Qe(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+a}).join(n)+a}).join(n);return!o&&!s?"":[""].join(n)}function RT(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function NE(e,t,r,n){return Nr("svg","root",{width:e,height:t,xmlns:LG,"xmlns:xlink":NG,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var qne=0;function IG(){return qne++}var PE={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"},ql="transform-origin";function Kne(e,t,r){var n=Q({},e.shape);Q(n,t),e.buildPath(r,n);var i=new kG;return i.reset(JB(e)),r.rebuildPath(i,1),i.generateStr(),i.getStr()}function Jne(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[ql]=r+"px "+n+"px")}var Qne={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function DG(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function eie(e,t,r){var n=e.shape.paths,i={},a,o;if(j(n,function(l){var u=RT(r.zrId);u.animation=!0,I_(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=Qe(c),d=f.length;if(d){o=f[d-1];var g=c[o];for(var m in g){var y=g[m];i[m]=i[m]||{d:""},i[m].d+=y.d||""}for(var x in h){var _=h[x].animation;_.indexOf(o)>=0&&(a=_)}}}),!!a){t.d=!1;var s=DG(i,r);return a.replace(o,s)}}function IE(e){return he(e)?PE[e]?"cubic-bezier("+PE[e]+")":XM(e)?e:"":""}function I_(e,t,r,n){var i=e.animators,a=i.length,o=[];if(e instanceof Hp){var s=eie(e,t,r);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u0}).length){var Ee=DG(A,r);return Ee+" "+_[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var x=r.zrId+"-cls-"+IG();r.cssNodes["."+x]={animation:o.join(",")},t.class=x}}function tie(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};DE(n,t,r)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,l=e.currentStates.indexOf("select")>=0&&s||o;l&&(a=M0(l))}var u=i.lineWidth;if(u){var c=!i.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};a&&(n.fill=a),i.stroke&&(n.stroke=i.stroke),u&&(n["stroke-width"]=u),DE(n,t,r)}}function DE(e,t,r,n){var i=JSON.stringify(e),a=r.cssStyleCache[i];a||(a=r.zrId+"-cls-"+IG(),r.cssStyleCache[i]=a,r.cssNodes["."+a+":hover"]=e),t.class=t.class?t.class+" "+a:a}var vp=Math.round;function EG(e){return e&&he(e.src)}function jG(e){return e&&we(e.toDataURL)}function vk(e,t,r,n){Hne(function(i,a){var o=i==="fill"||i==="stroke";o&&KB(a)?OG(t,e,i,n):o&&KM(a)?zG(r,e,i,n):e[i]=a,o&&n.ssr&&a==="none"&&(e["pointer-events"]="visible")},t,r,!1),lie(r,e,n)}function pk(e,t){var r=oF(t);r&&(r.each(function(n,i){n!=null&&(e[(LE+i).toLowerCase()]=n+"")}),t.isSilent()&&(e[LE+"silent"]="true"))}function EE(e){return ks(e[0]-1)&&ks(e[1])&&ks(e[2])&&ks(e[3]-1)}function rie(e){return ks(e[4])&&ks(e[5])}function gk(e,t,r){if(t&&!(rie(t)&&EE(t))){var n=1e4;e.transform=EE(t)?"translate("+vp(t[4]*n)/n+" "+vp(t[5]*n)/n+")":OX(t)}}function jE(e,t,r){for(var n=e.points,i=[],a=0;a"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";Jr(f,y),Jr(d,y)}else if(f==null||d==null){var x=function(N,D){if(N){var O=N.elm,R=f||D.width,F=d||D.height;N.tag==="pattern"&&(u?(F=1,R/=a.width):c&&(R=1,F/=a.height)),N.attrs.width=R,N.attrs.height=F,O&&(O.setAttribute("width",R),O.setAttribute("height",F))}},_=oA(g,null,e,function(N){l||x(M,N),x(h,N)});_&&_.width&&_.height&&(f=f||_.width,d=d||_.height)}h=Nr("image","img",{href:g,width:f,height:d}),o.width=f,o.height=d}else i.svgElement&&(h=Se(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/a.width):c?(w=1,S=o.height/a.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var T=QB(i);T&&(o.patternTransform=T);var M=Nr("pattern","",o,[h]),A=dk(M),P=n.patternCache,I=P[A];I||(I=n.zrId+"-p"+n.patternIdx++,P[A]=I,o.id=I,M=n.defs[I]=Nr("pattern",I,o,[h])),t[r]=u_(I)}}function uie(e,t,r){var n=r.clipPathCache,i=r.defs,a=n[e.id];if(!a){a=r.zrId+"-c"+r.clipPathIdx++;var o={id:a};n[e.id]=a,i[a]=Nr("clipPath",a,o,[RG(e,r)])}t["clip-path"]=u_(a)}function zE(e){return document.createTextNode(e)}function nu(e,t,r){e.insertBefore(t,r)}function BE(e,t){e.removeChild(t)}function FE(e,t){e.appendChild(t)}function BG(e){return e.parentNode}function FG(e){return e.nextSibling}function aw(e,t){e.textContent=t}var VE=58,cie=120,hie=Nr("","");function OT(e){return e===void 0}function Na(e){return e!==void 0}function fie(e,t,r){for(var n={},i=t;i<=r;++i){var a=e[i].key;a!==void 0&&(n[a]=i)}return n}function Yd(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function pp(e){var t,r=e.children,n=e.tag;if(Na(n)){var i=e.elm=PG(n);if(mk(hie,e),re(r))for(t=0;ta?(g=r[l+1]==null?null:r[l+1].elm,VG(e,g,r,i,l)):nx(e,t,n,a))}function Hc(e,t){var r=t.elm=e.elm,n=e.children,i=t.children;e!==t&&(mk(e,t),OT(t.text)?Na(n)&&Na(i)?n!==i&&die(r,n,i):Na(i)?(Na(e.text)&&aw(r,""),VG(r,null,i,0,i.length-1)):Na(n)?nx(r,n,0,n.length-1):Na(e.text)&&aw(r,""):e.text!==t.text&&(Na(n)&&nx(r,n,0,n.length-1),aw(r,t.text)))}function vie(e,t){if(Yd(e,t))Hc(e,t);else{var r=e.elm,n=BG(r);pp(t),n!==null&&(nu(n,t.elm,FG(r)),nx(n,[e],0,0))}return t}var pie=0,gie=function(){function e(t,r,n){if(this.type="svg",this.refreshHover=GE(),this.configLayer=GE(),this.storage=r,this._opts=n=Q({},n),this.root=t,this._id="zr"+pie++,this._oldVNode=NE(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=PG("svg");mk(null,this._oldVNode),i.appendChild(a),t.appendChild(i)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",vie(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return OE(t,RT(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=RT(this._id);a.animation=t.animation,a.willUpdate=t.willUpdate,a.compress=t.compress,a.emphasis=t.emphasis,a.ssr=this._opts.ssr;var o=[],s=this._bgVNode=mie(n,i,this._backgroundColor,a);s&&o.push(s);var l=t.compress?null:this._mainVNode=Nr("g","main",{},[]);this._paintList(r,a,l?l.children:o),l&&o.push(l);var u=ae(Qe(a.defs),function(f){return a.defs[f]});if(u.length&&o.push(Nr("defs","defs",{},u)),t.animation){var c=Xne(a.cssNodes,a.cssAnims,{newline:!0});if(c){var h=Nr("style","stl",{},[],c);o.push(h)}}return NE(n,i,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},dk(this.renderToVNode({animation:be(t.cssAnimation,!0),emphasis:be(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:be(t.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(t){this._backgroundColor=t},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(t,r,n){for(var i=t.length,a=[],o=0,s,l,u=0,c=0;c=0&&!(f&&l&&f[m]===l[m]);m--);for(var y=g-1;y>m;y--)o--,s=a[o-1];for(var x=m+1;x=s)}}for(var h=this.__startIndex;h15)break}}F.prevElClipPaths&&x.restore()};if(_)if(_.length===0)P=y.__endIndex;else for(var N=d.dpr,D=0;D<_.length;++D){var O=_[D];x.save(),x.beginPath(),x.rect(O.x*N,O.y*N,O.width*N,O.height*N),x.clip(),I(O),x.restore()}else x.save(),I(),x.restore();y.__drawIndex=P,y.__drawIndex0&&t>i[0]){for(l=0;lt);l++);s=n[i[l]]}if(i.splice(l+1,0,t),n[t]=r,!r.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(r.dom,u.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)}},e.prototype.eachLayer=function(t,r){for(var n=this._zlevelList,i=0;i0?Em:0),this._needsManuallyCompositing),c.__builtin__||i_("ZLevel "+u+" has been used by unkown layer "+c.id),c!==a&&(c.__used=!0,c.__startIndex!==l&&(c.__dirty=!0),c.__startIndex=l,c.incremental?c.__drawIndex=-1:c.__drawIndex=l,r(l),a=c),i.__dirty&Xn&&!i.__inHover&&(c.__dirty=!0,c.incremental&&c.__drawIndex<0&&(c.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(h,f){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(t){t.clear()},e.prototype.setBackgroundColor=function(t){this._backgroundColor=t,j(this._layers,function(r){r.setUnpainted()})},e.prototype.configLayer=function(t,r){if(r){var n=this._layerConfig;n[t]?Ge(n[t],r,!0):n[t]=r;for(var i=0;i-1&&(u.style.stroke=u.style.fill,u.style.fill=K.color.neutral00,u.style.lineWidth=2),n},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},t}(bt);function Uh(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var i=Vh(e,t,r[0]);return i!=null?i+"":null}else if(n){for(var a=[],o=0;o=0&&n.push(t[a])}return n.join(" ")}var qp=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;return o.updateData(r,n,i,a),o}return t.prototype._createSymbol=function(r,n,i,a,o,s){this.removeAll();var l=sr(r,-1,-1,2,2,null,s);l.attr({z2:be(o,100),culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),l.drift=Tie,this._symbolType=r,this.add(l)},t.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Ho(this.childAt(0))},t.prototype.downplay=function(){Uo(this.childAt(0))},t.prototype.setZ=function(r,n){var i=this.childAt(0);i.zlevel=r,i.z=n},t.prototype.setDraggable=function(r,n){var i=this.childAt(0);i.draggable=r,i.cursor=!n&&r?"move":i.cursor},t.prototype.updateData=function(r,n,i,a){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=t.getSymbolSize(r,n),u=t.getSymbolZ2(r,n),c=o!==this._symbolType,h=a&&a.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,f)}else{var d=this.childAt(0);d.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?d.attr(g):it(d,g,s,n),Oi(d)}if(this._updateCommon(r,n,l,i,a),c){var d=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:d.style.opacity}};d.scaleX=d.scaleY=0,d.style.opacity=0,Nt(d,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,i,a,o){var s=this.childAt(0),l=r.hostModel,u,c,h,f,d,g,m,y,x;if(a&&(u=a.emphasisItemStyle,c=a.blurItemStyle,h=a.selectItemStyle,f=a.focus,d=a.blurScope,m=a.labelStatesModels,y=a.hoverScale,x=a.cursorStyle,g=a.emphasisDisabled),!a||r.hasItemOption){var _=a&&a.itemModel?a.itemModel:r.getItemModel(n),w=_.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),f=w.get("focus"),d=w.get("blurScope"),g=w.get("disabled"),m=Cr(_),y=w.getShallow("scale"),x=_.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var T=ec(r.getItemVisual(n,"symbolOffset"),i);T&&(s.x=T[0],s.y=T[1]),x&&s.attr("cursor",x);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof Er){var P=s.style;s.useStyle(Q({image:P.image,x:P.x,y:P.y,width:P.width,height:P.height},M))}else s.__isEmptyBrush?s.useStyle(Q({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var I=r.getItemVisual(n,"liftZ"),N=this._z2;I!=null?N==null&&(this._z2=s.z2,s.z2+=I):N!=null&&(s.z2=N,this._z2=null);var D=o&&o.useNameLabel;Dr(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:O,inheritColor:A,defaultOpacity:M.opacity});function O(H){return D?r.getName(H):Uh(r,H)}this._sizeX=i[0]/2,this._sizeY=i[1]/2;var R=s.ensureState("emphasis");R.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=c;var F=y==null||y===!0?Math.max(1.1,3/this._sizeY):isFinite(y)&&y>0?+y:1;R.scaleX=this._sizeX*F,R.scaleY=this._sizeY*F,this.setSymbolScale(1),Dt(this,f,d,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,i){var a=this.childAt(0),o=De(this).dataIndex,s=i&&i.animation;if(this.silent=a.silent=!0,i&&i.fadeLabel){var l=a.getTextContent();l&&el(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();el(a,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return _f(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(Ce);function Tie(e,t){this.parent.drift(e,t)}function sw(e,t,r,n){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(n.isIgnore&&n.isIgnore(r))&&!(n.clipShape&&!n.clipShape.contain(t[0],t[1]))&&e.getItemVisual(r,"symbol")!=="none"}function UE(e){return e!=null&&!ke(e)&&(e={isIgnore:e}),e||{}}function ZE(e){var t=e.hostModel,r=t.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Cr(t),cursorStyle:t.get("cursor")}}var Kp=function(){function e(t){this.group=new Ce,this._SymbolCtor=t||qp}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=UE(r);var n=this.group,i=t.hostModel,a=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=ZE(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};a||n.removeAll(),t.diff(a).add(function(h){var f=c(h);if(sw(t,f,h,r)){var d=new o(t,h,l,u);d.setPosition(f),t.setItemGraphicEl(h,d),n.add(d)}}).update(function(h,f){var d=a.getItemGraphicEl(f),g=c(h);if(!sw(t,g,h,r)){n.remove(d);return}var m=t.getItemVisual(h,"symbol")||"circle",y=d&&d.getSymbolType&&d.getSymbolType();if(!d||y&&y!==m)n.remove(d),d=new o(t,h,l,u),d.setPosition(g);else{d.updateData(t,h,l,u);var x={x:g[0],y:g[1]};s?d.attr(x):it(d,x,i)}n.add(d),t.setItemGraphicEl(h,d)}).remove(function(h){var f=a.getItemGraphicEl(h);f&&f.fadeOut(function(){n.remove(f)},i)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(){var t=this,r=this._data;r&&r.eachItemGraphicEl(function(n,i){var a=t._getSymbolPoint(i);n.setPosition(a),n.markRedraw()})},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=ZE(t),this._data=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[],n=UE(n);function i(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var a=t.start;a0?r=n[0]:n[1]<0&&(r=n[1]),r}function HG(e,t,r,n){var i=NaN;e.stacked&&(i=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=r.get(e.baseDim,n),o[1-a]=i,t.dataToPoint(o)}function Aie(e,t){var r=[];return t.diff(e).add(function(n){r.push({cmd:"+",idx:n})}).update(function(n,i){r.push({cmd:"=",idx:i,idx1:n})}).remove(function(n){r.push({cmd:"-",idx:n})}).execute(),r}function kie(e,t,r,n,i,a,o,s){for(var l=Aie(e,t),u=[],c=[],h=[],f=[],d=[],g=[],m=[],y=WG(i,t,o),x=e.getLayout("points")||[],_=t.getLayout("points")||[],w=0;w=i||m<0)break;if(Cu(x,_)){if(l){m+=a;continue}break}if(m===r)e[a>0?"moveTo":"lineTo"](x,_),h=x,f=_;else{var w=x-u,S=_-c;if(w*w+S*S<.5){m+=a;continue}if(o>0){for(var T=m+a,M=t[T*2],A=t[T*2+1];M===x&&A===_&&y=n||Cu(M,A))d=x,g=_;else{N=M-u,D=A-c;var F=x-u,H=M-x,W=_-c,V=A-_,z=void 0,Z=void 0;if(s==="x"){z=Math.abs(F),Z=Math.abs(H);var U=N>0?1:-1;d=x-U*z*o,g=_,O=x+U*Z*o,R=_}else if(s==="y"){z=Math.abs(W),Z=Math.abs(V);var $=D>0?1:-1;d=x,g=_-$*z*o,O=x,R=_+$*Z*o}else z=Math.sqrt(F*F+W*W),Z=Math.sqrt(H*H+V*V),I=Z/(Z+z),d=x-N*o*(1-I),g=_-D*o*(1-I),O=x+N*o*I,R=_+D*o*I,O=ls(O,us(M,x)),R=ls(R,us(A,_)),O=us(O,ls(M,x)),R=us(R,ls(A,_)),N=O-x,D=R-_,d=x-N*z/Z,g=_-D*z/Z,d=ls(d,us(u,x)),g=ls(g,us(c,_)),d=us(d,ls(u,x)),g=us(g,ls(c,_)),N=x-d,D=_-g,O=x+N*Z/z,R=_+D*Z/z}e.bezierCurveTo(h,f,d,g,x,_),h=O,f=R}else e.lineTo(x,_)}u=x,c=_,m+=a}return y}var UG=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),Lie=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polyline",n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new UG},t.prototype.buildPath=function(r,n){var i=n.points,a=0,o=i.length/2;if(n.connectNulls){for(;o>0&&Cu(i[o*2-2],i[o*2-1]);o--);for(;a=0){var S=u?(g-l)*w+l:(d-s)*w+s;return u?[r,S]:[S,r]}s=d,l=g;break;case o.C:d=a[h++],g=a[h++],m=a[h++],y=a[h++],x=a[h++],_=a[h++];var T=u?C0(s,d,m,x,r,c):C0(l,g,y,_,r,c);if(T>0)for(var M=0;M=0){var S=u?kr(l,g,y,_,A):kr(s,d,m,x,A);return u?[r,S]:[S,r]}}s=x,l=_;break}}},t}(Ke),Nie=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(UG),ZG=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polygon",n}return t.prototype.getDefaultShape=function(){return new Nie},t.prototype.buildPath=function(r,n){var i=n.points,a=n.stackedOnPoints,o=0,s=i.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&Cu(i[s*2-2],i[s*2-1]);s--);for(;ot){a?r.push(o(a,l,t)):i&&r.push(o(i,l,0),o(i,l,t));break}else i&&(r.push(o(i,l,0)),i=null),r.push(l),a=l}return r}function Die(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var i,a,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(i=s&&s.coordDim,i==="x"||i==="y"){a=n[o];break}}if(a){var l=t.getAxis(i),u=ae(a.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=a.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=Iie(u,i==="x"?r.getWidth():r.getHeight()),d=f.length;if(!d&&c)return u[0].coord<0?h[1]?h[1]:u[c-1].color:h[0]?h[0]:u[0].color;var g=10,m=f[0].coord-g,y=f[d-1].coord+g,x=y-m;if(x<.001)return"transparent";j(f,function(w){w.offset=(w.coord-m)/x}),f.push({offset:d?f[d-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:d?f[0].offset:.5,color:h[0]||"transparent"});var _=new qu(0,0,0,0,f,!0);return _[i]=m,_[i+"2"]=y,_}}}function Eie(e,t,r){var n=e.get("showAllSymbol"),i=n==="auto";if(!(n&&!i)){var a=r.getAxesByScale("ordinal")[0];if(a&&!(i&&jie(a,t))){var o=t.mapDimension(a.dim),s={};return j(a.getViewLabels(),function(l){var u=a.scale.getRawOrdinalNumber(l.tickValue);s[u]=1}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function jie(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;on)return!1;return!0}function Rie(e,t){return isNaN(e)||isNaN(t)}function Oie(e){for(var t=e.length/2;t>0&&Rie(e[t*2-2],e[t*2-1]);t--);return t-1}function KE(e,t){return[e[t*2],e[t*2+1]]}function zie(e,t,r){for(var n=e.length/2,i=r==="x"?0:1,a,o,s=0,l=-1,u=0;u=t||a>=t&&o<=t){l=u;break}s=u,a=o}return{range:[s,l],t:(t-a)/(o-a)}}function XG(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var Z=g.getState("emphasis").style;Z.lineWidth=+g.style.lineWidth+1}De(g).seriesIndex=r.seriesIndex,Dt(g,W,V,z);var U=qE(r.get("smooth")),$=r.get("smoothMonotone");if(g.setShape({smooth:U,smoothMonotone:$,connectNulls:A}),m){var Y=s.getCalculationInfo("stackedOnSeries"),te=0;m.useStyle(Ae(u.getAreaStyle(),{fill:O,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),Y&&(te=qE(Y.get("smooth"))),m.setShape({smooth:U,stackedOnSmooth:te,smoothMonotone:$,connectNulls:A}),Sr(m,r,"areaStyle"),De(m).seriesIndex=r.seriesIndex,Dt(m,W,V,z)}var ie=this._changePolyState;s.eachItemGraphicEl(function(se){se&&(se.onHoverStateChange=ie)}),this._polyline.onHoverStateChange=ie,this._data=s,this._coordSys=a,this._stackedOnPoints=T,this._points=c,this._step=N,this._valueOrigin=w,r.get("triggerLineEvent")&&(this.packEventData(r,g),m&&this.packEventData(r,m))},t.prototype.packEventData=function(r,n){De(n).eventData={componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line"}},t.prototype.highlight=function(r,n,i,a){var o=r.getData(),s=Ru(o,a);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],h=l[s*2+1];if(isNaN(c)||isNaN(h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=r.get("zlevel")||0,d=r.get("z")||0;u=new qp(o,s),u.x=c,u.y=h,u.setZ(f,d);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=f,g.z=d,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else gt.prototype.highlight.call(this,r,n,i,a)},t.prototype.downplay=function(r,n,i,a){var o=r.getData(),s=Ru(o,a);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else gt.prototype.downplay.call(this,r,n,i,a)},t.prototype._changePolyState=function(r){var n=this._polygon;j0(this._polyline,r),n&&j0(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new Lie({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new ZG({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(i),this._polygon=i,i},t.prototype._initSymbolLabelAnimation=function(r,n,i){var a,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(a=s.isHorizontal(),o=!1):n.type==="polar"&&(a=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");we(c)&&(c=c(null));var h=u.get("animationDelay")||0,f=we(h)?h(null):h;r.eachItemGraphicEl(function(d,g){var m=d;if(m){var y=[d.x,d.y],x=void 0,_=void 0,w=void 0;if(i)if(o){var S=i,T=n.pointToCoord(y);a?(x=S.startAngle,_=S.endAngle,w=-T[1]/180*Math.PI):(x=S.r0,_=S.r,w=T[0])}else{var M=i;a?(x=M.x,_=M.x+M.width,w=d.x):(x=M.y+M.height,_=M.y,w=d.y)}var A=_===x?0:(w-x)/(_-x);l&&(A=1-A);var P=we(h)?h(g):c*A+f,I=m.getSymbolPath(),N=I.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:P}),N&&N.animateFrom({style:{opacity:0}},{duration:300,delay:P}),I.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,i){var a=r.getModel("endLabel");if(XG(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new tt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=Oie(l);c>=0&&(Dr(s,Cr(r,"endLabel"),{inheritColor:i,labelFetcher:r,labelDataIndex:c,defaultText:function(h,f,d){return d!=null?GG(o,d):Uh(o,h)},enableTextSetter:!0},Bie(a,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,i,a,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&a.originalX==null&&(a.originalX=u.x,a.originalY=u.y);var h=i.getLayout("points"),f=i.hostModel,d=f.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),x=y.isHorizontal(),_=y.inverse,w=n.shape,S=_?x?w.x:w.y+w.height:x?w.x+w.width:w.y,T=(x?m:0)*(_?-1:1),M=(x?0:-m)*(_?-1:1),A=x?"x":"y",P=zie(h,S,A),I=P.range,N=I[1]-I[0],D=void 0;if(N>=1){if(N>1&&!d){var O=KE(h,I[0]);u.attr({x:O[0]+T,y:O[1]+M}),o&&(D=f.getRawValue(I[0]))}else{var O=c.getPointOn(S,A);O&&u.attr({x:O[0]+T,y:O[1]+M});var R=f.getRawValue(I[0]),F=f.getRawValue(I[1]);o&&(D=_F(i,g,R,F,P.t))}a.lastFrameIndex=I[0]}else{var H=r===1||a.lastFrameIndex>0?I[0]:0,O=KE(h,H);o&&(D=f.getRawValue(H)),u.attr({x:O[0]+T,y:O[1]+M})}if(o){var W=vf(u);typeof W.setLabelText=="function"&&W.setLabelText(D)}}},t.prototype._doUpdateAnimation=function(r,n,i,a,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,f=kie(this._data,r,this._stackedOnPoints,n,this._coordSys,i,this._valueOrigin),d=f.current,g=f.stackedOnCurrent,m=f.next,y=f.stackedOnNext;if(o&&(g=cs(f.stackedOnCurrent,f.current,i,o,l),d=cs(f.current,null,i,o,l),y=cs(f.stackedOnNext,f.next,i,o,l),m=cs(f.next,null,i,o,l)),XE(d,m)>3e3||c&&XE(g,y)>3e3){u.stopAnimation(),u.setShape({points:m}),c&&(c.stopAnimation(),c.setShape({points:m,stackedOnPoints:y}));return}u.shape.__points=f.current,u.shape.points=d;var x={shape:{points:m}};f.current!==d&&(x.shape.__points=f.next),u.stopAnimation(),it(u,x,h),c&&(c.setShape({points:d,stackedOnPoints:g}),c.stopAnimation(),it(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],w=f.status,S=0;St&&(t=e[r]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,r=0;r10&&o.type==="cartesian2d"&&a){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),d=Math.round(s/f);if(isFinite(d)&&d>1){a==="lttb"?t.setData(i.lttbDownSample(i.mapDimension(u.dim),1/d)):a==="minmax"&&t.setData(i.minmaxDownSample(i.mapDimension(u.dim),1/d));var g=void 0;he(a)?g=Vie[a]:we(a)&&(g=a),g&&t.setData(i.downSample(i.mapDimension(u.dim),1/d,g,Gie))}}}}}function Wie(e){e.registerChartView(Fie),e.registerSeriesModel(Cie),e.registerLayout(Qp("line",!0)),e.registerVisual({seriesType:"line",reset:function(t){var r=t.getData(),n=t.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,qG("line"))}var gp=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return no(null,this,{useEncodeDefaulter:!0})},t.prototype.getMarkerPosition=function(r,n,i){var a=this.coordinateSystem;if(a&&a.clampData){var o=a.clampData(r),s=a.dataToPoint(o);if(i)j(a.getAxes(),function(f,d){if(f.type==="category"&&n!=null){var g=f.getTicksCoords(),m=f.getTickModel().get("alignWithLabel"),y=o[d],x=n[d]==="x1"||n[d]==="y1";if(x&&!m&&(y+=1),g.length<2)return;if(g.length===2){s[d]=f.toGlobalCoord(f.getExtent()[x?1:0]);return}for(var _=void 0,w=void 0,S=1,T=0;Ty){w=(M+_)/2;break}T===1&&(S=A-g[0].tickValue)}w==null&&(_?_&&(w=g[g.length-1].coord):w=g[0].coord),s[d]=f.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=a.getBaseAxis().isHorizontal()?0:1;s[h]+=u+c/2}return s}return[NaN,NaN]},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",defaultBarGap:"10%"},t}(bt);bt.registerClass(gp);var Hie=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(){return no(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},t.prototype.getProgressiveThreshold=function(){var r=this.get("progressiveThreshold"),n=this.get("largeThreshold");return n>r&&(r=n),r},t.prototype.brushSelector=function(r,n,i){return i.rect(n.getItemLayout(r))},t.type="series.bar",t.dependencies=["grid","polar"],t.defaultOption=fl(gp.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(gp),Uie=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),ix=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="sausage",n}return t.prototype.getDefaultShape=function(){return new Uie},t.prototype.buildPath=function(r,n){var i=n.cx,a=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,u=o+l,c=n.startAngle,h=n.endAngle,f=n.clockwise,d=Math.PI*2,g=f?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var i=n.scale,a=i.getExtent(),o=Math.max(0,a[0]),s=Math.min(a[1],i.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==i.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,i,a){if(this._isOrderChangedWithinSameData(r,n,i)){var o=this._dataSort(r,i,n);this._isOrderDifferentInView(o,i)&&(this._removeOnRenderedListener(a),a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",axisId:i.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,i){var a=n.baseAxis,o=this._dataSort(r,a,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",isInitSort:!0,axisId:a.index,sortInfo:o})},t.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},t.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},t.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(r){var n=this.group,i=this._data;r&&r.isAnimationEnabled()&&i&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],i.eachItemGraphicEl(function(a){Do(a,r,De(a).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type="bar",t}(gt),JE={cartesian2d:function(e,t){var r=t.width<0?-1:1,n=t.height<0?-1:1;r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=uw(t.x,e.x),s=cw(t.x+t.width,i),l=uw(t.y,e.y),u=cw(t.y+t.height,a),c=si?s:o,t.y=h&&l>a?u:l,t.width=c?0:s-o,t.height=h?0:u-l,r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height),c||h},polar:function(e,t){var r=t.r0<=t.r?1:-1;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}var i=cw(t.r,e.r),a=uw(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},QE={cartesian2d:function(e,t,r,n,i,a,o,s,l){var u=new Ze({shape:Q({},n),z2:1});if(u.__dataIndex=r,u.name="item",a){var c=u.shape,h=i?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,i,a,o,s,l){var u=!i&&l?ix:Qr,c=new u({shape:n,z2:1});c.name="item";var h=KG(i);if(c.calculateTextPosition=Zie(h,{isRoundCap:u===ix}),a){var f=c.shape,d=i?"r":"endAngle",g={};f[d]=i?n.r0:n.startAngle,g[d]=n[d],(s?it:Nt)(c,{shape:g},a)}return c}};function qie(e,t){var r=e.get("realtimeSort",!0),n=t.getBaseAxis();if(r&&n.type==="category"&&t.type==="cartesian2d")return{baseAxis:n,otherAxis:t.getOtherAxis(n)}}function ej(e,t,r,n,i,a,o,s){var l,u;a?(u={x:n.x,width:n.width},l={y:n.y,height:n.height}):(u={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?it:Nt)(r,{shape:l},t,i,null);var c=t?e.baseAxis.model:null;(o?it:Nt)(r,{shape:u},c,i)}function tj(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+a*i/2,y:n.y+o*i/2,width:n.width-a*i,height:n.height-o*i}},polar:function(e,t,r){var n=e.getItemLayout(t);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function Qie(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function KG(e){return function(t){var r=t?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}}(e)}function nj(e,t,r,n,i,a,o,s){var l=t.getItemVisual(r,"style");if(s){if(!a.get("roundCap")){var c=e.shape,h=Ba(n.getModel("itemStyle"),c,!0);Q(c,h),e.setShape(c)}}else{var u=n.get(["itemStyle","borderRadius"])||0;e.setShape("r",u)}e.useStyle(l);var f=n.getShallow("cursor");f&&e.attr("cursor",f);var d=s?o?i.r>=i.r0?"endArc":"startArc":i.endAngle>=i.startAngle?"endAngle":"startAngle":o?i.height>=0?"bottom":"top":i.width>=0?"right":"left",g=Cr(n);Dr(e,g,{labelFetcher:a,labelDataIndex:r,defaultText:Uh(a.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:d});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,$ie(e,y==="outside"?d:y,KG(o),n.get(["label","rotate"]))}s6(m,g,a.getRawValue(r),function(_){return GG(t,_)});var x=n.getModel(["emphasis"]);Dt(e,x.get("focus"),x.get("blurScope"),x.get("disabled")),Sr(e,n),Qie(i)&&(e.style.fill="none",e.style.stroke="none",j(e.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function eae(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,i,a)}var tae=function(){function e(){}return e}(),ij=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeBar",n}return t.prototype.getDefaultShape=function(){return new tae},t.prototype.buildPath=function(r,n){for(var i=n.points,a=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function rae(e,t,r){for(var n=e.baseDimIdx,i=1-n,a=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=a.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function JG(e,t,r){if(tl(r,"cartesian2d")){var n=t,i=r.getArea();return{x:e?n.x:i.x,y:e?i.y:n.y,width:e?n.width:i.width,height:e?i.height:n.height}}else{var i=r.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}}function nae(e,t,r){var n=e.type==="polar"?Qr:Ze;return new n({shape:JG(t,r,e),silent:!0,z2:0})}function iae(e){e.registerChartView(Xie),e.registerSeriesModel(Hie),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Fe(tG,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,rG("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,qG("bar")),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(i){t.sortInfo&&i.axis.setCategorySortInfo(t.sortInfo)})})}var sj=Math.PI*2,zm=Math.PI/180;function aae(e,t,r){t.eachSeriesByType(e,function(n){var i=n.getData(),a=i.mapDimension("value"),o=T6(n,r),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=o.viewRect,f=-n.get("startAngle")*zm,d=n.get("endAngle"),g=n.get("padAngle")*zm;d=d==="auto"?f-sj:-d*zm;var m=n.get("minAngle")*zm,y=m+g,x=0;i.each(a,function(V){!isNaN(V)&&x++});var _=i.getSum(a),w=Math.PI/(_||x)*2,S=n.get("clockwise"),T=n.get("roseType"),M=n.get("stillShowZeroSum"),A=i.getDataExtent(a);A[0]=0;var P=S?1:-1,I=[f,d],N=P*g/2;m_(I,!S),f=I[0],d=I[1];var D=QG(n);D.startAngle=f,D.endAngle=d,D.clockwise=S,D.cx=s,D.cy=l,D.r=u,D.r0=c;var O=Math.abs(d-f),R=O,F=0,H=f;if(i.setLayout({viewRect:h,r:u}),i.each(a,function(V,z){var Z;if(isNaN(V)){i.setItemLayout(z,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:S,cx:s,cy:l,r0:c,r:T?NaN:u});return}T!=="area"?Z=_===0&&M?w:V*w:Z=O/x,ZZ?($=H+P*Z/2,Y=$):($=H+N,Y=U-N),i.setItemLayout(z,{angle:Z,startAngle:$,endAngle:Y,clockwise:S,cx:s,cy:l,r0:c,r:T?ht(V,A,[c,u]):u}),H=U}),Rr?x:y,T=Math.abs(w.label.y-r);if(T>=S.maxY){var M=w.label.x-t-w.len2*i,A=n+w.len,P=Math.abs(M)e.unconstrainedWidth?null:f:null;n.setStyle("width",d)}tW(a,n)}}}function tW(e,t){uj.rect=e,TG(uj,t,lae)}var lae={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},uj={};function hw(e){return e.position==="center"}function uae(e){var t=e.getData(),r=[],n,i,a=!1,o=(e.get("minShowLabelAngle")||0)*oae,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,f=s.height;function d(M){M.ignore=!0}function g(M){if(!M.ignore)return!0;for(var A in M.states)if(M.states[A].ignore===!1)return!0;return!1}t.each(function(M){var A=t.getItemGraphicEl(M),P=A.shape,I=A.getTextContent(),N=A.getTextGuideLine(),D=t.getItemModel(M),O=D.getModel("label"),R=O.get("position")||D.get(["emphasis","label","position"]),F=O.get("distanceToLabelLine"),H=O.get("alignTo"),W=ce(O.get("edgeDistance"),u),V=O.get("bleedMargin");V==null&&(V=Math.min(u,f)>200?10:2);var z=D.getModel("labelLine"),Z=z.get("length");Z=ce(Z,u);var U=z.get("length2");if(U=ce(U,u),Math.abs(P.endAngle-P.startAngle)0?"right":"left":Y>0?"left":"right"}var et=Math.PI,lt=0,Et=O.get("rotate");if(rt(Et))lt=Et*(et/180);else if(R==="center")lt=0;else if(Et==="radial"||Et===!0){var lr=Y<0?-$+et:-$;lt=lr}else if(Et==="tangential"&&R!=="outside"&&R!=="outer"){var Mr=Math.atan2(Y,te);Mr<0&&(Mr=et*2+Mr);var Gn=te>0;Gn&&(Mr=et+Mr),lt=Mr-et}if(a=!!lt,I.x=ie,I.y=se,I.rotation=lt,I.setStyle({verticalAlign:"middle"}),me){I.setStyle({align:Ee});var io=I.states.select;io&&(io.x+=I.x,io.y+=I.y)}else{var Wn=new Pe(0,0,0,0);tW(Wn,I),r.push({label:I,labelLine:N,position:R,len:Z,len2:U,minTurnAngle:z.get("minTurnAngle"),maxSurfaceAngle:z.get("maxSurfaceAngle"),surfaceNormal:new Ne(Y,te),linePoints:le,textAlign:Ee,labelDistance:F,labelAlignTo:H,edgeDistance:W,bleedMargin:V,rect:Wn,unconstrainedWidth:Wn.width,labelStyleWidth:I.style.width})}A.setTextConfig({inside:me})}}),!a&&e.get("avoidLabelOverlap")&&sae(r,n,i,l,u,f,c,h);for(var m=0;m0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=a.r0}},t.type="pie",t}(gt);function Tf(e,t,r){t=re(t)&&{coordDimensions:t}||Q({encodeDefine:e.getEncode()},t);var n=e.getSource(),i=bf(n,t).dimensions,a=new dn(i,e);return a.initData(n,r),a}var Mf=function(){function e(t,r){this._getDataWithEncodedVisual=t,this._getRawData=r}return e.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},e.prototype.containName=function(t){var r=this._getRawData();return r.indexOfName(t)>=0},e.prototype.indexOfName=function(t){var r=this._getDataWithEncodedVisual();return r.indexOfName(t)},e.prototype.getItemVisual=function(t,r){var n=this._getDataWithEncodedVisual();return n.getItemVisual(t,r)},e}(),fae=Ye(),rW=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Mf(fe(this.getData,this),fe(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return Tf(this,{coordDimensions:["value"],encodeDefaulter:Fe(zA,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),i=fae(n),a=i.seats;if(!a){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),a=i.seats=cF(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=a[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){ju(r,"labelLine",["show"]);var n=r.labelLine,i=r.emphasis.labelLine;n.show=n.show&&r.label.show,i.show=i.show&&r.emphasis.label.show},t.type="series.pie",t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"50%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,coordinateSystemUsage:"box",left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:30,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(bt);aQ({fullType:rW.type,getCoord2:function(e){return e.getShallow("center")}});function dae(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(i){var a=n.mapDimension("value"),o=n.get(a,i);return!(rt(o)&&!isNaN(o)&&o<0)})}}}function vae(e){e.registerChartView(hae),e.registerSeriesModel(rW),gV("pie",e.registerAction),e.registerLayout(Fe(aae,"pie")),e.registerProcessor(Cf("pie")),e.registerProcessor(dae("pie"))}var pae=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.getInitialData=function(r,n){return no(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?5e3:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?1e4:this.get("progressiveThreshold"))},t.prototype.brushSelector=function(r,n,i){return i.point(n.getItemLayout(r))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:"clone"}},t}(bt),nW=4,gae=function(){function e(){}return e}(),mae=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new gae},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.buildPath=function(r,n){var i=n.points,a=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&a[0]=0;u--){var c=u*2,h=a[c]-s/2,f=a[c+1]-l/2;if(r>=h&&n>=f&&r<=h+s&&n<=f+l)return u}return-1},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect();if(r=i[0],n=i[1],a.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,i=n.points,a=n.size,o=a[0],s=a[1],l=1/0,u=1/0,c=-1/0,h=-1/0,f=0;f=0&&(u.dataIndex=h+(t.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),xae=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this._updateSymbolDraw(a,r);o.updateData(a,{clipShape:this._getClipShape(r)}),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,i){var a=r.getData(),o=this._updateSymbolDraw(a,r);o.incrementalPrepareUpdate(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,i){this._symbolDraw.incrementalUpdate(r,n.getData(),{clipShape:this._getClipShape(n)}),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,i){var a=r.getData();if(this.group.dirty(),!this._finished||a.count()>1e4)return{update:!0};var o=Qp("").reset(r,n,i);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout(a)},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._getClipShape=function(r){if(r.get("clip",!0)){var n=r.coordinateSystem;return n&&n.getArea&&n.getArea(.1)}},t.prototype._updateSymbolDraw=function(r,n){var i=this._symbolDraw,a=n.pipelineContext,o=a.large;return(!i||o!==this._isLargeDraw)&&(i&&i.remove(),i=this._symbolDraw=o?new yae:new Kp,this._isLargeDraw=o,this.group.removeAll()),this.group.add(i.group),i},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(gt),iW={left:0,right:0,top:0,bottom:0},ax=["25%","25%"],_ae=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var i=Ju(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),i&&r.outerBounds&&Ka(r.outerBounds,i)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&Ka(this.option.outerBounds,r.outerBounds)},t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"15%",top:65,right:"10%",bottom:80,containLabel:!1,outerBoundsMode:"auto",outerBounds:iW,outerBoundsContain:"all",outerBoundsClampWidth:ax[0],outerBoundsClampHeight:ax[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}($e),BT=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ht).models[0]},t.type="cartesian2dAxis",t}($e);Qt(BT,Sf);var aW={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:K.color.axisLine,width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15],breakLine:!0},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,color:K.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:K.color.axisSplitLine,width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:[K.color.backgroundTint,K.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:K.color.neutral00,borderColor:K.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:"auto"}},bae=Ge({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},aW),yk=Ge({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:K.color.axisMinorSplitLine,width:1}}},aW),wae=Ge({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},yk),Sae=Ae({logBase:10},yk);const oW={category:bae,value:yk,time:wae,log:Sae};var Cae={value:1,category:1,time:1,log:1},FT=null;function Tae(e){FT||(FT=e)}function eg(){return FT}function Zh(e,t,r,n){j(Cae,function(i,a){var o=Ge(Ge({},oW[a],!0),n,!0),s=function(l){q(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=t+"Axis."+a,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var f=op(this),d=f?Ju(c):{},g=h.getTheme();Ge(c,g.get(a+"Axis")),Ge(c,this.getDefaultOption()),c.type=cj(c),f&&Ka(c,d,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=fp.createByAxisModel(this))},u.prototype.getCategories=function(c){var h=this.option;if(h.type==="category")return c?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.prototype.updateAxisBreaks=function(c){var h=eg();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+a,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",cj)}function cj(e){return e.type||(e.data?"category":"value")}var Mae=function(){function e(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return e.prototype.getAxis=function(t){return this._axes[t]},e.prototype.getAxes=function(){return ae(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),ot(this.getAxes(),function(r){return r.scale.type===t})},e.prototype.addAxis=function(t){var r=t.dim;this._axes[r]=t,this._dimList.push(r)},e}(),VT=["x","y"];function hj(e){return(e.type==="interval"||e.type==="time")&&!e.hasBreaks()}var Aae=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="cartesian2d",r.dimensions=VT,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!hj(r)||!hj(n))){var i=r.getExtent(),a=n.getExtent(),o=this.dataToPoint([i[0],a[0]]),s=this.dataToPoint([i[1],a[1]]),l=i[1]-i[0],u=a[1]-a[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,f=o[0]-i[0]*c,d=o[1]-a[0]*h,g=this._transform=[c,0,0,h,f,d];this._invTransform=ji([],g)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(r){var n=this.getAxis("x"),i=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&i.contain(i.toLocalCoord(r[1]))},t.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},t.prototype.containZone=function(r,n){var i=this.dataToPoint(r),a=this.dataToPoint(n),o=this.getArea(),s=new Pe(i[0],i[1],a[0]-i[0],a[1]-i[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,i){i=i||[];var a=r[0],o=r[1];if(this._transform&&a!=null&&isFinite(a)&&o!=null&&isFinite(o))return Kt(i,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return i[0]=s.toGlobalCoord(s.dataToCoord(a,n)),i[1]=l.toGlobalCoord(l.dataToCoord(o,n)),i},t.prototype.clampData=function(r,n){var i=this.getAxis("x").scale,a=this.getAxis("y").scale,o=i.getExtent(),s=a.getExtent(),l=i.parse(r[0]),u=a.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),n},t.prototype.pointToData=function(r,n,i){if(i=i||[],this._invTransform)return Kt(i,r,this._invTransform);var a=this.getAxis("x"),o=this.getAxis("y");return i[0]=a.coordToData(a.toLocalCoord(r[0]),n),i[1]=o.coordToData(o.toLocalCoord(r[1]),n),i},t.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},t.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),i=this.getAxis("y").getGlobalExtent(),a=Math.min(n[0],n[1])-r,o=Math.min(i[0],i[1])-r,s=Math.max(n[0],n[1])-a+r,l=Math.max(i[0],i[1])-o+r;return new Pe(a,o,s,l)},t}(Mae),sW=function(e){q(t,e);function t(r,n,i,a,o){var s=e.call(this,r,n,i)||this;return s.index=0,s.type=a||"value",s.position=o||"bottom",s}return t.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},t.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},t.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},t.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},t}(Vi),D_="expandAxisBreak",lW="collapseAxisBreak",uW="toggleAxisBreak",xk="axisbreakchanged",kae={type:D_,event:xk,update:"update",refineEvent:_k},Lae={type:lW,event:xk,update:"update",refineEvent:_k},Nae={type:uW,event:xk,update:"update",refineEvent:_k};function _k(e,t,r,n){var i=[];return j(e,function(a){i=i.concat(a.eventBreaks)}),{eventContent:{breaks:i}}}function Pae(e){e.registerAction(kae,t),e.registerAction(Lae,t),e.registerAction(Nae,t);function t(r,n){var i=[],a=_h(n,r);function o(s,l){j(a[s],function(u){var c=u.updateAxisBreaks(r);j(c.breaks,function(h){var f;i.push(Ae((f={},f[l]=u.componentIndex,f),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:i}}}var Ls=Math.PI,Iae=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],Dae=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],$h=Ye(),cW=Ye(),hW=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,i=this.recordMap,a=i[r]||(i[r]=[]);return a[n]||(a[n]={ready:{}})},e}();function Eae(e,t,r,n){var i=r.axis,a=t.ensureRecord(r),o=[],s,l=bk(e.axisName)&&Hh(e.nameLocation);j(n,function(g){var m=Ja(g);if(!(!m||m.label.ignore)){o.push(m);var y=a.transGroup;l&&(y.transform?ji(bd,y.transform):zp(bd),m.transform&&aa(bd,bd,m.transform),Pe.copy(Bm,m.localRect),Bm.applyTransform(bd),s?s.union(Bm):Pe.copy(s=new Pe(0,0,0,0),Bm))}});var u=Math.abs(a.dirVec.x)>.1?"x":"y",c=a.transGroup[u];if(o.sort(function(g,m){return Math.abs(g.label[u]-c)-Math.abs(m.label[u]-c)}),l&&s){var h=i.getExtent(),f=Math.min(h[0],h[1]),d=Math.max(h[0],h[1])-f;s.union(new Pe(f,0,d,1))}a.stOccupiedRect=s,a.labelInfoList=o}var bd=Pr(),Bm=new Pe(0,0,0,0),fW=function(e,t,r,n,i,a){if(Hh(e.nameLocation)){var o=a.stOccupiedRect;o&&dW(Ine({},o,a.transGroup.transform),n,i)}else vW(a.labelInfoList,a.dirVec,n,i)};function dW(e,t,r){var n=new Ne;P_(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&IT(t,n)}function vW(e,t,r,n){for(var i=Ne.dot(n,t)>=0,a=0,o=e.length;a0?"top":"bottom",a="center"):Oh(i-Ls)?(o=n>0?"bottom":"top",a="center"):(o="middle",i>0&&i0?"right":"left":a=n>0?"left":"right"),{rotation:i,textAlign:a,textVerticalAlign:o}},e.makeAxisEventDataBase=function(t){var r={componentType:t.mainType,componentIndex:t.componentIndex};return r[t.mainType+"Index"]=t.componentIndex,r},e.isLabelSilent=function(t){var r=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||r&&r.show)},e}(),jae=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],Rae={axisLine:function(e,t,r,n,i,a,o){var s=n.get(["axisLine","show"]);if(s==="auto"&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),!!s){var l=n.axis.getExtent(),u=a.transform,c=[l[0],0],h=[l[1],0],f=c[0]>h[0];u&&(Kt(c,c,u),Kt(h,h,u));var d=Q({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:d};if(n.get(["axisLine","breakLine"])&&n.axis.scale.hasBreaks())eg().buildAxisBreakLine(n,i,a,g);else{var m=new ar(Q({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));Fh(m.shape,m.style.lineWidth),m.anid="line",i.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var x=n.get(["axisLine","symbolSize"]);he(y)&&(y=[y,y]),(he(x)||rt(x))&&(x=[x,x]);var _=ec(n.get(["axisLine","symbolOffset"])||0,x),w=x[0],S=x[1];j([{rotate:e.rotation+Math.PI/2,offset:_[0],r:0},{rotate:e.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(T,M){if(y[M]!=="none"&&y[M]!=null){var A=sr(y[M],-w/2,-S/2,w,S,d.stroke,!0),P=T.r+T.offset,I=f?h:c;A.attr({rotation:T.rotate,x:I[0]+P*Math.cos(e.rotation),y:I[1]-P*Math.sin(e.rotation),silent:!0,z2:11}),i.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,i,a,o,s){var l=dj(t,i,s);l&&fj(e,t,r,n,i,a,o,da.estimate)},axisTickLabelDetermine:function(e,t,r,n,i,a,o,s){var l=dj(t,i,s);l&&fj(e,t,r,n,i,a,o,da.determine);var u=Fae(e,i,a,n);Bae(e,t.labelLayoutList,u),Vae(e,i,a,n,e.tickDirection)},axisName:function(e,t,r,n,i,a,o,s){var l=r.ensureRecord(n);t.nameEl&&(i.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(bk(u)){var c=e.nameLocation,h=e.nameDirection,f=n.getModel("nameTextStyle"),d=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Ne(0,0),x=new Ne(0,0);c==="start"?(y.x=g[0]-m*d,x.x=-m):c==="end"?(y.x=g[1]+m*d,x.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*d,x.y=h);var _=Pr();x.transform(Ko(_,_,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*Ls/180);var S,T;Hh(c)?S=wn.innerTextLayout(e.rotation,w??e.rotation,h):(S=Oae(e.rotation,c,w||0,g),T=e.raw.axisNameAvailableWidth,T!=null&&(T=Math.abs(T/Math.sin(S.rotation)),!isFinite(T)&&(T=null)));var M=f.getFont(),A=n.get("nameTruncate",!0)||{},P=A.ellipsis,I=Fr(e.raw.nameTruncateMaxWidth,A.maxWidth,T),N=s.nameMarginLevel||0,D=new tt({x:y.x,y:y.y,rotation:S.rotation,silent:wn.isLabelSilent(n),style:Ct(f,{text:u,font:M,overflow:"truncate",width:I,ellipsis:P,fill:f.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:f.get("align")||S.textAlign,verticalAlign:f.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(Qo({el:D,componentModel:n,itemName:u}),D.__fullText=u,D.anid="name",n.get("triggerEvent")){var O=wn.makeAxisEventDataBase(n);O.targetType="axisName",O.name=u,De(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var R=l.nameLayout=Ja({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:Hh(c)?Iae[N]:Dae[N]});if(l.nameLocation=c,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&R){var F=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,R,x,F)}}}};function fj(e,t,r,n,i,a,o,s){gW(t)||Gae(e,t,i,s,n,o);var l=t.labelLayoutList;Wae(e,n,l,a),Zae(n,e.rotation,l);var u=e.optionHideOverlap;zae(n,l,u),u&&MG(ot(l,function(c){return c&&!c.label.ignore})),Eae(e,r,n,l)}function Oae(e,t,r,n){var i=eA(r-e),a,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return Oh(i-Ls/2)?(o=l?"bottom":"top",a="center"):Oh(i-Ls*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",iLs/2?a=l?"left":"right":a=l?"right":"left"),{rotation:i,textAlign:a,textVerticalAlign:o}}function zae(e,t,r){if(uG(e.axis))return;function n(s,l,u){var c=Ja(t[l]),h=Ja(t[u]);if(!(!c||!h)){if(s===!1||c.suggestIgnore){Xd(c.label);return}if(h.suggestIgnore){Xd(h.label);return}var f=.1;if(!r){var d=[0,0,0,0];c=DT({marginForce:d},c),h=DT({marginForce:d},h)}P_(c,h,null,{touchThreshold:f})&&Xd(s?h.label:c.label)}}var i=e.get(["axisLabel","showMinLabel"]),a=e.get(["axisLabel","showMaxLabel"]),o=t.length;n(i,0,1),n(a,o-1,o-2)}function Bae(e,t,r){e.showMinorTicks||j(t,function(n){if(n&&n.label.ignore)for(var i=0;iu[0]&&isFinite(g)&&isFinite(u[0]);)d=qb(d),g=u[1]-d*o;else{var y=e.getTicks().length-1;y>o&&(d=qb(d));var x=d*o;m=Math.ceil(u[1]/d)*d,g=ir(m-x),g<0&&u[0]>=0?(g=0,m=ir(x)):m>0&&u[1]<=0&&(m=0,g=-ir(x))}var _=(i[0].value-a[0].value)/s,w=(i[o].value-a[o].value)/s;n.setExtent.call(e,g+d*_,m+d*w),n.setInterval.call(e,d),(_||w)&&n.setNiceExtent.call(e,g+d,m-d)}var pj=[[3,1],[0,2]],qae=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=VT,this._initCartesian(t,r,n),this.model=t}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(t,r){var n=this._axesMap;this._updateScale(t,this.model);function i(o){var s,l=Qe(o),u=l.length;if(u){for(var c=[],h=u-1;h>=0;h--){var f=+l[h],d=o[f],g=d.model,m=d.scale;MT(m)&&g.get("alignTicks")&&g.get("interval")==null?c.push(d):(Gu(m,g),MT(m)&&(s=d))}c.length&&(s||(s=c.pop(),Gu(s.scale,s.model)),j(c,function(y){mW(y.scale,y.model,s.scale)}))}}i(n.x),i(n.y);var a={};j(n.x,function(o){gj(n,"y",o,a)}),j(n.y,function(o){gj(n,"x",o,a)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var i=Tr(t,r),a=this._rect=It(t.getBoxLayoutParams(),i.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(WT(o,a),!n){var u=Qae(a,s,o,l,r),c=void 0;if(l)HT?(HT(this._axesList,a),WT(o,a)):c=xj(a.clone(),"axisLabel",null,a,o,u,i);else{var h=eoe(t,a,i),f=h.outerBoundsRect,d=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;f&&(c=xj(f,d,g,a,o,u,i))}yW(a,o,da.determine,null,c,i)}j(this._coordsList,function(m){m.calcAffineTransform()})},e.prototype.getAxis=function(t,r){var n=this._axesMap[t];if(n!=null)return n[r||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(t,r){if(t!=null&&r!=null){var n="x"+t+"y"+r;return this._coordsMap[n]}ke(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var i=0,a=this._coordsList;i0})==null;return Bu(n,s,!0,!0,r),WT(i,n),l;function u(f){j(i[Oe[f]],function(d){if(dp(d.model)){var g=a.ensureRecord(d.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!Xr(d)&&d>1e-4&&(f/=d),f}}function Qae(e,t,r,n,i){var a=new hW(toe);return j(r,function(o){return j(o,function(s){if(dp(s.model)){var l=!n;s.axisBuilder=Yae(e,t,s.model,i,a,l)}})}),a}function yW(e,t,r,n,i,a){var o=r===da.determine;j(t,function(u){return j(u,function(c){dp(c.model)&&(Xae(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[Oe[1-u]]=e[pr[u]]<=a.refContainer[pr[u]]*.5?0:1-u===1?2:1}j(t,function(u,c){return j(u,function(h){dp(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function eoe(e,t,r){var n,i=e.get("outerBoundsMode",!0);i==="same"?n=t.clone():(i==null||i==="auto")&&(n=It(e.get("outerBounds",!0)||iW,r.refContainer));var a=e.get("outerBoundsContain",!0),o;a==null||a==="auto"||Ve(["all","axisLabel"],a)<0?o="all":o=a;var s=[P0(be(e.get("outerBoundsClampWidth",!0),ax[0]),t.width),P0(be(e.get("outerBoundsClampHeight",!0),ax[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var toe=function(e,t,r,n,i,a){var o=r.axis.dim==="x"?"y":"x";fW(e,t,r,n,i,a),Hh(e.nameLocation)||j(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&vW(s.labelInfoList,s.dirVec,n,i)})};function roe(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return noe(r,e,t),r.seriesInvolved&&aoe(r,e),r}function noe(e,t,r){var n=t.getComponent("tooltip"),i=t.getComponent("axisPointer"),a=i.get("link",!0)||[],o=[];j(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=mp(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(j(s.getAxes(),Fe(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var f=h.get("trigger")==="axis",d=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(f||d)&&j(g.baseAxes,Fe(m,d?"cross":!0,f)),d&&j(g.otherAxes,Fe(m,"cross",!1))}function m(y,x,_){var w=_.model.getModel("axisPointer",i),S=w.get("show");if(!(!S||S==="auto"&&!y&&!UT(w))){x==null&&(x=w.get("triggerTooltip")),w=y?ioe(_,h,i,t,y,x):w;var T=w.get("snap"),M=w.get("triggerEmphasis"),A=mp(_.model),P=x||T||_.type==="category",I=e.axesInfo[A]={key:A,axis:_,coordSys:s,axisPointerModel:w,triggerTooltip:x,triggerEmphasis:M,involveSeries:P,snap:T,useHandle:UT(w),seriesModels:[],linkGroup:null};u[A]=I,e.seriesInvolved=e.seriesInvolved||P;var N=ooe(a,_);if(N!=null){var D=o[N]||(o[N]={axesInfo:{}});D.axesInfo[A]=I,D.mapper=a[N].mapper,I.linkGroup=D}}}})}function ioe(e,t,r,n,i,a){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};j(s,function(f){l[f]=Se(o.get(f))}),l.snap=e.type!=="category"&&!!a,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),i==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!a){var h=l.lineStyle=o.get("crossStyle");h&&Ae(u,h.textStyle)}}return e.model.getModel("axisPointer",new qe(l,r,n))}function aoe(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,i=r.get(["tooltip","trigger"],!0),a=r.get(["tooltip","show"],!0);!n||!n.model||i==="none"||i===!1||i==="item"||a===!1||r.get(["axisPointer","show"],!0)===!1||j(e.coordSysAxesInfo[mp(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function ooe(e,t){for(var r=t.model,n=t.dim,i=0;i=0||e===t}function soe(e){var t=wk(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,i=r.option,a=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=UT(r);a==null&&(i.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var voe=Ye();function wj(e,t,r,n){if(e instanceof sW){var i=e.scale.type;if(i!=="category"&&i!=="ordinal")return r}var a=e.model,o=a.get("jitter"),s=a.get("jitterOverlap"),l=a.get("jitterMargin")||0,u=e.scale.type==="ordinal"?e.getBandWidth():null;return o>0?s?CW(r,o,u,n):poe(e,t,r,n,o,l):r}function CW(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var i=r-n*2,a=Math.min(Math.max(0,t),i);return e+(Math.random()-.5)*a}function poe(e,t,r,n,i,a){var o=voe(e);o.items||(o.items=[]);var s=o.items,l=Sj(s,t,r,n,i,a,1),u=Sj(s,t,r,n,i,a,-1),c=Math.abs(l-r)i/2||h&&f>h/2-n?CW(r,i,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function Sj(e,t,r,n,i,a,o){for(var s=r,l=0;li/2)return Number.MAX_VALUE;if(o===1&&g>s||o===-1&&g0&&!g.min?g.min=0:g.min!=null&&g.min<0&&!g.max&&(g.max=0);var m=l;g.color!=null&&(m=Ae({color:g.color},l));var y=Ge(Se(g),{boundaryGap:r,splitNumber:n,scale:i,axisLine:a,axisTick:o,axisLabel:s,name:g.text,showName:u,nameLocation:"end",nameGap:h,nameTextStyle:m,triggerEvent:f},!1);if(he(c)){var x=y.name;y.name=c.replace("{value}",x??"")}else we(c)&&(y.name=c(y.name,y));var _=new qe(y,null,this.ecModel);return Qt(_,Sf.prototype),_.mainType="radar",_.componentIndex=this.componentIndex,_},this);this._indicatorModels=d},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type="radar",t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Ge({lineStyle:{color:K.color.neutral20}},wd.axisLine),axisLabel:Fm(wd.axisLabel,!1),axisTick:Fm(wd.axisTick,!1),splitLine:Fm(wd.splitLine,!0),splitArea:Fm(wd.splitArea,!0),indicator:[]},t}($e),Coe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group;a.removeAll(),this._buildAxes(r,i),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var i=r.coordinateSystem,a=i.getIndicatorAxes(),o=ae(a,function(s){var l=s.model.get("showName")?s.name:"",u=new wn(s.model,n,{axisName:l,position:[i.cx,i.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});j(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,i=n.getIndicatorAxes();if(!i.length)return;var a=r.get("shape"),o=r.getModel("splitLine"),s=r.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),h=s.get("show"),f=l.get("color"),d=u.get("color"),g=re(f)?f:[f],m=re(d)?d:[d],y=[],x=[];function _(H,W,V){var z=V%W.length;return H[z]=H[z]||[],z}if(a==="circle")for(var w=i[0].getTicksCoords(),S=n.cx,T=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=a>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(i){var h=Math.abs(a),f=(a>0?1:-1)*(h>3?.4:h>1?.15:.05);this._checkTriggerMoveZoom(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:f,originX:s,originY:l,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(r){if(!(Mj(this._zr,"globalPan")||Sd(r))){var n=r.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(r,n,i,a,o){r._checkPointer(a,o.originX,o.originY)&&(Wo(a.event),a.__ecRoamConsumed=!0,Aj(r,n,i,a,o))},t}(Bi);function Sd(e){return e.__ecRoamConsumed}var Ioe=Ye();function E_(e){var t=Ioe(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function Cd(e,t,r,n){for(var i=E_(e),a=i.roam,o=a[t]=a[t]||[],s=0;s=4&&(c={x:parseFloat(f[0]||0),y:parseFloat(f[1]||0),width:parseFloat(f[2]),height:parseFloat(f[3])})}if(c&&s!=null&&l!=null&&(h=NW(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var d=i;i=new Ce,i.add(d),d.scaleX=d.scaleY=h.scale,d.x=h.x,d.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&i.setClipPath(new Ze({shape:{x:0,y:0,width:s,height:l}})),{root:i,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:a}},e.prototype._parseNode=function(t,r,n,i,a,o){var s=t.nodeName.toLowerCase(),l,u=i;if(s==="defs"&&(a=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!a){var c=vw[s];if(c&&ge(vw,s)){l=c.call(this,t,r);var h=t.getAttribute("name");if(h){var f={name:h,namedFrom:null,svgNodeTagLower:s,el:l};n.push(f),s==="g"&&(u=f)}else i&&n.push({name:i.name,namedFrom:i,svgNodeTagLower:s,el:l});r.add(l)}}var d=Pj[s];if(d&&ge(Pj,s)){var g=d.call(this,t),m=t.getAttribute("id");m&&(this._defs[m]=g)}}if(l&&l.isGroup)for(var y=t.firstChild;y;)y.nodeType===1?this._parseNode(y,l,n,u,a,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new zh({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});vi(r,n),Un(t,n,this._defsUsePending,!1,!1),Roe(n,r);var i=n.style,a=i.fontSize;a&&a<9&&(i.fontSize=9,n.scaleX*=a/9,n.scaleY*=a/9);var o=(i.fontSize||i.fontFamily)&&[i.fontStyle,i.fontWeight,(i.fontSize||12)+"px",i.fontFamily||"sans-serif"].join(" ");i.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){vw={g:function(t,r){var n=new Ce;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new Ze;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(t,r){var n=new ro;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),n.silent=!0,n},line:function(t,r){var n=new ar;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(t,r){var n=new Gp;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(t,r){var n=t.getAttribute("points"),i;n&&(i=Ej(n));var a=new en({shape:{points:i||[]},silent:!0});return vi(r,a),Un(t,a,this._defsUsePending,!1,!1),a},polyline:function(t,r){var n=t.getAttribute("points"),i;n&&(i=Ej(n));var a=new Gr({shape:{points:i||[]},silent:!0});return vi(r,a),Un(t,a,this._defsUsePending,!1,!1),a},image:function(t,r){var n=new Er;return vi(r,n),Un(t,n,this._defsUsePending,!1,!1),n.setStyle({image:t.getAttribute("xlink:href")||t.getAttribute("href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),n.silent=!0,n},text:function(t,r){var n=t.getAttribute("x")||"0",i=t.getAttribute("y")||"0",a=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(a),this._textY=parseFloat(i)+parseFloat(o);var s=new Ce;return vi(r,s),Un(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),i=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),i!=null&&(this._textY=parseFloat(i));var a=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new Ce;return vi(r,s),Un(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",i=ZF(n);return vi(r,i),Un(t,i,this._defsUsePending,!1,!1),i.silent=!0,i}}}(),e}(),Pj={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),r=parseInt(e.getAttribute("y1")||"0",10),n=parseInt(e.getAttribute("x2")||"10",10),i=parseInt(e.getAttribute("y2")||"0",10),a=new qu(t,r,n,i);return Ij(e,a),Dj(e,a),a},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),r=parseInt(e.getAttribute("cy")||"0",10),n=parseInt(e.getAttribute("r")||"0",10),i=new pA(t,r,n);return Ij(e,i),Dj(e,i),i}};function Ij(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function Dj(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),i=void 0;n&&n.indexOf("%")>0?i=parseInt(n,10)/100:n?i=parseFloat(n):i=0;var a={};LW(r,a,a);var o=a.stopColor||r.getAttribute("stop-color")||"#000000",s=a.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=fn(o),u=l&&l[3];u&&(l[3]*=Po(s),o=Li(l,"rgba"))}t.colorStops.push({offset:i,color:o})}r=r.nextSibling}}function vi(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Ae(t.__inheritedStyle,e.__inheritedStyle))}function Ej(e){for(var t=R_(e),r=[],n=0;n0;a-=2){var o=n[a],s=n[a-1],l=R_(o);switch(i=i||Pr(),s){case"translate":ha(i,i,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":l_(i,i,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Ko(i,i,-parseFloat(l[0])*pw,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*pw);aa(i,[1,0,u,1,0,0],i);break;case"skewY":var c=Math.tan(parseFloat(l[0])*pw);aa(i,[1,c,0,1,0,0],i);break;case"matrix":i[0]=parseFloat(l[0]),i[1]=parseFloat(l[1]),i[2]=parseFloat(l[2]),i[3]=parseFloat(l[3]),i[4]=parseFloat(l[4]),i[5]=parseFloat(l[5]);break}}t.setLocalTransform(i)}}var Rj=/([^\s:;]+)\s*:\s*([^:;]+)/g;function LW(e,t,r){var n=e.getAttribute("style");if(n){Rj.lastIndex=0;for(var i;(i=Rj.exec(n))!=null;){var a=i[1],o=ge(sx,a)?sx[a]:null;o&&(t[o]=i[2]);var s=ge(lx,a)?lx[a]:null;s&&(r[s]=i[2])}}}function Goe(e,t,r){for(var n=0;n0,_={api:n,geo:l,mapOrGeoModel:t,data:s,isVisualEncodedByVisualMap:x,isGeo:o,transformInfoRaw:f};l.resourceType==="geoJSON"?this._buildGeoJSON(_):l.resourceType==="geoSVG"&&this._buildSVG(_),this._updateController(t,y,r,n),this._updateMapSelectHandler(t,u,n,i)},e.prototype._buildGeoJSON=function(t){var r=this._regionsGroupByName=_e(),n=_e(),i=this._regionsGroup,a=t.transformInfoRaw,o=t.mapOrGeoModel,s=t.data,l=t.geo.projection,u=l&&l.stream;function c(d,g){return g&&(d=g(d)),d&&[d[0]*a.scaleX+a.x,d[1]*a.scaleY+a.y]}function h(d){for(var g=[],m=!u&&l&&l.project,y=0;y=0)&&(f=i);var d=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Dr(t,Cr(n),{labelFetcher:f,labelDataIndex:h,defaultText:r},d);var g=t.getTextContent();if(g&&(PW(g).ignore=g.ignore,t.textConfig&&o)){var m=t.getBoundingRect().clone();t.textConfig.layoutRect=m,t.textConfig.position=[(o[0]-m.x)/m.width*100+"%",(o[1]-m.y)/m.height*100+"%"]}t.disableLabelAnimation=!0}else t.removeTextContent(),t.removeTextConfig(),t.disableLabelAnimation=null}function Vj(e,t,r,n,i,a){e.data?e.data.setItemGraphicEl(a,t):De(t).eventData={componentType:"geo",componentIndex:i.componentIndex,geoIndex:i.componentIndex,name:r,region:n&&n.option||{}}}function Gj(e,t,r,n,i){e.data||Qo({el:t,componentModel:i,itemName:r,itemTooltipOption:n.get("tooltip")})}function Wj(e,t,r,n,i){t.highDownSilentOnTouch=!!i.get("selectedMode");var a=n.getModel("emphasis"),o=a.get("focus");return Dt(t,o,a.get("blurScope"),a.get("disabled")),e.isGeo&&KK(t,i,r),o}function Hj(e,t,r){var n=[],i;function a(){i=[]}function o(){i.length&&(n.push(i),i=[])}var s=t({polygonStart:a,polygonEnd:o,lineStart:a,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&i.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),j(e,function(l){s.lineStart();for(var u=0;u-1&&(i.style.stroke=i.style.fill,i.style.fill=K.color.neutral00,i.style.lineWidth=2),i},t.type="series.map",t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:K.color.tertiary},itemStyle:{borderWidth:.5,borderColor:K.color.border,areaColor:K.color.background},emphasis:{label:{show:!0,color:K.color.primary},itemStyle:{areaColor:K.color.highlight}},select:{label:{show:!0,color:K.color.primary},itemStyle:{color:K.color.highlight}},nameProperty:"name"},t}(bt);function lse(e,t){var r={};return j(e,function(n){n.each(n.mapDimension("value"),function(i,a){var o="ec-"+n.getName(a);r[o]=r[o]||[],isNaN(i)||r[o].push(i)})}),e[0].map(e[0].mapDimension("value"),function(n,i){for(var a="ec-"+e[0].getName(i),o=0,s=1/0,l=-1/0,u=r[a].length,c=0;c1?(w.width=_,w.height=_/m):(w.height=_,w.width=_*m),w.y=x[1]-w.height/2,w.x=x[0]-w.width/2;else{var S=e.getBoxLayoutParams();S.aspect=m,w=It(S,g),w=M6(e,w,m)}this.setViewRect(w.x,w.y,w.width,w.height),this.setCenter(e.get("center")),this.setZoom(e.get("zoom"))}function fse(e,t){j(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var dse=function(){function e(){this.dimensions=DW}return e.prototype.create=function(t,r){var n=[];function i(o){return{nameProperty:o.get("nameProperty"),aspectScale:o.get("aspectScale"),projection:o.get("projection")}}t.eachComponent("geo",function(o,s){var l=o.get("map"),u=new YT(l+s,l,Q({nameMap:o.get("nameMap"),api:r,ecModel:t},i(o)));u.zoomLimit=o.get("scaleLimit"),n.push(u),o.coordinateSystem=u,u.model=o,u.resize=Yj,u.resize(o,r)}),t.eachSeries(function(o){$p({targetModel:o,coordSysType:"geo",coordSysProvider:function(){var s=o.subType==="map"?o.getHostGeoModel():o.getReferringComponents("geo",Ht).models[0];return s&&s.coordinateSystem},allowNotFound:!0})});var a={};return t.eachSeriesByType("map",function(o){if(!o.getHostGeoModel()){var s=o.getMapType();a[s]=a[s]||[],a[s].push(o)}}),j(a,function(o,s){var l=ae(o,function(c){return c.get("nameMap")}),u=new YT(s,s,Q({nameMap:a_(l),api:r,ecModel:t},i(o[0])));u.zoomLimit=Fr.apply(null,ae(o,function(c){return c.get("scaleLimit")})),n.push(u),u.resize=Yj,u.resize(o[0],r),j(o,function(c){c.coordinateSystem=u,fse(u,c)})}),n},e.prototype.getFilledRegions=function(t,r,n,i){for(var a=(t||[]).slice(),o=_e(),s=0;s=0;o--){var s=i[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function xse(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,i=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){bse(e);var a=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;i?(e.hierNode.prelim=i.hierNode.prelim+t(e,i),e.hierNode.modifier=e.hierNode.prelim-a):e.hierNode.prelim=a}else i&&(e.hierNode.prelim=i.hierNode.prelim+t(e,i));e.parentNode.hierNode.defaultAncestor=wse(e,i,e.parentNode.hierNode.defaultAncestor||n[0],t)}function _se(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function Xj(e){return arguments.length?e:Tse}function qd(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function bse(e){for(var t=e.children,r=t.length,n=0,i=0;--r>=0;){var a=t[r];a.hierNode.prelim+=n,a.hierNode.modifier+=n,i+=a.hierNode.change,n+=a.hierNode.shift+i}}function wse(e,t,r,n){if(t){for(var i=e,a=e,o=a.parentNode.children[0],s=t,l=i.hierNode.modifier,u=a.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=gw(s),a=mw(a),s&&a;){i=gw(i),o=mw(o),i.hierNode.ancestor=e;var f=s.hierNode.prelim+h-a.hierNode.prelim-u+n(s,a);f>0&&(Cse(Sse(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=i.hierNode.modifier,c+=o.hierNode.modifier}s&&!gw(i)&&(i.hierNode.thread=s,i.hierNode.modifier+=h-l),a&&!mw(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,r=e)}return r}function gw(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function mw(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function Sse(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Cse(e,t,r){var n=r/(t.hierNode.i-e.hierNode.i);t.hierNode.change-=n,t.hierNode.shift+=r,t.hierNode.modifier+=r,t.hierNode.prelim+=r,e.hierNode.change+=n}function Tse(e,t){return e.parentNode===t.parentNode?1:2}var Mse=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Ase=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Mse},t.prototype.buildPath=function(r,n){var i=n.childPoints,a=i.length,o=n.parentPoint,s=i[0],l=i[a-1];if(a===1){r.moveTo(o[0],o[1]),r.lineTo(s[0],s[1]);return}var u=n.orient,c=u==="TB"||u==="BT"?0:1,h=1-c,f=ce(n.forkPosition,1),d=[];d[c]=o[c],d[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(d[0],d[1]),r.moveTo(s[0],s[1]),d[c]=s[c],r.lineTo(d[0],d[1]),d[c]=l[c],r.lineTo(d[0],d[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,T||(S=S-Math.PI));var A=T?"left":"right",P=s.getModel("label"),I=P.get("rotate"),N=I*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:P.get("position")||A,rotation:I==null?-S:N,origin:"center"}),D.setStyle("verticalAlign","middle"))}var O=s.get(["emphasis","focus"]),R=O==="relative"?Eh(o.getAncestorsIndices(),o.getDescendantIndices()):O==="ancestor"?o.getAncestorsIndices():O==="descendant"?o.getDescendantIndices():null;R&&(De(r).focus=R),Lse(i,o,c,r,g,d,m,n),r.__edge&&(r.onHoverStateChange=function(F){if(F!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Vp||j0(r.__edge,F)}})}function Lse(e,t,r,n,i,a,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),d=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new hf({shape:XT(c,h,f,i,i)})),it(m,{shape:XT(c,h,f,a,o)},e));else if(u==="polyline"&&c==="orthogonal"&&t!==r&&t.children&&t.children.length!==0&&t.isExpand===!0){for(var y=t.children,x=[],_=0;_r&&(r=i.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,i=n.length;r=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,r)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostTree,n=r.data.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(t,r){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,r)},e.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,r=0;r=0){var n=r.getData().tree.root,i=e.targetNode;if(he(i)&&(i=n.getNodeById(i)),i&&n.contains(i))return{node:i};var a=e.targetNodeId;if(a!=null&&(i=n.getNodeById(a)))return{node:i}}}function BW(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function Nk(e,t){var r=BW(e);return Ve(r,t)>=0}function O_(e,t){for(var r=[];e;){var n=e.dataIndex;r.push({name:e.name,dataIndex:n,value:t.getRawValue(n)}),e=e.parentNode}return r.reverse(),r}var zse=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.hasSymbolVisual=!0,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r){var n={name:r.name,children:r.data},i=r.leaves||{},a=new qe(i,this,this.ecModel),o=Lk.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,d){var g=o.getNodeByDataIndex(d);return g&&g.children.length&&g.isExpand||(f.parentModel=a),f})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=r.expandAndCollapse,c=u&&r.initialTreeDepth>=0?r.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var f=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=f&&f.collapsed!=null?!f.collapsed:h.depth<=c}),o.data},t.prototype.getOrient=function(){var r=this.get("orient");return r==="horizontal"?r="LR":r==="vertical"&&(r="TB"),r},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.formatTooltip=function(r,n,i){for(var a=this.getData().tree,o=a.root.children[0],s=a.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return gr("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=O_(i,this),n.collapsed=!i.isExpand,n},t.type="series.tree",t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,roamTrigger:"global",nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:K.color.borderTint,width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},t}(bt);function Bse(e,t,r){for(var n=[e],i=[],a;a=n.pop();)if(i.push(a),a.isExpand){var o=a.children;if(o.length)for(var s=0;s=0;a--)r.push(i[a])}}function Fse(e,t){e.eachSeriesByType("tree",function(r){Vse(r,t)})}function Vse(e,t){var r=Tr(e,t).refContainer,n=It(e.getBoxLayoutParams(),r);e.layoutInfo=n;var i=e.get("layout"),a=0,o=0,s=null;i==="radial"?(a=2*Math.PI,o=Math.min(n.height,n.width)/2,s=Xj(function(S,T){return(S.parentNode===T.parentNode?1:2)/S.depth})):(a=n.width,o=n.height,s=Xj());var l=e.getData().tree.root,u=l.children[0];if(u){yse(l),Bse(u,xse,s),l.hierNode.modifier=-u.hierNode.prelim,Ad(u,_se);var c=u,h=u,f=u;Ad(u,function(S){var T=S.getLayout().x;Th.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var d=c===h?1:s(c,h)/2,g=d-c.getLayout().x,m=0,y=0,x=0,_=0;if(i==="radial")m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Ad(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var T=qd(x,_);S.setLayout({x:T.x,y:T.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+d+g),m=a/(f.depth-1||1),Ad(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:a-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Ad(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function Gse(e){e.eachSeriesByType("tree",function(t){var r=t.getData(),n=r.tree;n.eachNode(function(i){var a=i.getModel(),o=a.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(i.dataIndex,"style");Q(s,o)})})}function Wse(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:"series",subType:"tree",query:t},function(n){var i=t.dataIndex,a=n.getData().tree,o=a.getNodeByDataIndex(i);o.isExpand=!o.isExpand})}),e.registerAction({type:"treeRoam",event:"treeRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",subType:"tree",query:t},function(i){var a=i.coordinateSystem,o=j_(a,t,i.get("scaleLimit"));i.setCenter(o.center),i.setZoom(o.zoom)})})}function Hse(e){e.registerChartView(kse),e.registerSeriesModel(zse),e.registerLayout(Fse),e.registerVisual(Gse),Wse(e)}var eR=["treemapZoomToNode","treemapRender","treemapMove"];function Use(e){for(var t=0;t1;)a=a.parentNode;var o=fT(e.ecModel,a.name||a.dataIndex+"",n);i.setVisual("decal",o)})}var Zse=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventUsingHoverLayer=!0,r}return t.prototype.getInitialData=function(r,n){var i={name:r.name,children:r.data};VW(i);var a=r.levels||[],o=this.designatedVisualItemStyle={},s=new qe({itemStyle:o},this,n);a=r.levels=$se(a,n);var l=ae(a||[],function(h){return new qe(h,s,n)},this),u=Lk.createTree(i,this,c);function c(h){h.wrapMethod("getItemModel",function(f,d){var g=u.getNodeByDataIndex(d),m=g?l[g.depth]:null;return f.parentModel=m||s,f})}return u.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(r,n,i){var a=this.getData(),o=this.getRawValue(r),s=a.getName(r);return gr("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=O_(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},Q(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=_e(),this._idIndexMapCount=0);var i=n.get(r);return i==null&&n.set(r,i=this._idIndexMapCount++),i},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){FW(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,coordinateSystemUsage:"box",left:K.size.l,top:K.size.xxxl,right:K.size.l,bottom:K.size.xxxl,sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:"global",nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",bottom:K.size.m,emptyItemWidth:25,itemStyle:{color:K.color.backgroundShade,textStyle:{color:K.color.secondary}},emphasis:{itemStyle:{color:K.color.background}}},label:{show:!0,distance:0,padding:5,position:"inside",color:K.color.neutral00,overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:K.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},t}(bt);function VW(e){var t=0;j(e.children,function(n){VW(n);var i=n.value;re(i)&&(i=i[0]),t+=i});var r=e.value;re(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),re(e.value)?e.value[0]=r:e.value=r}function $se(e,t){var r=Tt(t.get("color")),n=Tt(t.get(["aria","decal","decals"]));if(r){e=e||[];var i,a;j(e,function(s){var l=new qe(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(i=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(a=!0)});var o=e[0]||(e[0]={});return i||(o.color=r.slice()),!a&&n&&(o.decal=n.slice()),e}}var Yse=8,tR=8,yw=5,Xse=function(){function e(t){this.group=new Ce,t.add(this.group)}return e.prototype.render=function(t,r,n,i){var a=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!a.get("show")||!n)){var s=a.getModel("itemStyle"),l=a.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Tr(t,r).refContainer,f={left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},d={emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=It(f,h);this._prepare(n,d,u),this._renderContent(t,d,g,s,l,u,c,i),C_(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var i=t;i;i=i.parentNode){var a=br(i.getModel().get("name"),""),o=n.getTextRect(a),s=Math.max(o.width+Yse*2,r.emptyItemWidth);r.totalWidth+=s+tR,r.renderList.push({node:i,text:a,width:s})}},e.prototype._renderContent=function(t,r,n,i,a,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,d=r.renderList,g=a.getModel("itemStyle").getItemStyle(),m=d.length-1;m>=0;m--){var y=d[m],x=y.node,_=y.width,w=y.text;f>n.width&&(f-=_-c,_=c,w=null);var S=new en({shape:{points:qse(u,0,_,h,m===d.length-1,m===0)},style:Ae(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new tt({style:Ct(o,{text:w})}),textConfig:{position:"inside"},z2:uf*1e4,onclick:Fe(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=Ct(s,{text:w}),S.ensureState("emphasis").style=g,Dt(S,a.get("focus"),a.get("blurScope"),a.get("disabled")),this.group.add(S),Kse(S,t,x),u+=_+tR}},e.prototype.remove=function(){this.group.removeAll()},e}();function qse(e,t,r,n,i,a){var o=[[i?e:e-yw,t],[e+r,t],[e+r,t+n],[i?e:e-yw,t+n]];return!a&&o.splice(2,0,[e+r+yw,t+n/2]),!i&&o.push([e,t+n/2]),o}function Kse(e,t,r){De(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:r&&r.dataIndex,name:r&&r.name},treePathInfo:r&&O_(r,t)}}var Jse=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,i,a){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:i,easing:a}),!0)},e.prototype.finished=function(t){return this._finishedCallback=t,this},e.prototype.start=function(){for(var t=this,r=this._storage.length,n=function(){r--,r<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},i=0,a=this._storage.length;inR||Math.abs(r.dy)>nR)){var n=this.seriesModel.getData().tree.root;if(!n)return;var i=n.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+r.dx,y:i.y+r.dy,width:i.width,height:i.height}})}},t.prototype._onZoom=function(r){var n=r.originX,i=r.originY,a=r.scale;if(this._state!=="animating"){var o=this.seriesModel.getData().tree.root;if(!o)return;var s=o.getLayout();if(!s)return;var l=new Pe(s.x,s.y,s.width,s.height),u=null,c=this._controllerHost;u=c.zoomLimit;var h=c.zoom=c.zoom||1;if(h*=a,u){var f=u.min||0,d=u.max||1/0;h=Math.max(Math.min(d,h),f)}var g=h/c.zoom;c.zoom=h;var m=this.seriesModel.layoutInfo;n-=m.x,i-=m.y;var y=Pr();ha(y,y,[-n,-i]),l_(y,y,[g,g]),ha(y,y,[n,i]),l.applyTransform(y),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:l.x,y:l.y,width:l.width,height:l.height}})}},t.prototype._initEvents=function(r){var n=this;r.on("click",function(i){if(n._state==="ready"){var a=n.seriesModel.get("nodeClick",!0);if(a){var o=n.findTarget(i.offsetX,i.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(a==="zoomToNode")n._zoomToNode(o);else if(a==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&B0(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,i){var a=this;i||(i=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),i||(i={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new Xse(this.group))).render(r,n,i.node,function(o){a._state!=="animating"&&(Nk(r.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=kd(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(r){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype._rootToNode=function(r){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype.findTarget=function(r,n){var i,a=this.seriesModel.getViewRoot();return a.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(r,n),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)i={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),i},t.type="treemap",t}(gt);function kd(){return{nodeGroup:[],background:[],content:[]}}function ile(e,t,r,n,i,a,o,s,l,u){if(!o)return;var c=o.getLayout(),h=e.getData(),f=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var d=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,T=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),P=f.getModel(["blur","itemStyle"]),I=f.getModel(["select","itemStyle"]),N=M.get("borderRadius")||0,D=se("nodeGroup",qT);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),ux(D).nodeWidth=d,ux(D).nodeHeight=g,c.isAboveViewRoot)return D;var O=se("background",rR,u,tle);O&&U(D,O,T&&c.upperLabelHeight);var R=f.getModel("emphasis"),F=R.get("focus"),H=R.get("blurScope"),W=R.get("disabled"),V=F==="ancestor"?o.getAncestorsIndices():F==="descendant"?o.getDescendantIndices():F;if(T)np(D)&&fu(D,!1),O&&(fu(O,!W),h.setItemGraphicEl(o.dataIndex,O),tT(O,V,H));else{var z=se("content",rR,u,rle);z&&$(D,z),O.disableMorphing=!0,O&&np(O)&&fu(O,!1),fu(D,!W),h.setItemGraphicEl(o.dataIndex,D);var Z=f.getShallow("cursor");Z&&z.attr("cursor",Z),tT(D,V,H)}return D;function U(me,ye,Me){var pe=De(ye);if(pe.dataIndex=o.dataIndex,pe.seriesIndex=e.seriesIndex,ye.setShape({x:0,y:0,width:d,height:g,r:N}),y)Y(ye);else{ye.invisible=!1;var Te=o.getVisual("style"),st=Te.stroke,ze=oR(M);ze.fill=st;var et=Jl(A);et.fill=A.get("borderColor");var lt=Jl(P);lt.fill=P.get("borderColor");var Et=Jl(I);if(Et.fill=I.get("borderColor"),Me){var lr=d-2*m;te(ye,st,Te.opacity,{x:m,y:0,width:lr,height:S})}else ye.removeTextContent();ye.setStyle(ze),ye.ensureState("emphasis").style=et,ye.ensureState("blur").style=lt,ye.ensureState("select").style=Et,zu(ye)}me.add(ye)}function $(me,ye){var Me=De(ye);Me.dataIndex=o.dataIndex,Me.seriesIndex=e.seriesIndex;var pe=Math.max(d-2*m,0),Te=Math.max(g-2*m,0);if(ye.culling=!0,ye.setShape({x:m,y:m,width:pe,height:Te,r:N}),y)Y(ye);else{ye.invisible=!1;var st=o.getVisual("style"),ze=st.fill,et=oR(M);et.fill=ze,et.decal=st.decal;var lt=Jl(A),Et=Jl(P),lr=Jl(I);te(ye,ze,st.opacity,null),ye.setStyle(et),ye.ensureState("emphasis").style=lt,ye.ensureState("blur").style=Et,ye.ensureState("select").style=lr,zu(ye)}me.add(ye)}function Y(me){!me.invisible&&a.push(me)}function te(me,ye,Me,pe){var Te=f.getModel(pe?aR:iR),st=br(f.get("name"),null),ze=Te.getShallow("show");Dr(me,Cr(f,pe?aR:iR),{defaultText:ze?st:null,inheritColor:ye,defaultOpacity:Me,labelFetcher:e,labelDataIndex:o.dataIndex});var et=me.getTextContent();if(et){var lt=et.style,Et=Rp(lt.padding||0);pe&&(me.setTextConfig({layoutRect:pe}),et.disableLabelLayout=!0),et.beforeUpdate=function(){var Mr=Math.max((pe?pe.width:me.shape.width)-Et[1]-Et[3],0),Gn=Math.max((pe?pe.height:me.shape.height)-Et[0]-Et[2],0);(lt.width!==Mr||lt.height!==Gn)&&et.setStyle({width:Mr,height:Gn})},lt.truncateMinChar=2,lt.lineOverflow="truncate",ie(lt,pe,c);var lr=et.getState("emphasis");ie(lr?lr.style:null,pe,c)}}function ie(me,ye,Me){var pe=me?me.text:null;if(!ye&&Me.isLeafRoot&&pe!=null){var Te=e.get("drillDownIcon",!0);me.text=Te?Te+" "+pe:pe}}function se(me,ye,Me,pe){var Te=_!=null&&r[me][_],st=i[me];return Te?(r[me][_]=null,le(st,Te)):y||(Te=new ye,Te instanceof Ri&&(Te.z2=ale(Me,pe)),Ee(st,Te)),t[me][x]=Te}function le(me,ye){var Me=me[x]={};ye instanceof qT?(Me.oldX=ye.x,Me.oldY=ye.y):Me.oldShape=Q({},ye.shape)}function Ee(me,ye){var Me=me[x]={},pe=o.parentNode,Te=ye instanceof Ce;if(pe&&(!n||n.direction==="drillDown")){var st=0,ze=0,et=i.background[pe.getRawIndex()];!n&&et&&et.oldShape&&(st=et.oldShape.width,ze=et.oldShape.height),Te?(Me.oldX=0,Me.oldY=ze):Me.oldShape={x:st,y:ze,width:0,height:0}}Me.fadein=!Te}}function ale(e,t){return e*ele+t}var xp=j,ole=ke,cx=-1,Ir=function(){function e(t){var r=t.mappingMethod,n=t.type,i=this.option=Se(t);this.type=n,this.mappingMethod=r,this._normalizeData=ule[r];var a=e.visualHandlers[n];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[r],r==="piecewise"?(xw(i),sle(i)):r==="category"?i.categories?lle(i):xw(i,!0):(Jr(r!=="linear"||i.dataExtent),xw(i))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return fe(this._normalizeData,this)},e.listVisualTypes=function(){return Qe(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){ke(t)?j(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var i,a=re(t)?[]:ke(t)?{}:(i=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);i?a=l:a[s]=l}),a},e.retrieveVisuals=function(t){var r={},n;return t&&xp(e.visualHandlers,function(i,a){t.hasOwnProperty(a)&&(r[a]=t[a],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(re(t))t=t.slice();else if(ole(t)){var r=[];xp(t,function(n,i){r.push(i)}),t=r}else return[];return t.sort(function(n,i){return i==="color"&&n!=="color"&&n.indexOf("color")===0?1:-1}),t},e.dependsOn=function(t,r){return r==="color"?!!(t&&t.indexOf(r)===0):t===r},e.findPieceIndex=function(t,r,n){for(var i,a=1/0,o=0,s=r.length;o=0;a--)n[a]==null&&(delete r[t[a]],t.pop())}function xw(e,t){var r=e.visual,n=[];ke(r)?xp(r,function(a){n.push(a)}):r!=null&&n.push(r);var i={color:1,symbol:1};!t&&n.length===1&&!i.hasOwnProperty(e.type)&&(n[1]=n[0]),GW(e,n)}function Gm(e){return{applyVisual:function(t,r,n){var i=this.mapValueToVisual(t);n("color",e(r("color"),i))},_normalizedToVisual:KT([0,1])}}function sR(e){var t=this.option.visual;return t[Math.round(ht(e,[0,1],[0,t.length-1],!0))]||{}}function Ld(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Kd(e){var t=this.option.visual;return t[this.option.loop&&e!==cx?e%t.length:e]}function Ql(){return this.option.visual[0]}function KT(e){return{linear:function(t){return ht(t,e,this.option.visual,!0)},category:Kd,piecewise:function(t,r){var n=JT.call(this,r);return n==null&&(n=ht(t,e,this.option.visual,!0)),n},fixed:Ql}}function JT(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Ir.findPieceIndex(e,r),i=r[n];if(i&&i.visual)return i.visual[this.type]}}function GW(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=ae(t,function(r){var n=fn(r);return n||[0,0,0,1]})),t}var ule={linear:function(e){return ht(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Ir.findPieceIndex(e,t,!0);if(r!=null)return ht(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??cx},fixed:qt};function Wm(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=ple(i,l,m,y,g,n);HW(m,x,r,n)}})}}}function fle(e,t,r){var n=Q({},t),i=r.designatedVisualItemStyle;return j(["color","colorAlpha","colorSaturation"],function(a){i[a]=t[a];var o=e.get(a);i[a]=null,o!=null&&(n[a]=o)}),n}function lR(e){var t=_w(e,"color");if(t){var r=_w(e,"colorAlpha"),n=_w(e,"colorSaturation");return n&&(t=Io(t,null,null,n)),r&&(t=Jv(t,r)),t}}function dle(e,t){return t!=null?Io(t,null,null,e):null}function _w(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function vle(e,t,r,n,i,a){if(!(!a||!a.length)){var o=bw(t,"color")||i.color!=null&&i.color!=="none"&&(bw(t,"colorAlpha")||bw(t,"colorSaturation"));if(o){var s=t.get("visualMin"),l=t.get("visualMax"),u=r.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=t.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var f=new Ir(h);return WW(f).drColorMappingBy=c,f}}}function bw(e,t){var r=e.get(t);return re(r)&&r.length?{name:t,range:r}:null}function ple(e,t,r,n,i,a){var o=Q({},t);if(i){var s=i.type,l=s==="color"&&WW(i).drColorMappingBy,u=l==="index"?n:l==="id"?a.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=i.mapValueToVisual(u)}return o}var _p=Math.max,hx=Math.min,uR=Fr,Pk=j,UW=["itemStyle","borderWidth"],gle=["itemStyle","gapWidth"],mle=["upperLabel","show"],yle=["upperLabel","height"];const xle={seriesType:"treemap",reset:function(e,t,r,n){var i=e.option,a=Tr(e,r).refContainer,o=It(e.getBoxLayoutParams(),a),s=i.size||[],l=ce(uR(o.width,s[0]),a.width),u=ce(uR(o.height,s[1]),a.height),c=n&&n.type,h=["treemapZoomToNode","treemapRootToNode"],f=yp(n,h,e),d=c==="treemapRender"||c==="treemapMove"?n.rootRect:null,g=e.getViewRoot(),m=BW(g);if(c!=="treemapMove"){var y=c==="treemapZoomToNode"?Tle(e,f,g,l,u):d?[d.width,d.height]:[l,u],x=i.sort;x&&x!=="asc"&&x!=="desc"&&(x="desc");var _={squareRatio:i.squareRatio,sort:x,leafDepth:i.leafDepth};g.hostTree.clearLayouts();var w={x:0,y:0,width:y[0],height:y[1],area:y[0]*y[1]};g.setLayout(w),ZW(g,_,!1,0),w=g.getLayout(),Pk(m,function(T,M){var A=(m[M+1]||g).getValue();T.setLayout(Q({dataExtent:[A,A],borderWidth:0,upperHeight:0},w))})}var S=e.getData().tree.root;S.setLayout(Mle(o,d,f),!0),e.setLayoutInfo(o),$W(S,new Pe(-o.x,-o.y,r.getWidth(),r.getHeight()),m,g,0)}};function ZW(e,t,r,n){var i,a;if(!e.isRemoved()){var o=e.getLayout();i=o.width,a=o.height;var s=e.getModel(),l=s.get(UW),u=s.get(gle)/2,c=YW(s),h=Math.max(l,c),f=l-u,d=h-u;e.setLayout({borderWidth:l,upperHeight:h,upperLabelHeight:c},!0),i=_p(i-2*f,0),a=_p(a-f-d,0);var g=i*a,m=_le(e,s,g,t,r,n);if(m.length){var y={x:f,y:d,width:i,height:a},x=hx(i,a),_=1/0,w=[];w.area=0;for(var S=0,T=m.length;S=0;l--){var u=i[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function Cle(e,t,r){for(var n=0,i=1/0,a=0,o=void 0,s=e.length;an&&(n=o));var l=e.area*e.area,u=t*t*r;return l?_p(u*n/l,l/(u*i)):1/0}function cR(e,t,r,n,i){var a=t===r.width?0:1,o=1-a,s=["x","y"],l=["width","height"],u=r[s[a]],c=t?e.area/t:0;(i||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hHC&&(u=HC),a=s}un&&(n=t);var a=n%2?n+2:n+3;i=[];for(var o=0;o0&&(T[0]=-T[0],T[1]=-T[1]);var A=S[0]<0?-1:1;if(a.__position!=="start"&&a.__position!=="end"){var P=-Math.atan2(S[1],S[0]);h[0].8?"left":f[0]<-.8?"right":"center",m=f[1]>.8?"top":f[1]<-.8?"bottom":"middle";break;case"start":a.x=-f[0]*x+c[0],a.y=-f[1]*_+c[1],g=f[0]>.8?"right":f[0]<-.8?"left":"center",m=f[1]>.8?"bottom":f[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":a.x=x*A+c[0],a.y=c[1]+I,g=S[0]<0?"right":"left",a.originX=-x*A,a.originY=-I;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":a.x=M[0],a.y=M[1]+I,g="center",a.originY=-I;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":a.x=-x*A+h[0],a.y=h[1]+I,g=S[0]>=0?"right":"left",a.originX=x*A,a.originY=-I;break}a.scaleX=a.scaleY=o,a.setStyle({verticalAlign:a.__verticalAlign||m,align:a.__align||g})}},t}(Ce),Rk=function(){function e(t){this.group=new Ce,this._LineCtor=t||jk}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,i=n.group,a=n._lineData;n._lineData=t,a||i.removeAll();var o=gR(t);t.diff(a).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(a,t,l,s,o)}).remove(function(s){i.remove(a.getItemGraphicEl(s))}).execute()},e.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(r,n){r.updateLayout(t,n)},this)},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=gR(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r){this._progressiveEls=[];function n(s){!s.isGroup&&!Wle(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var i=t.start;i0}function gR(e){var t=e.hostModel,r=t.getModel("emphasis");return{lineStyle:t.getModel("lineStyle").getLineStyle(),emphasisLineStyle:r.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:t.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:t.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:r.get("disabled"),blurScope:r.get("blurScope"),focus:r.get("focus"),labelStatesModels:Cr(t)}}function mR(e){return isNaN(e[0])||isNaN(e[1])}function Mw(e){return e&&!mR(e[0])&&!mR(e[1])}var Aw=[],kw=[],Lw=[],Dc=Br,Nw=Vs,yR=Math.abs;function xR(e,t,r){for(var n=e[0],i=e[1],a=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){Aw[0]=Dc(n[0],i[0],a[0],c),Aw[1]=Dc(n[1],i[1],a[1],c);var h=yR(Nw(Aw,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function Pw(e,t){var r=[],n=qv,i=[[],[],[]],a=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[Ga(u[0]),Ga(u[1])],u[2]&&u.__original.push(Ga(u[2])));var f=u.__original;if(u[2]!=null){if(ln(i[0],f[0]),ln(i[1],f[2]),ln(i[2],f[1]),c&&c!=="none"){var d=Qd(s.node1),g=xR(i,f[0],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[0][0]=r[3],i[1][0]=r[4],n(i[0][1],i[1][1],i[2][1],g,r),i[0][1]=r[3],i[1][1]=r[4]}if(h&&h!=="none"){var d=Qd(s.node2),g=xR(i,f[1],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[1][0]=r[1],i[2][0]=r[2],n(i[0][1],i[1][1],i[2][1],g,r),i[1][1]=r[1],i[2][1]=r[2]}ln(u[0],i[0]),ln(u[1],i[2]),ln(u[2],i[1])}else{if(ln(a[0],f[0]),ln(a[1],f[1]),Ts(o,a[1],a[0]),Xu(o,o),c&&c!=="none"){var d=Qd(s.node1);x0(a[0],a[0],o,d*t)}if(h&&h!=="none"){var d=Qd(s.node2);x0(a[1],a[1],o,-d*t)}ln(u[0],a[0]),ln(u[1],a[1])}})}var t8=Ye();function Hle(e){if(e)return t8(e).bridge}function _R(e,t){e&&(t8(e).bridge=t)}function bR(e){return e.type==="view"}var Ule=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){var i=new Kp,a=new Rk,o=this.group,s=new Ce;this._controller=new rc(n.getZr()),this._controllerHost={target:s},s.add(i.group),s.add(a.group),o.add(s),this._symbolDraw=i,this._lineDraw=a,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,i){var a=this,o=r.coordinateSystem,s=!1;this._model=r,this._api=i,this._active=!0;var l=this._getThumbnailInfo();l&&l.bridge.reset(i);var u=this._symbolDraw,c=this._lineDraw;if(bR(o)){var h={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?this._mainGroup.attr(h):it(this._mainGroup,h,r)}Pw(r.getGraph(),Jd(r));var f=r.getData();u.updateData(f);var d=r.getEdgeData();c.updateData(d),this._updateNodeAndLinkScale(),this._updateController(null,r,i),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,i,m));var y=r.get("layout");f.graph.eachNode(function(S){var T=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var P=A.get("draggable");P&&M.on("drag",function(N){switch(y){case"force":g.warmUp(),!a._layouting&&a._startForceLayoutIteration(g,i,m),g.setFixed(T),f.setItemLayout(T,[M.x,M.y]);break;case"circular":f.setItemLayout(T,[M.x,M.y]),S.setLayout({fixed:!0},!0),Ek(r,"symbolSize",S,[N.offsetX,N.offsetY]),a.updateLayout(r);break;case"none":default:f.setItemLayout(T,[M.x,M.y]),Dk(r.getGraph(),r),a.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(T)}),M.setDraggable(P,!!A.get("cursor"));var I=A.get(["emphasis","focus"]);I==="adjacency"&&(De(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var T=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);T&&M==="adjacency"&&(De(T).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){JW(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,i,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._startForceLayoutIteration=function(r,n,i){var a=this,o=!1;(function s(){r.step(function(l){a.updateLayout(a._model),(l||!o)&&(o=!0,a._renderThumbnail(a._model,n,a._symbolDraw,a._lineDraw)),(a._layouting=!l)&&(i?a._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype._updateController=function(r,n,i){var a=this._controller,o=this._controllerHost,s=n.coordinateSystem;if(!bR(s)){a.disable();return}a.enable(n.get("roam"),{api:i,zInfo:{component:n},triggerInfo:{roamTrigger:n.get("roamTrigger"),isInSelf:function(l,u,c){return s.containPoint([u,c])},isInClip:function(l,u,c){return!r||r.contain(u,c)}}}),o.zoomLimit=n.get("scaleLimit"),o.zoom=s.getZoom(),a.off("pan").off("zoom").on("pan",function(l){i.dispatchAction({seriesId:n.id,type:"graphRoam",dx:l.dx,dy:l.dy})}).on("zoom",function(l){i.dispatchAction({seriesId:n.id,type:"graphRoam",zoom:l.scale,originX:l.originX,originY:l.originY})})},t.prototype.updateViewOnPan=function(r,n,i){this._active&&(Ck(this._controllerHost,i.dx,i.dy),this._updateThumbnailWindow())},t.prototype.updateViewOnZoom=function(r,n,i){this._active&&(Tk(this._controllerHost,i.zoom,i.originX,i.originY),this._updateNodeAndLinkScale(),Pw(r.getGraph(),Jd(r)),this._lineDraw.updateLayout(),n.updateLabelLayout(),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),i=Jd(r);n.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(i)})},t.prototype.updateLayout=function(r){this._active&&(Pw(r.getGraph(),Jd(r)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var r=this._model,n=r.coordinateSystem;if(n.type==="view"){var i=Hle(r);if(i)return{bridge:i,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(r.coordSys.transform,this._api)},t.prototype._renderThumbnail=function(r,n,i,a){var o=this._getThumbnailInfo();if(o){var s=new Ce,l=i.group.children(),u=a.group.children(),c=new Ce,h=new Ce;s.add(h),s.add(c);for(var f=0;f=0&&t.call(r,n[a],a)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,i=n.length,a=0;a=0&&n[a].node1.dataIndex>=0&&n[a].node2.dataIndex>=0&&t.call(r,n[a],a)},e.prototype.breadthFirstTraverse=function(t,r,n,i){if(r instanceof eu||(r=this._nodesMap[Ec(r)]),!!r){for(var a=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var a=0,o=i.length;a=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(d.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),r8=function(){function e(t,r,n){this.dataIndex=-1,this.node1=t,this.node2=r,this.dataIndex=n??-1}return e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostGraph,n=r.edgeData.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var t=_e(),r=_e();t.set(this.dataIndex,!0);for(var n=[this.node1],i=[this.node2],a=0;a=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(a=0;a=0&&!t.hasKey(m)&&(t.set(m,!0),i.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function n8(e,t){return{getValue:function(r){var n=this[e][t];return n.getStore().get(n.getDimensionIndex(r||"value"),this.dataIndex)},setVisual:function(r,n){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}Qt(eu,n8("hostGraph","data"));Qt(r8,n8("hostGraph","edgeData"));function Ok(e,t,r,n,i){for(var a=new Zle(n),o=0;o "+f)),u++)}var d=r.get("coordinateSystem"),g;if(d==="cartesian2d"||d==="polar"||d==="matrix")g=no(e,r);else{var m=mf.get(d),y=m?m.dimensions||[]:[];Ve(y,"value")<0&&y.concat(["value"]);var x=bf(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new dn(x,r),g.initData(e)}var _=new dn(["value"],r);return _.initData(l,s),i&&i(g,_),OW({mainData:g,struct:a,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var $le=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new Mf(i,i),this.fillDataTextStyle(r.edges||r.links),this._updateCategoriesData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links),this._updateCategoriesData()},t.prototype.mergeDefaultAndTheme=function(r){e.prototype.mergeDefaultAndTheme.apply(this,arguments),ju(r,"edgeLabel",["show"])},t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[],o=this;if(a&&i){Dle(this);var s=Ok(a,i,this,!0,l);return j(s.edges,function(u){Ele(u.node1,u.node2,this,u.dataIndex)},this),s.data}function l(u,c){u.wrapMethod("getItemModel",function(g){var m=o._categoriesModels,y=g.getShallow("category"),x=m[y];return x&&(x.parentModel=g.parentModel,g.parentModel=x),g});var h=qe.prototype.getModel;function f(g,m){var y=h.call(this,g,m);return y.resolveParentPath=d,y}c.wrapMethod("getItemModel",function(g){return g.resolveParentPath=d,g.getModel=f,g});function d(g){if(g&&(g[0]==="label"||g[1]==="label")){var m=g.slice();return g[0]==="label"?m[0]="edgeLabel":g[1]==="label"&&(m[1]="edgeLabel"),m}return g}}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.getCategoriesData=function(){return this._categoriesData},t.prototype.formatTooltip=function(r,n,i){if(i==="edge"){var a=this.getData(),o=this.getDataParams(r,i),s=a.graph.getEdgeByIndex(r),l=a.getName(s.node1.dataIndex),u=a.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),gr("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var h=oV({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=ae(this.option.categories||[],function(i){return i.value!=null?i:Q({value:0},i)}),n=new dn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(i){return n.getItemModel(i)})},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},t.type="series.graph",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.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:K.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function Yle(e){e.registerChartView(Ule),e.registerSeriesModel($le),e.registerProcessor(kle),e.registerVisual(Lle),e.registerVisual(Nle),e.registerLayout(jle),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,Ole),e.registerLayout(Ble),e.registerCoordinateSystem("graphView",{dimensions:nc.dimensions,create:Vle}),e.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},qt),e.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},qt),e.registerAction({type:"graphRoam",event:"graphRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",query:t},function(i){var a=n.getViewOfSeriesModel(i);a&&(t.dx!=null&&t.dy!=null&&a.updateViewOnPan(i,n,t),t.zoom!=null&&t.originX!=null&&t.originY!=null&&a.updateViewOnZoom(i,n,t));var o=i.coordinateSystem,s=j_(o,t,i.get("scaleLimit"));i.setCenter&&i.setCenter(s.center),i.setZoom&&i.setZoom(s.zoom)})})}var wR=function(e){q(t,e);function t(r,n,i){var a=e.call(this)||this;De(a).dataType="node",a.z2=2;var o=new tt;return a.setTextContent(o),a.updateData(r,n,i,!0),a}return t.prototype.updateData=function(r,n,i,a){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=Q(Ba(u.getModel("itemStyle"),h,!0),h),d=this;if(isNaN(f.startAngle)){d.setShape(f);return}a?d.setShape(f):it(d,{shape:f},l,n);var g=Q(Ba(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Sr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,d),Sr(d,u,"itemStyle");var m=c.get("focus");Dt(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,i){var a=this.getTextContent(),o=i.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");a.ignore=!c.get("show");var h=Cr(n),f=i.getVisual("style");Dr(a,h,{labelFetcher:{getFormattedLabel:function(_,w,S,T,M,A){return r.getFormattedLabel(_,w,"node",T,zn(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:i.dataIndex,defaultText:i.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var d=c.get("position")||"outside",g=c.get("distance")||0,m;d==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:d!=="outside"};var y=d!=="outside"?c.get("align")||"center":l>0?"left":"right",x=d!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";a.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(Qr),Xle=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;return De(o).dataType="edge",o.updateData(r,n,i,a,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var i=.7,a=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!a),r.bezierCurveTo((n.cx-n.s2[0])*i+n.s2[0],(n.cy-n.s2[1])*i+n.s2[1],(n.cx-n.t1[0])*i+n.t1[0],(n.cy-n.t1[1])*i+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!a),r.bezierCurveTo((n.cx-n.t2[0])*i+n.t2[0],(n.cy-n.t2[1])*i+n.t2[1],(n.cx-n.s1[0])*i+n.s1[0],(n.cy-n.s1[1])*i+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,i,a,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(i),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),d=h.getModel("emphasis"),g=d.get("focus"),m=Q(Ba(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),SR(y,l,r,f)):(Oi(y),SR(y,l,r,f),it(y,{shape:m},s,i)),Dt(this,g==="adjacency"?l.getAdjacentDataIndices():g,d.get("blurScope"),d.get("disabled")),Sr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(Ke);function SR(e,t,r,n){var i=t.node1,a=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(i.dataIndex,"style").fill,u=r.getItemVisual(a.dataIndex,"style").fill;if(he(l)&&he(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,d=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new qu(h,f,d,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var qle=Math.PI/180,Kle=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*qle;if(a.diff(o).add(function(c){var h=a.getItemLayout(c);if(h){var f=new wR(a,c,l);De(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),d=a.getItemLayout(c);if(!d){f&&Do(f,r,h);return}f?f.updateData(a,c,l):f=new wR(a,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Do(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=ce(u[0],i.getWidth()),this.group.originY=ce(u[1],i.getHeight()),Nt(this.group,{scaleX:1,scaleY:1},r)}this._data=a,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var i=r.getData(),a=r.getEdgeData(),o=this._edgeData,s=this.group;a.diff(o).add(function(l){var u=new Xle(i,a,l,n);De(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,a,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Do(u,r,l)}).execute(),this._edgeData=a},t.prototype.dispose=function(){},t.type="chord",t}(gt),Jle=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links),this.legendVisualProvider=new Mf(fe(this.getData,this),fe(this.getRawData,this))},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links)},t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[];if(a&&i){var o=Ok(a,i,this,!0,s);return o.data}function s(l,u){var c=qe.prototype.getModel;function h(d,g){var m=c.call(this,d,g);return m.resolveParentPath=f,m}u.wrapMethod("getItemModel",function(d){return d.resolveParentPath=f,d.getModel=h,d});function f(d){if(d&&(d[0]==="label"||d[1]==="label")){var g=d.slice();return d[0]==="label"?g[0]="edgeLabel":d[1]==="label"&&(g[1]="edgeLabel"),g}return d}}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,i){var a=this.getDataParams(r,i);if(i==="edge"){var o=this.getData(),s=o.graph.getEdgeByIndex(r),l=o.getName(s.node1.dataIndex),u=o.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),gr("nameValue",{name:c.join(" > "),value:a.value,noValue:a.value==null})}return gr("nameValue",{name:a.name,value:a.value,noValue:a.value==null})},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var a=this.getData(),o=this.getGraph().getNodeByIndex(r);if(i.name==null&&(i.name=a.getName(r)),i.value==null){var s=o.getLayout().value;i.value=s}}return i},t.type="series.chord",t.defaultOption={z:2,coordinateSystem:"none",legendHoverLink:!0,colorBy:"data",left:0,top:0,right:0,bottom:0,width:null,height:null,center:["50%","50%"],radius:["70%","80%"],clockwise:!0,startAngle:90,endAngle:"auto",minAngle:0,padAngle:3,itemStyle:{borderRadius:[0,0,5,5]},lineStyle:{width:0,color:"source",opacity:.2},label:{show:!0,position:"outside",distance:5},emphasis:{focus:"adjacency",lineStyle:{opacity:.5}}},t}(bt),Iw=Math.PI/180;function Qle(e,t){e.eachSeriesByType("chord",function(r){eue(r,t)})}function eue(e,t){var r=e.getData(),n=r.graph,i=e.getEdgeData(),a=i.count();if(a){var o=T6(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*Iw,0),f=Math.max((e.get("minAngle")||0)*Iw,0),d=-e.get("startAngle")*Iw,g=d+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[d,g];m_(x,!m);var _=x[0],w=x[1],S=w-_,T=r.getSum("value")===0&&i.getSum("value")===0,M=[],A=0;n.eachEdge(function(z){var Z=T?1:z.getValue("value");T&&(Z>0||f)&&(A+=2);var U=z.node1.dataIndex,$=z.node2.dataIndex;M[U]=(M[U]||0)+Z,M[$]=(M[$]||0)+Z});var P=0;if(n.eachNode(function(z){var Z=z.getValue("value");isNaN(Z)||(M[z.dataIndex]=Math.max(Z,M[z.dataIndex]||0)),!T&&(M[z.dataIndex]>0||f)&&A++,P+=M[z.dataIndex]||0}),!(A===0||P===0)){h*A>=Math.abs(S)&&(h=Math.max(0,(Math.abs(S)-f*A)/A)),(h+f)*A>=Math.abs(S)&&(f=(Math.abs(S)-h*A)/A);var I=(S-h*A*y)/P,N=0,D=0,O=0;n.eachNode(function(z){var Z=M[z.dataIndex]||0,U=I*(P?Z:1)*y;Math.abs(U)D){var F=N/D;n.eachNode(function(z){var Z=z.getLayout().angle;Math.abs(Z)>=f?z.setLayout({angle:Z*F,ratio:F},!0):z.setLayout({angle:f,ratio:f===0?1:Z/f},!0)})}else n.eachNode(function(z){if(!R){var Z=z.getLayout().angle,U=Math.min(Z/O,1),$=U*N;Z-$f&&f>0){var U=R?1:Math.min(Z/O,1),$=Z-f,Y=Math.min($,Math.min(H,N*U));H-=Y,z.setLayout({angle:Z-Y,ratio:(Z-Y)/Z},!0)}else f>0&&z.setLayout({angle:f,ratio:Z===0?1:f/Z},!0)}});var W=_,V=[];n.eachNode(function(z){var Z=Math.max(z.getLayout().angle,f);z.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:W,endAngle:W+Z*y,clockwise:m},!0),V[z.dataIndex]=W,W+=(Z+h)*y}),n.eachEdge(function(z){var Z=T?1:z.getValue("value"),U=I*(P?Z:1)*y,$=z.node1.dataIndex,Y=V[$]||0,te=Math.abs((z.node1.getLayout().ratio||1)*U),ie=Y+te*y,se=[s+c*Math.cos(Y),l+c*Math.sin(Y)],le=[s+c*Math.cos(ie),l+c*Math.sin(ie)],Ee=z.node2.dataIndex,me=V[Ee]||0,ye=Math.abs((z.node2.getLayout().ratio||1)*U),Me=me+ye*y,pe=[s+c*Math.cos(me),l+c*Math.sin(me)],Te=[s+c*Math.cos(Me),l+c*Math.sin(Me)];z.setLayout({s1:se,s2:le,sStartAngle:Y,sEndAngle:ie,t1:pe,t2:Te,tStartAngle:me,tEndAngle:Me,cx:s,cy:l,r:c,value:Z,clockwise:m}),V[$]=ie,V[Ee]=Me})}}}function tue(e){e.registerChartView(Kle),e.registerSeriesModel(Jle),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,Qle),e.registerProcessor(Cf("chord"))}var rue=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),nue=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new rue},t.prototype.buildPath=function(r,n){var i=Math.cos,a=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-i(l)*s*(s>=o/3?1:2),c=n.y-a(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+i(l)*s,n.y+a(l)*s),r.lineTo(n.x+i(n.angle)*o,n.y+a(n.angle)*o),r.lineTo(n.x-i(l)*s,n.y-a(l)*s),r.lineTo(u,c)},t}(Ke);function iue(e,t){var r=e.get("center"),n=t.getWidth(),i=t.getHeight(),a=Math.min(n,i),o=ce(r[0],t.getWidth()),s=ce(r[1],t.getHeight()),l=ce(e.get("radius"),a/2);return{cx:o,cy:s,r:l}}function Um(e,t){var r=e==null?"":e+"";return t&&(he(t)?r=t.replace("{value}",r):we(t)&&(r=t(e))),r}var aue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeAll();var a=r.get(["axisLine","lineStyle","color"]),o=iue(r,i);this._renderMain(r,n,i,a,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,i,a,o){var s=this.group,l=r.get("clockwise"),u=-r.get("startAngle")/180*Math.PI,c=-r.get("endAngle")/180*Math.PI,h=r.getModel("axisLine"),f=h.get("roundCap"),d=f?ix:Qr,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];m_(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],T=0;g&&T=I&&(N===0?0:a[N-1][0])Math.PI/2&&(ie+=Math.PI)):te==="tangential"?ie=-P-Math.PI/2:rt(te)&&(ie=te*Math.PI/180),ie===0?h.add(new tt({style:Ct(w,{text:Z,x:$,y:Y,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:F<-.4?"left":F>.4?"right":"center"},{inheritColor:U}),silent:!0})):h.add(new tt({style:Ct(w,{text:Z,x:$,y:Y,verticalAlign:"middle",align:"center"},{inheritColor:U}),silent:!0,originX:$,originY:Y,rotation:ie}))}if(_.get("show")&&W!==S){var V=_.get("distance");V=V?V+c:c;for(var se=0;se<=T;se++){F=Math.cos(P),H=Math.sin(P);var le=new ar({shape:{x1:F*(g-V)+f,y1:H*(g-V)+d,x2:F*(g-A-V)+f,y2:H*(g-A-V)+d},silent:!0,style:O});O.stroke==="auto"&&le.setStyle({stroke:a((W+se/T)/S)}),h.add(le),P+=N}P-=N}else P+=I}},t.prototype._renderPointer=function(r,n,i,a,o,s,l,u,c){var h=this.group,f=this._data,d=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),T=+r.get("max"),M=[S,T],A=[s,l];function P(N,D){var O=_.getItemModel(N),R=O.getModel("pointer"),F=ce(R.get("width"),o.r),H=ce(R.get("length"),o.r),W=r.get(["pointer","icon"]),V=R.get("offsetCenter"),z=ce(V[0],o.r),Z=ce(V[1],o.r),U=R.get("keepAspect"),$;return W?$=sr(W,z-F/2,Z-H,F,H,null,U):$=new nue({shape:{angle:-Math.PI/2,width:F,r:H,x:z,y:Z}}),$.rotation=-(D+Math.PI/2),$.x=o.cx,$.y=o.cy,$}function I(N,D){var O=y.get("roundCap"),R=O?ix:Qr,F=y.get("overlap"),H=F?y.get("width"):c/_.count(),W=F?o.r-H:o.r-(N+1)*H,V=F?o.r:o.r-N*H,z=new R({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:W,r:V}});return F&&(z.z2=ht(_.get(w,N),[S,T],[100,0],!0)),z}(x||m)&&(_.diff(f).add(function(N){var D=_.get(w,N);if(m){var O=P(N,s);Nt(O,{rotation:-((isNaN(+D)?A[0]:ht(D,M,A,!0))+Math.PI/2)},r),h.add(O),_.setItemGraphicEl(N,O)}if(x){var R=I(N,s),F=y.get("clip");Nt(R,{shape:{endAngle:ht(D,M,A,F)}},r),h.add(R),KC(r.seriesIndex,_.dataType,N,R),g[N]=R}}).update(function(N,D){var O=_.get(w,N);if(m){var R=f.getItemGraphicEl(D),F=R?R.rotation:s,H=P(N,F);H.rotation=F,it(H,{rotation:-((isNaN(+O)?A[0]:ht(O,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(N,H)}if(x){var W=d[D],V=W?W.shape.endAngle:s,z=I(N,V),Z=y.get("clip");it(z,{shape:{endAngle:ht(O,M,A,Z)}},r),h.add(z),KC(r.seriesIndex,_.dataType,N,z),g[N]=z}}).execute(),_.each(function(N){var D=_.getItemModel(N),O=D.getModel("emphasis"),R=O.get("focus"),F=O.get("blurScope"),H=O.get("disabled");if(m){var W=_.getItemGraphicEl(N),V=_.getItemVisual(N,"style"),z=V.fill;if(W instanceof Er){var Z=W.style;W.useStyle(Q({image:Z.image,x:Z.x,y:Z.y,width:Z.width,height:Z.height},V))}else W.useStyle(V),W.type!=="pointer"&&W.setColor(z);W.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),W.style.fill==="auto"&&W.setStyle("fill",a(ht(_.get(w,N),M,[0,1],!0))),W.z2EmphasisLift=0,Sr(W,D),Dt(W,R,F,H)}if(x){var U=g[N];U.useStyle(_.getItemVisual(N,"style")),U.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),U.z2EmphasisLift=0,Sr(U,D),Dt(U,R,F,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var i=r.getModel("anchor"),a=i.get("show");if(a){var o=i.get("size"),s=i.get("icon"),l=i.get("offsetCenter"),u=i.get("keepAspect"),c=sr(s,n.cx-o/2+ce(l[0],n.r),n.cy-o/2+ce(l[1],n.r),o,o,null,u);c.z2=i.get("showAbove")?1:0,c.setStyle(i.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,i,a,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new Ce,d=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){d[x]=new tt({silent:!0}),g[x]=new tt({silent:!0})}).update(function(x,_){d[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new Ce,T=a(ht(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),P=o.cx+ce(A[0],o.r),I=o.cy+ce(A[1],o.r),N=d[x];N.attr({z2:y?0:2,style:Ct(M,{x:P,y:I,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:T})}),S.add(N)}var D=_.getModel("detail");if(D.get("show")){var O=D.get("offsetCenter"),R=o.cx+ce(O[0],o.r),F=o.cy+ce(O[1],o.r),H=ce(D.get("width"),o.r),W=ce(D.get("height"),o.r),V=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:T,N=g[x],z=D.get("formatter");N.attr({z2:y?0:2,style:Ct(D,{x:R,y:F,text:Um(w,z),width:isNaN(H)?null:H,height:isNaN(W)?null:W,align:"center",verticalAlign:"middle"},{inheritColor:V})}),s6(N,{normal:D},w,function(U){return Um(U,z)}),m&&l6(N,x,l,r,{getFormattedLabel:function(U,$,Y,te,ie,se){return Um(se?se.interpolatedValue:w,z)}}),S.add(N)}f.add(S)}),this.group.add(f),this._titleEls=d,this._detailEls=g},t.type="gauge",t}(gt),oue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="itemStyle",r}return t.prototype.getInitialData=function(r,n){return Tf(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,K.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:K.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:K.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:K.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:K.color.neutral00,borderWidth:0,borderColor:K.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:K.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:K.color.transparent,borderWidth:0,borderColor:K.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:K.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},t}(bt);function sue(e){e.registerChartView(aue),e.registerSeriesModel(oue)}var lue=["itemStyle","opacity"],uue=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=i,o=new Gr,s=new tt;return a.setTextContent(s),i.setTextGuideLine(o),i.updateData(r,n,!0),i}return t.prototype.updateData=function(r,n,i){var a=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(lue);c=c??1,i||Oi(a),a.useStyle(r.getItemVisual(n,"style")),a.style.lineJoin="round",i?(a.setShape({points:l.points}),a.style.opacity=0,Nt(a,{style:{opacity:c}},o,n)):it(a,{style:{opacity:c},shape:{points:l.points}},o,n),Sr(a,s),this._updateLabel(r,n),Dt(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var i=this,a=this.getTextGuideLine(),o=i.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Dr(o,Cr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var d=l.getModel("label"),g=d.get("color"),m=g==="inherit"?f:null;i.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;a.setShape({points:y}),i.textGuideLineConfig={anchor:y?new Ne(y[0][0],y[0][1]):null},it(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),ck(i,hk(l),{stroke:f})},t}(en),cue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group;a.diff(o).add(function(l){var u=new uue(a,l);a.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,l),s.add(c),a.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Do(u,r,l)}).execute(),this._data=a},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type="funnel",t}(gt),hue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Mf(fe(this.getData,this),fe(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Tf(this,{coordDimensions:["value"],encodeDefaulter:Fe(zA,this)})},t.prototype._defaultLabelLine=function(r){ju(r,"labelLine",["show"]);var n=r.labelLine,i=r.emphasis.labelLine;n.show=n.show&&r.label.show,i.show=i.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),i=e.prototype.getDataParams.call(this,r),a=n.mapDimension("value"),o=n.getSum(a);return i.percent=o?+(n.get(a,r)/o*100).toFixed(2):0,i.$vars.push("percent"),i},t.type="series.funnel",t.defaultOption={coordinateSystemUsage:"box",z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:65,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:K.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function fue(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),i=[],a=t==="ascending",o=0,s=e.count();okue)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);i.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!Ew(this,"mousemove"))){var t=this._model,r=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),n=r.behavior;n==="jump"&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand(n==="none"?null:{axisExpandWindow:r.axisExpandWindow,animation:n==="jump"?null:{duration:0}})}}};function Ew(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var Pue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(r){var n=this.option;r&&Ge(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var i=r.get("parallelIndex");return i!=null&&n.getComponent("parallel",i)===this},t.prototype.setAxisExpand=function(r){j(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(n){r.hasOwnProperty(n)&&(this.option[n]=r[n])},this)},t.prototype._initDimensions=function(){var r=this.dimensions=[],n=this.parallelAxisIndex=[],i=ot(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(a){return(a.get("parallelIndex")||0)===this.componentIndex},this);j(i,function(a){r.push("dim"+a.get("dim")),n.push(a.componentIndex)})},t.type="parallel",t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},t}($e),Iue=function(e){q(t,e);function t(r,n,i,a,o){var s=e.call(this,r,n,i)||this;return s.type=a||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Vi);function rl(e,t,r,n,i,a){e=e||0;var o=r[1]-r[0];if(i!=null&&(i=jc(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),n==="all"){var s=Math.abs(t[1]-t[0]);s=jc(s,[0,o]),i=a=jc(s,[i,a]),n=0}t[0]=jc(t[0],r),t[1]=jc(t[1],r);var l=jw(t,n);t[n]+=e;var u=i||0,c=r.slice();l.sign<0?c[0]+=u:c[1]-=u,t[n]=jc(t[n],c);var h;return h=jw(t,n),i!=null&&(h.sign!==l.sign||h.spana&&(t[1-n]=t[n]+h.sign*a),t}function jw(e,t){var r=e[t]-e[1-t];return{span:Math.abs(r),sign:r>0?-1:r<0?1:t?-1:1}}function jc(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var Rw=j,a8=Math.min,o8=Math.max,MR=Math.floor,Due=Math.ceil,AR=ir,Eue=Math.PI,jue=function(){function e(t,r,n){this.type="parallel",this._axesMap=_e(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var i=t.dimensions,a=t.parallelAxisIndex;Rw(i,function(o,s){var l=a[s],u=r.getComponent("parallelAxis",l),c=this._axesMap.set(o,new Iue(o,Xp(u),[0,0],u.get("type"),l)),h=c.type==="category";c.onBand=h&&u.get("boundaryGap"),c.inverse=u.get("inverse"),u.axis=c,c.model=u,c.coordinateSystem=u.coordinateSystem=this},this)},e.prototype.update=function(t,r){this._updateAxesFromSeries(this._model,t)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,i=r.layoutBase,a=r.pixelDimIndex,o=t[1-a],s=t[a];return o>=n&&o<=n+r.axisLength&&s>=i&&s<=i+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype._updateAxesFromSeries=function(t,r){r.eachSeries(function(n){if(t.contains(n,r)){var i=n.getData();Rw(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(i,i.mapDimension(a)),Gu(o.scale,o.model)},this)}},this)},e.prototype.resize=function(t,r){var n=Tr(t,r).refContainer;this._rect=It(t.getBoxLayoutParams(),n),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var t=this._model,r=this._rect,n=["x","y"],i=["width","height"],a=t.get("layout"),o=a==="horizontal"?0:1,s=r[i[o]],l=[0,s],u=this.dimensions.length,c=Zm(t.get("axisExpandWidth"),l),h=Zm(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,d=t.get("axisExpandWindow"),g;if(d)g=Zm(d[1]-d[0],l),d[1]=d[0]+g;else{g=Zm(c*(h-1),l);var m=t.get("axisExpandCenter")||MR(u/2);d=[c*m-g/2],d[1]=d[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[MR(AR(d[0]/c,1))+1,Due(AR(d[1]/c,1))-1],_=y/c*d[0];return{layout:a,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[i[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:d,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,i=this._makeLayoutInfo(),a=i.layout;r.each(function(o){var s=[0,i.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),Rw(n,function(o,s){var l=(i.axisExpandable?Oue:Rue)(s,i),u={horizontal:{x:l.position,y:i.axisLength},vertical:{x:0,y:l.position}},c={horizontal:Eue/2,vertical:0},h=[u[a].x+t.x,u[a].y+t.y],f=c[a],d=Pr();Ko(d,d,f),ha(d,d,h),this._axesLayout[o]={position:h,rotation:f,transform:d,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(t){return this._axesMap.get(t)},e.prototype.dataToPoint=function(t,r){return this.axisCoordToPoint(this._axesMap.get(r).dataToCoord(t),r)},e.prototype.eachActiveState=function(t,r,n,i){n==null&&(n=0),i==null&&(i=t.count());var a=this._axesMap,o=this.dimensions,s=[],l=[];j(o,function(y){s.push(t.mapDimension(y)),l.push(a.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ca*(1-h[0])?(u="jump",l=s-a*(1-h[2])):(l=s-a*h[1])>=0&&(l=s-a*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?rl(l,i,o,"all"):u="none";else{var d=i[1]-i[0],g=o[1]*s/d;i=[o8(0,g-d/2)],i[1]=a8(o[1],i[0]+d),i[0]=i[1]-d}return{axisExpandWindow:i,behavior:u}},e}();function Zm(e,t){return a8(o8(e,t[0]),t[1])}function Rue(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Oue(e,t){var r=t.layoutLength,n=t.axisExpandWidth,i=t.axisCount,a=t.axisCollapseWidth,o=t.winInnerIndices,s,l=a,u=!1,c;return e=0;i--)Qn(n[i])},t.prototype.getActiveState=function(r){var n=this.activeIntervals;if(!n.length)return"normal";if(r==null||isNaN(+r))return"inactive";if(n.length===1){var i=n[0];if(i[0]<=r&&r<=i[1])return"active"}else for(var a=0,o=n.length;aGue}function f8(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function d8(e,t,r,n){var i=new Ce;return i.add(new Ze({name:"main",style:Gk(r),silent:!0,draggable:!0,cursor:"move",drift:Fe(NR,e,t,i,["n","s","w","e"]),ondragend:Fe(Hu,t,{isEnd:!0})})),j(n,function(a){i.add(new Ze({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Fe(NR,e,t,i,a),ondragend:Fe(Hu,t,{isEnd:!0})}))}),i}function v8(e,t,r,n){var i=n.brushStyle.lineWidth||0,a=Yh(i,Wue),o=r[0][0],s=r[1][0],l=o-i/2,u=s-i/2,c=r[0][1],h=r[1][1],f=c-a+i/2,d=h-a+i/2,g=c-o,m=h-s,y=g+i,x=m+i;mo(e,t,"main",o,s,g,m),n.transformable&&(mo(e,t,"w",l,u,a,x),mo(e,t,"e",f,u,a,x),mo(e,t,"n",l,u,y,a),mo(e,t,"s",l,d,y,a),mo(e,t,"nw",l,u,a,a),mo(e,t,"ne",f,u,a,a),mo(e,t,"sw",l,d,a,a),mo(e,t,"se",f,d,a,a))}function i2(e,t){var r=t.__brushOption,n=r.transformable,i=t.childAt(0);i.useStyle(Gk(r)),i.attr({silent:!n,cursor:n?"move":"default"}),j([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(a){var o=t.childOfName(a.join("")),s=a.length===1?a2(e,a[0]):Xue(e,a);o&&o.attr({silent:!n,invisible:!n,cursor:n?Uue[s]+"-resize":null})})}function mo(e,t,r,n,i,a,o){var s=t.childOfName(r);s&&s.setShape(Kue(Wk(e,t,[[n,i],[n+a,i+o]])))}function Gk(e){return Ae({strokeNoScale:!0},e.brushStyle)}function p8(e,t,r,n){var i=[wp(e,r),wp(t,n)],a=[Yh(e,r),Yh(t,n)];return[[i[0],a[0]],[i[1],a[1]]]}function Yue(e){return Us(e.group)}function a2(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},i=b_(r[t],Yue(e));return n[i]}function Xue(e,t){var r=[a2(e,t[0]),a2(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function NR(e,t,r,n,i,a){var o=r.__brushOption,s=e.toRectRange(o.range),l=g8(t,i,a);j(n,function(u){var c=Hue[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(p8(s[0][0],s[1][0],s[0][1],s[1][1])),Bk(t,r),Hu(t,{isEnd:!1})}function que(e,t,r,n){var i=t.__brushOption.range,a=g8(e,r,n);j(i,function(o){o[0]+=a[0],o[1]+=a[1]}),Bk(e,t),Hu(e,{isEnd:!1})}function g8(e,t,r){var n=e.group,i=n.transformCoordToLocal(t,r),a=n.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function Wk(e,t,r){var n=h8(e,t);return n&&n!==Wu?n.clipPath(r,e._transform):Se(r)}function Kue(e){var t=wp(e[0][0],e[1][0]),r=wp(e[0][1],e[1][1]),n=Yh(e[0][0],e[1][0]),i=Yh(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:i-r}}function Jue(e,t,r){if(!(!e._brushType||ece(e,t.offsetX,t.offsetY))){var n=e._zr,i=e._covers,a=Vk(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var B_={lineX:DR(0),lineY:DR(1),rect:{createCover:function(e,t){function r(n){return n}return d8({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=f8(e);return p8(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){v8(e,t,r,n)},updateCommon:i2,contain:s2},polygon:{createCover:function(e,t){var r=new Ce;return r.add(new Gr({name:"main",style:Gk(t),silent:!0})),r},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new en({name:"main",draggable:!0,drift:Fe(que,e,t),ondragend:Fe(Hu,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:Wk(e,t,r)})},updateCommon:i2,contain:s2}};function DR(e){return{createCover:function(t,r){return d8({toRectRange:function(n){var i=[n,[0,100]];return e&&i.reverse(),i},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=f8(t),n=wp(r[0][e],r[1][e]),i=Yh(r[0][e],r[1][e]);return[n,i]},updateCoverShape:function(t,r,n,i){var a,o=h8(t,r);if(o!==Wu&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,a];e&&l.reverse(),v8(t,r,l,i)},updateCommon:i2,contain:s2}}function y8(e){return e=Hk(e),function(t){return xA(t,e)}}function x8(e,t){return e=Hk(e),function(r){var n=t??r,i=n?e.width:e.height,a=n?e.x:e.y;return[a,a+(i||0)]}}function _8(e,t,r){var n=Hk(e);return function(i,a){return n.contain(a[0],a[1])&&!TW(i,t,r)}}function Hk(e){return Pe.create(e)}var tce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){e.prototype.init.apply(this,arguments),(this._brushController=new zk(n.getZr())).on("brush",fe(this._onBrush,this))},t.prototype.render=function(r,n,i,a){if(!rce(r,n,a)){this.axisModel=r,this.api=i,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ce,this.group.add(this._axisGroup),!!r.get("show")){var s=ice(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),d=Q({strokeContainThreshold:c},f),g=new wn(r,i,d);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(d,u,r,s,c,i),Up(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,i,a,o,s){var l=i.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=Pe.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:r.rotation,x:r.position[0],y:r.position[1]}).setPanels([{panelId:"pl",clipPath:y8(h),isTargetByCursor:_8(h,s,a),getLinearBrushOtherExtent:x8(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(nce(i))},t.prototype._onBrush=function(r){var n=r.areas,i=this.axisModel,a=i.axis,o=ae(n,function(s){return[a.coordToData(s.range[0],!0),a.coordToData(s.range[1],!0)]});(!i.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:i.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Mt);function rce(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function nce(e){var t=e.axis;return ae(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function ice(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var ace={type:"axisAreaSelect",event:"axisAreaSelected"};function oce(e){e.registerAction(ace,function(t,r){r.eachComponent({mainType:"parallelAxis",query:t},function(n){n.axis.model.setActiveIntervals(t.intervals)})}),e.registerAction("parallelAxisExpand",function(t,r){r.eachComponent({mainType:"parallel",query:t},function(n){n.setAxisExpand(t)})})}var sce={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function b8(e){e.registerComponentView(Lue),e.registerComponentModel(Pue),e.registerCoordinateSystem("parallel",Bue),e.registerPreprocessor(Tue),e.registerComponentModel(r2),e.registerComponentView(tce),Zh(e,"parallel",r2,sce),oce(e)}function lce(e){He(b8),e.registerChartView(mue),e.registerSeriesModel(_ue),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Cue)}var uce=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),cce=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new uce},t.prototype.buildPath=function(r,n){var i=n.extent;r.moveTo(n.x1,n.y1),r.bezierCurveTo(n.cpx1,n.cpy1,n.cpx2,n.cpy2,n.x2,n.y2),n.orient==="vertical"?(r.lineTo(n.x2+i,n.y2),r.bezierCurveTo(n.cpx2+i,n.cpy2,n.cpx1+i,n.cpy1,n.x1+i,n.y1)):(r.lineTo(n.x2,n.y2+i),r.bezierCurveTo(n.cpx2,n.cpy2+i,n.cpx1,n.cpy1+i,n.x1,n.y1+i)),r.closePath()},t.prototype.highlight=function(){Ho(this)},t.prototype.downplay=function(){Uo(this)},t}(Ke),hce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._mainGroup=new Ce,r._focusAdjacencyDisabled=!1,r}return t.prototype.init=function(r,n){this._controller=new rc(n.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},t.prototype.render=function(r,n,i){var a=this,o=r.getGraph(),s=this._mainGroup,l=r.layoutInfo,u=l.width,c=l.height,h=r.getData(),f=r.getData("edge"),d=r.get("orient");this._model=r,s.removeAll(),s.x=l.x,s.y=l.y,this._updateViewCoordSys(r,i),MW(r,i,s,this._controller,this._controllerHost,null),o.eachEdge(function(g){var m=new cce,y=De(m);y.dataIndex=g.dataIndex,y.seriesIndex=r.seriesIndex,y.dataType="edge";var x=g.getModel(),_=x.getModel("lineStyle"),w=_.get("curveness"),S=g.node1.getLayout(),T=g.node1.getModel(),M=T.get("localX"),A=T.get("localY"),P=g.node2.getLayout(),I=g.node2.getModel(),N=I.get("localX"),D=I.get("localY"),O=g.getLayout(),R,F,H,W,V,z,Z,U;m.shape.extent=Math.max(1,O.dy),m.shape.orient=d,d==="vertical"?(R=(M!=null?M*u:S.x)+O.sy,F=(A!=null?A*c:S.y)+S.dy,H=(N!=null?N*u:P.x)+O.ty,W=D!=null?D*c:P.y,V=R,z=F*(1-w)+W*w,Z=H,U=F*w+W*(1-w)):(R=(M!=null?M*u:S.x)+S.dx,F=(A!=null?A*c:S.y)+O.sy,H=N!=null?N*u:P.x,W=(D!=null?D*c:P.y)+O.ty,V=R*(1-w)+H*w,z=F,Z=R*w+H*(1-w),U=W),m.setShape({x1:R,y1:F,x2:H,y2:W,cpx1:V,cpy1:z,cpx2:Z,cpy2:U}),m.useStyle(_.getItemStyle()),ER(m.style,d,g);var $=""+x.get("value"),Y=Cr(x,"edgeLabel");Dr(m,Y,{labelFetcher:{getFormattedLabel:function(se,le,Ee,me,ye,Me){return r.getFormattedLabel(se,le,"edge",me,zn(ye,Y.normal&&Y.normal.get("formatter"),$),Me)}},labelDataIndex:g.dataIndex,defaultText:$}),m.setTextConfig({position:"inside"});var te=x.getModel("emphasis");Sr(m,x,"lineStyle",function(se){var le=se.getItemStyle();return ER(le,d,g),le}),s.add(m),f.setItemGraphicEl(g.dataIndex,m);var ie=te.get("focus");Dt(m,ie==="adjacency"?g.getAdjacentDataIndices():ie==="trajectory"?g.getTrajectoryDataIndices():ie,te.get("blurScope"),te.get("disabled"))}),o.eachNode(function(g){var m=g.getLayout(),y=g.getModel(),x=y.get("localX"),_=y.get("localY"),w=y.getModel("emphasis"),S=y.get(["itemStyle","borderRadius"])||0,T=new Ze({shape:{x:x!=null?x*u:m.x,y:_!=null?_*c:m.y,width:m.dx,height:m.dy,r:S},style:y.getModel("itemStyle").getItemStyle(),z2:10});Dr(T,Cr(y),{labelFetcher:{getFormattedLabel:function(A,P){return r.getFormattedLabel(A,P,"node")}},labelDataIndex:g.dataIndex,defaultText:g.id}),T.disableLabelAnimation=!0,T.setStyle("fill",g.getVisual("color")),T.setStyle("decal",g.getVisual("style").decal),Sr(T,y),s.add(T),h.setItemGraphicEl(g.dataIndex,T),De(T).dataType="node";var M=w.get("focus");Dt(T,M==="adjacency"?g.getAdjacentDataIndices():M==="trajectory"?g.getTrajectoryDataIndices():M,w.get("blurScope"),w.get("disabled"))}),h.eachItemGraphicEl(function(g,m){var y=h.getItemModel(m);y.get("draggable")&&(g.drift=function(x,_){a._focusAdjacencyDisabled=!0,this.shape.x+=x,this.shape.y+=_,this.dirty(),i.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:h.getRawIndex(m),localX:this.shape.x/u,localY:this.shape.y/c})},g.ondragend=function(){a._focusAdjacencyDisabled=!1},g.draggable=!0,g.cursor="move")}),!this._data&&r.isAnimationEnabled()&&s.setClipPath(fce(s.getBoundingRect(),r,function(){s.removeClipPath()})),this._data=r.getData()},t.prototype.dispose=function(){this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._updateViewCoordSys=function(r,n){var i=r.layoutInfo,a=i.width,o=i.height,s=r.coordinateSystem=new nc(null,{api:n,ecModel:r.ecModel});s.zoomLimit=r.get("scaleLimit"),s.setBoundingRect(0,0,a,o),s.setCenter(r.get("center")),s.setZoom(r.get("zoom")),this._controllerHost.target.attr({x:s.x,y:s.y,scaleX:s.scaleX,scaleY:s.scaleY})},t.type="sankey",t}(gt);function ER(e,t,r){switch(e.fill){case"source":e.fill=r.node1.getVisual("color"),e.decal=r.node1.getVisual("style").decal;break;case"target":e.fill=r.node2.getVisual("color"),e.decal=r.node2.getVisual("style").decal;break;case"gradient":var n=r.node1.getVisual("color"),i=r.node2.getVisual("color");he(n)&&he(i)&&(e.fill=new qu(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:i,offset:1}]))}}function fce(e,t,r){var n=new Ze({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Nt(n,{shape:{width:e.width+20}},t,r),n}var dce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new qe(o[l],this,n));var u=Ok(a,i,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(d.parentModel=_)}return d}),f.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(d.parentModel=w)}return d})}},t.prototype.setNodePosition=function(r,n){var i=this.option.data||this.option.nodes,a=i[r];a.localX=n[0],a.localY=n[1]},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,i){function a(d){return isNaN(d)||d==null}if(i==="edge"){var o=this.getDataParams(r,i),s=o.data,l=o.value,u=s.source+" -- "+s.target;return gr("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,i).data.name;return gr("nameValue",{name:f!=null?f+"":null,value:h,noValue:a(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(i.value==null&&n==="node"){var a=this.getGraph().getNodeByIndex(r),o=a.getLayout().value;i.value=o}return i},t.type="series.sankey",t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:K.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:K.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(bt);function vce(e,t){e.eachSeriesByType("sankey",function(r){var n=r.get("nodeWidth"),i=r.get("nodeGap"),a=Tr(r,t).refContainer,o=It(r.getBoxLayoutParams(),a);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;gce(c);var f=ot(c,function(y){return y.getLayout().value===0}),d=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");pce(c,h,n,i,s,l,d,g,m)})}function pce(e,t,r,n,i,a,o,s,l){mce(e,t,r,i,a,s,l),bce(e,t,a,i,n,o,s),Nce(e,s)}function gce(e){j(e,function(t){var r=Ys(t.outEdges,fx),n=Ys(t.inEdges,fx),i=t.getValue()||0,a=Math.max(r,n,i);t.setLayout({value:a},!0)})}function mce(e,t,r,n,i,a,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;x&&y.depth>d&&(d=y.depth),m.setLayout({depth:x?y.depth:h},!0),a==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?d:h-1;o&&o!=="left"&&yce(e,o,a,A);var P=a==="vertical"?(i-r)/A:(n-r)/A;_ce(e,P,a)}function w8(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function yce(e,t,r,n){if(t==="right"){for(var i=[],a=e,o=0;a.length;){for(var s=0;s0;a--)l*=.99,Cce(s,l,o),Ow(s,i,r,n,o),Lce(s,l,o),Ow(s,i,r,n,o)}function wce(e,t){var r=[],n=t==="vertical"?"y":"x",i=ZC(e,function(a){return a.getLayout()[n]});return i.keys.sort(function(a,o){return a-o}),j(i.keys,function(a){r.push(i.buckets.get(a))}),r}function Sce(e,t,r,n,i,a){var o=1/0;j(e,function(s){var l=s.length,u=0;j(s,function(h){u+=h.getLayout().value});var c=a==="vertical"?(n-(l-1)*i)/u:(r-(l-1)*i)/u;c0&&(s=l.getLayout()[a]+u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[f]+t;var g=i==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var d=h-2;d>=0;--d)l=o[d],u=l.getLayout()[a]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]}})}function Cce(e,t,r){j(e.slice().reverse(),function(n){j(n,function(i){if(i.outEdges.length){var a=Ys(i.outEdges,Tce,r)/Ys(i.outEdges,fx);if(isNaN(a)){var o=i.outEdges.length;a=o?Ys(i.outEdges,Mce,r)/o:0}if(r==="vertical"){var s=i.getLayout().x+(a-nl(i,r))*t;i.setLayout({x:s},!0)}else{var l=i.getLayout().y+(a-nl(i,r))*t;i.setLayout({y:l},!0)}}})})}function Tce(e,t){return nl(e.node2,t)*e.getValue()}function Mce(e,t){return nl(e.node2,t)}function Ace(e,t){return nl(e.node1,t)*e.getValue()}function kce(e,t){return nl(e.node1,t)}function nl(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function fx(e){return e.getValue()}function Ys(e,t,r){for(var n=0,i=e.length,a=-1;++ao&&(o=l)}),j(n,function(s){var l=new Ir({type:"color",mappingMethod:"linear",dataExtent:[a,o],visual:t.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}i.length&&j(i,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Ice(e){e.registerChartView(hce),e.registerSeriesModel(dce),e.registerLayout(vce),e.registerVisual(Pce),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:"series",subType:"sankey",query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),e.registerAction({type:"sankeyRoam",event:"sankeyRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",subType:"sankey",query:t},function(i){var a=i.coordinateSystem,o=j_(a,t,i.get("scaleLimit"));i.setCenter(o.center),i.setZoom(o.zoom)})})}var S8=function(){function e(){}return e.prototype._hasEncodeRule=function(t){var r=this.getEncode();return r&&r.get(t)!=null},e.prototype.getInitialData=function(t,r){var n,i=r.getComponent("xAxis",this.get("xAxisIndex")),a=r.getComponent("yAxis",this.get("yAxisIndex")),o=i.get("type"),s=a.get("type"),l;o==="category"?(t.layout="horizontal",n=i.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"?(t.layout="vertical",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("y")):t.layout=t.layout||"horizontal";var u=["x","y"],c=t.layout==="horizontal"?0:1,h=this._baseAxisDim=u[c],f=u[1-c],d=[i,a],g=d[c].get("type"),m=d[1-c].get("type"),y=t.data;if(y&&l){var x=[];j(y,function(S,T){var M;re(S)?(M=S.slice(),S.unshift(T)):re(S.value)?(M=Q({},S),M.value=M.value.slice(),S.value.unshift(T)):M=S,x.push(M)}),t.data=x}var _=this.defaultValueDimensions,w=[{name:h,type:X0(g),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:f,type:X0(m),dimsDef:_.slice()}];return Tf(this,{coordDimensions:w,dimensionsCount:_.length+1,encodeDefaulter:Fe(D6,w,this)})},e.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},e}(),C8=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],r.visualDrawType="stroke",r}return t.type="series.boxplot",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:K.color.neutral00,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:K.color.shadow}},animationDuration:800},t}(bt);Qt(C8,S8,!0);var Dce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this.group,s=this._data;this._data||o.removeAll();var l=r.get("layout")==="horizontal"?1:0;a.diff(s).add(function(u){if(a.hasValue(u)){var c=a.getItemLayout(u),h=jR(c,a,u,l,!0);a.setItemGraphicEl(u,h),o.add(h)}}).update(function(u,c){var h=s.getItemGraphicEl(c);if(!a.hasValue(u)){o.remove(h);return}var f=a.getItemLayout(u);h?(Oi(h),T8(f,h,a,u)):h=jR(f,a,u,l),o.add(h),a.setItemGraphicEl(u,h)}).remove(function(u){var c=s.getItemGraphicEl(u);c&&o.remove(c)}).execute(),this._data=a},t.prototype.remove=function(r){var n=this.group,i=this._data;this._data=null,i&&i.eachItemGraphicEl(function(a){a&&n.remove(a)})},t.type="boxplot",t}(gt),Ece=function(){function e(){}return e}(),jce=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="boxplotBoxPath",n}return t.prototype.getDefaultShape=function(){return new Ece},t.prototype.buildPath=function(r,n){var i=n.points,a=0;for(r.moveTo(i[a][0],i[a][1]),a++;a<4;a++)r.lineTo(i[a][0],i[a][1]);for(r.closePath();am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var Gce={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==Wr){var n="";ft(n)}var i=Vce(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:i.boxData},{data:i.outliers}]}};function Wce(e){e.registerSeriesModel(C8),e.registerChartView(Dce),e.registerLayout(Oce),e.registerTransform(Gce)}var Hce=["itemStyle","borderColor"],Uce=["itemStyle","borderColor0"],Zce=["itemStyle","borderColorDoji"],$ce=["itemStyle","color"],Yce=["itemStyle","color0"];function Uk(e,t){return t.get(e>0?$ce:Yce)}function Zk(e,t){return t.get(e===0?Zce:e>0?Hce:Uce)}var Xce={seriesType:"candlestick",plan:yf(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,i){for(var a;(a=n.next())!=null;){var o=i.getItemModel(a),s=i.getItemLayout(a).sign,l=o.getItemStyle();l.fill=Uk(s,o),l.stroke=Zk(s,o)||l.fill;var u=i.ensureUniqueItemVisual(a,"style");Q(u,l)}}}}}},qce=["color","borderColor"],Kce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,i){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,i,a){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){hl(this._progressiveEls||this.group,r)},t.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},t.prototype._renderNormal=function(r){var n=r.getData(),i=this._data,a=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea();this._data||a.removeAll(),n.diff(i).add(function(c){if(n.hasValue(c)){var h=n.getItemLayout(c);if(s&&RR(u,h))return;var f=zw(h,c,!0);Nt(f,{shape:{points:h.ends}},r,c),Bw(f,n,c,o),a.add(f),n.setItemGraphicEl(c,f)}}).update(function(c,h){var f=i.getItemGraphicEl(h);if(!n.hasValue(c)){a.remove(f);return}var d=n.getItemLayout(c);if(s&&RR(u,d)){a.remove(f);return}f?(it(f,{shape:{points:d.ends}},r,c),Oi(f)):f=zw(d),Bw(f,n,c,o),a.add(f),n.setItemGraphicEl(c,f)}).remove(function(c){var h=i.getItemGraphicEl(c);h&&a.remove(h)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),OR(r,this.group);var n=r.get("clip",!0)?Jp(r.coordinateSystem,!1,r):null;n?this.group.setClipPath(n):this.group.removeClipPath()},t.prototype._incrementalRenderNormal=function(r,n){for(var i=n.getData(),a=i.getLayout("isSimpleBox"),o;(o=r.next())!=null;){var s=i.getItemLayout(o),l=zw(s);Bw(l,i,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},t.prototype._incrementalRenderLarge=function(r,n){OR(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),this._data=null},t.type="candlestick",t}(gt),Jce=function(){function e(){}return e}(),Qce=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new Jce},t.prototype.buildPath=function(r,n){var i=n.points;this.__simpleBox?(r.moveTo(i[4][0],i[4][1]),r.lineTo(i[6][0],i[6][1])):(r.moveTo(i[0][0],i[0][1]),r.lineTo(i[1][0],i[1][1]),r.lineTo(i[2][0],i[2][1]),r.lineTo(i[3][0],i[3][1]),r.closePath(),r.moveTo(i[4][0],i[4][1]),r.lineTo(i[5][0],i[5][1]),r.moveTo(i[6][0],i[6][1]),r.lineTo(i[7][0],i[7][1]))},t}(Ke);function zw(e,t,r){var n=e.ends;return new Qce({shape:{points:r?ehe(n,e):n},z2:100})}function RR(e,t){for(var r=!0,n=0;nT?D[a]:N[a],ends:F,brushRect:Z(M,A,w)})}function V($,Y){var te=[];return te[i]=Y,te[a]=$,isNaN(Y)||isNaN($)?[NaN,NaN]:t.dataToPoint(te)}function z($,Y,te){var ie=Y.slice(),se=Y.slice();ie[i]=Py(ie[i]+n/2,1,!1),se[i]=Py(se[i]-n/2,1,!0),te?$.push(ie,se):$.push(se,ie)}function Z($,Y,te){var ie=V($,te),se=V(Y,te);return ie[i]-=n/2,se[i]-=n/2,{x:ie[0],y:ie[1],width:n,height:se[1]-ie[1]}}function U($){return $[i]=Py($[i],1),$}}function g(m,y){for(var x=Oa(m.count*4),_=0,w,S=[],T=[],M,A=y.getStore(),P=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var I=A.get(s,M),N=A.get(u,M),D=A.get(c,M),O=A.get(h,M),R=A.get(f,M);if(isNaN(I)||isNaN(O)||isNaN(R)){x[_++]=NaN,_+=3;continue}x[_++]=zR(A,M,N,D,c,P),S[i]=I,S[a]=O,w=t.dataToPoint(S,null,T),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[a]=R,w=t.dataToPoint(S,null,T),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function zR(e,t,r,n,i,a){var o;return r>n?o=-1:r0?e.get(i,t-1)<=n?1:-1:1,o}function ihe(e,t){var r=e.getBaseAxis(),n,i=r.type==="category"?r.getBandWidth():(n=r.getExtent(),Math.abs(n[1]-n[0])/t.count()),a=ce(be(e.get("barMaxWidth"),i),i),o=ce(be(e.get("barMinWidth"),1),i),s=e.get("barWidth");return s!=null?ce(s,i):Math.max(Math.min(i/2,a),o)}function ahe(e){e.registerChartView(Kce),e.registerSeriesModel(M8),e.registerPreprocessor(rhe),e.registerVisual(Xce),e.registerLayout(nhe)}function BR(e,t){var r=t.rippleEffectColor||t.color;e.eachChild(function(n){n.attr({z:t.z,zlevel:t.zlevel,style:{stroke:t.brushType==="stroke"?r:null,fill:t.brushType==="fill"?r:null}})})}var ohe=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=new qp(r,n),o=new Ce;return i.add(a),i.add(o),i.updateData(r,n),i}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,i=r.color,a=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var f=void 0;we(h)?f=h(i):f=h,a.__t>0&&(f=-s*a.__t),this._animateSymbol(a,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,i,a,o){if(n>0){r.__t=0;var s=this,l=r.animate("",a).when(o?n*2:n,{__t:o?2:1}).delay(i).during(function(){s._updateSymbolPosition(r)});a||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return To(r.__p1,r.__cp1)+To(r.__cp1,r.__p2)},t.prototype._updateAnimationPoints=function(r,n){r.__p1=n[0],r.__p2=n[1],r.__cp1=n[2]||[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]},t.prototype.updateData=function(r,n,i){this.childAt(0).updateData(r,n,i),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,i=r.__p2,a=r.__cp1,o=r.__t<1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=Br,c=NC;s[0]=u(n[0],a[0],i[0],o),s[1]=u(n[1],a[1],i[1],o);var h=r.__t<1?c(n[0],a[0],i[0],o):c(i[0],a[0],n[0],1-o),f=r.__t<1?c(n[1],a[1],i[1],o):c(i[1],a[1],n[1],1-o);r.rotation=-Math.atan2(f,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(r.__lastT!==void 0&&r.__lastT=0&&!(a[l]<=n);l--);l=Math.min(l,o-2)}else{for(l=s;ln);l++);l=Math.min(l-1,o-2)}var c=(n-a[l])/(a[l+1]-a[l]),h=i[l],f=i[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var d=r.__t<1?f[0]-h[0]:h[0]-f[0],g=r.__t<1?f[1]-h[1]:h[1]-f[1];r.rotation=-Math.atan2(g,d)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(A8),hhe=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),fhe=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new hhe},t.prototype.buildPath=function(r,n){var i=n.segs,a=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(i[o++],i[o++]);for(var l=1;l0){var d=(u+h)/2-(c-f)*a,g=(c+f)/2-(h-u)*a;r.quadraticCurveTo(d,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var i=this.shape,a=i.segs,o=i.curveness,s=this.style.lineWidth;if(i.polyline)for(var l=0,u=0;u0)for(var h=a[u++],f=a[u++],d=1;d0){var y=(h+g)/2-(f-m)*o,x=(f+m)/2-(g-h)*o;if(kF(h,f,y,x,g,m,s,r,n))return l}else if(ms(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect();if(r=i[0],n=i[1],a.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,i=n.segs,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+t.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),L8={seriesType:"lines",plan:yf(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(i,a){var o=[];if(n){var s=void 0,l=i.end-i.start;if(r){for(var u=0,c=i.start;c0&&(c||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(a);var h=r.get("clip",!0)&&Jp(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,i){var a=r.getData(),o=this._updateLineDraw(a,r);o.incrementalPrepareUpdate(a),this._clearLayer(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,i){this._lineDraw.incrementalUpdate(r,n.getData()),this._finished=r.end===n.getData().count()},t.prototype.eachRendered=function(r){this._lineDraw&&this._lineDraw.eachRendered(r)},t.prototype.updateTransform=function(r,n,i){var a=r.getData(),o=r.pipelineContext;if(!this._finished||o.large||o.progressiveRender)return{update:!0};var s=L8.reset(r,n,i);s.progress&&s.progress({start:0,end:a.count(),count:a.count()},a),this._lineDraw.updateLayout(),this._clearLayer(i)},t.prototype._updateLineDraw=function(r,n){var i=this._lineDraw,a=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!i||a!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(i&&i.remove(),i=this._lineDraw=l?new dhe:new Rk(o?a?che:k8:a?A8:jk),this._hasEffet=a,this._isPolyline=o,this._isLargeDraw=l),this.group.add(i.group),i},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=r.getZr(),i=n.painter.getType()==="svg";!i&&this._lastZlevel!=null&&n.painter.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(r,n){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(n)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.type="lines",t}(gt),phe=typeof Uint32Array>"u"?Array:Uint32Array,ghe=typeof Float64Array>"u"?Array:Float64Array;function FR(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=ae(t,function(r){var n=[r[0].coord,r[1].coord],i={coords:n};return r[0].name&&(i.fromName=r[0].name),r[1].name&&(i.toName=r[1].name),a_([i,r[0],r[1]])}))}var mhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="lineStyle",r.visualDrawType="stroke",r}return t.prototype.init=function(r){r.data=r.data||[],FR(r);var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(r){if(FR(r),r.data){var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(r){var n=this._processFlatCoordsArray(r.data);n.flatCoords&&(this._flatCoords?(this._flatCoords=Eh(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Eh(this._flatCoordsOffset,n.flatCoordsOffset)):(this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset),r.data=new Float32Array(n.count)),this.getRawData().appendData(r.data)},t.prototype._getCoordsFromItemModel=function(r){var n=this.getData().getItemModel(r),i=n.option instanceof Array?n.option:n.getShallow("coords");return i},t.prototype.getLineCoordsCount=function(r){return this._flatCoordsOffset?this._flatCoordsOffset[r*2+1]:this._getCoordsFromItemModel(r).length},t.prototype.getLineCoords=function(r,n){if(this._flatCoordsOffset){for(var i=this._flatCoordsOffset[r*2],a=this._flatCoordsOffset[r*2+1],o=0;o ")})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?1e4:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?2e4:this.get("progressiveThreshold"))},t.prototype.getZLevelKey=function(){var r=this.getModel("effect"),n=r.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:r.get("show")&&n>0?n+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.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}},t}(bt);function $m(e){return e instanceof Array||(e=[e,e]),e}var yhe={seriesType:"lines",reset:function(e){var t=$m(e.get("symbol")),r=$m(e.get("symbolSize")),n=e.getData();n.setVisual("fromSymbol",t&&t[0]),n.setVisual("toSymbol",t&&t[1]),n.setVisual("fromSymbolSize",r&&r[0]),n.setVisual("toSymbolSize",r&&r[1]);function i(a,o){var s=a.getItemModel(o),l=$m(s.getShallow("symbol",!0)),u=$m(s.getShallow("symbolSize",!0));l[0]&&a.setItemVisual(o,"fromSymbol",l[0]),l[1]&&a.setItemVisual(o,"toSymbol",l[1]),u[0]&&a.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&a.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?i:null}}};function xhe(e){e.registerChartView(vhe),e.registerSeriesModel(mhe),e.registerLayout(L8),e.registerVisual(yhe)}var _he=256,bhe=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=Bn.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,i,a,o){var s=this._getBrush(),l=this._getGradient(a,"inRange"),u=this._getGradient(a,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),d=t.length;h.width=r,h.height=n;for(var g=0;g0){var O=o(w)?l:u;w>0&&(w=w*N+P),T[M++]=O[D],T[M++]=O[D+1],T[M++]=O[D+2],T[M++]=O[D+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=Bn.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var i=t.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor=K.color.neutral99,i.beginPath(),i.arc(-r,r,this.pointSize,0,Math.PI*2,!0),i.closePath(),i.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,i=n[r]||(n[r]=new Uint8ClampedArray(256*4)),a=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,a),i[o++]=a[0],i[o++]=a[1],i[o++]=a[2],i[o++]=a[3];return i},e}();function whe(e,t,r){var n=e[1]-e[0];t=ae(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var i=t.length,a=0;return function(o){var s;for(s=a;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}function VR(e){var t=e.dimensions;return t[0]==="lng"&&t[1]==="lat"}var Che=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(a=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,i,0,r.getData().count()):VR(o)&&this._renderOnGeo(o,r,a,i)},t.prototype.incrementalPrepareRender=function(r,n,i){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,i,a){var o=n.coordinateSystem;o&&(VR(o)?this.render(n,i,a):(this._progressiveEls=[],this._renderOnGridLike(n,a,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){hl(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,i,a,o){var s=r.coordinateSystem,l=tl(s,"cartesian2d"),u=tl(s,"matrix"),c,h,f,d;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=g.getBandWidth()+.5,h=m.getBandWidth()+.5,f=g.scale.getExtent(),d=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),T=r.get(["itemStyle","borderRadius"]),M=Cr(r),A=r.getModel("emphasis"),P=A.get("focus"),I=A.get("blurScope"),N=A.get("disabled"),D=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],O=i;Of[1]||Wd[1])continue;var V=s.dataToPoint([H,W]);R=new Ze({shape:{x:V[0]-c/2,y:V[1]-h/2,width:c,height:h},style:F})}else if(u){var z=s.dataToLayout([x.get(D[0],O),x.get(D[1],O)]).rect;if(Xr(z.x))continue;R=new Ze({z2:1,shape:z,style:F})}else{if(isNaN(x.get(D[1],O)))continue;var Z=s.dataToLayout([x.get(D[0],O)]),z=Z.contentRect||Z.rect;if(Xr(z.x)||Xr(z.y))continue;R=new Ze({z2:1,shape:z,style:F})}if(x.hasItemOption){var U=x.getItemModel(O),$=U.getModel("emphasis");_=$.getModel("itemStyle").getItemStyle(),w=U.getModel(["blur","itemStyle"]).getItemStyle(),S=U.getModel(["select","itemStyle"]).getItemStyle(),T=U.get(["itemStyle","borderRadius"]),P=$.get("focus"),I=$.get("blurScope"),N=$.get("disabled"),M=Cr(U)}R.shape.r=T;var Y=r.getRawValue(O),te="-";Y&&Y[2]!=null&&(te=Y[2]+""),Dr(R,M,{labelFetcher:r,labelDataIndex:O,defaultOpacity:F.opacity,defaultText:te}),R.ensureState("emphasis").style=_,R.ensureState("blur").style=w,R.ensureState("select").style=S,Dt(R,P,I,N),R.incremental=o,o&&(R.states.emphasis.hoverLayer=!0),y.add(R),x.setItemGraphicEl(O,R),this._progressiveEls&&this._progressiveEls.push(R)}},t.prototype._renderOnGeo=function(r,n,i,a){var o=i.targetVisuals.inRange,s=i.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new bhe;u.blurSize=n.get("blurSize"),u.pointSize=n.get("pointSize"),u.minOpacity=n.get("minOpacity"),u.maxOpacity=n.get("maxOpacity");var c=r.getViewRect().clone(),h=r.getRoamTransform();c.applyTransform(h);var f=Math.max(c.x,0),d=Math.max(c.y,0),g=Math.min(c.width+c.x,a.getWidth()),m=Math.min(c.height+c.y,a.getHeight()),y=g-f,x=m-d,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,P,I){var N=r.dataToPoint([A,P]);return N[0]-=f,N[1]-=d,N.push(I),N}),S=i.getExtent(),T=i.type==="visualMap.continuous"?She(S,i.option.range):whe(S,i.getPieceList(),i.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},T);var M=new Er({style:{width:y,height:x,x:f,y:d,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(gt),The=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return no(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=mf.get(this.get("coordinateSystem"));if(r&&r.dimensions)return r.dimensions[0]==="lng"&&r.dimensions[1]==="lat"},t.type="series.heatmap",t.dependencies=["grid","geo","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function Mhe(e){e.registerChartView(Che),e.registerSeriesModel(The)}var Ahe=["itemStyle","borderWidth"],GR=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],Gw=new ro,khe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:GR[+c],categoryDim:GR[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=HR(o,g),y=WR(o,g,m,f),x=UR(o,f,y);o.setItemGraphicEl(g,x),a.add(x),$R(x,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){a.remove(y);return}var x=HR(o,g),_=WR(o,g,x,f),w=j8(o,_);y&&w!==y.__pictorialShapeStr&&(a.remove(y),o.setItemGraphicEl(g,null),y=null),y?jhe(y,f,_):y=UR(o,f,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,a.add(y),$R(y,f,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&ZR(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var d=r.get("clip",!0)?Jp(r.coordinateSystem,!1,r):null;return d?a.setClipPath(d):a.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var i=this.group,a=this._data;r.get("animation")?a&&a.eachItemGraphicEl(function(o){ZR(a,De(o).dataIndex,r,o)}):i.removeAll()},t.type="pictorialBar",t}(gt);function WR(e,t,r,n){var i=e.getItemLayout(t),a=r.get("symbolRepeat"),o=r.get("symbolClip"),s=r.get("symbolPosition")||"start",l=r.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=r.get("symbolPatternSize")||2,h=r.isAnimationEnabled(),f={dataIndex:t,layout:i,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:a,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};Lhe(r,a,i,n,f),Nhe(e,t,i,a,o,f.boundingLength,f.pxSign,c,n,f),Phe(r,f.symbolScale,u,n,f);var d=f.symbolSize,g=ec(r.get("symbolOffset"),d);return Ihe(r,d,i,a,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function Lhe(e,t,r,n,i){var a=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[a.wh]<=0),c;if(re(o)){var h=[Ww(s,o[0])-l,Ww(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function Ww(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Nhe(e,t,r,n,i,a,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),d=e.getItemVisual(t,"symbolSize"),g;re(d)?g=d.slice():d==null?g=["100%","100%"]:g=[d,d],g[h.index]=ce(g[h.index],f),g[c.index]=ce(g[c.index],n?f:Math.abs(a)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Phe(e,t,r,n,i){var a=e.get(Ahe)||0;a&&(Gw.attr({scaleX:t[0],scaleY:t[1],rotation:r}),Gw.updateTransform(),a/=Gw.getLineScale(),a*=t[n.valueDim.index]),i.valueLineWidth=a||0}function Ihe(e,t,r,n,i,a,o,s,l,u,c,h){var f=c.categoryDim,d=c.valueDim,g=h.pxSign,m=Math.max(t[d.index]+s,0),y=m;if(n){var x=Math.abs(l),_=Fr(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=ce(_,t[d.index]),T=Math.max(m+S*2,0),M=w?0:S*2,A=rA(n),P=A?n:YR((x+M)/T),I=x-P*m;S=I/2/(w?P:Math.max(P-1,1)),T=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(P=u?YR((Math.abs(u)+M)/T):0),y=P*T-M,h.repeatTimes=P,h.symbolMargin=S}var N=g*(y/2),D=h.pathPosition=[];D[f.index]=r[f.wh]/2,D[d.index]=o==="start"?N:o==="end"?l-N:l/2,a&&(D[0]+=a[0],D[1]+=a[1]);var O=h.bundlePosition=[];O[f.index]=r[f.xy],O[d.index]=r[d.xy];var R=h.barRectShape=Q({},r);R[d.wh]=g*Math.max(Math.abs(r[d.wh]),Math.abs(D[d.index]+N)),R[f.wh]=r[f.wh];var F=h.clipShape={};F[f.xy]=-r[f.xy],F[f.wh]=c.ecSize[f.wh],F[d.xy]=0,F[d.wh]=r[d.wh]}function N8(e){var t=e.symbolPatternSize,r=sr(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function P8(e,t,r,n){var i=e.__pictorialBundle,a=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=a[t.valueDim.index]+o+r.symbolMargin*2;for($k(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function I8(e,t,r,n){var i=e.__pictorialBundle,a=e.__pictorialMainPath;a?Sh(a,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(a=e.__pictorialMainPath=N8(r),i.add(a),Sh(a,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:0,scaleY:0,rotation:r.rotation},{scaleX:r.symbolScale[0],scaleY:r.symbolScale[1]},r,n))}function D8(e,t,r){var n=Q({},t.barRectShape),i=e.__pictorialBarRect;i?Sh(i,null,{shape:n},t,r):(i=e.__pictorialBarRect=new Ze({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),i.disableMorphing=!0,e.add(i))}function E8(e,t,r,n){if(r.symbolClip){var i=e.__pictorialClipPath,a=Q({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(i)it(i,{shape:a},s,l);else{a[o.wh]=0,i=new Ze({shape:a}),e.__pictorialBundle.setClipPath(i),e.__pictorialClipPath=i;var u={};u[o.wh]=r.clipShape[o.wh],Ku[n?"updateProps":"initProps"](i,{shape:u},s,l)}}}function HR(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=Dhe,r.isAnimationEnabled=Ehe,r}function Dhe(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function Ehe(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function UR(e,t,r,n){var i=new Ce,a=new Ce;return i.add(a),i.__pictorialBundle=a,a.x=r.bundlePosition[0],a.y=r.bundlePosition[1],r.symbolRepeat?P8(i,t,r):I8(i,t,r),D8(i,r,n),E8(i,t,r,n),i.__pictorialShapeStr=j8(e,r),i.__pictorialSymbolMeta=r,i}function jhe(e,t,r){var n=r.animationModel,i=r.dataIndex,a=e.__pictorialBundle;it(a,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,i),r.symbolRepeat?P8(e,t,r,!0):I8(e,t,r,!0),D8(e,r,!0),E8(e,t,r,!0)}function ZR(e,t,r,n){var i=n.__pictorialBarRect;i&&i.removeTextContent();var a=[];$k(n,function(o){a.push(o)}),n.__pictorialMainPath&&a.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),j(a,function(o){el(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function j8(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function $k(e,t,r){j(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function Sh(e,t,r,n,i,a){t&&e.attr(t),n.symbolClip&&!i?r&&e.attr(r):r&&Ku[i?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,a)}function $R(e,t,r){var n=r.dataIndex,i=r.itemModel,a=i.getModel("emphasis"),o=a.getModel("itemStyle").getItemStyle(),s=i.getModel(["blur","itemStyle"]).getItemStyle(),l=i.getModel(["select","itemStyle"]).getItemStyle(),u=i.getShallow("cursor"),c=a.get("focus"),h=a.get("blurScope"),f=a.get("scale");$k(e,function(m){if(m instanceof Er){var y=m.style;m.useStyle(Q({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,f&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var d=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Dr(g,Cr(i),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Uh(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:d}),Dt(e,c,h,a.get("disabled"))}function YR(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var Rhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.defaultSymbol="roundRect",r}return t.prototype.getInitialData=function(r){return r.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series.pictorialBar",t.dependencies=["grid"],t.defaultOption=fl(gp.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:K.color.primary}}}),t}(gp);function Ohe(e){e.registerChartView(khe),e.registerSeriesModel(Rhe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Fe(tG,"pictorialBar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,rG("pictorialBar"))}var zhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._layers=[],r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this,s=this.group,l=r.getLayerSeries(),u=a.getLayout("layoutInfo"),c=u.rect,h=u.boundaryGap;s.x=0,s.y=c.y+h[0];function f(y){return y.name}var d=new Zo(this._layersSeries||[],l,f,f),g=[];d.add(fe(m,this,"add")).update(fe(m,this,"update")).remove(fe(m,this,"remove")).execute();function m(y,x,_){var w=o._layers;if(y==="remove"){s.remove(w[x]);return}for(var S=[],T=[],M,A=l[x].indices,P=0;Pa&&(a=s),n.push(s)}for(var u=0;ua&&(a=h)}return{y0:i,max:a}}function Whe(e){e.registerChartView(zhe),e.registerSeriesModel(Fhe),e.registerLayout(Vhe),e.registerProcessor(Cf("themeRiver"))}var Hhe=2,Uhe=4,qR=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;o.z2=Hhe,o.textConfig={inside:!0},De(o).seriesIndex=n.seriesIndex;var s=new tt({z2:Uhe,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,i,a),o}return t.prototype.updateData=function(r,n,i,a,o){this.node=n,n.piece=this,i=i||this._seriesModel,a=a||this._ecModel;var s=this;De(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=Q({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var d=n.getVisual("decal");d&&(f.decal=Gh(d,o));var g=Ba(l.getModel("itemStyle"),h,!0);Q(h,g),j(Cn,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var T=Ba(S,h);T&&(w.shape=T)}),r?(s.setShape(h),s.shape.r=c.r0,Nt(s,{shape:{r:c.r}},i,n.dataIndex)):(it(s,{shape:h},i),Oi(s)),s.useStyle(f),this._updateLabel(i);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=i||this._seriesModel,this._ecModel=a||this._ecModel;var y=u.get("focus"),x=y==="relative"?Eh(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;Dt(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,i=this.node.getModel(),a=i.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),h=this,f=h.getTextContent(),d=this.node.dataIndex,g=a.get("minAngle")/180*Math.PI,m=a.get("show")&&!(g!=null&&Math.abs(s)F&&!Oh(W-F)&&W0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,i):(o.virtualPiece=new qR(_,r,n,i),c.add(o.virtualPiece)),w.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(w.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},t.prototype._initEvents=function(){var r=this;this.group.off("click"),this.group.on("click",function(n){var i=!1,a=r.seriesModel.getViewRoot();a.eachNode(function(o){if(!i&&o.piece&&o.piece===n.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")r._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";B0(u,c)}}i=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:l2,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var i=n.getData(),a=i.getItemLayout(0);if(a){var o=r[0]-a.cx,s=r[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},t.type="sunburst",t}(gt),Xhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r,n){var i={name:r.name,children:r.data};R8(i);var a=this._levelModels=ae(r.levels||[],function(l){return new qe(l,this,n)},this),o=Lk.createTree(i,this,s);function s(l){l.wrapMethod("getItemModel",function(u,c){var h=o.getNodeByDataIndex(c),f=a[h.depth];return f&&(u.parentModel=f),u})}return o.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treePathInfo=O_(i,this),n},t.prototype.getLevelModel=function(r){return this._levelModels&&this._levelModels[r.depth]},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){FW(this)},t.type="series.sunburst",t.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},t}(bt);function R8(e){var t=0;j(e.children,function(n){R8(n);var i=n.value;re(i)&&(i=i[0]),t+=i});var r=e.value;re(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),re(e.value)?e.value[0]=r:e.value=r}var JR=Math.PI/180;function qhe(e,t,r){t.eachSeriesByType(e,function(n){var i=n.get("center"),a=n.get("radius");re(a)||(a=[0,a]),re(i)||(i=[i,i]);var o=r.getWidth(),s=r.getHeight(),l=Math.min(o,s),u=ce(i[0],o),c=ce(i[1],s),h=ce(a[0],l/2),f=ce(a[1],l/2),d=-n.get("startAngle")*JR,g=n.get("minAngle")*JR,m=n.getData().tree.root,y=n.getViewRoot(),x=y.depth,_=n.get("sort");_!=null&&O8(y,_);var w=0;j(y.children,function(W){!isNaN(W.getValue())&&w++});var S=y.getValue(),T=Math.PI/(S||w)*2,M=y.depth>0,A=y.height-(M?-1:1),P=(f-h)/(A||1),I=n.get("clockwise"),N=n.get("stillShowZeroSum"),D=I?1:-1,O=function(W,V){if(W){var z=V;if(W!==m){var Z=W.getValue(),U=S===0&&N?T:Z*T;U1;)o=o.parentNode;var s=i.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&he(s)&&(s=T0(s,(n.depth-1)/(a-1)*.5)),s}e.eachSeriesByType("sunburst",function(n){var i=n.getData(),a=i.tree;a.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,a.root.height));var u=i.ensureUniqueItemVisual(o.dataIndex,"style");Q(u,l)})})}function Qhe(e){e.registerChartView(Yhe),e.registerSeriesModel(Xhe),e.registerLayout(Fe(qhe,"sunburst")),e.registerProcessor(Fe(Cf,"sunburst")),e.registerVisual(Jhe),$he(e)}var QR={color:"fill",borderColor:"stroke"},efe={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Eo=Ye(),tfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},t.prototype.getInitialData=function(r,n){return no(null,this)},t.prototype.getDataParams=function(r,n,i){var a=e.prototype.getDataParams.call(this,r,n);return i&&(a.info=Eo(i).info),a},t.type="series.custom",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},t}(bt);function rfe(e,t){return t=t||[0,0],ae(["x","y"],function(r,n){var i=this.getAxis(r),a=t[n],o=e[n]/2;return i.type==="category"?i.getBandWidth():Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function nfe(e){var t=e.master.getRect();return{coordSys:{type:"cartesian2d",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r){return e.dataToPoint(r)},size:fe(rfe,e)}}}function ife(e,t){return t=t||[0,0],ae([0,1],function(r){var n=t[r],i=e[r]/2,a=[],o=[];return a[r]=n-i,o[r]=n+i,a[1-r]=o[1-r]=t[1-r],Math.abs(this.dataToPoint(a)[r]-this.dataToPoint(o)[r])},this)}function afe(e){var t=e.getBoundingRect();return{coordSys:{type:"geo",x:t.x,y:t.y,width:t.width,height:t.height,zoom:e.getZoom()},api:{coord:function(r){return e.dataToPoint(r)},size:fe(ife,e)}}}function ofe(e,t){var r=this.getAxis(),n=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return r.type==="category"?r.getBandWidth():Math.abs(r.dataToCoord(n-i)-r.dataToCoord(n+i))}function sfe(e){var t=e.getRect();return{coordSys:{type:"singleAxis",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r){return e.dataToPoint(r)},size:fe(ofe,e)}}}function lfe(e,t){return t=t||[0,0],ae(["Radius","Angle"],function(r,n){var i="get"+r+"Axis",a=this[i](),o=t[n],s=e[n]/2,l=a.type==="category"?a.getBandWidth():Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return r==="Angle"&&(l=l*Math.PI/180),l},this)}function ufe(e){var t=e.getRadiusAxis(),r=e.getAngleAxis(),n=t.getExtent();return n[0]>n[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(i){var a=t.dataToRadius(i[0]),o=r.dataToAngle(i[1]),s=e.coordToPoint([a,o]);return s.push(a,o*Math.PI/180),s},size:fe(lfe,e)}}}function cfe(e){var t=e.getRect(),r=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:r.start,end:r.end,weeks:r.weeks,dayCount:r.allDay}},api:{coord:function(n,i){return e.dataToPoint(n,i)},layout:function(n,i){return e.dataToLayout(n,i)}}}}function hfe(e){var t=e.getRect();return{coordSys:{type:"matrix",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r,n){return e.dataToPoint(r,n)},layout:function(r,n){return e.dataToLayout(r,n)}}}}function z8(e,t,r,n){return e&&(e.legacy||e.legacy!==!1&&!r&&!n&&t!=="tspan"&&(t==="text"||ge(e,"text")))}function B8(e,t,r){var n=e,i,a,o;if(t==="text")o=n;else{o={},ge(n,"text")&&(o.text=n.text),ge(n,"rich")&&(o.rich=n.rich),ge(n,"textFill")&&(o.fill=n.textFill),ge(n,"textStroke")&&(o.stroke=n.textStroke),ge(n,"fontFamily")&&(o.fontFamily=n.fontFamily),ge(n,"fontSize")&&(o.fontSize=n.fontSize),ge(n,"fontStyle")&&(o.fontStyle=n.fontStyle),ge(n,"fontWeight")&&(o.fontWeight=n.fontWeight),a={type:"text",style:o,silent:!0},i={};var s=ge(n,"textPosition");r?i.position=s?n.textPosition:"inside":s&&(i.position=n.textPosition),ge(n,"textPosition")&&(i.position=n.textPosition),ge(n,"textOffset")&&(i.offset=n.textOffset),ge(n,"textRotation")&&(i.rotation=n.textRotation),ge(n,"textDistance")&&(i.distance=n.textDistance)}return eO(o,e),j(o.rich,function(l){eO(l,l)}),{textConfig:i,textContent:a}}function eO(e,t){t&&(t.font=t.textFont||t.font,ge(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),ge(t,"textAlign")&&(e.align=t.textAlign),ge(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),ge(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),ge(t,"textWidth")&&(e.width=t.textWidth),ge(t,"textHeight")&&(e.height=t.textHeight),ge(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),ge(t,"textPadding")&&(e.padding=t.textPadding),ge(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),ge(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),ge(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),ge(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),ge(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),ge(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),ge(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function tO(e,t,r){var n=e;n.textPosition=n.textPosition||r.position||"inside",r.offset!=null&&(n.textOffset=r.offset),r.rotation!=null&&(n.textRotation=r.rotation),r.distance!=null&&(n.textDistance=r.distance);var i=n.textPosition.indexOf("inside")>=0,a=e.fill||K.color.neutral99;rO(n,t);var o=n.textFill==null;return i?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=a),n.textStrokeWidth==null&&(n.textStrokeWidth=2)):(o&&(n.textFill=e.fill||r.outsideFill||K.color.neutral00),!n.textStroke&&r.outsideStroke&&(n.textStroke=r.outsideStroke)),n.text=t.text,n.rich=t.rich,j(t.rich,function(s){rO(s,s)}),n}function rO(e,t){t&&(ge(t,"fill")&&(e.textFill=t.fill),ge(t,"stroke")&&(e.textStroke=t.fill),ge(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),ge(t,"font")&&(e.font=t.font),ge(t,"fontStyle")&&(e.fontStyle=t.fontStyle),ge(t,"fontWeight")&&(e.fontWeight=t.fontWeight),ge(t,"fontSize")&&(e.fontSize=t.fontSize),ge(t,"fontFamily")&&(e.fontFamily=t.fontFamily),ge(t,"align")&&(e.textAlign=t.align),ge(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),ge(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),ge(t,"width")&&(e.textWidth=t.width),ge(t,"height")&&(e.textHeight=t.height),ge(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),ge(t,"padding")&&(e.textPadding=t.padding),ge(t,"borderColor")&&(e.textBorderColor=t.borderColor),ge(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),ge(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),ge(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),ge(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),ge(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),ge(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),ge(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),ge(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),ge(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),ge(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var F8={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},nO=Qe(F8);Ei(Ya,function(e,t){return e[t]=1,e},{});Ya.join(", ");var dx=["","style","shape","extra"],Xh=Ye();function Yk(e,t,r,n,i){var a=e+"Animation",o=ff(e,n,i)||{},s=Xh(t).userDuring;return o.duration>0&&(o.during=s?fe(gfe,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Q(o,r[a]),o}function By(e,t,r,n){n=n||{};var i=n.dataIndex,a=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Xh(e),u=t.style;l.userDuring=t.during;var c={},h={};if(yfe(e,t,h),e.type==="compound")for(var f=e.shape.paths,d=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else dfe(e,t,i||0,r,c);V8(e,t),u?e.dirty():e.markRedraw()}function V8(e,t){for(var r=Xh(e).leaveToProps,n=0;n0&&e.animateFrom(i,a)}}function vfe(e,t){ge(t,"silent")&&(e.silent=t.silent),ge(t,"ignore")&&(e.ignore=t.ignore),e instanceof Ri&&ge(t,"invisible")&&(e.invisible=t.invisible),e instanceof Ke&&ge(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var Aa={},pfe={setTransform:function(e,t){return Aa.el[e]=t,this},getTransform:function(e){return Aa.el[e]},setShape:function(e,t){var r=Aa.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=Aa.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=Aa.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=Aa.el.style;if(t)return t[e]},setExtra:function(e,t){var r=Aa.el.extra||(Aa.el.extra={});return r[e]=t,this},getExtra:function(e){var t=Aa.el.extra;if(t)return t[e]}};function gfe(){var e=this,t=e.el;if(t){var r=Xh(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}Aa.el=t,n(pfe)}}function iO(e,t,r,n){var i=r[e];if(i){var a=t[e],o;if(a){var s=r.transition,l=i.transition;if(l)if(!o&&(o=n[e]={}),Tu(l))Q(o,a);else for(var u=Tt(l),c=0;c=0){!o&&(o=n[e]={});for(var d=Qe(a),c=0;c=0)){var f=e.getAnimationStyleProps(),d=f?f.style:null;if(d){!a&&(a=n.style={});for(var g=Qe(r),u=0;u=0?t.getStore().get(z,W):void 0}var Z=t.get(V.name,W),U=V&&V.ordinalMeta;return U?U.categories[Z]:Z}function A(H,W){W==null&&(W=c);var V=t.getItemVisual(W,"style"),z=V&&V.fill,Z=V&&V.opacity,U=w(W,Ns).getItemStyle();z!=null&&(U.fill=z),Z!=null&&(U.opacity=Z);var $={inheritColor:he(z)?z:K.color.neutral99},Y=S(W,Ns),te=Ct(Y,null,$,!1,!0);te.text=Y.getShallow("show")?be(e.getFormattedLabel(W,Ns),Uh(t,W)):null;var ie=R0(Y,$,!1);return N(H,U),U=tO(U,te,ie),H&&I(U,H),U.legacy=!0,U}function P(H,W){W==null&&(W=c);var V=w(W,jo).getItemStyle(),z=S(W,jo),Z=Ct(z,null,null,!0,!0);Z.text=z.getShallow("show")?zn(e.getFormattedLabel(W,jo),e.getFormattedLabel(W,Ns),Uh(t,W)):null;var U=R0(z,null,!0);return N(H,V),V=tO(V,Z,U),H&&I(V,H),V.legacy=!0,V}function I(H,W){for(var V in W)ge(W,V)&&(H[V]=W[V])}function N(H,W){H&&(H.textFill&&(W.textFill=H.textFill),H.textPosition&&(W.textPosition=H.textPosition))}function D(H,W){if(W==null&&(W=c),ge(QR,H)){var V=t.getItemVisual(W,"style");return V?V[QR[H]]:null}if(ge(efe,H))return t.getItemVisual(W,H)}function O(H){if(o.type==="cartesian2d"){var W=o.getBaseAxis();return Cre(Ae({axis:W},H))}}function R(){return r.getCurrentSeriesIndices()}function F(H){return wA(H,r)}}function Lfe(e){var t={};return j(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var i=n.coordDim,a=t[i]=t[i]||[];a[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function Yw(e,t,r,n,i,a,o){if(!n){a.remove(t);return}var s=Qk(e,t,r,n,i,a);return s&&o.setItemGraphicEl(r,s),s&&Dt(s,n.focus,n.blurScope,n.emphasisDisabled),s}function Qk(e,t,r,n,i,a){var o=-1,s=t;t&&U8(t,n,i)&&(o=Ve(a.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=Kk(n),s&&Tfe(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),pi.normal.cfg=pi.normal.conOpt=pi.emphasis.cfg=pi.emphasis.conOpt=pi.blur.cfg=pi.blur.conOpt=pi.select.cfg=pi.select.conOpt=null,pi.isLegacy=!1,Pfe(u,r,n,i,l,pi),Nfe(u,r,n,i,l),Jk(e,u,r,n,pi,i,l),ge(n,"info")&&(Eo(u).info=n.info);for(var c=0;c=0?a.replaceAt(u,o):a.add(u),u}function U8(e,t,r){var n=Eo(e),i=t.type,a=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||i!=null&&i!==n.customGraphicType||i==="path"&&Rfe(a)&&Z8(a)!==n.customPathData||i==="image"&&ge(o,"image")&&o.image!==n.customImagePath}function Nfe(e,t,r,n,i){var a=r.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&U8(o,a,n)&&(o=null),o||(o=Kk(a),e.setClipPath(o)),Jk(null,o,t,a,null,n,i)}}function Pfe(e,t,r,n,i,a){if(!(e.isGroup||e.type==="compoundPath")){oO(r,null,a),oO(r,jo,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,l=a.blur.conOpt,u=a.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=Kk(o),e.setTextContent(c)),Jk(null,c,t,o,null,n,i);for(var h=o&&o.style,f=0;f=c;d--){var g=t.childAt(d);Dfe(t,g,i)}}}function Dfe(e,t,r){t&&F_(t,Eo(e).option,r)}function Efe(e){new Zo(e.oldChildren,e.newChildren,sO,sO,e).add(lO).update(lO).remove(jfe).execute()}function sO(e,t){var r=e&&e.name;return r??Sfe+t}function lO(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,i=t!=null?r.oldChildren[t]:null;Qk(r.api,i,r.dataIndex,n,r.seriesModel,r.group)}function jfe(e){var t=this.context,r=t.oldChildren[e];r&&F_(r,Eo(r).option,t.seriesModel)}function Z8(e){return e&&(e.pathData||e.d)}function Rfe(e){return e&&(ge(e,"pathData")||ge(e,"d"))}function Ofe(e){e.registerChartView(Mfe),e.registerSeriesModel(tfe)}var iu=Ye(),uO=Se,Xw=fe,tL=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,i){var a=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!i&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,t,r,n);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=c;var h=this._moveAnimation=this.determineAnimation(t,r);if(!s)s=this._group=new Ce,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=Fe(cO,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}fO(s,r,!0),this._renderHandle(a)}},e.prototype.remove=function(t){this.clear(t)},e.prototype.dispose=function(t){this.clear(t)},e.prototype.determineAnimation=function(t,r){var n=r.get("animation"),i=t.axis,a=i.type==="category",o=r.get("snap");if(!o&&!a)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(a&&i.getBandWidth()>s)return!0;if(o){var l=wk(t).seriesDataCount,u=i.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,i,a){},e.prototype.createPointerEl=function(t,r,n,i){var a=r.pointer;if(a){var o=iu(t).pointerEl=new Ku[a.type](uO(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,i){if(r.label){var a=iu(t).labelEl=new tt(uO(r.label));t.add(a),hO(a,i)}},e.prototype.updatePointerEl=function(t,r,n){var i=iu(t).pointerEl;i&&r.pointer&&(i.setStyle(r.pointer.style),n(i,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,i){var a=iu(t).labelEl;a&&(a.setStyle(r.label.style),n(a,{x:r.label.x,y:r.label.y}),hO(a,i))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),i=this._handle,a=r.getModel("handle"),o=r.get("status");if(!a.get("show")||!o||o==="hide"){i&&n.remove(i),this._handle=null;return}var s;this._handle||(s=!0,i=this._handle=df(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Wo(u.event)},onmousedown:Xw(this._onHandleDragMove,this,0,0),drift:Xw(this._onHandleDragMove,this),ondragend:Xw(this._onHandleDragEnd,this)}),n.add(i)),fO(i,r,!1),i.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");re(l)||(l=[l,l]),i.scaleX=l[0]/2,i.scaleY=l[1]/2,xf(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){cO(this._axisPointerModel,!r&&this._moveAnimation,this._handle,qw(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(qw(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(qw(i)),iu(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var r=t.getZr(),n=this._group,i=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),i&&r.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),lp(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(t,r,n){return n=n||0,{x:t[n],y:t[1-n],width:r[n],height:r[1-n]}},e}();function cO(e,t,r,n){$8(iu(r).lastProp,n)||(iu(r).lastProp=n,t?it(r,n,e):(r.stopAnimation(),r.attr(n)))}function $8(e,t){if(ke(e)&&ke(t)){var r=!0;return j(t,function(n,i){r=r&&$8(e[i],n)}),!!r}else return e===t}function hO(e,t){e[t.get(["label","show"])?"show":"hide"]()}function qw(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function fO(e,t,r){var n=t.get("z"),i=t.get("zlevel");e&&e.traverse(function(a){a.type!=="group"&&(n!=null&&(a.z=n),i!=null&&(a.zlevel=i),a.silent=r)})}function rL(e){var t=e.get("type"),r=e.getModel(t+"Style"),n;return t==="line"?(n=r.getLineStyle(),n.fill=null):t==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function Y8(e,t,r,n,i){var a=r.get("value"),o=X8(a,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=gf(s.get("padding")||0),u=s.getFont(),c=c_(o,u),h=i.position,f=c.width+l[1]+l[3],d=c.height+l[0]+l[2],g=i.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=i.verticalAlign;m==="bottom"&&(h[1]-=d),m==="middle"&&(h[1]-=d/2),zfe(h,f,d,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:Ct(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function zfe(e,t,r,n){var i=n.getWidth(),a=n.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+r,a)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function X8(e,t,r,n,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:q0(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};j(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),he(o)?a=o.replace("{value}",a):we(o)&&(a=o(s))}return a}function nL(e,t,r){var n=Pr();return Ko(n,n,r.rotation),ha(n,n,r.position),sa([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function q8(e,t,r,n,i,a){var o=wn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=i.get(["label","margin"]),Y8(t,n,i,a,{position:nL(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function iL(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function K8(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function dO(e,t,r,n,i,a){return{cx:e,cy:t,r0:r,r:n,startAngle:i,endAngle:a,clockwise:!0}}var Bfe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.grid,u=a.get("type"),c=vO(l,s).getOtherAxis(s).getGlobalExtent(),h=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var f=rL(a),d=Ffe[u](s,h,c);d.style=f,r.graphicKey=d.type,r.pointer=d}var g=ox(l.getRect(),i);q8(n,r,g,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=ox(n.axis.grid.getRect(),n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=nL(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.grid,l=o.getGlobalExtent(!0),u=vO(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Math.min(l[1],h[c]),h[c]=Math.max(l[0],h[c]);var f=(u[1]+u[0])/2,d=[f,f];d[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:d,tooltipOption:g[c]}},t}(tL);function vO(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var Ffe={line:function(e,t,r){var n=iL([t,r[0]],[t,r[1]],pO(e));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(e,t,r){var n=Math.max(1,e.getBandWidth()),i=r[1]-r[0];return{type:"Rect",shape:K8([t-n/2,r[0]],[n,i],pO(e))}}};function pO(e){return e.dim==="x"?0:1}var Vfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:"dashed"},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:"auto",margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,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:K.color.accent40,throttle:40}},t}($e),Lo=Ye(),Gfe=j;function J8(e,t,r){if(!Je.node){var n=t.getZr();Lo(n).records||(Lo(n).records={}),Wfe(n,t);var i=Lo(n).records[e]||(Lo(n).records[e]={});i.handler=r}}function Wfe(e,t){if(Lo(e).initialized)return;Lo(e).initialized=!0,r("click",Fe(gO,"click")),r("mousemove",Fe(gO,"mousemove")),r("globalout",Ufe);function r(n,i){e.on(n,function(a){var o=Zfe(t);Gfe(Lo(e).records,function(s){s&&i(s,a,o.dispatchAction)}),Hfe(o.pendings,t)})}}function Hfe(e,t){var r=e.showTip.length,n=e.hideTip.length,i;r?i=e.showTip[r-1]:n&&(i=e.hideTip[n-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function Ufe(e,t,r){e.handler("leave",null,r)}function gO(e,t,r,n){t.handler(e,r,n)}function Zfe(e){var t={showTip:[],hideTip:[]},r=function(n){var i=t[n.type];i?i.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function h2(e,t){if(!Je.node){var r=t.getZr(),n=(Lo(r).records||{})[e];n&&(Lo(r).records[e]=null)}}var $fe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=n.getComponent("tooltip"),o=r.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click";J8("axisPointer",i,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},t.prototype.remove=function(r,n){h2("axisPointer",n)},t.prototype.dispose=function(r,n){h2("axisPointer",n)},t.type="axisPointer",t}(Mt);function Q8(e,t){var r=[],n=e.seriesIndex,i;if(n==null||!(i=t.getSeriesByIndex(n)))return{point:[]};var a=i.getData(),o=Ru(a,e);if(o==null||o<0||re(o))return{point:[]};var s=a.getItemGraphicEl(o),l=i.coordinateSystem;if(i.getTooltipPosition)r=i.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,d=h==="x"||h==="radius"?1:0,g=a.mapDimension(f),m=[];m[d]=a.get(g,o),m[1-d]=a.get(a.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(a.getValues(ae(l.dimensions,function(x){return a.mapDimension(x)}),o))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),r=[y.x+y.width/2,y.y+y.height/2]}return{point:r,el:s}}var mO=Ye();function Yfe(e,t,r){var n=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||fe(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Fy(i)&&(i=Q8({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var l=Fy(i),u=a.axesInfo,c=s.axesInfo,h=n==="leave"||Fy(i),f={},d={},g={list:[],map:{}},m={showPointer:Fe(qfe,d),showTooltip:Fe(Kfe,g)};j(s.coordSysMap,function(x,_){var w=l||x.containPoint(i);j(s.coordSysAxesInfo[_],function(S,T){var M=S.axis,A=tde(u,S);if(!h&&w&&(!u||A)){var P=A&&A.value;P==null&&!l&&(P=M.pointToData(i)),P!=null&&yO(S,P,m,!1,f)}})});var y={};return j(c,function(x,_){var w=x.linkGroup;w&&!d[_]&&j(w.axesInfo,function(S,T){var M=d[T];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,xO(S),xO(x)))),y[x.key]=A}})}),j(y,function(x,_){yO(c[_],x,m,!0,f)}),Jfe(d,c,f),Qfe(g,i,e,o),ede(c,o,r),f}}function yO(e,t,r,n,i){var a=e.axis;if(!(a.scale.isBlank()||!a.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=Xfe(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&i.seriesIndex==null&&Q(i,s[0]),!n&&e.snap&&a.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function Xfe(e,t){var r=t.axis,n=r.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return j(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var d=l.getAxisTooltipData(c,e,r);f=d.dataIndices,h=d.nestestValue}else{if(f=l.indicesOfNearest(n,c[0],e,r.type==="category"?.5:null),!f.length)return;h=l.getData().get(c[0],f[0])}if(!(h==null||!isFinite(h))){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,i=h,a.length=0),j(f,function(y){a.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:a,snapToValue:i}}function qfe(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function Kfe(e,t,r,n){var i=r.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!i.length)){var l=t.coordSys.model,u=mp(l),c=e.map[u];c||(c=e.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:i.slice()})}}function Jfe(e,t,r){var n=r.axesInfo=[];j(t,function(i,a){var o=i.axisPointerModel.option,s=e[a];s?(!i.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!i.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:i.axis.dim,axisIndex:i.axis.model.componentIndex,value:o.value})})}function Qfe(e,t,r,n){if(Fy(t)||!e.list.length){n({type:"hideTip"});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function ede(e,t,r){var n=r.getZr(),i="axisPointerLastHighlights",a=mO(n)[i]||{},o=mO(n)[i]={};j(e,function(u,c){var h=u.axisPointerModel.option;h.status==="show"&&u.triggerEmphasis&&j(h.seriesDataIndices,function(f){var d=f.seriesIndex+" | "+f.dataIndex;o[d]=f})});var s=[],l=[];j(a,function(u,c){!o[c]&&l.push(u)}),j(o,function(u,c){!a[c]&&s.push(u)}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function tde(e,t){for(var r=0;r<(e||[]).length;r++){var n=e[r];if(t.axis.dim===n.axisDim&&t.axis.model.componentIndex===n.axisIndex)return n}}function xO(e){var t=e.axis.model,r={},n=r.axisDim=e.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=t.componentIndex,r.axisName=r[n+"AxisName"]=t.name,r.axisId=r[n+"AxisId"]=t.id,r}function Fy(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function tg(e){tc.registerAxisPointerClass("CartesianAxisPointer",Bfe),e.registerComponentModel(Vfe),e.registerComponentView($fe),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!re(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=roe(t,r)}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},Yfe)}function rde(e){He(SW),He(tg)}var nde=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=l.getOtherAxis(s),c=u.getExtent(),h=s.dataToCoord(n),f=a.get("type");if(f&&f!=="none"){var d=rL(a),g=ade[f](s,l,h,c);g.style=d,r.graphicKey=g.type,r.pointer=g}var m=a.get(["label","margin"]),y=ide(n,i,a,l,m);Y8(r,i,a,o,y)},t}(tL);function ide(e,t,r,n,i){var a=t.axis,o=a.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(a.dim==="radius"){var f=Pr();Ko(f,f,s),ha(f,f,[n.cx,n.cy]),u=sa([o,-i],f);var d=t.getModel("axisLabel").get("rotate")||0,g=wn.innerTextLayout(s,d*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+i,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var ade={line:function(e,t,r,n){return e.dim==="angle"?{type:"Line",shape:iL(t.coordToPoint([n[0],r]),t.coordToPoint([n[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n){var i=Math.max(1,e.getBandWidth()),a=Math.PI/180;return e.dim==="angle"?{type:"Sector",shape:dO(t.cx,t.cy,n[0],n[1],(-r-i/2)*a,(-r+i/2)*a)}:{type:"Sector",shape:dO(t.cx,t.cy,r-i/2,r+i/2,0,Math.PI*2)}}},ode=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.findAxisModel=function(r){var n,i=this.ecModel;return i.eachComponent(r,function(a){a.getCoordSysModel()===this&&(n=a)},this),n},t.type="polar",t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}($e),aL=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ht).models[0]},t.type="polarAxis",t}($e);Qt(aL,Sf);var sde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(aL),lde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(aL),oL=function(e){q(t,e);function t(r,n){return e.call(this,"radius",r,n)||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t}(Vi);oL.prototype.dataToRadius=Vi.prototype.dataToCoord;oL.prototype.radiusToData=Vi.prototype.coordToData;var ude=Ye(),sL=function(e){q(t,e);function t(r,n){return e.call(this,"angle",r,n||[0,360])||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t.prototype.calculateCategoryInterval=function(){var r=this,n=r.getLabelModel(),i=r.scale,a=i.getExtent(),o=i.count();if(a[1]-a[0]<1)return 0;var s=a[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=c_(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var d=Math.max(0,Math.floor(f)),g=ude(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-d)<=1&&Math.abs(y-o)<=1&&m>d?d=m:(g.lastTickCount=o,g.lastAutoInterval=d),d},t}(Vi);sL.prototype.dataToAngle=Vi.prototype.dataToCoord;sL.prototype.angleToData=Vi.prototype.coordToData;var eH=["radius","angle"],cde=function(){function e(t){this.dimensions=eH,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new oL,this._angleAxis=new sL,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(t){var r=this.pointToCoord(t);return this._radiusAxis.contain(r[0])&&this._angleAxis.contain(r[1])},e.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},e.prototype.getAxis=function(t){var r="_"+t+"Axis";return this[r]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(t){var r=[],n=this._angleAxis,i=this._radiusAxis;return n.scale.type===t&&r.push(n),i.scale.type===t&&r.push(i),r},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(t){var r=this._angleAxis;return t===r?this._radiusAxis:r},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(t){var r=t!=null&&t!=="auto"?this.getAxis(t):this.getBaseAxis();return{baseAxes:[r],otherAxes:[this.getOtherAxis(r)]}},e.prototype.dataToPoint=function(t,r,n){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],r),this._angleAxis.dataToAngle(t[1],r)],n)},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(i[0],r),n[1]=this._angleAxis.angleToData(i[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,i=this.getAngleAxis(),a=i.getExtent(),o=Math.min(a[0],a[1]),s=Math.max(a[0],a[1]);i.inverse?o=s-360:s=o+360;var l=Math.sqrt(r*r+n*n);r/=l,n/=l;for(var u=Math.atan2(-n,r)/Math.PI*180,c=us;)u+=c*360;return[l,u]},e.prototype.coordToPoint=function(t,r){r=r||[];var n=t[0],i=t[1]/180*Math.PI;return r[0]=Math.cos(i)*n+this.cx,r[1]=-Math.sin(i)*n+this.cy,r},e.prototype.getArea=function(){var t=this.getAngleAxis(),r=this.getRadiusAxis(),n=r.getExtent().slice();n[0]>n[1]&&n.reverse();var i=t.getExtent(),a=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-i[0]*a,endAngle:-i[1]*a,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,d=this.r0;return f!==d&&h-o<=f*f&&h+o>=d*d},x:this.cx-n[1],y:this.cy-n[1],width:n[1]*2,height:n[1]*2}},e.prototype.convertToPixel=function(t,r,n){var i=_O(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=_O(r);return i===this?this.pointToData(n):null},e}();function _O(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function hde(e,t,r){var n=t.get("center"),i=Tr(t,r).refContainer;e.cx=ce(n[0],i.width)+i.x,e.cy=ce(n[1],i.height)+i.y;var a=e.getRadiusAxis(),o=Math.min(i.width,i.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:re(s)||(s=[0,s]);var l=[ce(s[0],o),ce(s[1],o)];a.inverse?a.setExtent(l[1],l[0]):a.setExtent(l[0],l[1])}function fde(e,t){var r=this,n=r.getAngleAxis(),i=r.getRadiusAxis();if(n.scale.setExtent(1/0,-1/0),i.scale.setExtent(1/0,-1/0),e.eachSeries(function(s){if(s.coordinateSystem===r){var l=s.getData();j(K0(l,"radius"),function(u){i.scale.unionExtentFromData(l,u)}),j(K0(l,"angle"),function(u){n.scale.unionExtentFromData(l,u)})}}),Gu(n.scale,n.model),Gu(i.scale,i.model),n.type==="category"&&!n.onBand){var a=n.getExtent(),o=360/n.scale.count();n.inverse?a[1]+=o:a[1]-=o,n.setExtent(a[0],a[1])}}function dde(e){return e.mainType==="angleAxis"}function bO(e,t){var r;if(e.type=t.get("type"),e.scale=Xp(t),e.onBand=t.get("boundaryGap")&&e.type==="category",e.inverse=t.get("inverse"),dde(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),i=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,i)}t.axis=e,e.model=t}var vde={dimensions:eH,create:function(e,t){var r=[];return e.eachComponent("polar",function(n,i){var a=new cde(i+"");a.update=fde;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");bO(o,l),bO(s,u),hde(a,n,t),r.push(a),n.coordinateSystem=a,a.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")==="polar"){var i=n.getReferringComponents("polar",Ht).models[0];n.coordinateSystem=i.coordinateSystem}}),r}},pde=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function Ym(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),i=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:i[0],y2:i[1]}}function Xm(e){var t=e.getRadiusAxis();return t.inverse?0:1}function wO(e){var t=e[0],r=e[e.length-1];t&&r&&Math.abs(Math.abs(t.coord-r.coord)-360)<1e-4&&e.pop()}var gde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.axisPointerClass="PolarAxisPointer",r}return t.prototype.render=function(r,n){if(this.group.removeAll(),!!r.get("show")){var i=r.axis,a=i.polar,o=a.getRadiusAxis().getExtent(),s=i.getTicksCoords({breakTicks:"none"}),l=i.getMinorTicksCoords(),u=ae(i.getViewLabels(),function(c){c=Se(c);var h=i.scale,f=h.type==="ordinal"?h.getRawOrdinalNumber(c.tickValue):c.tickValue;return c.coord=i.dataToCoord(f),c});wO(u),wO(s),j(pde,function(c){r.get([c,"show"])&&(!i.scale.isBlank()||c==="axisLine")&&mde[c](this.group,r,a,s,l,o,u)},this)}},t.type="angleAxis",t}(tc),mde={axisLine:function(e,t,r,n,i,a){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=Xm(r),h=c?0:1,f,d=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[h]===0?f=new Ku[d]({shape:{cx:r.cx,cy:r.cy,r:a[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new cf({shape:{cx:r.cx,cy:r.cy,r:a[c],r0:a[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,i,a){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[Xm(r)],u=ae(n,function(c){return new ar({shape:Ym(r,[l,l+s],c.coord)})});e.add(qn(u,{style:Ae(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,i,a){if(i.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=a[Xm(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var T=s[g];ke(T)&&T.textStyle&&(d=new qe(T.textStyle,l,l.ecModel))}var M=new tt({silent:wn.isLabelSilent(t),style:Ct(d,{x:y[0],y:y[1],fill:d.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),Qo({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=wn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,De(M).eventData=A}},this)},splitLine:function(e,t,r,n,i,a){var o=t.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],h=0;h=0?"p":"n",H=I;T&&(n[c][R]||(n[c][R]={p:I,n:I}),H=n[c][R][F]);var W=void 0,V=void 0,z=void 0,Z=void 0;if(g.dim==="radius"){var U=g.dataToCoord(O)-I,$=l.dataToCoord(R);Math.abs(U)=Z})}}})}function Sde(e){var t={};j(e,function(n,i){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=rH(o,s),u=s.getExtent(),c=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/a.count(),h=t[l]||{bandWidth:c,remainedWidth:c,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},f=h.stacks;t[l]=h;var d=tH(n);f[d]||h.autoWidthCount++,f[d]=f[d]||{width:0,maxWidth:0};var g=ce(n.get("barWidth"),c),m=ce(n.get("barMaxWidth"),c),y=n.get("barGap"),x=n.get("barCategoryGap");g&&!f[d].width&&(g=Math.min(h.remainedWidth,g),f[d].width=g,h.remainedWidth-=g),m&&(f[d].maxWidth=m),y!=null&&(h.gap=y),x!=null&&(h.categoryGap=x)});var r={};return j(t,function(n,i){r[i]={};var a=n.stacks,o=n.bandWidth,s=ce(n.categoryGap,o),l=ce(n.gap,1),u=n.remainedWidth,c=n.autoWidthCount,h=(u-s)/(c+(c-1)*l);h=Math.max(h,0),j(a,function(m,y){var x=m.maxWidth;x&&x=r.y&&t[1]<=r.y+r.height:n.contain(n.toLocalCoord(t[1]))&&t[0]>=r.y&&t[0]<=r.y+r.height},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.getAxis();return n[0]=i.coordToData(i.toLocalCoord(t[i.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var i=this.getAxis(),a=this.getRect();n=n||[];var o=i.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=i.toGlobalCoord(i.dataToCoord(+t)),n[1-o]=o===0?a.y+a.height/2:a.x+a.width/2,n},e.prototype.convertToPixel=function(t,r,n){var i=SO(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=SO(r);return i===this?this.pointToData(n):null},e}();function SO(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function Dde(e,t){var r=[];return e.eachComponent("singleAxis",function(n,i){var a=new Ide(n,e,t);a.name="single_"+i,a.resize(n,t),n.coordinateSystem=a,r.push(a)}),e.eachSeries(function(n){if(n.get("coordinateSystem")==="singleAxis"){var i=n.getReferringComponents("singleAxis",Ht).models[0];n.coordinateSystem=i&&i.coordinateSystem}}),r}var Ede={create:Dde,dimensions:nH},CO=["x","y"],jde=["width","height"],Rde=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.coordinateSystem,u=Kw(l,1-gx(s)),c=l.dataToPoint(n)[0],h=a.get("type");if(h&&h!=="none"){var f=rL(a),d=Ode[h](s,c,u);d.style=f,r.graphicKey=d.type,r.pointer=d}var g=f2(i);q8(n,r,g,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=f2(n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=nL(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.coordinateSystem,l=gx(o),u=Kw(s,l),c=[r.x,r.y];c[l]+=n[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var h=Kw(s,1-l),f=(h[1]+h[0])/2,d=[f,f];return d[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:d,tooltipOption:{verticalAlign:"middle"}}},t}(tL),Ode={line:function(e,t,r){var n=iL([t,r[0]],[t,r[1]],gx(e));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(e,t,r){var n=e.getBandWidth(),i=r[1]-r[0];return{type:"Rect",shape:K8([t-n/2,r[0]],[n,i],gx(e))}}};function gx(e){return e.isHorizontal()?0:1}function Kw(e,t){var r=e.getRect();return[r[CO[t]],r[CO[t]]+r[jde[t]]]}var zde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Mt);function Bde(e){He(tg),tc.registerAxisPointerClass("SingleAxisPointer",Rde),e.registerComponentView(zde),e.registerComponentView(Lde),e.registerComponentModel(Vy),Zh(e,"single",Vy,Vy.defaultOption),e.registerCoordinateSystem("single",Ede)}var Fde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,i){var a=Ju(r);e.prototype.init.apply(this,arguments),TO(r,a)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),TO(this.option,r)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.layoutMode="box",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:K.color.axisLine,width:1,type:"solid"}},itemStyle:{color:K.color.neutral00,borderWidth:1,borderColor:K.color.neutral10},dayLabel:{show:!0,firstDay:0,position:"start",margin:K.size.s,color:K.color.secondary},monthLabel:{show:!0,position:"start",margin:K.size.s,align:"center",formatter:null,color:K.color.secondary},yearLabel:{show:!0,position:null,margin:K.size.xl,formatter:null,color:K.color.quaternary,fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},t}($e);function TO(e,t){var r=e.cellSize,n;re(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var i=ae([0,1],function(a){return lQ(t,a)&&(n[a]="auto"),n[a]!=null&&n[a]!=="auto"});Ka(e,t,{type:"box",ignoreSize:i})}var Vde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group;a.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,a),this._renderLines(r,s,l,a),this._renderYearText(r,s,l,a),this._renderMonthText(r,u,l,a),this._renderWeekText(r,u,s,l,a)},t.prototype._renderDayRect=function(r,n,i){for(var a=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=a.getCellWidth(),l=a.getCellHeight(),u=n.start.time;u<=n.end.time;u=a.getNextNDay(u,1).time){var c=a.dataToCalendarLayout([u],!1).tl,h=new Ze({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});i.add(h)}},t.prototype._renderLines=function(r,n,i,a){var o=this,s=r.coordinateSystem,l=r.getModel(["splitLine","lineStyle"]).getLineStyle(),u=r.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=n.start,f=0;h.time<=n.end.time;f++){g(h.formatedDate),f===0&&(h=s.getDateInfo(n.start.y+"-"+n.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=s.getDateInfo(d)}g(s.getNextNDay(n.end.time,1).formatedDate);function g(m){o._firstDayOfMonth.push(s.getDateInfo(m)),o._firstDayPoints.push(s.dataToCalendarLayout([m],!1).tl);var y=o._getLinePointsOfOneWeek(r,m,i);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,a)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,i),l,a),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,i),l,a)},t.prototype._getEdgesPoints=function(r,n,i){var a=[r[0].slice(),r[r.length-1].slice()],o=i==="horizontal"?0:1;return a[0][o]=a[0][o]-n/2,a[1][o]=a[1][o]+n/2,a},t.prototype._drawSplitline=function(r,n,i){var a=new Gr({z2:20,shape:{points:r},style:n});i.add(a)},t.prototype._getLinePointsOfOneWeek=function(r,n,i){for(var a=r.coordinateSystem,o=a.getDateInfo(n),s=[],l=0;l<7;l++){var u=a.getNextNDay(o.time,l),c=a.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[i==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return he(r)&&r?tQ(r,n):we(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,i,a,o){var s=n[0],l=n[1],u=["center","bottom"];a==="bottom"?(l+=o,u=["center","top"]):a==="left"?s-=o:a==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(a==="left"||a==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,i,a){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=i!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,f=i==="horizontal"?0:1,d={top:[c,u[f][1]],bottom:[c,u[1-f][1]],left:[u[1-f][0],h],right:[u[f][0],h]},g=n.start.y;+n.end.y>+n.start.y&&(g=g+"-"+n.end.y);var m=o.get("formatter"),y={start:n.start.y,end:n.end.y,nameMap:g},x=this._formatterLabel(m,y),_=new tt({z2:30,style:Ct(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,d[l],i,l,s)),a.add(_)}},t.prototype._monthTextPositionControl=function(r,n,i,a,o){var s="left",l="top",u=r[0],c=r[1];return i==="horizontal"?(c=c+o,n&&(s="center"),a==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),a==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,i,a){var o=r.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||he(s))&&(s&&(n=sT(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,d=i==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=a.start.time&&i.times.end.time&&r.reverse(),r},e.prototype._getRangeInfo=function(t){var r=[this.getDateInfo(t[0]),this.getDateInfo(t[1])],n;r[0].time>r[1].time&&(n=!0,r.reverse());var i=Math.floor(r[1].time/Jw)-Math.floor(r[0].time/Jw)+1,a=new Date(r[0].time),o=a.getDate(),s=r[1].date.getDate();a.setDate(o+i-1);var l=a.getDate();if(l!==s)for(var u=a.getTime()-r[1].time>0?1:-1;(l=a.getDate())!==s&&(a.getTime()-r[1].time)*u>0;)i-=u,a.setDate(l-u);var c=Math.floor((i+r[0].day+6)/7),h=n?-c+1:c-1;return n&&r.reverse(),{range:[r[0].formatedDate,r[1].formatedDate],start:r[0],end:r[1],allDay:i,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var i=this._getRangeInfo(n);if(t>i.weeks||t===0&&ri.lweek)return null;var a=(t-1)*7-i.fweek+r,o=new Date(i.start.time);return o.setDate(+i.start.d+a),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(i){var a=new e(i,t,r);n.push(a),i.coordinateSystem=a}),t.eachComponent(function(i,a){$p({targetModel:a,coordSysType:"calendar",coordSysProvider:w6})}),n},e.dimensions=["time","value"],e}();function Qw(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function Wde(e){e.registerComponentModel(Fde),e.registerComponentView(Vde),e.registerCoordinateSystem("calendar",Gde)}var wo={level:1,leaf:2,nonLeaf:3},Ro={none:0,all:1,body:2,corner:3};function d2(e,t,r){var n=t[Oe[r]].getCell(e);return!n&&rt(e)&&e<0&&(n=t[Oe[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function iH(e){var t=e||[];return t[0]=t[0]||[],t[1]=t[1]||[],t[0][0]=t[0][1]=t[1][0]=t[1][1]=NaN,t}function aH(e,t,r,n,i){MO(e[0],t,i,r,n,0),MO(e[1],t,i,r,n,1)}function MO(e,t,r,n,i,a){e[0]=1/0,e[1]=-1/0;var o=n[a],s=re(o)?o:[o],l=s.length,u=!!r;if(l>=1?(AO(e,t,s,u,i,a,0),l>1&&AO(e,t,s,u,i,a,l-1)):e[0]=e[1]=NaN,u){var c=-i[Oe[1-a]].getLocatorCount(a),h=i[Oe[a]].getLocatorCount(a)-1;r===Ro.body?c=nr(0,c):r===Ro.corner&&(h=ni(-1,h)),h=t[0]&&e[0]<=t[1]}function NO(e,t){e.id.set(t[0][0],t[1][0]),e.span.set(t[0][1]-e.id.x+1,t[1][1]-e.id.y+1)}function Zde(e,t){e[0][0]=t[0][0],e[0][1]=t[0][1],e[1][0]=t[1][0],e[1][1]=t[1][1]}function PO(e,t,r,n){var i=d2(t[n][0],r,n),a=d2(t[n][1],r,n);e[Oe[n]]=e[pr[n]]=NaN,i&&a&&(e[Oe[n]]=i.xy,e[pr[n]]=a.xy+a.wh-i.xy)}function Nd(e,t,r,n){return e[Oe[t]]=r,e[Oe[1-t]]=n,e}function $de(e){return e&&(e.type===wo.leaf||e.type===wo.nonLeaf)?e:null}function mx(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var IO=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=Yde(t);var n=r.get("data",!0);n!=null&&!re(n)&&(n=[]),n?this._initByDimModelData(n):this._initBySeriesData()}return e.prototype._initByDimModelData=function(t){var r=this,n=r._cells,i=r._levels,a=[],o=0;r._leavesCount=s(t,0,0),l();return;function s(u,c,h){var f=0;return u&&j(u,function(d,g){var m;he(d)?m={value:d}:ke(d)?(m=d,d.value!=null&&!he(d.value)&&(m={value:null})):m={value:null};var y={type:wo.nonLeaf,ordinal:NaN,level:h,firstLeafLocator:c,id:new Ne,span:Nd(new Ne,r.dimIdx,1,1),option:m,xy:NaN,wh:NaN,dim:r,rect:mx()};o++,(a[c]||(a[c]=[])).push(y),i[h]||(i[h]={type:wo.level,xy:NaN,wh:NaN,option:null,id:new Ne,dim:r});var x=s(m.children,c,h+1),_=Math.max(1,x);y.span[Oe[r.dimIdx]]=_,f+=_,c+=_}),f}function l(){for(var u=[];n.length=1,w=r[Oe[n]],S=a.getLocatorCount(n)-1,T=new Ws;for(o.resetLayoutIterator(T,n);T.next();)M(T.item);for(a.resetLayoutIterator(T,n);T.next();)M(T.item);function M(A){Xr(A.wh)&&(A.wh=x),A.xy=w,A.id[Oe[n]]===S&&!_&&(A.wh=r[Oe[n]]+r[pr[n]]-A.xy),w+=A.wh}}function BO(e,t){for(var r=t[Oe[e]].resetCellIterator();r.next();){var n=r.item;yx(n.rect,e,n.id,n.span,t),yx(n.rect,1-e,n.id,n.span,t),n.type===wo.nonLeaf&&(n.xy=n.rect[Oe[e]],n.wh=n.rect[pr[e]])}}function FO(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var i=r.spanRect,a=r.id;yx(i,0,a,n,t),yx(i,1,a,n,t)}})}function yx(e,t,r,n,i){e[pr[t]]=0;var a=r[Oe[t]],o=a<0?i[Oe[1-t]]:i[Oe[t]],s=o.getUnitLayoutInfo(t,r[Oe[t]]);if(e[Oe[t]]=s.xy,e[pr[t]]=s.wh,n[Oe[t]]>1){var l=o.getUnitLayoutInfo(t,r[Oe[t]]+n[Oe[t]]-1);e[pr[t]]=l.xy+l.wh-s.xy}}function sve(e,t,r){var n=P0(e,r[pr[t]]);return p2(n,r[pr[t]])}function p2(e,t){return Math.max(Math.min(e,be(t,1/0)),0)}function rS(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var $r={inBody:1,inCorner:2,outside:3},Ta={x:null,y:null,point:[]};function VO(e,t,r,n,i){var a=r[Oe[t]],o=r[Oe[1-t]],s=a.getUnitLayoutInfo(t,a.getLocatorCount(t)-1),l=a.getUnitLayoutInfo(t,0),u=o.getUnitLayoutInfo(t,-o.getLocatorCount(t)),c=o.shouldShow()?o.getUnitLayoutInfo(t,-1):null,h=e.point[t]=n[t];if(!l&&!c){e[Oe[t]]=$r.outside;return}if(i===Ro.body){l?(e[Oe[t]]=$r.inBody,h=ni(s.xy+s.wh,nr(l.xy,h)),e.point[t]=h):e[Oe[t]]=$r.outside;return}else if(i===Ro.corner){c?(e[Oe[t]]=$r.inCorner,h=ni(c.xy+c.wh,nr(u.xy,h)),e.point[t]=h):e[Oe[t]]=$r.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,d=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!i){e[Oe[t]]=$r.outside;return}h=g}e.point[t]=h,e[Oe[t]]=f<=h&&h<=g?$r.inBody:d<=h&&h<=f?$r.inCorner:$r.outside}function GO(e,t,r,n){var i=1-r;if(e[Oe[r]]!==$r.outside)for(n[Oe[r]].resetCellIterator(tS);tS.next();){var a=tS.item;if(HO(e.point[r],a.rect,r)&&HO(e.point[i],a.rect,i)){t[r]=a.ordinal,t[i]=a.id[Oe[i]];return}}}function WO(e,t,r,n){if(e[Oe[r]]!==$r.outside){var i=e[Oe[r]]===$r.inCorner?n[Oe[1-r]]:n[Oe[r]];for(i.resetLayoutIterator(ey,r);ey.next();)if(lve(e.point[r],ey.item)){t[r]=ey.item.id[Oe[r]];return}}}function lve(e,t){return t.xy<=e&&e<=t.xy+t.wh}function HO(e,t,r){return t[Oe[r]]<=e&&e<=t[Oe[r]]+t[pr[r]]}function uve(e){e.registerComponentModel(Jde),e.registerComponentView(nve),e.registerCoordinateSystem("matrix",ove)}function cve(e,t){var r=e.existing;if(t.id=e.keyInfo.id,!t.type&&r&&(t.type=r.type),t.parentId==null){var n=t.parentOption;n?t.parentId=n.id:r&&(t.parentId=r.parentId)}t.parentOption=null}function UO(e,t){var r;return j(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function hve(e,t,r){var n=Q({},r),i=e[t],a=r.$action||"merge";a==="merge"?i?(Ge(i,n,!0),Ka(i,n,{ignoreSize:!0}),A6(r,i),ty(r,i),ty(r,i,"shape"),ty(r,i,"style"),ty(r,i,"extra"),r.clipPath=i.clipPath):e[t]=n:a==="replace"?e[t]=n:a==="remove"&&i&&(e[t]=null)}var sH=["transition","enterFrom","leaveTo"],fve=sH.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function ty(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?sH:fve,i=0;i=0;c--){var h=i[c],f=br(h.id,null),d=f!=null?o.get(f):null;if(d){var g=d.parent,x=_i(g),_=g===a?{width:s,height:l}:{width:x.width,height:x.height},w={},S=C_(d,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!_i(d).isNew&&S){for(var T=h.transition,M={},A=0;A=0)?M[P]=I:d[P]=I}it(d,M,r,0)}else d.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(i){Gy(i,_i(i).option,n,r._lastGraphicModel)}),this._elMap=_e()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Mt);function g2(e){var t=ge(ZO,e)?ZO[e]:ip(e),r=new t({});return _i(r).type=e,r}function $O(e,t,r,n){var i=g2(r);return t.add(i),n.set(e,i),_i(i).id=e,_i(i).isNew=!0,i}function Gy(e,t,r,n){var i=e&&e.parent;i&&(e.type==="group"&&e.traverse(function(a){Gy(a,t,r,n)}),F_(e,t,n),r.removeKey(_i(e).id))}function YO(e,t,r,n){e.isGroup||j([["cursor",Ri.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(i){var a=i[0];ge(t,a)?e[a]=be(t[a],i[1]):e[a]==null&&(e[a]=i[1])}),j(Qe(t),function(i){if(i.indexOf("on")===0){var a=t[i];e[i]=we(a)?a:null}}),ge(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function gve(e){return e=Q({},e),j(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(S6),function(t){delete e[t]}),e}function mve(e,t,r){var n=De(e).eventData;!e.silent&&!e.ignore&&!n&&(n=De(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function yve(e){e.registerComponentModel(vve),e.registerComponentView(pve),e.registerPreprocessor(function(t){var r=t.graphic;re(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var XO=["x","y","radius","angle","single"],xve=["cartesian2d","polar","singleAxis"];function _ve(e){var t=e.get("coordinateSystem");return Ve(xve,t)>=0}function Ps(e){return e+"Axis"}function bve(e,t){var r=_e(),n=[],i=_e();e.eachComponent({mainType:"dataZoom",query:t},function(c){i.get(c.uid)||s(c)});var a;do a=!1,e.eachComponent("dataZoom",o);while(a);function o(c){!i.get(c.uid)&&l(c)&&(s(c),a=!0)}function s(c){i.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,d){var g=r.get(f);g&&g[d]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function lH(e){var t=e.ecModel,r={infoList:[],infoMap:_e()};return e.eachTargetAxis(function(n,i){var a=t.getComponent(Ps(n),i);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(a)}}}),r}var nS=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},e}(),Sp=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return t.prototype.init=function(r,n,i){var a=qO(r);this.settledOption=a,this.mergeDefaultAndTheme(r,i),this._doInit(a)},t.prototype.mergeOption=function(r){var n=qO(r);Ge(this.option,r,!0),Ge(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var i=this.settledOption;j([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(n[a[0]]=i[a[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=_e(),i=this._fillSpecifiedTargetAxis(n);i?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return j(XO,function(i){var a=this.getReferringComponents(Ps(i),Bq);if(a.specified){n=!0;var o=new nS;j(a.models,function(s){o.add(s.componentIndex)}),r.set(i,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var i=this.ecModel,a=!0;if(a){var o=n==="vertical"?"y":"x",s=i.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=i.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===n}});l(s,"single")}function l(u,c){var h=u[0];if(h){var f=new nS;if(f.add(h.componentIndex),r.set(c,f),a=!1,c==="x"||c==="y"){var d=h.getReferringComponents("grid",Ht).models[0];d&&j(u,function(g){h.componentIndex!==g.componentIndex&&d===g.getReferringComponents("grid",Ht).models[0]&&f.add(g.componentIndex)})}}}a&&j(XO,function(u){if(a){var c=i.findComponents({mainType:Ps(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new nS;h.add(c[0].componentIndex),r.set(u,h),a=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(r){var n=this._rangePropMode,i=this.get("rangeMode");j([["start","startValue"],["end","endValue"]],function(a,o){var s=r[a[0]]!=null,l=r[a[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":i?n[o]=i[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,i){r==null&&(r=this.ecModel.getComponent(Ps(n),i))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(i,a){j(i.indexList,function(o){r.call(n,a,o)})})},t.prototype.getAxisProxy=function(r,n){var i=this.getAxisModel(r,n);if(i)return i.__dzAxisProxy},t.prototype.getAxisModel=function(r,n){var i=this._targetAxisInfoMap.get(r);if(i&&i.indexMap[n])return this.ecModel.getComponent(Ps(r),n)},t.prototype.setRawRange=function(r){var n=this.option,i=this.settledOption;j([["start","startValue"],["end","endValue"]],function(a){(r[a[0]]!=null||r[a[1]]!=null)&&(n[a[0]]=i[a[0]]=r[a[0]],n[a[1]]=i[a[1]]=r[a[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;j(["start","startValue","end","endValue"],function(i){n[i]=r[i]})},t.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getDataPercentWindow()},t.prototype.getValueRange=function(r,n){if(r==null&&n==null){var i=this.findRepresentativeAxisProxy();if(i)return i.getDataValueWindow()}else return this.getAxisProxy(r,n).getDataValueWindow()},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return r.__dzAxisProxy;for(var n,i=this._targetAxisInfoMap.keys(),a=0;ao[1];if(w&&!S&&!T)return!0;w&&(y=!0),S&&(g=!0),T&&(m=!0)}return y&&g&&m})}else Uc(c,function(d){if(a==="empty")l.setData(u=u.map(d,function(m){return s(m)?m:NaN}));else{var g={};g[d]=o,u.selectRange(g)}});Uc(c,function(d){u.setApproximateExtent(o,d)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._dataExtent;Uc(["min","max"],function(i){var a=r.get(i+"Span"),o=r.get(i+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=ht(n[0]+o,n,[0,100],!0):a!=null&&(o=ht(a,[0,100],n,!0)-n[0]),t[i+"Span"]=a,t[i+"ValueSpan"]=o},this)},e.prototype._setAxisModel=function(){var t=this.getAxisModel(),r=this._percentWindow,n=this._valueWindow;if(r){var i=QM(n,[0,500]);i=Math.min(i,20);var a=t.axis.scale.rawExtentInfo;r[0]!==0&&a.setDeterminedMinMax("min",+n[0].toFixed(i)),r[1]!==100&&a.setDeterminedMinMax("max",+n[1].toFixed(i)),a.freeze()}},e}();function Tve(e,t,r){var n=[1/0,-1/0];Uc(r,function(o){Wre(n,o.getData(),t)});var i=e.getAxisModel(),a=sG(i.axis.scale,i,n).calculate();return[a.min,a.max]}var Mve={getTargetSeries:function(e){function t(i){e.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=e.getComponent(Ps(o),s);i(o,s,l,a)})})}t(function(i,a,o,s){o.__dzAxisProxy=null});var r=[];t(function(i,a,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new Cve(i,a,s,e),r.push(o.__dzAxisProxy))});var n=_e();return j(r,function(i){j(i.getTargetSeriesModels(),function(a){n.set(a.uid,a)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){r.eachTargetAxis(function(n,i){r.getAxisProxy(n,i).reset(r)}),r.eachTargetAxis(function(n,i){r.getAxisProxy(n,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var i=n.getDataPercentWindow(),a=n.getDataValueWindow();r.setCalculatedRange({start:i[0],end:i[1],startValue:a[0],endValue:a[1]})}})}};function Ave(e){e.registerAction("dataZoom",function(t,r){var n=bve(r,t);j(n,function(i){i.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var JO=!1;function hL(e){JO||(JO=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,Mve),Ave(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function kve(e){e.registerComponentModel(wve),e.registerComponentView(Sve),hL(e)}var Ci=function(){function e(){}return e}(),uH={};function Zc(e,t){uH[e]=t}function cH(e){return uH[e]}var Lve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var r=this.ecModel;j(this.option.feature,function(n,i){var a=cH(i);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(r)),Ge(n,a.defaultOption))})},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:K.color.accent50}},tooltip:{show:!1,position:"bottom"}},t}($e);function hH(e,t){var r=gf(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var i=new Ze({shape:{x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2],r:t.get("borderRadius")},style:n,silent:!0,z2:-1});return i}var Nve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){var o=this.group;if(o.removeAll(),!r.get("show"))return;var s=+r.get("itemSize"),l=r.get("orient")==="vertical",u=r.get("feature")||{},c=this._features||(this._features={}),h=[];j(u,function(_,w){h.push(w)}),new Zo(this._featureNames||[],h).add(f).update(f).remove(Fe(f,null)).execute(),this._featureNames=h;function f(_,w){var S=h[_],T=h[w],M=u[S],A=new qe(M,r,r.ecModel),P;if(a&&a.newTitle!=null&&a.featureName===S&&(M.title=a.newTitle),S&&!T){if(Pve(S))P={onclick:A.option.onclick,featureName:S};else{var I=cH(S);if(!I)return;P=new I}c[S]=P}else if(P=c[T],!P)return;P.uid=pf("toolbox-feature"),P.model=A,P.ecModel=n,P.api=i;var N=P instanceof Ci;if(!S&&T){N&&P.dispose&&P.dispose(n,i);return}if(!A.get("show")||N&&P.unusable){N&&P.remove&&P.remove(n,i);return}d(A,P,S),A.setIconStatus=function(D,O){var R=this.option,F=this.iconPaths;R.iconStatus=R.iconStatus||{},R.iconStatus[D]=O,F[D]&&(O==="emphasis"?Ho:Uo)(F[D])},P instanceof Ci&&P.render&&P.render(A,n,i,a)}function d(_,w,S){var T=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Ci&&w.getIcons?w.getIcons():_.get("icon"),P=_.get("title")||{},I,N;he(A)?(I={},I[S]=A):I=A,he(P)?(N={},N[S]=P):N=P;var D=_.iconPaths={};j(I,function(O,R){var F=df(O,{},{x:-s/2,y:-s/2,width:s,height:s});F.setStyle(T.getItemStyle());var H=F.ensureState("emphasis");H.style=M.getItemStyle();var W=new tt({style:{text:N[R],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:wA({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});F.setTextContent(W),Qo({el:F,componentModel:r,itemName:R,formatterParamsExtra:{title:N[R]}}),F.__title=N[R],F.on("mouseover",function(){var V=M.getItemStyle(),z=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";W.setStyle({fill:M.get("textFill")||V.fill||V.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),F.setTextConfig({position:M.get("textPosition")||z}),W.ignore=!r.get("showTitle"),i.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",R])!=="emphasis"&&i.leaveEmphasis(this),W.hide()}),(_.get(["iconStatus",R])==="emphasis"?Ho:Uo)(F),o.add(F),F.on("click",fe(w.onclick,w,n,i,R)),D[R]=F})}var g=Tr(r,i).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=It(m,g,y);wu(r.get("orient"),o,r.get("itemGap"),x.width,x.height),C_(o,m,g,y),o.add(hH(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),T=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!we(A)&&w){var P=A.style||(A.style={}),I=c_(w,tt.makeFont(P)),N=_.x+o.x,D=_.y+o.y+s,O=!1;D+I.height>i.getHeight()&&(T.position="top",O=!0);var R=O?-5-I.height:s+10;N+I.width/2>i.getWidth()?(T.position=["100%",R],P.align="right"):N-I.width/2<0&&(T.position=[0,R],P.align="left")}})},t.prototype.updateView=function(r,n,i,a){j(this._features,function(o){o instanceof Ci&&o.updateView&&o.updateView(o.model,n,i,a)})},t.prototype.remove=function(r,n){j(this._features,function(i){i instanceof Ci&&i.remove&&i.remove(r,n)}),this.group.removeAll()},t.prototype.dispose=function(r,n){j(this._features,function(i){i instanceof Ci&&i.dispose&&i.dispose(r,n)})},t.type="toolbox",t}(Mt);function Pve(e){return e.indexOf("my")===0}var Ive=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var i=this.model,a=i.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":i.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:i.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:i.get("connectedBackgroundColor"),excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")}),u=Je.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=a+"."+s,c.target="_blank",c.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var f=l.split(","),d=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];d&&(g=window.atob(g));var m=a+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,T=S.document;T.open("image/svg+xml","replace"),T.write(g),T.close(),S.focus(),T.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=i.get("lang"),A='',P=window.open();P.document.write(A),P.document.title=a}},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:K.color.neutral00,name:"",excludeComponents:["toolbox"],lang:r.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return n},t}(Ci),QO="__ec_magicType_stack__",Dve=[["line","bar"],["stack"]],Eve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var r=this.model,n=r.get("icon"),i={};return j(r.get("type"),function(a){n[a]&&(i[a]=n[a])}),i},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return n},t.prototype.onclick=function(r,n,i){var a=this.model,o=a.get(["seriesIndex",i]);if(e5[i]){var s={series:[]},l=function(h){var f=h.subType,d=h.id,g=e5[i](f,d,h,a);g&&(Ae(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(i==="line"||i==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,Ht).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var T=0;T<=S;T++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=i==="bar"}}};j(Dve,function(h){Ve(h,i)>=0&&j(h,function(f){a.setIconStatus(f,"normal")})}),a.setIconStatus(i,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=i;i==="stack"&&(u=Ge({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),a.get(["iconStatus",i])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Ci),e5={line:function(e,t,r,n){if(e==="bar")return Ge({id:t,type:"line",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(e,t,r,n){if(e==="line")return Ge({id:t,type:"bar",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(e,t,r,n){var i=r.get("stack")===QO;if(e==="line"||e==="bar")return n.setIconStatus("stack",i?"normal":"emphasis"),Ge({id:t,stack:i?"":QO},n.get(["option","stack"])||{},!0)}};pa({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var V_=new Array(60).join("-"),qh=" ";function jve(e){var t={},r=[],n=[];return e.eachRawSeries(function(i){var a=i.coordinateSystem;if(a&&(a.type==="cartesian2d"||a.type==="polar")){var o=a.getBaseAxis();if(o.type==="category"){var s=o.dim+"_"+o.index;t[s]||(t[s]={categoryAxis:o,valueAxis:a.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(i)}else r.push(i)}else r.push(i)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function Rve(e){var t=[];return j(e,function(r,n){var i=r.categoryAxis,a=r.valueAxis,o=a.dim,s=[" "].concat(ae(r.series,function(d){return d.name})),l=[i.model.getCategories()];j(r.series,function(d){var g=d.getRawData();l.push(d.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(qh)],c=0;c0,_={api:n,geo:l,mapOrGeoModel:t,data:s,isVisualEncodedByVisualMap:x,isGeo:o,transformInfoRaw:f};l.resourceType==="geoJSON"?this._buildGeoJSON(_):l.resourceType==="geoSVG"&&this._buildSVG(_),this._updateController(t,y,r,n),this._updateMapSelectHandler(t,u,n,i)},e.prototype._buildGeoJSON=function(t){var r=this._regionsGroupByName=_e(),n=_e(),i=this._regionsGroup,a=t.transformInfoRaw,o=t.mapOrGeoModel,s=t.data,l=t.geo.projection,u=l&&l.stream;function c(d,g){return g&&(d=g(d)),d&&[d[0]*a.scaleX+a.x,d[1]*a.scaleY+a.y]}function h(d){for(var g=[],m=!u&&l&&l.project,y=0;y=0)&&(f=i);var d=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Dr(t,Cr(n),{labelFetcher:f,labelDataIndex:h,defaultText:r},d);var g=t.getTextContent();if(g&&(PW(g).ignore=g.ignore,t.textConfig&&o)){var m=t.getBoundingRect().clone();t.textConfig.layoutRect=m,t.textConfig.position=[(o[0]-m.x)/m.width*100+"%",(o[1]-m.y)/m.height*100+"%"]}t.disableLabelAnimation=!0}else t.removeTextContent(),t.removeTextConfig(),t.disableLabelAnimation=null}function Vj(e,t,r,n,i,a){e.data?e.data.setItemGraphicEl(a,t):De(t).eventData={componentType:"geo",componentIndex:i.componentIndex,geoIndex:i.componentIndex,name:r,region:n&&n.option||{}}}function Gj(e,t,r,n,i){e.data||Qo({el:t,componentModel:i,itemName:r,itemTooltipOption:n.get("tooltip")})}function Wj(e,t,r,n,i){t.highDownSilentOnTouch=!!i.get("selectedMode");var a=n.getModel("emphasis"),o=a.get("focus");return Dt(t,o,a.get("blurScope"),a.get("disabled")),e.isGeo&&KK(t,i,r),o}function Hj(e,t,r){var n=[],i;function a(){i=[]}function o(){i.length&&(n.push(i),i=[])}var s=t({polygonStart:a,polygonEnd:o,lineStart:a,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&i.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),j(e,function(l){s.lineStart();for(var u=0;u-1&&(i.style.stroke=i.style.fill,i.style.fill=K.color.neutral00,i.style.lineWidth=2),i},t.type="series.map",t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:K.color.tertiary},itemStyle:{borderWidth:.5,borderColor:K.color.border,areaColor:K.color.background},emphasis:{label:{show:!0,color:K.color.primary},itemStyle:{areaColor:K.color.highlight}},select:{label:{show:!0,color:K.color.primary},itemStyle:{color:K.color.highlight}},nameProperty:"name"},t}(bt);function lse(e,t){var r={};return j(e,function(n){n.each(n.mapDimension("value"),function(i,a){var o="ec-"+n.getName(a);r[o]=r[o]||[],isNaN(i)||r[o].push(i)})}),e[0].map(e[0].mapDimension("value"),function(n,i){for(var a="ec-"+e[0].getName(i),o=0,s=1/0,l=-1/0,u=r[a].length,c=0;c1?(w.width=_,w.height=_/m):(w.height=_,w.width=_*m),w.y=x[1]-w.height/2,w.x=x[0]-w.width/2;else{var S=e.getBoxLayoutParams();S.aspect=m,w=It(S,g),w=M6(e,w,m)}this.setViewRect(w.x,w.y,w.width,w.height),this.setCenter(e.get("center")),this.setZoom(e.get("zoom"))}function fse(e,t){j(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var dse=function(){function e(){this.dimensions=DW}return e.prototype.create=function(t,r){var n=[];function i(o){return{nameProperty:o.get("nameProperty"),aspectScale:o.get("aspectScale"),projection:o.get("projection")}}t.eachComponent("geo",function(o,s){var l=o.get("map"),u=new YT(l+s,l,Q({nameMap:o.get("nameMap"),api:r,ecModel:t},i(o)));u.zoomLimit=o.get("scaleLimit"),n.push(u),o.coordinateSystem=u,u.model=o,u.resize=Yj,u.resize(o,r)}),t.eachSeries(function(o){$p({targetModel:o,coordSysType:"geo",coordSysProvider:function(){var s=o.subType==="map"?o.getHostGeoModel():o.getReferringComponents("geo",Ht).models[0];return s&&s.coordinateSystem},allowNotFound:!0})});var a={};return t.eachSeriesByType("map",function(o){if(!o.getHostGeoModel()){var s=o.getMapType();a[s]=a[s]||[],a[s].push(o)}}),j(a,function(o,s){var l=ae(o,function(c){return c.get("nameMap")}),u=new YT(s,s,Q({nameMap:a_(l),api:r,ecModel:t},i(o[0])));u.zoomLimit=Fr.apply(null,ae(o,function(c){return c.get("scaleLimit")})),n.push(u),u.resize=Yj,u.resize(o[0],r),j(o,function(c){c.coordinateSystem=u,fse(u,c)})}),n},e.prototype.getFilledRegions=function(t,r,n,i){for(var a=(t||[]).slice(),o=_e(),s=0;s=0;o--){var s=i[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function xse(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,i=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){bse(e);var a=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;i?(e.hierNode.prelim=i.hierNode.prelim+t(e,i),e.hierNode.modifier=e.hierNode.prelim-a):e.hierNode.prelim=a}else i&&(e.hierNode.prelim=i.hierNode.prelim+t(e,i));e.parentNode.hierNode.defaultAncestor=wse(e,i,e.parentNode.hierNode.defaultAncestor||n[0],t)}function _se(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function Xj(e){return arguments.length?e:Tse}function qd(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function bse(e){for(var t=e.children,r=t.length,n=0,i=0;--r>=0;){var a=t[r];a.hierNode.prelim+=n,a.hierNode.modifier+=n,i+=a.hierNode.change,n+=a.hierNode.shift+i}}function wse(e,t,r,n){if(t){for(var i=e,a=e,o=a.parentNode.children[0],s=t,l=i.hierNode.modifier,u=a.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=gw(s),a=mw(a),s&&a;){i=gw(i),o=mw(o),i.hierNode.ancestor=e;var f=s.hierNode.prelim+h-a.hierNode.prelim-u+n(s,a);f>0&&(Cse(Sse(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=i.hierNode.modifier,c+=o.hierNode.modifier}s&&!gw(i)&&(i.hierNode.thread=s,i.hierNode.modifier+=h-l),a&&!mw(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,r=e)}return r}function gw(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function mw(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function Sse(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Cse(e,t,r){var n=r/(t.hierNode.i-e.hierNode.i);t.hierNode.change-=n,t.hierNode.shift+=r,t.hierNode.modifier+=r,t.hierNode.prelim+=r,e.hierNode.change+=n}function Tse(e,t){return e.parentNode===t.parentNode?1:2}var Mse=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Ase=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Mse},t.prototype.buildPath=function(r,n){var i=n.childPoints,a=i.length,o=n.parentPoint,s=i[0],l=i[a-1];if(a===1){r.moveTo(o[0],o[1]),r.lineTo(s[0],s[1]);return}var u=n.orient,c=u==="TB"||u==="BT"?0:1,h=1-c,f=ce(n.forkPosition,1),d=[];d[c]=o[c],d[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(d[0],d[1]),r.moveTo(s[0],s[1]),d[c]=s[c],r.lineTo(d[0],d[1]),d[c]=l[c],r.lineTo(d[0],d[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,T||(S=S-Math.PI));var A=T?"left":"right",P=s.getModel("label"),I=P.get("rotate"),N=I*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:P.get("position")||A,rotation:I==null?-S:N,origin:"center"}),D.setStyle("verticalAlign","middle"))}var O=s.get(["emphasis","focus"]),R=O==="relative"?Eh(o.getAncestorsIndices(),o.getDescendantIndices()):O==="ancestor"?o.getAncestorsIndices():O==="descendant"?o.getDescendantIndices():null;R&&(De(r).focus=R),Lse(i,o,c,r,g,d,m,n),r.__edge&&(r.onHoverStateChange=function(F){if(F!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Vp||j0(r.__edge,F)}})}function Lse(e,t,r,n,i,a,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),d=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new hf({shape:XT(c,h,f,i,i)})),it(m,{shape:XT(c,h,f,a,o)},e));else if(u==="polyline"&&c==="orthogonal"&&t!==r&&t.children&&t.children.length!==0&&t.isExpand===!0){for(var y=t.children,x=[],_=0;_r&&(r=i.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,i=n.length;r=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,r)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostTree,n=r.data.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(t,r){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,r)},e.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,r=0;r=0){var n=r.getData().tree.root,i=e.targetNode;if(he(i)&&(i=n.getNodeById(i)),i&&n.contains(i))return{node:i};var a=e.targetNodeId;if(a!=null&&(i=n.getNodeById(a)))return{node:i}}}function BW(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function Nk(e,t){var r=BW(e);return Ve(r,t)>=0}function O_(e,t){for(var r=[];e;){var n=e.dataIndex;r.push({name:e.name,dataIndex:n,value:t.getRawValue(n)}),e=e.parentNode}return r.reverse(),r}var zse=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.hasSymbolVisual=!0,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r){var n={name:r.name,children:r.data},i=r.leaves||{},a=new qe(i,this,this.ecModel),o=Lk.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,d){var g=o.getNodeByDataIndex(d);return g&&g.children.length&&g.isExpand||(f.parentModel=a),f})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=r.expandAndCollapse,c=u&&r.initialTreeDepth>=0?r.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var f=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=f&&f.collapsed!=null?!f.collapsed:h.depth<=c}),o.data},t.prototype.getOrient=function(){var r=this.get("orient");return r==="horizontal"?r="LR":r==="vertical"&&(r="TB"),r},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.formatTooltip=function(r,n,i){for(var a=this.getData().tree,o=a.root.children[0],s=a.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return gr("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=O_(i,this),n.collapsed=!i.isExpand,n},t.type="series.tree",t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,roamTrigger:"global",nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:K.color.borderTint,width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},t}(bt);function Bse(e,t,r){for(var n=[e],i=[],a;a=n.pop();)if(i.push(a),a.isExpand){var o=a.children;if(o.length)for(var s=0;s=0;a--)r.push(i[a])}}function Fse(e,t){e.eachSeriesByType("tree",function(r){Vse(r,t)})}function Vse(e,t){var r=Tr(e,t).refContainer,n=It(e.getBoxLayoutParams(),r);e.layoutInfo=n;var i=e.get("layout"),a=0,o=0,s=null;i==="radial"?(a=2*Math.PI,o=Math.min(n.height,n.width)/2,s=Xj(function(S,T){return(S.parentNode===T.parentNode?1:2)/S.depth})):(a=n.width,o=n.height,s=Xj());var l=e.getData().tree.root,u=l.children[0];if(u){yse(l),Bse(u,xse,s),l.hierNode.modifier=-u.hierNode.prelim,Ad(u,_se);var c=u,h=u,f=u;Ad(u,function(S){var T=S.getLayout().x;Th.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var d=c===h?1:s(c,h)/2,g=d-c.getLayout().x,m=0,y=0,x=0,_=0;if(i==="radial")m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Ad(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var T=qd(x,_);S.setLayout({x:T.x,y:T.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+d+g),m=a/(f.depth-1||1),Ad(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:a-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Ad(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function Gse(e){e.eachSeriesByType("tree",function(t){var r=t.getData(),n=r.tree;n.eachNode(function(i){var a=i.getModel(),o=a.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(i.dataIndex,"style");Q(s,o)})})}function Wse(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:"series",subType:"tree",query:t},function(n){var i=t.dataIndex,a=n.getData().tree,o=a.getNodeByDataIndex(i);o.isExpand=!o.isExpand})}),e.registerAction({type:"treeRoam",event:"treeRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",subType:"tree",query:t},function(i){var a=i.coordinateSystem,o=j_(a,t,i.get("scaleLimit"));i.setCenter(o.center),i.setZoom(o.zoom)})})}function Hse(e){e.registerChartView(kse),e.registerSeriesModel(zse),e.registerLayout(Fse),e.registerVisual(Gse),Wse(e)}var eR=["treemapZoomToNode","treemapRender","treemapMove"];function Use(e){for(var t=0;t1;)a=a.parentNode;var o=fT(e.ecModel,a.name||a.dataIndex+"",n);i.setVisual("decal",o)})}var Zse=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventUsingHoverLayer=!0,r}return t.prototype.getInitialData=function(r,n){var i={name:r.name,children:r.data};VW(i);var a=r.levels||[],o=this.designatedVisualItemStyle={},s=new qe({itemStyle:o},this,n);a=r.levels=$se(a,n);var l=ae(a||[],function(h){return new qe(h,s,n)},this),u=Lk.createTree(i,this,c);function c(h){h.wrapMethod("getItemModel",function(f,d){var g=u.getNodeByDataIndex(d),m=g?l[g.depth]:null;return f.parentModel=m||s,f})}return u.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(r,n,i){var a=this.getData(),o=this.getRawValue(r),s=a.getName(r);return gr("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=O_(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},Q(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=_e(),this._idIndexMapCount=0);var i=n.get(r);return i==null&&n.set(r,i=this._idIndexMapCount++),i},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){FW(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,coordinateSystemUsage:"box",left:K.size.l,top:K.size.xxxl,right:K.size.l,bottom:K.size.xxxl,sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:"global",nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",bottom:K.size.m,emptyItemWidth:25,itemStyle:{color:K.color.backgroundShade,textStyle:{color:K.color.secondary}},emphasis:{itemStyle:{color:K.color.background}}},label:{show:!0,distance:0,padding:5,position:"inside",color:K.color.neutral00,overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:K.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},t}(bt);function VW(e){var t=0;j(e.children,function(n){VW(n);var i=n.value;re(i)&&(i=i[0]),t+=i});var r=e.value;re(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),re(e.value)?e.value[0]=r:e.value=r}function $se(e,t){var r=Tt(t.get("color")),n=Tt(t.get(["aria","decal","decals"]));if(r){e=e||[];var i,a;j(e,function(s){var l=new qe(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(i=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(a=!0)});var o=e[0]||(e[0]={});return i||(o.color=r.slice()),!a&&n&&(o.decal=n.slice()),e}}var Yse=8,tR=8,yw=5,Xse=function(){function e(t){this.group=new Ce,t.add(this.group)}return e.prototype.render=function(t,r,n,i){var a=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!a.get("show")||!n)){var s=a.getModel("itemStyle"),l=a.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Tr(t,r).refContainer,f={left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},d={emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=It(f,h);this._prepare(n,d,u),this._renderContent(t,d,g,s,l,u,c,i),C_(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var i=t;i;i=i.parentNode){var a=br(i.getModel().get("name"),""),o=n.getTextRect(a),s=Math.max(o.width+Yse*2,r.emptyItemWidth);r.totalWidth+=s+tR,r.renderList.push({node:i,text:a,width:s})}},e.prototype._renderContent=function(t,r,n,i,a,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,d=r.renderList,g=a.getModel("itemStyle").getItemStyle(),m=d.length-1;m>=0;m--){var y=d[m],x=y.node,_=y.width,w=y.text;f>n.width&&(f-=_-c,_=c,w=null);var S=new en({shape:{points:qse(u,0,_,h,m===d.length-1,m===0)},style:Ae(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new tt({style:Ct(o,{text:w})}),textConfig:{position:"inside"},z2:uf*1e4,onclick:Fe(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=Ct(s,{text:w}),S.ensureState("emphasis").style=g,Dt(S,a.get("focus"),a.get("blurScope"),a.get("disabled")),this.group.add(S),Kse(S,t,x),u+=_+tR}},e.prototype.remove=function(){this.group.removeAll()},e}();function qse(e,t,r,n,i,a){var o=[[i?e:e-yw,t],[e+r,t],[e+r,t+n],[i?e:e-yw,t+n]];return!a&&o.splice(2,0,[e+r+yw,t+n/2]),!i&&o.push([e,t+n/2]),o}function Kse(e,t,r){De(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:r&&r.dataIndex,name:r&&r.name},treePathInfo:r&&O_(r,t)}}var Jse=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,i,a){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:i,easing:a}),!0)},e.prototype.finished=function(t){return this._finishedCallback=t,this},e.prototype.start=function(){for(var t=this,r=this._storage.length,n=function(){r--,r<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},i=0,a=this._storage.length;inR||Math.abs(r.dy)>nR)){var n=this.seriesModel.getData().tree.root;if(!n)return;var i=n.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+r.dx,y:i.y+r.dy,width:i.width,height:i.height}})}},t.prototype._onZoom=function(r){var n=r.originX,i=r.originY,a=r.scale;if(this._state!=="animating"){var o=this.seriesModel.getData().tree.root;if(!o)return;var s=o.getLayout();if(!s)return;var l=new Pe(s.x,s.y,s.width,s.height),u=null,c=this._controllerHost;u=c.zoomLimit;var h=c.zoom=c.zoom||1;if(h*=a,u){var f=u.min||0,d=u.max||1/0;h=Math.max(Math.min(d,h),f)}var g=h/c.zoom;c.zoom=h;var m=this.seriesModel.layoutInfo;n-=m.x,i-=m.y;var y=Pr();ha(y,y,[-n,-i]),l_(y,y,[g,g]),ha(y,y,[n,i]),l.applyTransform(y),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:l.x,y:l.y,width:l.width,height:l.height}})}},t.prototype._initEvents=function(r){var n=this;r.on("click",function(i){if(n._state==="ready"){var a=n.seriesModel.get("nodeClick",!0);if(a){var o=n.findTarget(i.offsetX,i.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(a==="zoomToNode")n._zoomToNode(o);else if(a==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&B0(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,i){var a=this;i||(i=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),i||(i={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new Xse(this.group))).render(r,n,i.node,function(o){a._state!=="animating"&&(Nk(r.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=kd(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(r){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype._rootToNode=function(r){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype.findTarget=function(r,n){var i,a=this.seriesModel.getViewRoot();return a.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(r,n),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)i={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),i},t.type="treemap",t}(gt);function kd(){return{nodeGroup:[],background:[],content:[]}}function ile(e,t,r,n,i,a,o,s,l,u){if(!o)return;var c=o.getLayout(),h=e.getData(),f=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var d=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,T=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),P=f.getModel(["blur","itemStyle"]),I=f.getModel(["select","itemStyle"]),N=M.get("borderRadius")||0,D=se("nodeGroup",qT);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),ux(D).nodeWidth=d,ux(D).nodeHeight=g,c.isAboveViewRoot)return D;var O=se("background",rR,u,tle);O&&U(D,O,T&&c.upperLabelHeight);var R=f.getModel("emphasis"),F=R.get("focus"),H=R.get("blurScope"),W=R.get("disabled"),V=F==="ancestor"?o.getAncestorsIndices():F==="descendant"?o.getDescendantIndices():F;if(T)np(D)&&fu(D,!1),O&&(fu(O,!W),h.setItemGraphicEl(o.dataIndex,O),tT(O,V,H));else{var z=se("content",rR,u,rle);z&&$(D,z),O.disableMorphing=!0,O&&np(O)&&fu(O,!1),fu(D,!W),h.setItemGraphicEl(o.dataIndex,D);var Z=f.getShallow("cursor");Z&&z.attr("cursor",Z),tT(D,V,H)}return D;function U(me,ye,Me){var pe=De(ye);if(pe.dataIndex=o.dataIndex,pe.seriesIndex=e.seriesIndex,ye.setShape({x:0,y:0,width:d,height:g,r:N}),y)Y(ye);else{ye.invisible=!1;var Te=o.getVisual("style"),st=Te.stroke,ze=oR(M);ze.fill=st;var et=Jl(A);et.fill=A.get("borderColor");var lt=Jl(P);lt.fill=P.get("borderColor");var Et=Jl(I);if(Et.fill=I.get("borderColor"),Me){var lr=d-2*m;te(ye,st,Te.opacity,{x:m,y:0,width:lr,height:S})}else ye.removeTextContent();ye.setStyle(ze),ye.ensureState("emphasis").style=et,ye.ensureState("blur").style=lt,ye.ensureState("select").style=Et,zu(ye)}me.add(ye)}function $(me,ye){var Me=De(ye);Me.dataIndex=o.dataIndex,Me.seriesIndex=e.seriesIndex;var pe=Math.max(d-2*m,0),Te=Math.max(g-2*m,0);if(ye.culling=!0,ye.setShape({x:m,y:m,width:pe,height:Te,r:N}),y)Y(ye);else{ye.invisible=!1;var st=o.getVisual("style"),ze=st.fill,et=oR(M);et.fill=ze,et.decal=st.decal;var lt=Jl(A),Et=Jl(P),lr=Jl(I);te(ye,ze,st.opacity,null),ye.setStyle(et),ye.ensureState("emphasis").style=lt,ye.ensureState("blur").style=Et,ye.ensureState("select").style=lr,zu(ye)}me.add(ye)}function Y(me){!me.invisible&&a.push(me)}function te(me,ye,Me,pe){var Te=f.getModel(pe?aR:iR),st=br(f.get("name"),null),ze=Te.getShallow("show");Dr(me,Cr(f,pe?aR:iR),{defaultText:ze?st:null,inheritColor:ye,defaultOpacity:Me,labelFetcher:e,labelDataIndex:o.dataIndex});var et=me.getTextContent();if(et){var lt=et.style,Et=Rp(lt.padding||0);pe&&(me.setTextConfig({layoutRect:pe}),et.disableLabelLayout=!0),et.beforeUpdate=function(){var Mr=Math.max((pe?pe.width:me.shape.width)-Et[1]-Et[3],0),Gn=Math.max((pe?pe.height:me.shape.height)-Et[0]-Et[2],0);(lt.width!==Mr||lt.height!==Gn)&&et.setStyle({width:Mr,height:Gn})},lt.truncateMinChar=2,lt.lineOverflow="truncate",ie(lt,pe,c);var lr=et.getState("emphasis");ie(lr?lr.style:null,pe,c)}}function ie(me,ye,Me){var pe=me?me.text:null;if(!ye&&Me.isLeafRoot&&pe!=null){var Te=e.get("drillDownIcon",!0);me.text=Te?Te+" "+pe:pe}}function se(me,ye,Me,pe){var Te=_!=null&&r[me][_],st=i[me];return Te?(r[me][_]=null,le(st,Te)):y||(Te=new ye,Te instanceof Ri&&(Te.z2=ale(Me,pe)),Ee(st,Te)),t[me][x]=Te}function le(me,ye){var Me=me[x]={};ye instanceof qT?(Me.oldX=ye.x,Me.oldY=ye.y):Me.oldShape=Q({},ye.shape)}function Ee(me,ye){var Me=me[x]={},pe=o.parentNode,Te=ye instanceof Ce;if(pe&&(!n||n.direction==="drillDown")){var st=0,ze=0,et=i.background[pe.getRawIndex()];!n&&et&&et.oldShape&&(st=et.oldShape.width,ze=et.oldShape.height),Te?(Me.oldX=0,Me.oldY=ze):Me.oldShape={x:st,y:ze,width:0,height:0}}Me.fadein=!Te}}function ale(e,t){return e*ele+t}var xp=j,ole=ke,cx=-1,Ir=function(){function e(t){var r=t.mappingMethod,n=t.type,i=this.option=Se(t);this.type=n,this.mappingMethod=r,this._normalizeData=ule[r];var a=e.visualHandlers[n];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[r],r==="piecewise"?(xw(i),sle(i)):r==="category"?i.categories?lle(i):xw(i,!0):(Jr(r!=="linear"||i.dataExtent),xw(i))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return fe(this._normalizeData,this)},e.listVisualTypes=function(){return Qe(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){ke(t)?j(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var i,a=re(t)?[]:ke(t)?{}:(i=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);i?a=l:a[s]=l}),a},e.retrieveVisuals=function(t){var r={},n;return t&&xp(e.visualHandlers,function(i,a){t.hasOwnProperty(a)&&(r[a]=t[a],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(re(t))t=t.slice();else if(ole(t)){var r=[];xp(t,function(n,i){r.push(i)}),t=r}else return[];return t.sort(function(n,i){return i==="color"&&n!=="color"&&n.indexOf("color")===0?1:-1}),t},e.dependsOn=function(t,r){return r==="color"?!!(t&&t.indexOf(r)===0):t===r},e.findPieceIndex=function(t,r,n){for(var i,a=1/0,o=0,s=r.length;o=0;a--)n[a]==null&&(delete r[t[a]],t.pop())}function xw(e,t){var r=e.visual,n=[];ke(r)?xp(r,function(a){n.push(a)}):r!=null&&n.push(r);var i={color:1,symbol:1};!t&&n.length===1&&!i.hasOwnProperty(e.type)&&(n[1]=n[0]),GW(e,n)}function Gm(e){return{applyVisual:function(t,r,n){var i=this.mapValueToVisual(t);n("color",e(r("color"),i))},_normalizedToVisual:KT([0,1])}}function sR(e){var t=this.option.visual;return t[Math.round(ht(e,[0,1],[0,t.length-1],!0))]||{}}function Ld(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Kd(e){var t=this.option.visual;return t[this.option.loop&&e!==cx?e%t.length:e]}function Ql(){return this.option.visual[0]}function KT(e){return{linear:function(t){return ht(t,e,this.option.visual,!0)},category:Kd,piecewise:function(t,r){var n=JT.call(this,r);return n==null&&(n=ht(t,e,this.option.visual,!0)),n},fixed:Ql}}function JT(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Ir.findPieceIndex(e,r),i=r[n];if(i&&i.visual)return i.visual[this.type]}}function GW(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=ae(t,function(r){var n=fn(r);return n||[0,0,0,1]})),t}var ule={linear:function(e){return ht(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Ir.findPieceIndex(e,t,!0);if(r!=null)return ht(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??cx},fixed:qt};function Wm(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=ple(i,l,m,y,g,n);HW(m,x,r,n)}})}}}function fle(e,t,r){var n=Q({},t),i=r.designatedVisualItemStyle;return j(["color","colorAlpha","colorSaturation"],function(a){i[a]=t[a];var o=e.get(a);i[a]=null,o!=null&&(n[a]=o)}),n}function lR(e){var t=_w(e,"color");if(t){var r=_w(e,"colorAlpha"),n=_w(e,"colorSaturation");return n&&(t=Io(t,null,null,n)),r&&(t=Jv(t,r)),t}}function dle(e,t){return t!=null?Io(t,null,null,e):null}function _w(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function vle(e,t,r,n,i,a){if(!(!a||!a.length)){var o=bw(t,"color")||i.color!=null&&i.color!=="none"&&(bw(t,"colorAlpha")||bw(t,"colorSaturation"));if(o){var s=t.get("visualMin"),l=t.get("visualMax"),u=r.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=t.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var f=new Ir(h);return WW(f).drColorMappingBy=c,f}}}function bw(e,t){var r=e.get(t);return re(r)&&r.length?{name:t,range:r}:null}function ple(e,t,r,n,i,a){var o=Q({},t);if(i){var s=i.type,l=s==="color"&&WW(i).drColorMappingBy,u=l==="index"?n:l==="id"?a.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=i.mapValueToVisual(u)}return o}var _p=Math.max,hx=Math.min,uR=Fr,Pk=j,UW=["itemStyle","borderWidth"],gle=["itemStyle","gapWidth"],mle=["upperLabel","show"],yle=["upperLabel","height"];const xle={seriesType:"treemap",reset:function(e,t,r,n){var i=e.option,a=Tr(e,r).refContainer,o=It(e.getBoxLayoutParams(),a),s=i.size||[],l=ce(uR(o.width,s[0]),a.width),u=ce(uR(o.height,s[1]),a.height),c=n&&n.type,h=["treemapZoomToNode","treemapRootToNode"],f=yp(n,h,e),d=c==="treemapRender"||c==="treemapMove"?n.rootRect:null,g=e.getViewRoot(),m=BW(g);if(c!=="treemapMove"){var y=c==="treemapZoomToNode"?Tle(e,f,g,l,u):d?[d.width,d.height]:[l,u],x=i.sort;x&&x!=="asc"&&x!=="desc"&&(x="desc");var _={squareRatio:i.squareRatio,sort:x,leafDepth:i.leafDepth};g.hostTree.clearLayouts();var w={x:0,y:0,width:y[0],height:y[1],area:y[0]*y[1]};g.setLayout(w),ZW(g,_,!1,0),w=g.getLayout(),Pk(m,function(T,M){var A=(m[M+1]||g).getValue();T.setLayout(Q({dataExtent:[A,A],borderWidth:0,upperHeight:0},w))})}var S=e.getData().tree.root;S.setLayout(Mle(o,d,f),!0),e.setLayoutInfo(o),$W(S,new Pe(-o.x,-o.y,r.getWidth(),r.getHeight()),m,g,0)}};function ZW(e,t,r,n){var i,a;if(!e.isRemoved()){var o=e.getLayout();i=o.width,a=o.height;var s=e.getModel(),l=s.get(UW),u=s.get(gle)/2,c=YW(s),h=Math.max(l,c),f=l-u,d=h-u;e.setLayout({borderWidth:l,upperHeight:h,upperLabelHeight:c},!0),i=_p(i-2*f,0),a=_p(a-f-d,0);var g=i*a,m=_le(e,s,g,t,r,n);if(m.length){var y={x:f,y:d,width:i,height:a},x=hx(i,a),_=1/0,w=[];w.area=0;for(var S=0,T=m.length;S=0;l--){var u=i[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function Cle(e,t,r){for(var n=0,i=1/0,a=0,o=void 0,s=e.length;an&&(n=o));var l=e.area*e.area,u=t*t*r;return l?_p(u*n/l,l/(u*i)):1/0}function cR(e,t,r,n,i){var a=t===r.width?0:1,o=1-a,s=["x","y"],l=["width","height"],u=r[s[a]],c=t?e.area/t:0;(i||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hHC&&(u=HC),a=s}un&&(n=t);var a=n%2?n+2:n+3;i=[];for(var o=0;o0&&(T[0]=-T[0],T[1]=-T[1]);var A=S[0]<0?-1:1;if(a.__position!=="start"&&a.__position!=="end"){var P=-Math.atan2(S[1],S[0]);h[0].8?"left":f[0]<-.8?"right":"center",m=f[1]>.8?"top":f[1]<-.8?"bottom":"middle";break;case"start":a.x=-f[0]*x+c[0],a.y=-f[1]*_+c[1],g=f[0]>.8?"right":f[0]<-.8?"left":"center",m=f[1]>.8?"bottom":f[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":a.x=x*A+c[0],a.y=c[1]+I,g=S[0]<0?"right":"left",a.originX=-x*A,a.originY=-I;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":a.x=M[0],a.y=M[1]+I,g="center",a.originY=-I;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":a.x=-x*A+h[0],a.y=h[1]+I,g=S[0]>=0?"right":"left",a.originX=x*A,a.originY=-I;break}a.scaleX=a.scaleY=o,a.setStyle({verticalAlign:a.__verticalAlign||m,align:a.__align||g})}},t}(Ce),Rk=function(){function e(t){this.group=new Ce,this._LineCtor=t||jk}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,i=n.group,a=n._lineData;n._lineData=t,a||i.removeAll();var o=gR(t);t.diff(a).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(a,t,l,s,o)}).remove(function(s){i.remove(a.getItemGraphicEl(s))}).execute()},e.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(r,n){r.updateLayout(t,n)},this)},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=gR(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r){this._progressiveEls=[];function n(s){!s.isGroup&&!Wle(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var i=t.start;i0}function gR(e){var t=e.hostModel,r=t.getModel("emphasis");return{lineStyle:t.getModel("lineStyle").getLineStyle(),emphasisLineStyle:r.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:t.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:t.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:r.get("disabled"),blurScope:r.get("blurScope"),focus:r.get("focus"),labelStatesModels:Cr(t)}}function mR(e){return isNaN(e[0])||isNaN(e[1])}function Mw(e){return e&&!mR(e[0])&&!mR(e[1])}var Aw=[],kw=[],Lw=[],Dc=Br,Nw=Vs,yR=Math.abs;function xR(e,t,r){for(var n=e[0],i=e[1],a=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){Aw[0]=Dc(n[0],i[0],a[0],c),Aw[1]=Dc(n[1],i[1],a[1],c);var h=yR(Nw(Aw,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function Pw(e,t){var r=[],n=qv,i=[[],[],[]],a=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[Ga(u[0]),Ga(u[1])],u[2]&&u.__original.push(Ga(u[2])));var f=u.__original;if(u[2]!=null){if(ln(i[0],f[0]),ln(i[1],f[2]),ln(i[2],f[1]),c&&c!=="none"){var d=Qd(s.node1),g=xR(i,f[0],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[0][0]=r[3],i[1][0]=r[4],n(i[0][1],i[1][1],i[2][1],g,r),i[0][1]=r[3],i[1][1]=r[4]}if(h&&h!=="none"){var d=Qd(s.node2),g=xR(i,f[1],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[1][0]=r[1],i[2][0]=r[2],n(i[0][1],i[1][1],i[2][1],g,r),i[1][1]=r[1],i[2][1]=r[2]}ln(u[0],i[0]),ln(u[1],i[2]),ln(u[2],i[1])}else{if(ln(a[0],f[0]),ln(a[1],f[1]),Ts(o,a[1],a[0]),Xu(o,o),c&&c!=="none"){var d=Qd(s.node1);x0(a[0],a[0],o,d*t)}if(h&&h!=="none"){var d=Qd(s.node2);x0(a[1],a[1],o,-d*t)}ln(u[0],a[0]),ln(u[1],a[1])}})}var tH=Ye();function Hle(e){if(e)return tH(e).bridge}function _R(e,t){e&&(tH(e).bridge=t)}function bR(e){return e.type==="view"}var Ule=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){var i=new Kp,a=new Rk,o=this.group,s=new Ce;this._controller=new rc(n.getZr()),this._controllerHost={target:s},s.add(i.group),s.add(a.group),o.add(s),this._symbolDraw=i,this._lineDraw=a,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,i){var a=this,o=r.coordinateSystem,s=!1;this._model=r,this._api=i,this._active=!0;var l=this._getThumbnailInfo();l&&l.bridge.reset(i);var u=this._symbolDraw,c=this._lineDraw;if(bR(o)){var h={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?this._mainGroup.attr(h):it(this._mainGroup,h,r)}Pw(r.getGraph(),Jd(r));var f=r.getData();u.updateData(f);var d=r.getEdgeData();c.updateData(d),this._updateNodeAndLinkScale(),this._updateController(null,r,i),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,i,m));var y=r.get("layout");f.graph.eachNode(function(S){var T=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var P=A.get("draggable");P&&M.on("drag",function(N){switch(y){case"force":g.warmUp(),!a._layouting&&a._startForceLayoutIteration(g,i,m),g.setFixed(T),f.setItemLayout(T,[M.x,M.y]);break;case"circular":f.setItemLayout(T,[M.x,M.y]),S.setLayout({fixed:!0},!0),Ek(r,"symbolSize",S,[N.offsetX,N.offsetY]),a.updateLayout(r);break;case"none":default:f.setItemLayout(T,[M.x,M.y]),Dk(r.getGraph(),r),a.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(T)}),M.setDraggable(P,!!A.get("cursor"));var I=A.get(["emphasis","focus"]);I==="adjacency"&&(De(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var T=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);T&&M==="adjacency"&&(De(T).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){JW(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,i,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._startForceLayoutIteration=function(r,n,i){var a=this,o=!1;(function s(){r.step(function(l){a.updateLayout(a._model),(l||!o)&&(o=!0,a._renderThumbnail(a._model,n,a._symbolDraw,a._lineDraw)),(a._layouting=!l)&&(i?a._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype._updateController=function(r,n,i){var a=this._controller,o=this._controllerHost,s=n.coordinateSystem;if(!bR(s)){a.disable();return}a.enable(n.get("roam"),{api:i,zInfo:{component:n},triggerInfo:{roamTrigger:n.get("roamTrigger"),isInSelf:function(l,u,c){return s.containPoint([u,c])},isInClip:function(l,u,c){return!r||r.contain(u,c)}}}),o.zoomLimit=n.get("scaleLimit"),o.zoom=s.getZoom(),a.off("pan").off("zoom").on("pan",function(l){i.dispatchAction({seriesId:n.id,type:"graphRoam",dx:l.dx,dy:l.dy})}).on("zoom",function(l){i.dispatchAction({seriesId:n.id,type:"graphRoam",zoom:l.scale,originX:l.originX,originY:l.originY})})},t.prototype.updateViewOnPan=function(r,n,i){this._active&&(Ck(this._controllerHost,i.dx,i.dy),this._updateThumbnailWindow())},t.prototype.updateViewOnZoom=function(r,n,i){this._active&&(Tk(this._controllerHost,i.zoom,i.originX,i.originY),this._updateNodeAndLinkScale(),Pw(r.getGraph(),Jd(r)),this._lineDraw.updateLayout(),n.updateLabelLayout(),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),i=Jd(r);n.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(i)})},t.prototype.updateLayout=function(r){this._active&&(Pw(r.getGraph(),Jd(r)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var r=this._model,n=r.coordinateSystem;if(n.type==="view"){var i=Hle(r);if(i)return{bridge:i,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(r.coordSys.transform,this._api)},t.prototype._renderThumbnail=function(r,n,i,a){var o=this._getThumbnailInfo();if(o){var s=new Ce,l=i.group.children(),u=a.group.children(),c=new Ce,h=new Ce;s.add(h),s.add(c);for(var f=0;f=0&&t.call(r,n[a],a)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,i=n.length,a=0;a=0&&n[a].node1.dataIndex>=0&&n[a].node2.dataIndex>=0&&t.call(r,n[a],a)},e.prototype.breadthFirstTraverse=function(t,r,n,i){if(r instanceof eu||(r=this._nodesMap[Ec(r)]),!!r){for(var a=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var a=0,o=i.length;a=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(d.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),rH=function(){function e(t,r,n){this.dataIndex=-1,this.node1=t,this.node2=r,this.dataIndex=n??-1}return e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostGraph,n=r.edgeData.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var t=_e(),r=_e();t.set(this.dataIndex,!0);for(var n=[this.node1],i=[this.node2],a=0;a=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(a=0;a=0&&!t.hasKey(m)&&(t.set(m,!0),i.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function nH(e,t){return{getValue:function(r){var n=this[e][t];return n.getStore().get(n.getDimensionIndex(r||"value"),this.dataIndex)},setVisual:function(r,n){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}Qt(eu,nH("hostGraph","data"));Qt(rH,nH("hostGraph","edgeData"));function Ok(e,t,r,n,i){for(var a=new Zle(n),o=0;o "+f)),u++)}var d=r.get("coordinateSystem"),g;if(d==="cartesian2d"||d==="polar"||d==="matrix")g=no(e,r);else{var m=mf.get(d),y=m?m.dimensions||[]:[];Ve(y,"value")<0&&y.concat(["value"]);var x=bf(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new dn(x,r),g.initData(e)}var _=new dn(["value"],r);return _.initData(l,s),i&&i(g,_),OW({mainData:g,struct:a,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var $le=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new Mf(i,i),this.fillDataTextStyle(r.edges||r.links),this._updateCategoriesData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links),this._updateCategoriesData()},t.prototype.mergeDefaultAndTheme=function(r){e.prototype.mergeDefaultAndTheme.apply(this,arguments),ju(r,"edgeLabel",["show"])},t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[],o=this;if(a&&i){Dle(this);var s=Ok(a,i,this,!0,l);return j(s.edges,function(u){Ele(u.node1,u.node2,this,u.dataIndex)},this),s.data}function l(u,c){u.wrapMethod("getItemModel",function(g){var m=o._categoriesModels,y=g.getShallow("category"),x=m[y];return x&&(x.parentModel=g.parentModel,g.parentModel=x),g});var h=qe.prototype.getModel;function f(g,m){var y=h.call(this,g,m);return y.resolveParentPath=d,y}c.wrapMethod("getItemModel",function(g){return g.resolveParentPath=d,g.getModel=f,g});function d(g){if(g&&(g[0]==="label"||g[1]==="label")){var m=g.slice();return g[0]==="label"?m[0]="edgeLabel":g[1]==="label"&&(m[1]="edgeLabel"),m}return g}}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.getCategoriesData=function(){return this._categoriesData},t.prototype.formatTooltip=function(r,n,i){if(i==="edge"){var a=this.getData(),o=this.getDataParams(r,i),s=a.graph.getEdgeByIndex(r),l=a.getName(s.node1.dataIndex),u=a.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),gr("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var h=oV({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=ae(this.option.categories||[],function(i){return i.value!=null?i:Q({value:0},i)}),n=new dn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(i){return n.getItemModel(i)})},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},t.type="series.graph",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.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:K.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function Yle(e){e.registerChartView(Ule),e.registerSeriesModel($le),e.registerProcessor(kle),e.registerVisual(Lle),e.registerVisual(Nle),e.registerLayout(jle),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,Ole),e.registerLayout(Ble),e.registerCoordinateSystem("graphView",{dimensions:nc.dimensions,create:Vle}),e.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},qt),e.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},qt),e.registerAction({type:"graphRoam",event:"graphRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",query:t},function(i){var a=n.getViewOfSeriesModel(i);a&&(t.dx!=null&&t.dy!=null&&a.updateViewOnPan(i,n,t),t.zoom!=null&&t.originX!=null&&t.originY!=null&&a.updateViewOnZoom(i,n,t));var o=i.coordinateSystem,s=j_(o,t,i.get("scaleLimit"));i.setCenter&&i.setCenter(s.center),i.setZoom&&i.setZoom(s.zoom)})})}var wR=function(e){q(t,e);function t(r,n,i){var a=e.call(this)||this;De(a).dataType="node",a.z2=2;var o=new tt;return a.setTextContent(o),a.updateData(r,n,i,!0),a}return t.prototype.updateData=function(r,n,i,a){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=Q(Ba(u.getModel("itemStyle"),h,!0),h),d=this;if(isNaN(f.startAngle)){d.setShape(f);return}a?d.setShape(f):it(d,{shape:f},l,n);var g=Q(Ba(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Sr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,d),Sr(d,u,"itemStyle");var m=c.get("focus");Dt(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,i){var a=this.getTextContent(),o=i.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");a.ignore=!c.get("show");var h=Cr(n),f=i.getVisual("style");Dr(a,h,{labelFetcher:{getFormattedLabel:function(_,w,S,T,M,A){return r.getFormattedLabel(_,w,"node",T,zn(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:i.dataIndex,defaultText:i.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var d=c.get("position")||"outside",g=c.get("distance")||0,m;d==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:d!=="outside"};var y=d!=="outside"?c.get("align")||"center":l>0?"left":"right",x=d!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";a.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(Qr),Xle=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;return De(o).dataType="edge",o.updateData(r,n,i,a,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var i=.7,a=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!a),r.bezierCurveTo((n.cx-n.s2[0])*i+n.s2[0],(n.cy-n.s2[1])*i+n.s2[1],(n.cx-n.t1[0])*i+n.t1[0],(n.cy-n.t1[1])*i+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!a),r.bezierCurveTo((n.cx-n.t2[0])*i+n.t2[0],(n.cy-n.t2[1])*i+n.t2[1],(n.cx-n.s1[0])*i+n.s1[0],(n.cy-n.s1[1])*i+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,i,a,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(i),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),d=h.getModel("emphasis"),g=d.get("focus"),m=Q(Ba(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),SR(y,l,r,f)):(Oi(y),SR(y,l,r,f),it(y,{shape:m},s,i)),Dt(this,g==="adjacency"?l.getAdjacentDataIndices():g,d.get("blurScope"),d.get("disabled")),Sr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(Ke);function SR(e,t,r,n){var i=t.node1,a=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(i.dataIndex,"style").fill,u=r.getItemVisual(a.dataIndex,"style").fill;if(he(l)&&he(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,d=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new qu(h,f,d,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var qle=Math.PI/180,Kle=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*qle;if(a.diff(o).add(function(c){var h=a.getItemLayout(c);if(h){var f=new wR(a,c,l);De(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),d=a.getItemLayout(c);if(!d){f&&Do(f,r,h);return}f?f.updateData(a,c,l):f=new wR(a,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Do(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=ce(u[0],i.getWidth()),this.group.originY=ce(u[1],i.getHeight()),Nt(this.group,{scaleX:1,scaleY:1},r)}this._data=a,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var i=r.getData(),a=r.getEdgeData(),o=this._edgeData,s=this.group;a.diff(o).add(function(l){var u=new Xle(i,a,l,n);De(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,a,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Do(u,r,l)}).execute(),this._edgeData=a},t.prototype.dispose=function(){},t.type="chord",t}(gt),Jle=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links),this.legendVisualProvider=new Mf(fe(this.getData,this),fe(this.getRawData,this))},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(r.edges||r.links)},t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[];if(a&&i){var o=Ok(a,i,this,!0,s);return o.data}function s(l,u){var c=qe.prototype.getModel;function h(d,g){var m=c.call(this,d,g);return m.resolveParentPath=f,m}u.wrapMethod("getItemModel",function(d){return d.resolveParentPath=f,d.getModel=h,d});function f(d){if(d&&(d[0]==="label"||d[1]==="label")){var g=d.slice();return d[0]==="label"?g[0]="edgeLabel":d[1]==="label"&&(g[1]="edgeLabel"),g}return d}}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,i){var a=this.getDataParams(r,i);if(i==="edge"){var o=this.getData(),s=o.graph.getEdgeByIndex(r),l=o.getName(s.node1.dataIndex),u=o.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),gr("nameValue",{name:c.join(" > "),value:a.value,noValue:a.value==null})}return gr("nameValue",{name:a.name,value:a.value,noValue:a.value==null})},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var a=this.getData(),o=this.getGraph().getNodeByIndex(r);if(i.name==null&&(i.name=a.getName(r)),i.value==null){var s=o.getLayout().value;i.value=s}}return i},t.type="series.chord",t.defaultOption={z:2,coordinateSystem:"none",legendHoverLink:!0,colorBy:"data",left:0,top:0,right:0,bottom:0,width:null,height:null,center:["50%","50%"],radius:["70%","80%"],clockwise:!0,startAngle:90,endAngle:"auto",minAngle:0,padAngle:3,itemStyle:{borderRadius:[0,0,5,5]},lineStyle:{width:0,color:"source",opacity:.2},label:{show:!0,position:"outside",distance:5},emphasis:{focus:"adjacency",lineStyle:{opacity:.5}}},t}(bt),Iw=Math.PI/180;function Qle(e,t){e.eachSeriesByType("chord",function(r){eue(r,t)})}function eue(e,t){var r=e.getData(),n=r.graph,i=e.getEdgeData(),a=i.count();if(a){var o=T6(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*Iw,0),f=Math.max((e.get("minAngle")||0)*Iw,0),d=-e.get("startAngle")*Iw,g=d+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[d,g];m_(x,!m);var _=x[0],w=x[1],S=w-_,T=r.getSum("value")===0&&i.getSum("value")===0,M=[],A=0;n.eachEdge(function(z){var Z=T?1:z.getValue("value");T&&(Z>0||f)&&(A+=2);var U=z.node1.dataIndex,$=z.node2.dataIndex;M[U]=(M[U]||0)+Z,M[$]=(M[$]||0)+Z});var P=0;if(n.eachNode(function(z){var Z=z.getValue("value");isNaN(Z)||(M[z.dataIndex]=Math.max(Z,M[z.dataIndex]||0)),!T&&(M[z.dataIndex]>0||f)&&A++,P+=M[z.dataIndex]||0}),!(A===0||P===0)){h*A>=Math.abs(S)&&(h=Math.max(0,(Math.abs(S)-f*A)/A)),(h+f)*A>=Math.abs(S)&&(f=(Math.abs(S)-h*A)/A);var I=(S-h*A*y)/P,N=0,D=0,O=0;n.eachNode(function(z){var Z=M[z.dataIndex]||0,U=I*(P?Z:1)*y;Math.abs(U)D){var F=N/D;n.eachNode(function(z){var Z=z.getLayout().angle;Math.abs(Z)>=f?z.setLayout({angle:Z*F,ratio:F},!0):z.setLayout({angle:f,ratio:f===0?1:Z/f},!0)})}else n.eachNode(function(z){if(!R){var Z=z.getLayout().angle,U=Math.min(Z/O,1),$=U*N;Z-$f&&f>0){var U=R?1:Math.min(Z/O,1),$=Z-f,Y=Math.min($,Math.min(H,N*U));H-=Y,z.setLayout({angle:Z-Y,ratio:(Z-Y)/Z},!0)}else f>0&&z.setLayout({angle:f,ratio:Z===0?1:f/Z},!0)}});var W=_,V=[];n.eachNode(function(z){var Z=Math.max(z.getLayout().angle,f);z.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:W,endAngle:W+Z*y,clockwise:m},!0),V[z.dataIndex]=W,W+=(Z+h)*y}),n.eachEdge(function(z){var Z=T?1:z.getValue("value"),U=I*(P?Z:1)*y,$=z.node1.dataIndex,Y=V[$]||0,te=Math.abs((z.node1.getLayout().ratio||1)*U),ie=Y+te*y,se=[s+c*Math.cos(Y),l+c*Math.sin(Y)],le=[s+c*Math.cos(ie),l+c*Math.sin(ie)],Ee=z.node2.dataIndex,me=V[Ee]||0,ye=Math.abs((z.node2.getLayout().ratio||1)*U),Me=me+ye*y,pe=[s+c*Math.cos(me),l+c*Math.sin(me)],Te=[s+c*Math.cos(Me),l+c*Math.sin(Me)];z.setLayout({s1:se,s2:le,sStartAngle:Y,sEndAngle:ie,t1:pe,t2:Te,tStartAngle:me,tEndAngle:Me,cx:s,cy:l,r:c,value:Z,clockwise:m}),V[$]=ie,V[Ee]=Me})}}}function tue(e){e.registerChartView(Kle),e.registerSeriesModel(Jle),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,Qle),e.registerProcessor(Cf("chord"))}var rue=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),nue=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new rue},t.prototype.buildPath=function(r,n){var i=Math.cos,a=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-i(l)*s*(s>=o/3?1:2),c=n.y-a(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+i(l)*s,n.y+a(l)*s),r.lineTo(n.x+i(n.angle)*o,n.y+a(n.angle)*o),r.lineTo(n.x-i(l)*s,n.y-a(l)*s),r.lineTo(u,c)},t}(Ke);function iue(e,t){var r=e.get("center"),n=t.getWidth(),i=t.getHeight(),a=Math.min(n,i),o=ce(r[0],t.getWidth()),s=ce(r[1],t.getHeight()),l=ce(e.get("radius"),a/2);return{cx:o,cy:s,r:l}}function Um(e,t){var r=e==null?"":e+"";return t&&(he(t)?r=t.replace("{value}",r):we(t)&&(r=t(e))),r}var aue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeAll();var a=r.get(["axisLine","lineStyle","color"]),o=iue(r,i);this._renderMain(r,n,i,a,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,i,a,o){var s=this.group,l=r.get("clockwise"),u=-r.get("startAngle")/180*Math.PI,c=-r.get("endAngle")/180*Math.PI,h=r.getModel("axisLine"),f=h.get("roundCap"),d=f?ix:Qr,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];m_(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],T=0;g&&T=I&&(N===0?0:a[N-1][0])Math.PI/2&&(ie+=Math.PI)):te==="tangential"?ie=-P-Math.PI/2:rt(te)&&(ie=te*Math.PI/180),ie===0?h.add(new tt({style:Ct(w,{text:Z,x:$,y:Y,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:F<-.4?"left":F>.4?"right":"center"},{inheritColor:U}),silent:!0})):h.add(new tt({style:Ct(w,{text:Z,x:$,y:Y,verticalAlign:"middle",align:"center"},{inheritColor:U}),silent:!0,originX:$,originY:Y,rotation:ie}))}if(_.get("show")&&W!==S){var V=_.get("distance");V=V?V+c:c;for(var se=0;se<=T;se++){F=Math.cos(P),H=Math.sin(P);var le=new ar({shape:{x1:F*(g-V)+f,y1:H*(g-V)+d,x2:F*(g-A-V)+f,y2:H*(g-A-V)+d},silent:!0,style:O});O.stroke==="auto"&&le.setStyle({stroke:a((W+se/T)/S)}),h.add(le),P+=N}P-=N}else P+=I}},t.prototype._renderPointer=function(r,n,i,a,o,s,l,u,c){var h=this.group,f=this._data,d=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),T=+r.get("max"),M=[S,T],A=[s,l];function P(N,D){var O=_.getItemModel(N),R=O.getModel("pointer"),F=ce(R.get("width"),o.r),H=ce(R.get("length"),o.r),W=r.get(["pointer","icon"]),V=R.get("offsetCenter"),z=ce(V[0],o.r),Z=ce(V[1],o.r),U=R.get("keepAspect"),$;return W?$=sr(W,z-F/2,Z-H,F,H,null,U):$=new nue({shape:{angle:-Math.PI/2,width:F,r:H,x:z,y:Z}}),$.rotation=-(D+Math.PI/2),$.x=o.cx,$.y=o.cy,$}function I(N,D){var O=y.get("roundCap"),R=O?ix:Qr,F=y.get("overlap"),H=F?y.get("width"):c/_.count(),W=F?o.r-H:o.r-(N+1)*H,V=F?o.r:o.r-N*H,z=new R({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:W,r:V}});return F&&(z.z2=ht(_.get(w,N),[S,T],[100,0],!0)),z}(x||m)&&(_.diff(f).add(function(N){var D=_.get(w,N);if(m){var O=P(N,s);Nt(O,{rotation:-((isNaN(+D)?A[0]:ht(D,M,A,!0))+Math.PI/2)},r),h.add(O),_.setItemGraphicEl(N,O)}if(x){var R=I(N,s),F=y.get("clip");Nt(R,{shape:{endAngle:ht(D,M,A,F)}},r),h.add(R),KC(r.seriesIndex,_.dataType,N,R),g[N]=R}}).update(function(N,D){var O=_.get(w,N);if(m){var R=f.getItemGraphicEl(D),F=R?R.rotation:s,H=P(N,F);H.rotation=F,it(H,{rotation:-((isNaN(+O)?A[0]:ht(O,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(N,H)}if(x){var W=d[D],V=W?W.shape.endAngle:s,z=I(N,V),Z=y.get("clip");it(z,{shape:{endAngle:ht(O,M,A,Z)}},r),h.add(z),KC(r.seriesIndex,_.dataType,N,z),g[N]=z}}).execute(),_.each(function(N){var D=_.getItemModel(N),O=D.getModel("emphasis"),R=O.get("focus"),F=O.get("blurScope"),H=O.get("disabled");if(m){var W=_.getItemGraphicEl(N),V=_.getItemVisual(N,"style"),z=V.fill;if(W instanceof Er){var Z=W.style;W.useStyle(Q({image:Z.image,x:Z.x,y:Z.y,width:Z.width,height:Z.height},V))}else W.useStyle(V),W.type!=="pointer"&&W.setColor(z);W.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),W.style.fill==="auto"&&W.setStyle("fill",a(ht(_.get(w,N),M,[0,1],!0))),W.z2EmphasisLift=0,Sr(W,D),Dt(W,R,F,H)}if(x){var U=g[N];U.useStyle(_.getItemVisual(N,"style")),U.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),U.z2EmphasisLift=0,Sr(U,D),Dt(U,R,F,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var i=r.getModel("anchor"),a=i.get("show");if(a){var o=i.get("size"),s=i.get("icon"),l=i.get("offsetCenter"),u=i.get("keepAspect"),c=sr(s,n.cx-o/2+ce(l[0],n.r),n.cy-o/2+ce(l[1],n.r),o,o,null,u);c.z2=i.get("showAbove")?1:0,c.setStyle(i.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,i,a,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new Ce,d=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){d[x]=new tt({silent:!0}),g[x]=new tt({silent:!0})}).update(function(x,_){d[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new Ce,T=a(ht(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),P=o.cx+ce(A[0],o.r),I=o.cy+ce(A[1],o.r),N=d[x];N.attr({z2:y?0:2,style:Ct(M,{x:P,y:I,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:T})}),S.add(N)}var D=_.getModel("detail");if(D.get("show")){var O=D.get("offsetCenter"),R=o.cx+ce(O[0],o.r),F=o.cy+ce(O[1],o.r),H=ce(D.get("width"),o.r),W=ce(D.get("height"),o.r),V=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:T,N=g[x],z=D.get("formatter");N.attr({z2:y?0:2,style:Ct(D,{x:R,y:F,text:Um(w,z),width:isNaN(H)?null:H,height:isNaN(W)?null:W,align:"center",verticalAlign:"middle"},{inheritColor:V})}),s6(N,{normal:D},w,function(U){return Um(U,z)}),m&&l6(N,x,l,r,{getFormattedLabel:function(U,$,Y,te,ie,se){return Um(se?se.interpolatedValue:w,z)}}),S.add(N)}f.add(S)}),this.group.add(f),this._titleEls=d,this._detailEls=g},t.type="gauge",t}(gt),oue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="itemStyle",r}return t.prototype.getInitialData=function(r,n){return Tf(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,K.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:K.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:K.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:K.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:K.color.neutral00,borderWidth:0,borderColor:K.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:K.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:K.color.transparent,borderWidth:0,borderColor:K.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:K.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},t}(bt);function sue(e){e.registerChartView(aue),e.registerSeriesModel(oue)}var lue=["itemStyle","opacity"],uue=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=i,o=new Gr,s=new tt;return a.setTextContent(s),i.setTextGuideLine(o),i.updateData(r,n,!0),i}return t.prototype.updateData=function(r,n,i){var a=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(lue);c=c??1,i||Oi(a),a.useStyle(r.getItemVisual(n,"style")),a.style.lineJoin="round",i?(a.setShape({points:l.points}),a.style.opacity=0,Nt(a,{style:{opacity:c}},o,n)):it(a,{style:{opacity:c},shape:{points:l.points}},o,n),Sr(a,s),this._updateLabel(r,n),Dt(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var i=this,a=this.getTextGuideLine(),o=i.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Dr(o,Cr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var d=l.getModel("label"),g=d.get("color"),m=g==="inherit"?f:null;i.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;a.setShape({points:y}),i.textGuideLineConfig={anchor:y?new Ne(y[0][0],y[0][1]):null},it(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),ck(i,hk(l),{stroke:f})},t}(en),cue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group;a.diff(o).add(function(l){var u=new uue(a,l);a.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,l),s.add(c),a.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Do(u,r,l)}).execute(),this._data=a},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type="funnel",t}(gt),hue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Mf(fe(this.getData,this),fe(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Tf(this,{coordDimensions:["value"],encodeDefaulter:Fe(zA,this)})},t.prototype._defaultLabelLine=function(r){ju(r,"labelLine",["show"]);var n=r.labelLine,i=r.emphasis.labelLine;n.show=n.show&&r.label.show,i.show=i.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),i=e.prototype.getDataParams.call(this,r),a=n.mapDimension("value"),o=n.getSum(a);return i.percent=o?+(n.get(a,r)/o*100).toFixed(2):0,i.$vars.push("percent"),i},t.type="series.funnel",t.defaultOption={coordinateSystemUsage:"box",z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:65,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:K.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function fue(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),i=[],a=t==="ascending",o=0,s=e.count();okue)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);i.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!Ew(this,"mousemove"))){var t=this._model,r=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),n=r.behavior;n==="jump"&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand(n==="none"?null:{axisExpandWindow:r.axisExpandWindow,animation:n==="jump"?null:{duration:0}})}}};function Ew(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var Pue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(r){var n=this.option;r&&Ge(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var i=r.get("parallelIndex");return i!=null&&n.getComponent("parallel",i)===this},t.prototype.setAxisExpand=function(r){j(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(n){r.hasOwnProperty(n)&&(this.option[n]=r[n])},this)},t.prototype._initDimensions=function(){var r=this.dimensions=[],n=this.parallelAxisIndex=[],i=ot(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(a){return(a.get("parallelIndex")||0)===this.componentIndex},this);j(i,function(a){r.push("dim"+a.get("dim")),n.push(a.componentIndex)})},t.type="parallel",t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},t}($e),Iue=function(e){q(t,e);function t(r,n,i,a,o){var s=e.call(this,r,n,i)||this;return s.type=a||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Vi);function rl(e,t,r,n,i,a){e=e||0;var o=r[1]-r[0];if(i!=null&&(i=jc(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),n==="all"){var s=Math.abs(t[1]-t[0]);s=jc(s,[0,o]),i=a=jc(s,[i,a]),n=0}t[0]=jc(t[0],r),t[1]=jc(t[1],r);var l=jw(t,n);t[n]+=e;var u=i||0,c=r.slice();l.sign<0?c[0]+=u:c[1]-=u,t[n]=jc(t[n],c);var h;return h=jw(t,n),i!=null&&(h.sign!==l.sign||h.spana&&(t[1-n]=t[n]+h.sign*a),t}function jw(e,t){var r=e[t]-e[1-t];return{span:Math.abs(r),sign:r>0?-1:r<0?1:t?-1:1}}function jc(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var Rw=j,aH=Math.min,oH=Math.max,MR=Math.floor,Due=Math.ceil,AR=ir,Eue=Math.PI,jue=function(){function e(t,r,n){this.type="parallel",this._axesMap=_e(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var i=t.dimensions,a=t.parallelAxisIndex;Rw(i,function(o,s){var l=a[s],u=r.getComponent("parallelAxis",l),c=this._axesMap.set(o,new Iue(o,Xp(u),[0,0],u.get("type"),l)),h=c.type==="category";c.onBand=h&&u.get("boundaryGap"),c.inverse=u.get("inverse"),u.axis=c,c.model=u,c.coordinateSystem=u.coordinateSystem=this},this)},e.prototype.update=function(t,r){this._updateAxesFromSeries(this._model,t)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,i=r.layoutBase,a=r.pixelDimIndex,o=t[1-a],s=t[a];return o>=n&&o<=n+r.axisLength&&s>=i&&s<=i+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype._updateAxesFromSeries=function(t,r){r.eachSeries(function(n){if(t.contains(n,r)){var i=n.getData();Rw(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(i,i.mapDimension(a)),Gu(o.scale,o.model)},this)}},this)},e.prototype.resize=function(t,r){var n=Tr(t,r).refContainer;this._rect=It(t.getBoxLayoutParams(),n),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var t=this._model,r=this._rect,n=["x","y"],i=["width","height"],a=t.get("layout"),o=a==="horizontal"?0:1,s=r[i[o]],l=[0,s],u=this.dimensions.length,c=Zm(t.get("axisExpandWidth"),l),h=Zm(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,d=t.get("axisExpandWindow"),g;if(d)g=Zm(d[1]-d[0],l),d[1]=d[0]+g;else{g=Zm(c*(h-1),l);var m=t.get("axisExpandCenter")||MR(u/2);d=[c*m-g/2],d[1]=d[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[MR(AR(d[0]/c,1))+1,Due(AR(d[1]/c,1))-1],_=y/c*d[0];return{layout:a,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[i[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:d,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,i=this._makeLayoutInfo(),a=i.layout;r.each(function(o){var s=[0,i.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),Rw(n,function(o,s){var l=(i.axisExpandable?Oue:Rue)(s,i),u={horizontal:{x:l.position,y:i.axisLength},vertical:{x:0,y:l.position}},c={horizontal:Eue/2,vertical:0},h=[u[a].x+t.x,u[a].y+t.y],f=c[a],d=Pr();Ko(d,d,f),ha(d,d,h),this._axesLayout[o]={position:h,rotation:f,transform:d,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(t){return this._axesMap.get(t)},e.prototype.dataToPoint=function(t,r){return this.axisCoordToPoint(this._axesMap.get(r).dataToCoord(t),r)},e.prototype.eachActiveState=function(t,r,n,i){n==null&&(n=0),i==null&&(i=t.count());var a=this._axesMap,o=this.dimensions,s=[],l=[];j(o,function(y){s.push(t.mapDimension(y)),l.push(a.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ca*(1-h[0])?(u="jump",l=s-a*(1-h[2])):(l=s-a*h[1])>=0&&(l=s-a*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?rl(l,i,o,"all"):u="none";else{var d=i[1]-i[0],g=o[1]*s/d;i=[oH(0,g-d/2)],i[1]=aH(o[1],i[0]+d),i[0]=i[1]-d}return{axisExpandWindow:i,behavior:u}},e}();function Zm(e,t){return aH(oH(e,t[0]),t[1])}function Rue(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Oue(e,t){var r=t.layoutLength,n=t.axisExpandWidth,i=t.axisCount,a=t.axisCollapseWidth,o=t.winInnerIndices,s,l=a,u=!1,c;return e=0;i--)Qn(n[i])},t.prototype.getActiveState=function(r){var n=this.activeIntervals;if(!n.length)return"normal";if(r==null||isNaN(+r))return"inactive";if(n.length===1){var i=n[0];if(i[0]<=r&&r<=i[1])return"active"}else for(var a=0,o=n.length;aGue}function fH(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function dH(e,t,r,n){var i=new Ce;return i.add(new Ze({name:"main",style:Gk(r),silent:!0,draggable:!0,cursor:"move",drift:Fe(NR,e,t,i,["n","s","w","e"]),ondragend:Fe(Hu,t,{isEnd:!0})})),j(n,function(a){i.add(new Ze({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Fe(NR,e,t,i,a),ondragend:Fe(Hu,t,{isEnd:!0})}))}),i}function vH(e,t,r,n){var i=n.brushStyle.lineWidth||0,a=Yh(i,Wue),o=r[0][0],s=r[1][0],l=o-i/2,u=s-i/2,c=r[0][1],h=r[1][1],f=c-a+i/2,d=h-a+i/2,g=c-o,m=h-s,y=g+i,x=m+i;mo(e,t,"main",o,s,g,m),n.transformable&&(mo(e,t,"w",l,u,a,x),mo(e,t,"e",f,u,a,x),mo(e,t,"n",l,u,y,a),mo(e,t,"s",l,d,y,a),mo(e,t,"nw",l,u,a,a),mo(e,t,"ne",f,u,a,a),mo(e,t,"sw",l,d,a,a),mo(e,t,"se",f,d,a,a))}function i2(e,t){var r=t.__brushOption,n=r.transformable,i=t.childAt(0);i.useStyle(Gk(r)),i.attr({silent:!n,cursor:n?"move":"default"}),j([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(a){var o=t.childOfName(a.join("")),s=a.length===1?a2(e,a[0]):Xue(e,a);o&&o.attr({silent:!n,invisible:!n,cursor:n?Uue[s]+"-resize":null})})}function mo(e,t,r,n,i,a,o){var s=t.childOfName(r);s&&s.setShape(Kue(Wk(e,t,[[n,i],[n+a,i+o]])))}function Gk(e){return Ae({strokeNoScale:!0},e.brushStyle)}function pH(e,t,r,n){var i=[wp(e,r),wp(t,n)],a=[Yh(e,r),Yh(t,n)];return[[i[0],a[0]],[i[1],a[1]]]}function Yue(e){return Us(e.group)}function a2(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},i=b_(r[t],Yue(e));return n[i]}function Xue(e,t){var r=[a2(e,t[0]),a2(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function NR(e,t,r,n,i,a){var o=r.__brushOption,s=e.toRectRange(o.range),l=gH(t,i,a);j(n,function(u){var c=Hue[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(pH(s[0][0],s[1][0],s[0][1],s[1][1])),Bk(t,r),Hu(t,{isEnd:!1})}function que(e,t,r,n){var i=t.__brushOption.range,a=gH(e,r,n);j(i,function(o){o[0]+=a[0],o[1]+=a[1]}),Bk(e,t),Hu(e,{isEnd:!1})}function gH(e,t,r){var n=e.group,i=n.transformCoordToLocal(t,r),a=n.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function Wk(e,t,r){var n=hH(e,t);return n&&n!==Wu?n.clipPath(r,e._transform):Se(r)}function Kue(e){var t=wp(e[0][0],e[1][0]),r=wp(e[0][1],e[1][1]),n=Yh(e[0][0],e[1][0]),i=Yh(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:i-r}}function Jue(e,t,r){if(!(!e._brushType||ece(e,t.offsetX,t.offsetY))){var n=e._zr,i=e._covers,a=Vk(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var B_={lineX:DR(0),lineY:DR(1),rect:{createCover:function(e,t){function r(n){return n}return dH({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=fH(e);return pH(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){vH(e,t,r,n)},updateCommon:i2,contain:s2},polygon:{createCover:function(e,t){var r=new Ce;return r.add(new Gr({name:"main",style:Gk(t),silent:!0})),r},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new en({name:"main",draggable:!0,drift:Fe(que,e,t),ondragend:Fe(Hu,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:Wk(e,t,r)})},updateCommon:i2,contain:s2}};function DR(e){return{createCover:function(t,r){return dH({toRectRange:function(n){var i=[n,[0,100]];return e&&i.reverse(),i},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=fH(t),n=wp(r[0][e],r[1][e]),i=Yh(r[0][e],r[1][e]);return[n,i]},updateCoverShape:function(t,r,n,i){var a,o=hH(t,r);if(o!==Wu&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,a];e&&l.reverse(),vH(t,r,l,i)},updateCommon:i2,contain:s2}}function yH(e){return e=Hk(e),function(t){return xA(t,e)}}function xH(e,t){return e=Hk(e),function(r){var n=t??r,i=n?e.width:e.height,a=n?e.x:e.y;return[a,a+(i||0)]}}function _H(e,t,r){var n=Hk(e);return function(i,a){return n.contain(a[0],a[1])&&!TW(i,t,r)}}function Hk(e){return Pe.create(e)}var tce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){e.prototype.init.apply(this,arguments),(this._brushController=new zk(n.getZr())).on("brush",fe(this._onBrush,this))},t.prototype.render=function(r,n,i,a){if(!rce(r,n,a)){this.axisModel=r,this.api=i,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ce,this.group.add(this._axisGroup),!!r.get("show")){var s=ice(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),d=Q({strokeContainThreshold:c},f),g=new wn(r,i,d);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(d,u,r,s,c,i),Up(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,i,a,o,s){var l=i.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=Pe.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:r.rotation,x:r.position[0],y:r.position[1]}).setPanels([{panelId:"pl",clipPath:yH(h),isTargetByCursor:_H(h,s,a),getLinearBrushOtherExtent:xH(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(nce(i))},t.prototype._onBrush=function(r){var n=r.areas,i=this.axisModel,a=i.axis,o=ae(n,function(s){return[a.coordToData(s.range[0],!0),a.coordToData(s.range[1],!0)]});(!i.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:i.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Mt);function rce(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function nce(e){var t=e.axis;return ae(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function ice(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var ace={type:"axisAreaSelect",event:"axisAreaSelected"};function oce(e){e.registerAction(ace,function(t,r){r.eachComponent({mainType:"parallelAxis",query:t},function(n){n.axis.model.setActiveIntervals(t.intervals)})}),e.registerAction("parallelAxisExpand",function(t,r){r.eachComponent({mainType:"parallel",query:t},function(n){n.setAxisExpand(t)})})}var sce={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function bH(e){e.registerComponentView(Lue),e.registerComponentModel(Pue),e.registerCoordinateSystem("parallel",Bue),e.registerPreprocessor(Tue),e.registerComponentModel(r2),e.registerComponentView(tce),Zh(e,"parallel",r2,sce),oce(e)}function lce(e){He(bH),e.registerChartView(mue),e.registerSeriesModel(_ue),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Cue)}var uce=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),cce=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new uce},t.prototype.buildPath=function(r,n){var i=n.extent;r.moveTo(n.x1,n.y1),r.bezierCurveTo(n.cpx1,n.cpy1,n.cpx2,n.cpy2,n.x2,n.y2),n.orient==="vertical"?(r.lineTo(n.x2+i,n.y2),r.bezierCurveTo(n.cpx2+i,n.cpy2,n.cpx1+i,n.cpy1,n.x1+i,n.y1)):(r.lineTo(n.x2,n.y2+i),r.bezierCurveTo(n.cpx2,n.cpy2+i,n.cpx1,n.cpy1+i,n.x1,n.y1+i)),r.closePath()},t.prototype.highlight=function(){Ho(this)},t.prototype.downplay=function(){Uo(this)},t}(Ke),hce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._mainGroup=new Ce,r._focusAdjacencyDisabled=!1,r}return t.prototype.init=function(r,n){this._controller=new rc(n.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},t.prototype.render=function(r,n,i){var a=this,o=r.getGraph(),s=this._mainGroup,l=r.layoutInfo,u=l.width,c=l.height,h=r.getData(),f=r.getData("edge"),d=r.get("orient");this._model=r,s.removeAll(),s.x=l.x,s.y=l.y,this._updateViewCoordSys(r,i),MW(r,i,s,this._controller,this._controllerHost,null),o.eachEdge(function(g){var m=new cce,y=De(m);y.dataIndex=g.dataIndex,y.seriesIndex=r.seriesIndex,y.dataType="edge";var x=g.getModel(),_=x.getModel("lineStyle"),w=_.get("curveness"),S=g.node1.getLayout(),T=g.node1.getModel(),M=T.get("localX"),A=T.get("localY"),P=g.node2.getLayout(),I=g.node2.getModel(),N=I.get("localX"),D=I.get("localY"),O=g.getLayout(),R,F,H,W,V,z,Z,U;m.shape.extent=Math.max(1,O.dy),m.shape.orient=d,d==="vertical"?(R=(M!=null?M*u:S.x)+O.sy,F=(A!=null?A*c:S.y)+S.dy,H=(N!=null?N*u:P.x)+O.ty,W=D!=null?D*c:P.y,V=R,z=F*(1-w)+W*w,Z=H,U=F*w+W*(1-w)):(R=(M!=null?M*u:S.x)+S.dx,F=(A!=null?A*c:S.y)+O.sy,H=N!=null?N*u:P.x,W=(D!=null?D*c:P.y)+O.ty,V=R*(1-w)+H*w,z=F,Z=R*w+H*(1-w),U=W),m.setShape({x1:R,y1:F,x2:H,y2:W,cpx1:V,cpy1:z,cpx2:Z,cpy2:U}),m.useStyle(_.getItemStyle()),ER(m.style,d,g);var $=""+x.get("value"),Y=Cr(x,"edgeLabel");Dr(m,Y,{labelFetcher:{getFormattedLabel:function(se,le,Ee,me,ye,Me){return r.getFormattedLabel(se,le,"edge",me,zn(ye,Y.normal&&Y.normal.get("formatter"),$),Me)}},labelDataIndex:g.dataIndex,defaultText:$}),m.setTextConfig({position:"inside"});var te=x.getModel("emphasis");Sr(m,x,"lineStyle",function(se){var le=se.getItemStyle();return ER(le,d,g),le}),s.add(m),f.setItemGraphicEl(g.dataIndex,m);var ie=te.get("focus");Dt(m,ie==="adjacency"?g.getAdjacentDataIndices():ie==="trajectory"?g.getTrajectoryDataIndices():ie,te.get("blurScope"),te.get("disabled"))}),o.eachNode(function(g){var m=g.getLayout(),y=g.getModel(),x=y.get("localX"),_=y.get("localY"),w=y.getModel("emphasis"),S=y.get(["itemStyle","borderRadius"])||0,T=new Ze({shape:{x:x!=null?x*u:m.x,y:_!=null?_*c:m.y,width:m.dx,height:m.dy,r:S},style:y.getModel("itemStyle").getItemStyle(),z2:10});Dr(T,Cr(y),{labelFetcher:{getFormattedLabel:function(A,P){return r.getFormattedLabel(A,P,"node")}},labelDataIndex:g.dataIndex,defaultText:g.id}),T.disableLabelAnimation=!0,T.setStyle("fill",g.getVisual("color")),T.setStyle("decal",g.getVisual("style").decal),Sr(T,y),s.add(T),h.setItemGraphicEl(g.dataIndex,T),De(T).dataType="node";var M=w.get("focus");Dt(T,M==="adjacency"?g.getAdjacentDataIndices():M==="trajectory"?g.getTrajectoryDataIndices():M,w.get("blurScope"),w.get("disabled"))}),h.eachItemGraphicEl(function(g,m){var y=h.getItemModel(m);y.get("draggable")&&(g.drift=function(x,_){a._focusAdjacencyDisabled=!0,this.shape.x+=x,this.shape.y+=_,this.dirty(),i.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:h.getRawIndex(m),localX:this.shape.x/u,localY:this.shape.y/c})},g.ondragend=function(){a._focusAdjacencyDisabled=!1},g.draggable=!0,g.cursor="move")}),!this._data&&r.isAnimationEnabled()&&s.setClipPath(fce(s.getBoundingRect(),r,function(){s.removeClipPath()})),this._data=r.getData()},t.prototype.dispose=function(){this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._updateViewCoordSys=function(r,n){var i=r.layoutInfo,a=i.width,o=i.height,s=r.coordinateSystem=new nc(null,{api:n,ecModel:r.ecModel});s.zoomLimit=r.get("scaleLimit"),s.setBoundingRect(0,0,a,o),s.setCenter(r.get("center")),s.setZoom(r.get("zoom")),this._controllerHost.target.attr({x:s.x,y:s.y,scaleX:s.scaleX,scaleY:s.scaleY})},t.type="sankey",t}(gt);function ER(e,t,r){switch(e.fill){case"source":e.fill=r.node1.getVisual("color"),e.decal=r.node1.getVisual("style").decal;break;case"target":e.fill=r.node2.getVisual("color"),e.decal=r.node2.getVisual("style").decal;break;case"gradient":var n=r.node1.getVisual("color"),i=r.node2.getVisual("color");he(n)&&he(i)&&(e.fill=new qu(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:i,offset:1}]))}}function fce(e,t,r){var n=new Ze({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Nt(n,{shape:{width:e.width+20}},t,r),n}var dce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new qe(o[l],this,n));var u=Ok(a,i,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(d.parentModel=_)}return d}),f.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(d.parentModel=w)}return d})}},t.prototype.setNodePosition=function(r,n){var i=this.option.data||this.option.nodes,a=i[r];a.localX=n[0],a.localY=n[1]},t.prototype.setCenter=function(r){this.option.center=r},t.prototype.setZoom=function(r){this.option.zoom=r},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,i){function a(d){return isNaN(d)||d==null}if(i==="edge"){var o=this.getDataParams(r,i),s=o.data,l=o.value,u=s.source+" -- "+s.target;return gr("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,i).data.name;return gr("nameValue",{name:f!=null?f+"":null,value:h,noValue:a(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(i.value==null&&n==="node"){var a=this.getGraph().getNodeByIndex(r),o=a.getLayout().value;i.value=o}return i},t.type="series.sankey",t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:K.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:K.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(bt);function vce(e,t){e.eachSeriesByType("sankey",function(r){var n=r.get("nodeWidth"),i=r.get("nodeGap"),a=Tr(r,t).refContainer,o=It(r.getBoxLayoutParams(),a);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;gce(c);var f=ot(c,function(y){return y.getLayout().value===0}),d=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");pce(c,h,n,i,s,l,d,g,m)})}function pce(e,t,r,n,i,a,o,s,l){mce(e,t,r,i,a,s,l),bce(e,t,a,i,n,o,s),Nce(e,s)}function gce(e){j(e,function(t){var r=Ys(t.outEdges,fx),n=Ys(t.inEdges,fx),i=t.getValue()||0,a=Math.max(r,n,i);t.setLayout({value:a},!0)})}function mce(e,t,r,n,i,a,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;x&&y.depth>d&&(d=y.depth),m.setLayout({depth:x?y.depth:h},!0),a==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?d:h-1;o&&o!=="left"&&yce(e,o,a,A);var P=a==="vertical"?(i-r)/A:(n-r)/A;_ce(e,P,a)}function wH(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function yce(e,t,r,n){if(t==="right"){for(var i=[],a=e,o=0;a.length;){for(var s=0;s0;a--)l*=.99,Cce(s,l,o),Ow(s,i,r,n,o),Lce(s,l,o),Ow(s,i,r,n,o)}function wce(e,t){var r=[],n=t==="vertical"?"y":"x",i=ZC(e,function(a){return a.getLayout()[n]});return i.keys.sort(function(a,o){return a-o}),j(i.keys,function(a){r.push(i.buckets.get(a))}),r}function Sce(e,t,r,n,i,a){var o=1/0;j(e,function(s){var l=s.length,u=0;j(s,function(h){u+=h.getLayout().value});var c=a==="vertical"?(n-(l-1)*i)/u:(r-(l-1)*i)/u;c0&&(s=l.getLayout()[a]+u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[f]+t;var g=i==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var d=h-2;d>=0;--d)l=o[d],u=l.getLayout()[a]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]}})}function Cce(e,t,r){j(e.slice().reverse(),function(n){j(n,function(i){if(i.outEdges.length){var a=Ys(i.outEdges,Tce,r)/Ys(i.outEdges,fx);if(isNaN(a)){var o=i.outEdges.length;a=o?Ys(i.outEdges,Mce,r)/o:0}if(r==="vertical"){var s=i.getLayout().x+(a-nl(i,r))*t;i.setLayout({x:s},!0)}else{var l=i.getLayout().y+(a-nl(i,r))*t;i.setLayout({y:l},!0)}}})})}function Tce(e,t){return nl(e.node2,t)*e.getValue()}function Mce(e,t){return nl(e.node2,t)}function Ace(e,t){return nl(e.node1,t)*e.getValue()}function kce(e,t){return nl(e.node1,t)}function nl(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function fx(e){return e.getValue()}function Ys(e,t,r){for(var n=0,i=e.length,a=-1;++ao&&(o=l)}),j(n,function(s){var l=new Ir({type:"color",mappingMethod:"linear",dataExtent:[a,o],visual:t.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}i.length&&j(i,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Ice(e){e.registerChartView(hce),e.registerSeriesModel(dce),e.registerLayout(vce),e.registerVisual(Pce),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:"series",subType:"sankey",query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),e.registerAction({type:"sankeyRoam",event:"sankeyRoam",update:"none"},function(t,r,n){r.eachComponent({mainType:"series",subType:"sankey",query:t},function(i){var a=i.coordinateSystem,o=j_(a,t,i.get("scaleLimit"));i.setCenter(o.center),i.setZoom(o.zoom)})})}var SH=function(){function e(){}return e.prototype._hasEncodeRule=function(t){var r=this.getEncode();return r&&r.get(t)!=null},e.prototype.getInitialData=function(t,r){var n,i=r.getComponent("xAxis",this.get("xAxisIndex")),a=r.getComponent("yAxis",this.get("yAxisIndex")),o=i.get("type"),s=a.get("type"),l;o==="category"?(t.layout="horizontal",n=i.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"?(t.layout="vertical",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("y")):t.layout=t.layout||"horizontal";var u=["x","y"],c=t.layout==="horizontal"?0:1,h=this._baseAxisDim=u[c],f=u[1-c],d=[i,a],g=d[c].get("type"),m=d[1-c].get("type"),y=t.data;if(y&&l){var x=[];j(y,function(S,T){var M;re(S)?(M=S.slice(),S.unshift(T)):re(S.value)?(M=Q({},S),M.value=M.value.slice(),S.value.unshift(T)):M=S,x.push(M)}),t.data=x}var _=this.defaultValueDimensions,w=[{name:h,type:X0(g),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:f,type:X0(m),dimsDef:_.slice()}];return Tf(this,{coordDimensions:w,dimensionsCount:_.length+1,encodeDefaulter:Fe(D6,w,this)})},e.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},e}(),CH=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],r.visualDrawType="stroke",r}return t.type="series.boxplot",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:K.color.neutral00,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:K.color.shadow}},animationDuration:800},t}(bt);Qt(CH,SH,!0);var Dce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this.group,s=this._data;this._data||o.removeAll();var l=r.get("layout")==="horizontal"?1:0;a.diff(s).add(function(u){if(a.hasValue(u)){var c=a.getItemLayout(u),h=jR(c,a,u,l,!0);a.setItemGraphicEl(u,h),o.add(h)}}).update(function(u,c){var h=s.getItemGraphicEl(c);if(!a.hasValue(u)){o.remove(h);return}var f=a.getItemLayout(u);h?(Oi(h),TH(f,h,a,u)):h=jR(f,a,u,l),o.add(h),a.setItemGraphicEl(u,h)}).remove(function(u){var c=s.getItemGraphicEl(u);c&&o.remove(c)}).execute(),this._data=a},t.prototype.remove=function(r){var n=this.group,i=this._data;this._data=null,i&&i.eachItemGraphicEl(function(a){a&&n.remove(a)})},t.type="boxplot",t}(gt),Ece=function(){function e(){}return e}(),jce=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="boxplotBoxPath",n}return t.prototype.getDefaultShape=function(){return new Ece},t.prototype.buildPath=function(r,n){var i=n.points,a=0;for(r.moveTo(i[a][0],i[a][1]),a++;a<4;a++)r.lineTo(i[a][0],i[a][1]);for(r.closePath();am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var Gce={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==Wr){var n="";ft(n)}var i=Vce(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:i.boxData},{data:i.outliers}]}};function Wce(e){e.registerSeriesModel(CH),e.registerChartView(Dce),e.registerLayout(Oce),e.registerTransform(Gce)}var Hce=["itemStyle","borderColor"],Uce=["itemStyle","borderColor0"],Zce=["itemStyle","borderColorDoji"],$ce=["itemStyle","color"],Yce=["itemStyle","color0"];function Uk(e,t){return t.get(e>0?$ce:Yce)}function Zk(e,t){return t.get(e===0?Zce:e>0?Hce:Uce)}var Xce={seriesType:"candlestick",plan:yf(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,i){for(var a;(a=n.next())!=null;){var o=i.getItemModel(a),s=i.getItemLayout(a).sign,l=o.getItemStyle();l.fill=Uk(s,o),l.stroke=Zk(s,o)||l.fill;var u=i.ensureUniqueItemVisual(a,"style");Q(u,l)}}}}}},qce=["color","borderColor"],Kce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,i){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,i,a){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){hl(this._progressiveEls||this.group,r)},t.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},t.prototype._renderNormal=function(r){var n=r.getData(),i=this._data,a=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea();this._data||a.removeAll(),n.diff(i).add(function(c){if(n.hasValue(c)){var h=n.getItemLayout(c);if(s&&RR(u,h))return;var f=zw(h,c,!0);Nt(f,{shape:{points:h.ends}},r,c),Bw(f,n,c,o),a.add(f),n.setItemGraphicEl(c,f)}}).update(function(c,h){var f=i.getItemGraphicEl(h);if(!n.hasValue(c)){a.remove(f);return}var d=n.getItemLayout(c);if(s&&RR(u,d)){a.remove(f);return}f?(it(f,{shape:{points:d.ends}},r,c),Oi(f)):f=zw(d),Bw(f,n,c,o),a.add(f),n.setItemGraphicEl(c,f)}).remove(function(c){var h=i.getItemGraphicEl(c);h&&a.remove(h)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),OR(r,this.group);var n=r.get("clip",!0)?Jp(r.coordinateSystem,!1,r):null;n?this.group.setClipPath(n):this.group.removeClipPath()},t.prototype._incrementalRenderNormal=function(r,n){for(var i=n.getData(),a=i.getLayout("isSimpleBox"),o;(o=r.next())!=null;){var s=i.getItemLayout(o),l=zw(s);Bw(l,i,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},t.prototype._incrementalRenderLarge=function(r,n){OR(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),this._data=null},t.type="candlestick",t}(gt),Jce=function(){function e(){}return e}(),Qce=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new Jce},t.prototype.buildPath=function(r,n){var i=n.points;this.__simpleBox?(r.moveTo(i[4][0],i[4][1]),r.lineTo(i[6][0],i[6][1])):(r.moveTo(i[0][0],i[0][1]),r.lineTo(i[1][0],i[1][1]),r.lineTo(i[2][0],i[2][1]),r.lineTo(i[3][0],i[3][1]),r.closePath(),r.moveTo(i[4][0],i[4][1]),r.lineTo(i[5][0],i[5][1]),r.moveTo(i[6][0],i[6][1]),r.lineTo(i[7][0],i[7][1]))},t}(Ke);function zw(e,t,r){var n=e.ends;return new Qce({shape:{points:r?ehe(n,e):n},z2:100})}function RR(e,t){for(var r=!0,n=0;nT?D[a]:N[a],ends:F,brushRect:Z(M,A,w)})}function V($,Y){var te=[];return te[i]=Y,te[a]=$,isNaN(Y)||isNaN($)?[NaN,NaN]:t.dataToPoint(te)}function z($,Y,te){var ie=Y.slice(),se=Y.slice();ie[i]=Py(ie[i]+n/2,1,!1),se[i]=Py(se[i]-n/2,1,!0),te?$.push(ie,se):$.push(se,ie)}function Z($,Y,te){var ie=V($,te),se=V(Y,te);return ie[i]-=n/2,se[i]-=n/2,{x:ie[0],y:ie[1],width:n,height:se[1]-ie[1]}}function U($){return $[i]=Py($[i],1),$}}function g(m,y){for(var x=Oa(m.count*4),_=0,w,S=[],T=[],M,A=y.getStore(),P=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var I=A.get(s,M),N=A.get(u,M),D=A.get(c,M),O=A.get(h,M),R=A.get(f,M);if(isNaN(I)||isNaN(O)||isNaN(R)){x[_++]=NaN,_+=3;continue}x[_++]=zR(A,M,N,D,c,P),S[i]=I,S[a]=O,w=t.dataToPoint(S,null,T),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[a]=R,w=t.dataToPoint(S,null,T),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function zR(e,t,r,n,i,a){var o;return r>n?o=-1:r0?e.get(i,t-1)<=n?1:-1:1,o}function ihe(e,t){var r=e.getBaseAxis(),n,i=r.type==="category"?r.getBandWidth():(n=r.getExtent(),Math.abs(n[1]-n[0])/t.count()),a=ce(be(e.get("barMaxWidth"),i),i),o=ce(be(e.get("barMinWidth"),1),i),s=e.get("barWidth");return s!=null?ce(s,i):Math.max(Math.min(i/2,a),o)}function ahe(e){e.registerChartView(Kce),e.registerSeriesModel(MH),e.registerPreprocessor(rhe),e.registerVisual(Xce),e.registerLayout(nhe)}function BR(e,t){var r=t.rippleEffectColor||t.color;e.eachChild(function(n){n.attr({z:t.z,zlevel:t.zlevel,style:{stroke:t.brushType==="stroke"?r:null,fill:t.brushType==="fill"?r:null}})})}var ohe=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=new qp(r,n),o=new Ce;return i.add(a),i.add(o),i.updateData(r,n),i}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,i=r.color,a=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var f=void 0;we(h)?f=h(i):f=h,a.__t>0&&(f=-s*a.__t),this._animateSymbol(a,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,i,a,o){if(n>0){r.__t=0;var s=this,l=r.animate("",a).when(o?n*2:n,{__t:o?2:1}).delay(i).during(function(){s._updateSymbolPosition(r)});a||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return To(r.__p1,r.__cp1)+To(r.__cp1,r.__p2)},t.prototype._updateAnimationPoints=function(r,n){r.__p1=n[0],r.__p2=n[1],r.__cp1=n[2]||[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]},t.prototype.updateData=function(r,n,i){this.childAt(0).updateData(r,n,i),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,i=r.__p2,a=r.__cp1,o=r.__t<1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=Br,c=NC;s[0]=u(n[0],a[0],i[0],o),s[1]=u(n[1],a[1],i[1],o);var h=r.__t<1?c(n[0],a[0],i[0],o):c(i[0],a[0],n[0],1-o),f=r.__t<1?c(n[1],a[1],i[1],o):c(i[1],a[1],n[1],1-o);r.rotation=-Math.atan2(f,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(r.__lastT!==void 0&&r.__lastT=0&&!(a[l]<=n);l--);l=Math.min(l,o-2)}else{for(l=s;ln);l++);l=Math.min(l-1,o-2)}var c=(n-a[l])/(a[l+1]-a[l]),h=i[l],f=i[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var d=r.__t<1?f[0]-h[0]:h[0]-f[0],g=r.__t<1?f[1]-h[1]:h[1]-f[1];r.rotation=-Math.atan2(g,d)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(AH),hhe=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),fhe=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new hhe},t.prototype.buildPath=function(r,n){var i=n.segs,a=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(i[o++],i[o++]);for(var l=1;l0){var d=(u+h)/2-(c-f)*a,g=(c+f)/2-(h-u)*a;r.quadraticCurveTo(d,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var i=this.shape,a=i.segs,o=i.curveness,s=this.style.lineWidth;if(i.polyline)for(var l=0,u=0;u0)for(var h=a[u++],f=a[u++],d=1;d0){var y=(h+g)/2-(f-m)*o,x=(f+m)/2-(g-h)*o;if(kF(h,f,y,x,g,m,s,r,n))return l}else if(ms(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect();if(r=i[0],n=i[1],a.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,i=n.segs,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+t.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),LH={seriesType:"lines",plan:yf(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(i,a){var o=[];if(n){var s=void 0,l=i.end-i.start;if(r){for(var u=0,c=i.start;c0&&(c||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(a);var h=r.get("clip",!0)&&Jp(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,i){var a=r.getData(),o=this._updateLineDraw(a,r);o.incrementalPrepareUpdate(a),this._clearLayer(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,i){this._lineDraw.incrementalUpdate(r,n.getData()),this._finished=r.end===n.getData().count()},t.prototype.eachRendered=function(r){this._lineDraw&&this._lineDraw.eachRendered(r)},t.prototype.updateTransform=function(r,n,i){var a=r.getData(),o=r.pipelineContext;if(!this._finished||o.large||o.progressiveRender)return{update:!0};var s=LH.reset(r,n,i);s.progress&&s.progress({start:0,end:a.count(),count:a.count()},a),this._lineDraw.updateLayout(),this._clearLayer(i)},t.prototype._updateLineDraw=function(r,n){var i=this._lineDraw,a=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!i||a!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(i&&i.remove(),i=this._lineDraw=l?new dhe:new Rk(o?a?che:kH:a?AH:jk),this._hasEffet=a,this._isPolyline=o,this._isLargeDraw=l),this.group.add(i.group),i},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=r.getZr(),i=n.painter.getType()==="svg";!i&&this._lastZlevel!=null&&n.painter.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(r,n){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(n)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.type="lines",t}(gt),phe=typeof Uint32Array>"u"?Array:Uint32Array,ghe=typeof Float64Array>"u"?Array:Float64Array;function FR(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=ae(t,function(r){var n=[r[0].coord,r[1].coord],i={coords:n};return r[0].name&&(i.fromName=r[0].name),r[1].name&&(i.toName=r[1].name),a_([i,r[0],r[1]])}))}var mhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="lineStyle",r.visualDrawType="stroke",r}return t.prototype.init=function(r){r.data=r.data||[],FR(r);var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(r){if(FR(r),r.data){var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(r){var n=this._processFlatCoordsArray(r.data);n.flatCoords&&(this._flatCoords?(this._flatCoords=Eh(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Eh(this._flatCoordsOffset,n.flatCoordsOffset)):(this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset),r.data=new Float32Array(n.count)),this.getRawData().appendData(r.data)},t.prototype._getCoordsFromItemModel=function(r){var n=this.getData().getItemModel(r),i=n.option instanceof Array?n.option:n.getShallow("coords");return i},t.prototype.getLineCoordsCount=function(r){return this._flatCoordsOffset?this._flatCoordsOffset[r*2+1]:this._getCoordsFromItemModel(r).length},t.prototype.getLineCoords=function(r,n){if(this._flatCoordsOffset){for(var i=this._flatCoordsOffset[r*2],a=this._flatCoordsOffset[r*2+1],o=0;o ")})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?1e4:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?2e4:this.get("progressiveThreshold"))},t.prototype.getZLevelKey=function(){var r=this.getModel("effect"),n=r.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:r.get("show")&&n>0?n+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.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}},t}(bt);function $m(e){return e instanceof Array||(e=[e,e]),e}var yhe={seriesType:"lines",reset:function(e){var t=$m(e.get("symbol")),r=$m(e.get("symbolSize")),n=e.getData();n.setVisual("fromSymbol",t&&t[0]),n.setVisual("toSymbol",t&&t[1]),n.setVisual("fromSymbolSize",r&&r[0]),n.setVisual("toSymbolSize",r&&r[1]);function i(a,o){var s=a.getItemModel(o),l=$m(s.getShallow("symbol",!0)),u=$m(s.getShallow("symbolSize",!0));l[0]&&a.setItemVisual(o,"fromSymbol",l[0]),l[1]&&a.setItemVisual(o,"toSymbol",l[1]),u[0]&&a.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&a.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?i:null}}};function xhe(e){e.registerChartView(vhe),e.registerSeriesModel(mhe),e.registerLayout(LH),e.registerVisual(yhe)}var _he=256,bhe=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=Bn.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,i,a,o){var s=this._getBrush(),l=this._getGradient(a,"inRange"),u=this._getGradient(a,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),d=t.length;h.width=r,h.height=n;for(var g=0;g0){var O=o(w)?l:u;w>0&&(w=w*N+P),T[M++]=O[D],T[M++]=O[D+1],T[M++]=O[D+2],T[M++]=O[D+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=Bn.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var i=t.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor=K.color.neutral99,i.beginPath(),i.arc(-r,r,this.pointSize,0,Math.PI*2,!0),i.closePath(),i.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,i=n[r]||(n[r]=new Uint8ClampedArray(256*4)),a=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,a),i[o++]=a[0],i[o++]=a[1],i[o++]=a[2],i[o++]=a[3];return i},e}();function whe(e,t,r){var n=e[1]-e[0];t=ae(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var i=t.length,a=0;return function(o){var s;for(s=a;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}function VR(e){var t=e.dimensions;return t[0]==="lng"&&t[1]==="lat"}var Che=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(a=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,i,0,r.getData().count()):VR(o)&&this._renderOnGeo(o,r,a,i)},t.prototype.incrementalPrepareRender=function(r,n,i){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,i,a){var o=n.coordinateSystem;o&&(VR(o)?this.render(n,i,a):(this._progressiveEls=[],this._renderOnGridLike(n,a,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){hl(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,i,a,o){var s=r.coordinateSystem,l=tl(s,"cartesian2d"),u=tl(s,"matrix"),c,h,f,d;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=g.getBandWidth()+.5,h=m.getBandWidth()+.5,f=g.scale.getExtent(),d=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),T=r.get(["itemStyle","borderRadius"]),M=Cr(r),A=r.getModel("emphasis"),P=A.get("focus"),I=A.get("blurScope"),N=A.get("disabled"),D=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],O=i;Of[1]||Wd[1])continue;var V=s.dataToPoint([H,W]);R=new Ze({shape:{x:V[0]-c/2,y:V[1]-h/2,width:c,height:h},style:F})}else if(u){var z=s.dataToLayout([x.get(D[0],O),x.get(D[1],O)]).rect;if(Xr(z.x))continue;R=new Ze({z2:1,shape:z,style:F})}else{if(isNaN(x.get(D[1],O)))continue;var Z=s.dataToLayout([x.get(D[0],O)]),z=Z.contentRect||Z.rect;if(Xr(z.x)||Xr(z.y))continue;R=new Ze({z2:1,shape:z,style:F})}if(x.hasItemOption){var U=x.getItemModel(O),$=U.getModel("emphasis");_=$.getModel("itemStyle").getItemStyle(),w=U.getModel(["blur","itemStyle"]).getItemStyle(),S=U.getModel(["select","itemStyle"]).getItemStyle(),T=U.get(["itemStyle","borderRadius"]),P=$.get("focus"),I=$.get("blurScope"),N=$.get("disabled"),M=Cr(U)}R.shape.r=T;var Y=r.getRawValue(O),te="-";Y&&Y[2]!=null&&(te=Y[2]+""),Dr(R,M,{labelFetcher:r,labelDataIndex:O,defaultOpacity:F.opacity,defaultText:te}),R.ensureState("emphasis").style=_,R.ensureState("blur").style=w,R.ensureState("select").style=S,Dt(R,P,I,N),R.incremental=o,o&&(R.states.emphasis.hoverLayer=!0),y.add(R),x.setItemGraphicEl(O,R),this._progressiveEls&&this._progressiveEls.push(R)}},t.prototype._renderOnGeo=function(r,n,i,a){var o=i.targetVisuals.inRange,s=i.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new bhe;u.blurSize=n.get("blurSize"),u.pointSize=n.get("pointSize"),u.minOpacity=n.get("minOpacity"),u.maxOpacity=n.get("maxOpacity");var c=r.getViewRect().clone(),h=r.getRoamTransform();c.applyTransform(h);var f=Math.max(c.x,0),d=Math.max(c.y,0),g=Math.min(c.width+c.x,a.getWidth()),m=Math.min(c.height+c.y,a.getHeight()),y=g-f,x=m-d,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,P,I){var N=r.dataToPoint([A,P]);return N[0]-=f,N[1]-=d,N.push(I),N}),S=i.getExtent(),T=i.type==="visualMap.continuous"?She(S,i.option.range):whe(S,i.getPieceList(),i.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},T);var M=new Er({style:{width:y,height:x,x:f,y:d,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(gt),The=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return no(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=mf.get(this.get("coordinateSystem"));if(r&&r.dimensions)return r.dimensions[0]==="lng"&&r.dimensions[1]==="lat"},t.type="series.heatmap",t.dependencies=["grid","geo","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(bt);function Mhe(e){e.registerChartView(Che),e.registerSeriesModel(The)}var Ahe=["itemStyle","borderWidth"],GR=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],Gw=new ro,khe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:GR[+c],categoryDim:GR[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=HR(o,g),y=WR(o,g,m,f),x=UR(o,f,y);o.setItemGraphicEl(g,x),a.add(x),$R(x,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){a.remove(y);return}var x=HR(o,g),_=WR(o,g,x,f),w=jH(o,_);y&&w!==y.__pictorialShapeStr&&(a.remove(y),o.setItemGraphicEl(g,null),y=null),y?jhe(y,f,_):y=UR(o,f,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,a.add(y),$R(y,f,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&ZR(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var d=r.get("clip",!0)?Jp(r.coordinateSystem,!1,r):null;return d?a.setClipPath(d):a.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var i=this.group,a=this._data;r.get("animation")?a&&a.eachItemGraphicEl(function(o){ZR(a,De(o).dataIndex,r,o)}):i.removeAll()},t.type="pictorialBar",t}(gt);function WR(e,t,r,n){var i=e.getItemLayout(t),a=r.get("symbolRepeat"),o=r.get("symbolClip"),s=r.get("symbolPosition")||"start",l=r.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=r.get("symbolPatternSize")||2,h=r.isAnimationEnabled(),f={dataIndex:t,layout:i,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:a,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};Lhe(r,a,i,n,f),Nhe(e,t,i,a,o,f.boundingLength,f.pxSign,c,n,f),Phe(r,f.symbolScale,u,n,f);var d=f.symbolSize,g=ec(r.get("symbolOffset"),d);return Ihe(r,d,i,a,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function Lhe(e,t,r,n,i){var a=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[a.wh]<=0),c;if(re(o)){var h=[Ww(s,o[0])-l,Ww(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function Ww(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Nhe(e,t,r,n,i,a,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),d=e.getItemVisual(t,"symbolSize"),g;re(d)?g=d.slice():d==null?g=["100%","100%"]:g=[d,d],g[h.index]=ce(g[h.index],f),g[c.index]=ce(g[c.index],n?f:Math.abs(a)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Phe(e,t,r,n,i){var a=e.get(Ahe)||0;a&&(Gw.attr({scaleX:t[0],scaleY:t[1],rotation:r}),Gw.updateTransform(),a/=Gw.getLineScale(),a*=t[n.valueDim.index]),i.valueLineWidth=a||0}function Ihe(e,t,r,n,i,a,o,s,l,u,c,h){var f=c.categoryDim,d=c.valueDim,g=h.pxSign,m=Math.max(t[d.index]+s,0),y=m;if(n){var x=Math.abs(l),_=Fr(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=ce(_,t[d.index]),T=Math.max(m+S*2,0),M=w?0:S*2,A=rA(n),P=A?n:YR((x+M)/T),I=x-P*m;S=I/2/(w?P:Math.max(P-1,1)),T=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(P=u?YR((Math.abs(u)+M)/T):0),y=P*T-M,h.repeatTimes=P,h.symbolMargin=S}var N=g*(y/2),D=h.pathPosition=[];D[f.index]=r[f.wh]/2,D[d.index]=o==="start"?N:o==="end"?l-N:l/2,a&&(D[0]+=a[0],D[1]+=a[1]);var O=h.bundlePosition=[];O[f.index]=r[f.xy],O[d.index]=r[d.xy];var R=h.barRectShape=Q({},r);R[d.wh]=g*Math.max(Math.abs(r[d.wh]),Math.abs(D[d.index]+N)),R[f.wh]=r[f.wh];var F=h.clipShape={};F[f.xy]=-r[f.xy],F[f.wh]=c.ecSize[f.wh],F[d.xy]=0,F[d.wh]=r[d.wh]}function NH(e){var t=e.symbolPatternSize,r=sr(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function PH(e,t,r,n){var i=e.__pictorialBundle,a=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=a[t.valueDim.index]+o+r.symbolMargin*2;for($k(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function IH(e,t,r,n){var i=e.__pictorialBundle,a=e.__pictorialMainPath;a?Sh(a,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(a=e.__pictorialMainPath=NH(r),i.add(a),Sh(a,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:0,scaleY:0,rotation:r.rotation},{scaleX:r.symbolScale[0],scaleY:r.symbolScale[1]},r,n))}function DH(e,t,r){var n=Q({},t.barRectShape),i=e.__pictorialBarRect;i?Sh(i,null,{shape:n},t,r):(i=e.__pictorialBarRect=new Ze({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),i.disableMorphing=!0,e.add(i))}function EH(e,t,r,n){if(r.symbolClip){var i=e.__pictorialClipPath,a=Q({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(i)it(i,{shape:a},s,l);else{a[o.wh]=0,i=new Ze({shape:a}),e.__pictorialBundle.setClipPath(i),e.__pictorialClipPath=i;var u={};u[o.wh]=r.clipShape[o.wh],Ku[n?"updateProps":"initProps"](i,{shape:u},s,l)}}}function HR(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=Dhe,r.isAnimationEnabled=Ehe,r}function Dhe(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function Ehe(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function UR(e,t,r,n){var i=new Ce,a=new Ce;return i.add(a),i.__pictorialBundle=a,a.x=r.bundlePosition[0],a.y=r.bundlePosition[1],r.symbolRepeat?PH(i,t,r):IH(i,t,r),DH(i,r,n),EH(i,t,r,n),i.__pictorialShapeStr=jH(e,r),i.__pictorialSymbolMeta=r,i}function jhe(e,t,r){var n=r.animationModel,i=r.dataIndex,a=e.__pictorialBundle;it(a,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,i),r.symbolRepeat?PH(e,t,r,!0):IH(e,t,r,!0),DH(e,r,!0),EH(e,t,r,!0)}function ZR(e,t,r,n){var i=n.__pictorialBarRect;i&&i.removeTextContent();var a=[];$k(n,function(o){a.push(o)}),n.__pictorialMainPath&&a.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),j(a,function(o){el(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function jH(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function $k(e,t,r){j(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function Sh(e,t,r,n,i,a){t&&e.attr(t),n.symbolClip&&!i?r&&e.attr(r):r&&Ku[i?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,a)}function $R(e,t,r){var n=r.dataIndex,i=r.itemModel,a=i.getModel("emphasis"),o=a.getModel("itemStyle").getItemStyle(),s=i.getModel(["blur","itemStyle"]).getItemStyle(),l=i.getModel(["select","itemStyle"]).getItemStyle(),u=i.getShallow("cursor"),c=a.get("focus"),h=a.get("blurScope"),f=a.get("scale");$k(e,function(m){if(m instanceof Er){var y=m.style;m.useStyle(Q({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,f&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var d=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Dr(g,Cr(i),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Uh(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:d}),Dt(e,c,h,a.get("disabled"))}function YR(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var Rhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.defaultSymbol="roundRect",r}return t.prototype.getInitialData=function(r){return r.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series.pictorialBar",t.dependencies=["grid"],t.defaultOption=fl(gp.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:K.color.primary}}}),t}(gp);function Ohe(e){e.registerChartView(khe),e.registerSeriesModel(Rhe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Fe(tG,"pictorialBar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,rG("pictorialBar"))}var zhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._layers=[],r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this,s=this.group,l=r.getLayerSeries(),u=a.getLayout("layoutInfo"),c=u.rect,h=u.boundaryGap;s.x=0,s.y=c.y+h[0];function f(y){return y.name}var d=new Zo(this._layersSeries||[],l,f,f),g=[];d.add(fe(m,this,"add")).update(fe(m,this,"update")).remove(fe(m,this,"remove")).execute();function m(y,x,_){var w=o._layers;if(y==="remove"){s.remove(w[x]);return}for(var S=[],T=[],M,A=l[x].indices,P=0;Pa&&(a=s),n.push(s)}for(var u=0;ua&&(a=h)}return{y0:i,max:a}}function Whe(e){e.registerChartView(zhe),e.registerSeriesModel(Fhe),e.registerLayout(Vhe),e.registerProcessor(Cf("themeRiver"))}var Hhe=2,Uhe=4,qR=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;o.z2=Hhe,o.textConfig={inside:!0},De(o).seriesIndex=n.seriesIndex;var s=new tt({z2:Uhe,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,i,a),o}return t.prototype.updateData=function(r,n,i,a,o){this.node=n,n.piece=this,i=i||this._seriesModel,a=a||this._ecModel;var s=this;De(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=Q({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var d=n.getVisual("decal");d&&(f.decal=Gh(d,o));var g=Ba(l.getModel("itemStyle"),h,!0);Q(h,g),j(Cn,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var T=Ba(S,h);T&&(w.shape=T)}),r?(s.setShape(h),s.shape.r=c.r0,Nt(s,{shape:{r:c.r}},i,n.dataIndex)):(it(s,{shape:h},i),Oi(s)),s.useStyle(f),this._updateLabel(i);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=i||this._seriesModel,this._ecModel=a||this._ecModel;var y=u.get("focus"),x=y==="relative"?Eh(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;Dt(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,i=this.node.getModel(),a=i.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),h=this,f=h.getTextContent(),d=this.node.dataIndex,g=a.get("minAngle")/180*Math.PI,m=a.get("show")&&!(g!=null&&Math.abs(s)F&&!Oh(W-F)&&W0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,i):(o.virtualPiece=new qR(_,r,n,i),c.add(o.virtualPiece)),w.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(w.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},t.prototype._initEvents=function(){var r=this;this.group.off("click"),this.group.on("click",function(n){var i=!1,a=r.seriesModel.getViewRoot();a.eachNode(function(o){if(!i&&o.piece&&o.piece===n.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")r._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";B0(u,c)}}i=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:l2,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var i=n.getData(),a=i.getItemLayout(0);if(a){var o=r[0]-a.cx,s=r[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},t.type="sunburst",t}(gt),Xhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r,n){var i={name:r.name,children:r.data};RH(i);var a=this._levelModels=ae(r.levels||[],function(l){return new qe(l,this,n)},this),o=Lk.createTree(i,this,s);function s(l){l.wrapMethod("getItemModel",function(u,c){var h=o.getNodeByDataIndex(c),f=a[h.depth];return f&&(u.parentModel=f),u})}return o.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treePathInfo=O_(i,this),n},t.prototype.getLevelModel=function(r){return this._levelModels&&this._levelModels[r.depth]},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){FW(this)},t.type="series.sunburst",t.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},t}(bt);function RH(e){var t=0;j(e.children,function(n){RH(n);var i=n.value;re(i)&&(i=i[0]),t+=i});var r=e.value;re(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),re(e.value)?e.value[0]=r:e.value=r}var JR=Math.PI/180;function qhe(e,t,r){t.eachSeriesByType(e,function(n){var i=n.get("center"),a=n.get("radius");re(a)||(a=[0,a]),re(i)||(i=[i,i]);var o=r.getWidth(),s=r.getHeight(),l=Math.min(o,s),u=ce(i[0],o),c=ce(i[1],s),h=ce(a[0],l/2),f=ce(a[1],l/2),d=-n.get("startAngle")*JR,g=n.get("minAngle")*JR,m=n.getData().tree.root,y=n.getViewRoot(),x=y.depth,_=n.get("sort");_!=null&&OH(y,_);var w=0;j(y.children,function(W){!isNaN(W.getValue())&&w++});var S=y.getValue(),T=Math.PI/(S||w)*2,M=y.depth>0,A=y.height-(M?-1:1),P=(f-h)/(A||1),I=n.get("clockwise"),N=n.get("stillShowZeroSum"),D=I?1:-1,O=function(W,V){if(W){var z=V;if(W!==m){var Z=W.getValue(),U=S===0&&N?T:Z*T;U1;)o=o.parentNode;var s=i.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&he(s)&&(s=T0(s,(n.depth-1)/(a-1)*.5)),s}e.eachSeriesByType("sunburst",function(n){var i=n.getData(),a=i.tree;a.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,a.root.height));var u=i.ensureUniqueItemVisual(o.dataIndex,"style");Q(u,l)})})}function Qhe(e){e.registerChartView(Yhe),e.registerSeriesModel(Xhe),e.registerLayout(Fe(qhe,"sunburst")),e.registerProcessor(Fe(Cf,"sunburst")),e.registerVisual(Jhe),$he(e)}var QR={color:"fill",borderColor:"stroke"},efe={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Eo=Ye(),tfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},t.prototype.getInitialData=function(r,n){return no(null,this)},t.prototype.getDataParams=function(r,n,i){var a=e.prototype.getDataParams.call(this,r,n);return i&&(a.info=Eo(i).info),a},t.type="series.custom",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},t}(bt);function rfe(e,t){return t=t||[0,0],ae(["x","y"],function(r,n){var i=this.getAxis(r),a=t[n],o=e[n]/2;return i.type==="category"?i.getBandWidth():Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function nfe(e){var t=e.master.getRect();return{coordSys:{type:"cartesian2d",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r){return e.dataToPoint(r)},size:fe(rfe,e)}}}function ife(e,t){return t=t||[0,0],ae([0,1],function(r){var n=t[r],i=e[r]/2,a=[],o=[];return a[r]=n-i,o[r]=n+i,a[1-r]=o[1-r]=t[1-r],Math.abs(this.dataToPoint(a)[r]-this.dataToPoint(o)[r])},this)}function afe(e){var t=e.getBoundingRect();return{coordSys:{type:"geo",x:t.x,y:t.y,width:t.width,height:t.height,zoom:e.getZoom()},api:{coord:function(r){return e.dataToPoint(r)},size:fe(ife,e)}}}function ofe(e,t){var r=this.getAxis(),n=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return r.type==="category"?r.getBandWidth():Math.abs(r.dataToCoord(n-i)-r.dataToCoord(n+i))}function sfe(e){var t=e.getRect();return{coordSys:{type:"singleAxis",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r){return e.dataToPoint(r)},size:fe(ofe,e)}}}function lfe(e,t){return t=t||[0,0],ae(["Radius","Angle"],function(r,n){var i="get"+r+"Axis",a=this[i](),o=t[n],s=e[n]/2,l=a.type==="category"?a.getBandWidth():Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return r==="Angle"&&(l=l*Math.PI/180),l},this)}function ufe(e){var t=e.getRadiusAxis(),r=e.getAngleAxis(),n=t.getExtent();return n[0]>n[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(i){var a=t.dataToRadius(i[0]),o=r.dataToAngle(i[1]),s=e.coordToPoint([a,o]);return s.push(a,o*Math.PI/180),s},size:fe(lfe,e)}}}function cfe(e){var t=e.getRect(),r=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:r.start,end:r.end,weeks:r.weeks,dayCount:r.allDay}},api:{coord:function(n,i){return e.dataToPoint(n,i)},layout:function(n,i){return e.dataToLayout(n,i)}}}}function hfe(e){var t=e.getRect();return{coordSys:{type:"matrix",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r,n){return e.dataToPoint(r,n)},layout:function(r,n){return e.dataToLayout(r,n)}}}}function zH(e,t,r,n){return e&&(e.legacy||e.legacy!==!1&&!r&&!n&&t!=="tspan"&&(t==="text"||ge(e,"text")))}function BH(e,t,r){var n=e,i,a,o;if(t==="text")o=n;else{o={},ge(n,"text")&&(o.text=n.text),ge(n,"rich")&&(o.rich=n.rich),ge(n,"textFill")&&(o.fill=n.textFill),ge(n,"textStroke")&&(o.stroke=n.textStroke),ge(n,"fontFamily")&&(o.fontFamily=n.fontFamily),ge(n,"fontSize")&&(o.fontSize=n.fontSize),ge(n,"fontStyle")&&(o.fontStyle=n.fontStyle),ge(n,"fontWeight")&&(o.fontWeight=n.fontWeight),a={type:"text",style:o,silent:!0},i={};var s=ge(n,"textPosition");r?i.position=s?n.textPosition:"inside":s&&(i.position=n.textPosition),ge(n,"textPosition")&&(i.position=n.textPosition),ge(n,"textOffset")&&(i.offset=n.textOffset),ge(n,"textRotation")&&(i.rotation=n.textRotation),ge(n,"textDistance")&&(i.distance=n.textDistance)}return eO(o,e),j(o.rich,function(l){eO(l,l)}),{textConfig:i,textContent:a}}function eO(e,t){t&&(t.font=t.textFont||t.font,ge(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),ge(t,"textAlign")&&(e.align=t.textAlign),ge(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),ge(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),ge(t,"textWidth")&&(e.width=t.textWidth),ge(t,"textHeight")&&(e.height=t.textHeight),ge(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),ge(t,"textPadding")&&(e.padding=t.textPadding),ge(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),ge(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),ge(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),ge(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),ge(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),ge(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),ge(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function tO(e,t,r){var n=e;n.textPosition=n.textPosition||r.position||"inside",r.offset!=null&&(n.textOffset=r.offset),r.rotation!=null&&(n.textRotation=r.rotation),r.distance!=null&&(n.textDistance=r.distance);var i=n.textPosition.indexOf("inside")>=0,a=e.fill||K.color.neutral99;rO(n,t);var o=n.textFill==null;return i?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=a),n.textStrokeWidth==null&&(n.textStrokeWidth=2)):(o&&(n.textFill=e.fill||r.outsideFill||K.color.neutral00),!n.textStroke&&r.outsideStroke&&(n.textStroke=r.outsideStroke)),n.text=t.text,n.rich=t.rich,j(t.rich,function(s){rO(s,s)}),n}function rO(e,t){t&&(ge(t,"fill")&&(e.textFill=t.fill),ge(t,"stroke")&&(e.textStroke=t.fill),ge(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),ge(t,"font")&&(e.font=t.font),ge(t,"fontStyle")&&(e.fontStyle=t.fontStyle),ge(t,"fontWeight")&&(e.fontWeight=t.fontWeight),ge(t,"fontSize")&&(e.fontSize=t.fontSize),ge(t,"fontFamily")&&(e.fontFamily=t.fontFamily),ge(t,"align")&&(e.textAlign=t.align),ge(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),ge(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),ge(t,"width")&&(e.textWidth=t.width),ge(t,"height")&&(e.textHeight=t.height),ge(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),ge(t,"padding")&&(e.textPadding=t.padding),ge(t,"borderColor")&&(e.textBorderColor=t.borderColor),ge(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),ge(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),ge(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),ge(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),ge(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),ge(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),ge(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),ge(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),ge(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),ge(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var FH={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},nO=Qe(FH);Ei(Ya,function(e,t){return e[t]=1,e},{});Ya.join(", ");var dx=["","style","shape","extra"],Xh=Ye();function Yk(e,t,r,n,i){var a=e+"Animation",o=ff(e,n,i)||{},s=Xh(t).userDuring;return o.duration>0&&(o.during=s?fe(gfe,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Q(o,r[a]),o}function By(e,t,r,n){n=n||{};var i=n.dataIndex,a=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Xh(e),u=t.style;l.userDuring=t.during;var c={},h={};if(yfe(e,t,h),e.type==="compound")for(var f=e.shape.paths,d=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else dfe(e,t,i||0,r,c);VH(e,t),u?e.dirty():e.markRedraw()}function VH(e,t){for(var r=Xh(e).leaveToProps,n=0;n0&&e.animateFrom(i,a)}}function vfe(e,t){ge(t,"silent")&&(e.silent=t.silent),ge(t,"ignore")&&(e.ignore=t.ignore),e instanceof Ri&&ge(t,"invisible")&&(e.invisible=t.invisible),e instanceof Ke&&ge(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var Aa={},pfe={setTransform:function(e,t){return Aa.el[e]=t,this},getTransform:function(e){return Aa.el[e]},setShape:function(e,t){var r=Aa.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=Aa.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=Aa.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=Aa.el.style;if(t)return t[e]},setExtra:function(e,t){var r=Aa.el.extra||(Aa.el.extra={});return r[e]=t,this},getExtra:function(e){var t=Aa.el.extra;if(t)return t[e]}};function gfe(){var e=this,t=e.el;if(t){var r=Xh(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}Aa.el=t,n(pfe)}}function iO(e,t,r,n){var i=r[e];if(i){var a=t[e],o;if(a){var s=r.transition,l=i.transition;if(l)if(!o&&(o=n[e]={}),Tu(l))Q(o,a);else for(var u=Tt(l),c=0;c=0){!o&&(o=n[e]={});for(var d=Qe(a),c=0;c=0)){var f=e.getAnimationStyleProps(),d=f?f.style:null;if(d){!a&&(a=n.style={});for(var g=Qe(r),u=0;u=0?t.getStore().get(z,W):void 0}var Z=t.get(V.name,W),U=V&&V.ordinalMeta;return U?U.categories[Z]:Z}function A(H,W){W==null&&(W=c);var V=t.getItemVisual(W,"style"),z=V&&V.fill,Z=V&&V.opacity,U=w(W,Ns).getItemStyle();z!=null&&(U.fill=z),Z!=null&&(U.opacity=Z);var $={inheritColor:he(z)?z:K.color.neutral99},Y=S(W,Ns),te=Ct(Y,null,$,!1,!0);te.text=Y.getShallow("show")?be(e.getFormattedLabel(W,Ns),Uh(t,W)):null;var ie=R0(Y,$,!1);return N(H,U),U=tO(U,te,ie),H&&I(U,H),U.legacy=!0,U}function P(H,W){W==null&&(W=c);var V=w(W,jo).getItemStyle(),z=S(W,jo),Z=Ct(z,null,null,!0,!0);Z.text=z.getShallow("show")?zn(e.getFormattedLabel(W,jo),e.getFormattedLabel(W,Ns),Uh(t,W)):null;var U=R0(z,null,!0);return N(H,V),V=tO(V,Z,U),H&&I(V,H),V.legacy=!0,V}function I(H,W){for(var V in W)ge(W,V)&&(H[V]=W[V])}function N(H,W){H&&(H.textFill&&(W.textFill=H.textFill),H.textPosition&&(W.textPosition=H.textPosition))}function D(H,W){if(W==null&&(W=c),ge(QR,H)){var V=t.getItemVisual(W,"style");return V?V[QR[H]]:null}if(ge(efe,H))return t.getItemVisual(W,H)}function O(H){if(o.type==="cartesian2d"){var W=o.getBaseAxis();return Cre(Ae({axis:W},H))}}function R(){return r.getCurrentSeriesIndices()}function F(H){return wA(H,r)}}function Lfe(e){var t={};return j(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var i=n.coordDim,a=t[i]=t[i]||[];a[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function Yw(e,t,r,n,i,a,o){if(!n){a.remove(t);return}var s=Qk(e,t,r,n,i,a);return s&&o.setItemGraphicEl(r,s),s&&Dt(s,n.focus,n.blurScope,n.emphasisDisabled),s}function Qk(e,t,r,n,i,a){var o=-1,s=t;t&&UH(t,n,i)&&(o=Ve(a.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=Kk(n),s&&Tfe(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),pi.normal.cfg=pi.normal.conOpt=pi.emphasis.cfg=pi.emphasis.conOpt=pi.blur.cfg=pi.blur.conOpt=pi.select.cfg=pi.select.conOpt=null,pi.isLegacy=!1,Pfe(u,r,n,i,l,pi),Nfe(u,r,n,i,l),Jk(e,u,r,n,pi,i,l),ge(n,"info")&&(Eo(u).info=n.info);for(var c=0;c=0?a.replaceAt(u,o):a.add(u),u}function UH(e,t,r){var n=Eo(e),i=t.type,a=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||i!=null&&i!==n.customGraphicType||i==="path"&&Rfe(a)&&ZH(a)!==n.customPathData||i==="image"&&ge(o,"image")&&o.image!==n.customImagePath}function Nfe(e,t,r,n,i){var a=r.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&UH(o,a,n)&&(o=null),o||(o=Kk(a),e.setClipPath(o)),Jk(null,o,t,a,null,n,i)}}function Pfe(e,t,r,n,i,a){if(!(e.isGroup||e.type==="compoundPath")){oO(r,null,a),oO(r,jo,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,l=a.blur.conOpt,u=a.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=Kk(o),e.setTextContent(c)),Jk(null,c,t,o,null,n,i);for(var h=o&&o.style,f=0;f=c;d--){var g=t.childAt(d);Dfe(t,g,i)}}}function Dfe(e,t,r){t&&F_(t,Eo(e).option,r)}function Efe(e){new Zo(e.oldChildren,e.newChildren,sO,sO,e).add(lO).update(lO).remove(jfe).execute()}function sO(e,t){var r=e&&e.name;return r??Sfe+t}function lO(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,i=t!=null?r.oldChildren[t]:null;Qk(r.api,i,r.dataIndex,n,r.seriesModel,r.group)}function jfe(e){var t=this.context,r=t.oldChildren[e];r&&F_(r,Eo(r).option,t.seriesModel)}function ZH(e){return e&&(e.pathData||e.d)}function Rfe(e){return e&&(ge(e,"pathData")||ge(e,"d"))}function Ofe(e){e.registerChartView(Mfe),e.registerSeriesModel(tfe)}var iu=Ye(),uO=Se,Xw=fe,tL=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,i){var a=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!i&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,t,r,n);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=c;var h=this._moveAnimation=this.determineAnimation(t,r);if(!s)s=this._group=new Ce,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=Fe(cO,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}fO(s,r,!0),this._renderHandle(a)}},e.prototype.remove=function(t){this.clear(t)},e.prototype.dispose=function(t){this.clear(t)},e.prototype.determineAnimation=function(t,r){var n=r.get("animation"),i=t.axis,a=i.type==="category",o=r.get("snap");if(!o&&!a)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(a&&i.getBandWidth()>s)return!0;if(o){var l=wk(t).seriesDataCount,u=i.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,i,a){},e.prototype.createPointerEl=function(t,r,n,i){var a=r.pointer;if(a){var o=iu(t).pointerEl=new Ku[a.type](uO(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,i){if(r.label){var a=iu(t).labelEl=new tt(uO(r.label));t.add(a),hO(a,i)}},e.prototype.updatePointerEl=function(t,r,n){var i=iu(t).pointerEl;i&&r.pointer&&(i.setStyle(r.pointer.style),n(i,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,i){var a=iu(t).labelEl;a&&(a.setStyle(r.label.style),n(a,{x:r.label.x,y:r.label.y}),hO(a,i))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),i=this._handle,a=r.getModel("handle"),o=r.get("status");if(!a.get("show")||!o||o==="hide"){i&&n.remove(i),this._handle=null;return}var s;this._handle||(s=!0,i=this._handle=df(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Wo(u.event)},onmousedown:Xw(this._onHandleDragMove,this,0,0),drift:Xw(this._onHandleDragMove,this),ondragend:Xw(this._onHandleDragEnd,this)}),n.add(i)),fO(i,r,!1),i.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");re(l)||(l=[l,l]),i.scaleX=l[0]/2,i.scaleY=l[1]/2,xf(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){cO(this._axisPointerModel,!r&&this._moveAnimation,this._handle,qw(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(qw(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(qw(i)),iu(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var r=t.getZr(),n=this._group,i=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),i&&r.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),lp(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(t,r,n){return n=n||0,{x:t[n],y:t[1-n],width:r[n],height:r[1-n]}},e}();function cO(e,t,r,n){$H(iu(r).lastProp,n)||(iu(r).lastProp=n,t?it(r,n,e):(r.stopAnimation(),r.attr(n)))}function $H(e,t){if(ke(e)&&ke(t)){var r=!0;return j(t,function(n,i){r=r&&$H(e[i],n)}),!!r}else return e===t}function hO(e,t){e[t.get(["label","show"])?"show":"hide"]()}function qw(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function fO(e,t,r){var n=t.get("z"),i=t.get("zlevel");e&&e.traverse(function(a){a.type!=="group"&&(n!=null&&(a.z=n),i!=null&&(a.zlevel=i),a.silent=r)})}function rL(e){var t=e.get("type"),r=e.getModel(t+"Style"),n;return t==="line"?(n=r.getLineStyle(),n.fill=null):t==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function YH(e,t,r,n,i){var a=r.get("value"),o=XH(a,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=gf(s.get("padding")||0),u=s.getFont(),c=c_(o,u),h=i.position,f=c.width+l[1]+l[3],d=c.height+l[0]+l[2],g=i.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=i.verticalAlign;m==="bottom"&&(h[1]-=d),m==="middle"&&(h[1]-=d/2),zfe(h,f,d,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:Ct(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function zfe(e,t,r,n){var i=n.getWidth(),a=n.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+r,a)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function XH(e,t,r,n,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:q0(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};j(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),he(o)?a=o.replace("{value}",a):we(o)&&(a=o(s))}return a}function nL(e,t,r){var n=Pr();return Ko(n,n,r.rotation),ha(n,n,r.position),sa([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function qH(e,t,r,n,i,a){var o=wn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=i.get(["label","margin"]),YH(t,n,i,a,{position:nL(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function iL(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function KH(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function dO(e,t,r,n,i,a){return{cx:e,cy:t,r0:r,r:n,startAngle:i,endAngle:a,clockwise:!0}}var Bfe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.grid,u=a.get("type"),c=vO(l,s).getOtherAxis(s).getGlobalExtent(),h=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var f=rL(a),d=Ffe[u](s,h,c);d.style=f,r.graphicKey=d.type,r.pointer=d}var g=ox(l.getRect(),i);qH(n,r,g,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=ox(n.axis.grid.getRect(),n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=nL(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.grid,l=o.getGlobalExtent(!0),u=vO(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Math.min(l[1],h[c]),h[c]=Math.max(l[0],h[c]);var f=(u[1]+u[0])/2,d=[f,f];d[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:d,tooltipOption:g[c]}},t}(tL);function vO(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var Ffe={line:function(e,t,r){var n=iL([t,r[0]],[t,r[1]],pO(e));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(e,t,r){var n=Math.max(1,e.getBandWidth()),i=r[1]-r[0];return{type:"Rect",shape:KH([t-n/2,r[0]],[n,i],pO(e))}}};function pO(e){return e.dim==="x"?0:1}var Vfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:"dashed"},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:"auto",margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,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:K.color.accent40,throttle:40}},t}($e),Lo=Ye(),Gfe=j;function JH(e,t,r){if(!Je.node){var n=t.getZr();Lo(n).records||(Lo(n).records={}),Wfe(n,t);var i=Lo(n).records[e]||(Lo(n).records[e]={});i.handler=r}}function Wfe(e,t){if(Lo(e).initialized)return;Lo(e).initialized=!0,r("click",Fe(gO,"click")),r("mousemove",Fe(gO,"mousemove")),r("globalout",Ufe);function r(n,i){e.on(n,function(a){var o=Zfe(t);Gfe(Lo(e).records,function(s){s&&i(s,a,o.dispatchAction)}),Hfe(o.pendings,t)})}}function Hfe(e,t){var r=e.showTip.length,n=e.hideTip.length,i;r?i=e.showTip[r-1]:n&&(i=e.hideTip[n-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function Ufe(e,t,r){e.handler("leave",null,r)}function gO(e,t,r,n){t.handler(e,r,n)}function Zfe(e){var t={showTip:[],hideTip:[]},r=function(n){var i=t[n.type];i?i.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function h2(e,t){if(!Je.node){var r=t.getZr(),n=(Lo(r).records||{})[e];n&&(Lo(r).records[e]=null)}}var $fe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=n.getComponent("tooltip"),o=r.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click";JH("axisPointer",i,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},t.prototype.remove=function(r,n){h2("axisPointer",n)},t.prototype.dispose=function(r,n){h2("axisPointer",n)},t.type="axisPointer",t}(Mt);function QH(e,t){var r=[],n=e.seriesIndex,i;if(n==null||!(i=t.getSeriesByIndex(n)))return{point:[]};var a=i.getData(),o=Ru(a,e);if(o==null||o<0||re(o))return{point:[]};var s=a.getItemGraphicEl(o),l=i.coordinateSystem;if(i.getTooltipPosition)r=i.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,d=h==="x"||h==="radius"?1:0,g=a.mapDimension(f),m=[];m[d]=a.get(g,o),m[1-d]=a.get(a.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(a.getValues(ae(l.dimensions,function(x){return a.mapDimension(x)}),o))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),r=[y.x+y.width/2,y.y+y.height/2]}return{point:r,el:s}}var mO=Ye();function Yfe(e,t,r){var n=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||fe(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Fy(i)&&(i=QH({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var l=Fy(i),u=a.axesInfo,c=s.axesInfo,h=n==="leave"||Fy(i),f={},d={},g={list:[],map:{}},m={showPointer:Fe(qfe,d),showTooltip:Fe(Kfe,g)};j(s.coordSysMap,function(x,_){var w=l||x.containPoint(i);j(s.coordSysAxesInfo[_],function(S,T){var M=S.axis,A=tde(u,S);if(!h&&w&&(!u||A)){var P=A&&A.value;P==null&&!l&&(P=M.pointToData(i)),P!=null&&yO(S,P,m,!1,f)}})});var y={};return j(c,function(x,_){var w=x.linkGroup;w&&!d[_]&&j(w.axesInfo,function(S,T){var M=d[T];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,xO(S),xO(x)))),y[x.key]=A}})}),j(y,function(x,_){yO(c[_],x,m,!0,f)}),Jfe(d,c,f),Qfe(g,i,e,o),ede(c,o,r),f}}function yO(e,t,r,n,i){var a=e.axis;if(!(a.scale.isBlank()||!a.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=Xfe(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&i.seriesIndex==null&&Q(i,s[0]),!n&&e.snap&&a.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function Xfe(e,t){var r=t.axis,n=r.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return j(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var d=l.getAxisTooltipData(c,e,r);f=d.dataIndices,h=d.nestestValue}else{if(f=l.indicesOfNearest(n,c[0],e,r.type==="category"?.5:null),!f.length)return;h=l.getData().get(c[0],f[0])}if(!(h==null||!isFinite(h))){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,i=h,a.length=0),j(f,function(y){a.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:a,snapToValue:i}}function qfe(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function Kfe(e,t,r,n){var i=r.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!i.length)){var l=t.coordSys.model,u=mp(l),c=e.map[u];c||(c=e.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:i.slice()})}}function Jfe(e,t,r){var n=r.axesInfo=[];j(t,function(i,a){var o=i.axisPointerModel.option,s=e[a];s?(!i.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!i.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:i.axis.dim,axisIndex:i.axis.model.componentIndex,value:o.value})})}function Qfe(e,t,r,n){if(Fy(t)||!e.list.length){n({type:"hideTip"});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function ede(e,t,r){var n=r.getZr(),i="axisPointerLastHighlights",a=mO(n)[i]||{},o=mO(n)[i]={};j(e,function(u,c){var h=u.axisPointerModel.option;h.status==="show"&&u.triggerEmphasis&&j(h.seriesDataIndices,function(f){var d=f.seriesIndex+" | "+f.dataIndex;o[d]=f})});var s=[],l=[];j(a,function(u,c){!o[c]&&l.push(u)}),j(o,function(u,c){!a[c]&&s.push(u)}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function tde(e,t){for(var r=0;r<(e||[]).length;r++){var n=e[r];if(t.axis.dim===n.axisDim&&t.axis.model.componentIndex===n.axisIndex)return n}}function xO(e){var t=e.axis.model,r={},n=r.axisDim=e.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=t.componentIndex,r.axisName=r[n+"AxisName"]=t.name,r.axisId=r[n+"AxisId"]=t.id,r}function Fy(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function tg(e){tc.registerAxisPointerClass("CartesianAxisPointer",Bfe),e.registerComponentModel(Vfe),e.registerComponentView($fe),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!re(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=roe(t,r)}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},Yfe)}function rde(e){He(SW),He(tg)}var nde=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=l.getOtherAxis(s),c=u.getExtent(),h=s.dataToCoord(n),f=a.get("type");if(f&&f!=="none"){var d=rL(a),g=ade[f](s,l,h,c);g.style=d,r.graphicKey=g.type,r.pointer=g}var m=a.get(["label","margin"]),y=ide(n,i,a,l,m);YH(r,i,a,o,y)},t}(tL);function ide(e,t,r,n,i){var a=t.axis,o=a.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(a.dim==="radius"){var f=Pr();Ko(f,f,s),ha(f,f,[n.cx,n.cy]),u=sa([o,-i],f);var d=t.getModel("axisLabel").get("rotate")||0,g=wn.innerTextLayout(s,d*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+i,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var ade={line:function(e,t,r,n){return e.dim==="angle"?{type:"Line",shape:iL(t.coordToPoint([n[0],r]),t.coordToPoint([n[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n){var i=Math.max(1,e.getBandWidth()),a=Math.PI/180;return e.dim==="angle"?{type:"Sector",shape:dO(t.cx,t.cy,n[0],n[1],(-r-i/2)*a,(-r+i/2)*a)}:{type:"Sector",shape:dO(t.cx,t.cy,r-i/2,r+i/2,0,Math.PI*2)}}},ode=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.findAxisModel=function(r){var n,i=this.ecModel;return i.eachComponent(r,function(a){a.getCoordSysModel()===this&&(n=a)},this),n},t.type="polar",t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}($e),aL=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ht).models[0]},t.type="polarAxis",t}($e);Qt(aL,Sf);var sde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(aL),lde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(aL),oL=function(e){q(t,e);function t(r,n){return e.call(this,"radius",r,n)||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t}(Vi);oL.prototype.dataToRadius=Vi.prototype.dataToCoord;oL.prototype.radiusToData=Vi.prototype.coordToData;var ude=Ye(),sL=function(e){q(t,e);function t(r,n){return e.call(this,"angle",r,n||[0,360])||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t.prototype.calculateCategoryInterval=function(){var r=this,n=r.getLabelModel(),i=r.scale,a=i.getExtent(),o=i.count();if(a[1]-a[0]<1)return 0;var s=a[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=c_(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var d=Math.max(0,Math.floor(f)),g=ude(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-d)<=1&&Math.abs(y-o)<=1&&m>d?d=m:(g.lastTickCount=o,g.lastAutoInterval=d),d},t}(Vi);sL.prototype.dataToAngle=Vi.prototype.dataToCoord;sL.prototype.angleToData=Vi.prototype.coordToData;var e8=["radius","angle"],cde=function(){function e(t){this.dimensions=e8,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new oL,this._angleAxis=new sL,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(t){var r=this.pointToCoord(t);return this._radiusAxis.contain(r[0])&&this._angleAxis.contain(r[1])},e.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},e.prototype.getAxis=function(t){var r="_"+t+"Axis";return this[r]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(t){var r=[],n=this._angleAxis,i=this._radiusAxis;return n.scale.type===t&&r.push(n),i.scale.type===t&&r.push(i),r},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(t){var r=this._angleAxis;return t===r?this._radiusAxis:r},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(t){var r=t!=null&&t!=="auto"?this.getAxis(t):this.getBaseAxis();return{baseAxes:[r],otherAxes:[this.getOtherAxis(r)]}},e.prototype.dataToPoint=function(t,r,n){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],r),this._angleAxis.dataToAngle(t[1],r)],n)},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(i[0],r),n[1]=this._angleAxis.angleToData(i[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,i=this.getAngleAxis(),a=i.getExtent(),o=Math.min(a[0],a[1]),s=Math.max(a[0],a[1]);i.inverse?o=s-360:s=o+360;var l=Math.sqrt(r*r+n*n);r/=l,n/=l;for(var u=Math.atan2(-n,r)/Math.PI*180,c=us;)u+=c*360;return[l,u]},e.prototype.coordToPoint=function(t,r){r=r||[];var n=t[0],i=t[1]/180*Math.PI;return r[0]=Math.cos(i)*n+this.cx,r[1]=-Math.sin(i)*n+this.cy,r},e.prototype.getArea=function(){var t=this.getAngleAxis(),r=this.getRadiusAxis(),n=r.getExtent().slice();n[0]>n[1]&&n.reverse();var i=t.getExtent(),a=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-i[0]*a,endAngle:-i[1]*a,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,d=this.r0;return f!==d&&h-o<=f*f&&h+o>=d*d},x:this.cx-n[1],y:this.cy-n[1],width:n[1]*2,height:n[1]*2}},e.prototype.convertToPixel=function(t,r,n){var i=_O(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=_O(r);return i===this?this.pointToData(n):null},e}();function _O(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function hde(e,t,r){var n=t.get("center"),i=Tr(t,r).refContainer;e.cx=ce(n[0],i.width)+i.x,e.cy=ce(n[1],i.height)+i.y;var a=e.getRadiusAxis(),o=Math.min(i.width,i.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:re(s)||(s=[0,s]);var l=[ce(s[0],o),ce(s[1],o)];a.inverse?a.setExtent(l[1],l[0]):a.setExtent(l[0],l[1])}function fde(e,t){var r=this,n=r.getAngleAxis(),i=r.getRadiusAxis();if(n.scale.setExtent(1/0,-1/0),i.scale.setExtent(1/0,-1/0),e.eachSeries(function(s){if(s.coordinateSystem===r){var l=s.getData();j(K0(l,"radius"),function(u){i.scale.unionExtentFromData(l,u)}),j(K0(l,"angle"),function(u){n.scale.unionExtentFromData(l,u)})}}),Gu(n.scale,n.model),Gu(i.scale,i.model),n.type==="category"&&!n.onBand){var a=n.getExtent(),o=360/n.scale.count();n.inverse?a[1]+=o:a[1]-=o,n.setExtent(a[0],a[1])}}function dde(e){return e.mainType==="angleAxis"}function bO(e,t){var r;if(e.type=t.get("type"),e.scale=Xp(t),e.onBand=t.get("boundaryGap")&&e.type==="category",e.inverse=t.get("inverse"),dde(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),i=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,i)}t.axis=e,e.model=t}var vde={dimensions:e8,create:function(e,t){var r=[];return e.eachComponent("polar",function(n,i){var a=new cde(i+"");a.update=fde;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");bO(o,l),bO(s,u),hde(a,n,t),r.push(a),n.coordinateSystem=a,a.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")==="polar"){var i=n.getReferringComponents("polar",Ht).models[0];n.coordinateSystem=i.coordinateSystem}}),r}},pde=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function Ym(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),i=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:i[0],y2:i[1]}}function Xm(e){var t=e.getRadiusAxis();return t.inverse?0:1}function wO(e){var t=e[0],r=e[e.length-1];t&&r&&Math.abs(Math.abs(t.coord-r.coord)-360)<1e-4&&e.pop()}var gde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.axisPointerClass="PolarAxisPointer",r}return t.prototype.render=function(r,n){if(this.group.removeAll(),!!r.get("show")){var i=r.axis,a=i.polar,o=a.getRadiusAxis().getExtent(),s=i.getTicksCoords({breakTicks:"none"}),l=i.getMinorTicksCoords(),u=ae(i.getViewLabels(),function(c){c=Se(c);var h=i.scale,f=h.type==="ordinal"?h.getRawOrdinalNumber(c.tickValue):c.tickValue;return c.coord=i.dataToCoord(f),c});wO(u),wO(s),j(pde,function(c){r.get([c,"show"])&&(!i.scale.isBlank()||c==="axisLine")&&mde[c](this.group,r,a,s,l,o,u)},this)}},t.type="angleAxis",t}(tc),mde={axisLine:function(e,t,r,n,i,a){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=Xm(r),h=c?0:1,f,d=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[h]===0?f=new Ku[d]({shape:{cx:r.cx,cy:r.cy,r:a[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new cf({shape:{cx:r.cx,cy:r.cy,r:a[c],r0:a[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,i,a){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[Xm(r)],u=ae(n,function(c){return new ar({shape:Ym(r,[l,l+s],c.coord)})});e.add(qn(u,{style:Ae(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,i,a){if(i.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=a[Xm(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var T=s[g];ke(T)&&T.textStyle&&(d=new qe(T.textStyle,l,l.ecModel))}var M=new tt({silent:wn.isLabelSilent(t),style:Ct(d,{x:y[0],y:y[1],fill:d.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),Qo({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=wn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,De(M).eventData=A}},this)},splitLine:function(e,t,r,n,i,a){var o=t.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],h=0;h=0?"p":"n",H=I;T&&(n[c][R]||(n[c][R]={p:I,n:I}),H=n[c][R][F]);var W=void 0,V=void 0,z=void 0,Z=void 0;if(g.dim==="radius"){var U=g.dataToCoord(O)-I,$=l.dataToCoord(R);Math.abs(U)=Z})}}})}function Sde(e){var t={};j(e,function(n,i){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=r8(o,s),u=s.getExtent(),c=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/a.count(),h=t[l]||{bandWidth:c,remainedWidth:c,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},f=h.stacks;t[l]=h;var d=t8(n);f[d]||h.autoWidthCount++,f[d]=f[d]||{width:0,maxWidth:0};var g=ce(n.get("barWidth"),c),m=ce(n.get("barMaxWidth"),c),y=n.get("barGap"),x=n.get("barCategoryGap");g&&!f[d].width&&(g=Math.min(h.remainedWidth,g),f[d].width=g,h.remainedWidth-=g),m&&(f[d].maxWidth=m),y!=null&&(h.gap=y),x!=null&&(h.categoryGap=x)});var r={};return j(t,function(n,i){r[i]={};var a=n.stacks,o=n.bandWidth,s=ce(n.categoryGap,o),l=ce(n.gap,1),u=n.remainedWidth,c=n.autoWidthCount,h=(u-s)/(c+(c-1)*l);h=Math.max(h,0),j(a,function(m,y){var x=m.maxWidth;x&&x=r.y&&t[1]<=r.y+r.height:n.contain(n.toLocalCoord(t[1]))&&t[0]>=r.y&&t[0]<=r.y+r.height},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.getAxis();return n[0]=i.coordToData(i.toLocalCoord(t[i.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var i=this.getAxis(),a=this.getRect();n=n||[];var o=i.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=i.toGlobalCoord(i.dataToCoord(+t)),n[1-o]=o===0?a.y+a.height/2:a.x+a.width/2,n},e.prototype.convertToPixel=function(t,r,n){var i=SO(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=SO(r);return i===this?this.pointToData(n):null},e}();function SO(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function Dde(e,t){var r=[];return e.eachComponent("singleAxis",function(n,i){var a=new Ide(n,e,t);a.name="single_"+i,a.resize(n,t),n.coordinateSystem=a,r.push(a)}),e.eachSeries(function(n){if(n.get("coordinateSystem")==="singleAxis"){var i=n.getReferringComponents("singleAxis",Ht).models[0];n.coordinateSystem=i&&i.coordinateSystem}}),r}var Ede={create:Dde,dimensions:n8},CO=["x","y"],jde=["width","height"],Rde=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.coordinateSystem,u=Kw(l,1-gx(s)),c=l.dataToPoint(n)[0],h=a.get("type");if(h&&h!=="none"){var f=rL(a),d=Ode[h](s,c,u);d.style=f,r.graphicKey=d.type,r.pointer=d}var g=f2(i);qH(n,r,g,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=f2(n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=nL(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.coordinateSystem,l=gx(o),u=Kw(s,l),c=[r.x,r.y];c[l]+=n[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var h=Kw(s,1-l),f=(h[1]+h[0])/2,d=[f,f];return d[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:d,tooltipOption:{verticalAlign:"middle"}}},t}(tL),Ode={line:function(e,t,r){var n=iL([t,r[0]],[t,r[1]],gx(e));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(e,t,r){var n=e.getBandWidth(),i=r[1]-r[0];return{type:"Rect",shape:KH([t-n/2,r[0]],[n,i],gx(e))}}};function gx(e){return e.isHorizontal()?0:1}function Kw(e,t){var r=e.getRect();return[r[CO[t]],r[CO[t]]+r[jde[t]]]}var zde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Mt);function Bde(e){He(tg),tc.registerAxisPointerClass("SingleAxisPointer",Rde),e.registerComponentView(zde),e.registerComponentView(Lde),e.registerComponentModel(Vy),Zh(e,"single",Vy,Vy.defaultOption),e.registerCoordinateSystem("single",Ede)}var Fde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,i){var a=Ju(r);e.prototype.init.apply(this,arguments),TO(r,a)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),TO(this.option,r)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.layoutMode="box",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:K.color.axisLine,width:1,type:"solid"}},itemStyle:{color:K.color.neutral00,borderWidth:1,borderColor:K.color.neutral10},dayLabel:{show:!0,firstDay:0,position:"start",margin:K.size.s,color:K.color.secondary},monthLabel:{show:!0,position:"start",margin:K.size.s,align:"center",formatter:null,color:K.color.secondary},yearLabel:{show:!0,position:null,margin:K.size.xl,formatter:null,color:K.color.quaternary,fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},t}($e);function TO(e,t){var r=e.cellSize,n;re(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var i=ae([0,1],function(a){return lQ(t,a)&&(n[a]="auto"),n[a]!=null&&n[a]!=="auto"});Ka(e,t,{type:"box",ignoreSize:i})}var Vde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group;a.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,a),this._renderLines(r,s,l,a),this._renderYearText(r,s,l,a),this._renderMonthText(r,u,l,a),this._renderWeekText(r,u,s,l,a)},t.prototype._renderDayRect=function(r,n,i){for(var a=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=a.getCellWidth(),l=a.getCellHeight(),u=n.start.time;u<=n.end.time;u=a.getNextNDay(u,1).time){var c=a.dataToCalendarLayout([u],!1).tl,h=new Ze({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});i.add(h)}},t.prototype._renderLines=function(r,n,i,a){var o=this,s=r.coordinateSystem,l=r.getModel(["splitLine","lineStyle"]).getLineStyle(),u=r.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=n.start,f=0;h.time<=n.end.time;f++){g(h.formatedDate),f===0&&(h=s.getDateInfo(n.start.y+"-"+n.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=s.getDateInfo(d)}g(s.getNextNDay(n.end.time,1).formatedDate);function g(m){o._firstDayOfMonth.push(s.getDateInfo(m)),o._firstDayPoints.push(s.dataToCalendarLayout([m],!1).tl);var y=o._getLinePointsOfOneWeek(r,m,i);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,a)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,i),l,a),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,i),l,a)},t.prototype._getEdgesPoints=function(r,n,i){var a=[r[0].slice(),r[r.length-1].slice()],o=i==="horizontal"?0:1;return a[0][o]=a[0][o]-n/2,a[1][o]=a[1][o]+n/2,a},t.prototype._drawSplitline=function(r,n,i){var a=new Gr({z2:20,shape:{points:r},style:n});i.add(a)},t.prototype._getLinePointsOfOneWeek=function(r,n,i){for(var a=r.coordinateSystem,o=a.getDateInfo(n),s=[],l=0;l<7;l++){var u=a.getNextNDay(o.time,l),c=a.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[i==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return he(r)&&r?tQ(r,n):we(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,i,a,o){var s=n[0],l=n[1],u=["center","bottom"];a==="bottom"?(l+=o,u=["center","top"]):a==="left"?s-=o:a==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(a==="left"||a==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,i,a){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=i!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,f=i==="horizontal"?0:1,d={top:[c,u[f][1]],bottom:[c,u[1-f][1]],left:[u[1-f][0],h],right:[u[f][0],h]},g=n.start.y;+n.end.y>+n.start.y&&(g=g+"-"+n.end.y);var m=o.get("formatter"),y={start:n.start.y,end:n.end.y,nameMap:g},x=this._formatterLabel(m,y),_=new tt({z2:30,style:Ct(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,d[l],i,l,s)),a.add(_)}},t.prototype._monthTextPositionControl=function(r,n,i,a,o){var s="left",l="top",u=r[0],c=r[1];return i==="horizontal"?(c=c+o,n&&(s="center"),a==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),a==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,i,a){var o=r.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||he(s))&&(s&&(n=sT(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,d=i==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=a.start.time&&i.times.end.time&&r.reverse(),r},e.prototype._getRangeInfo=function(t){var r=[this.getDateInfo(t[0]),this.getDateInfo(t[1])],n;r[0].time>r[1].time&&(n=!0,r.reverse());var i=Math.floor(r[1].time/Jw)-Math.floor(r[0].time/Jw)+1,a=new Date(r[0].time),o=a.getDate(),s=r[1].date.getDate();a.setDate(o+i-1);var l=a.getDate();if(l!==s)for(var u=a.getTime()-r[1].time>0?1:-1;(l=a.getDate())!==s&&(a.getTime()-r[1].time)*u>0;)i-=u,a.setDate(l-u);var c=Math.floor((i+r[0].day+6)/7),h=n?-c+1:c-1;return n&&r.reverse(),{range:[r[0].formatedDate,r[1].formatedDate],start:r[0],end:r[1],allDay:i,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var i=this._getRangeInfo(n);if(t>i.weeks||t===0&&ri.lweek)return null;var a=(t-1)*7-i.fweek+r,o=new Date(i.start.time);return o.setDate(+i.start.d+a),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(i){var a=new e(i,t,r);n.push(a),i.coordinateSystem=a}),t.eachComponent(function(i,a){$p({targetModel:a,coordSysType:"calendar",coordSysProvider:w6})}),n},e.dimensions=["time","value"],e}();function Qw(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function Wde(e){e.registerComponentModel(Fde),e.registerComponentView(Vde),e.registerCoordinateSystem("calendar",Gde)}var wo={level:1,leaf:2,nonLeaf:3},Ro={none:0,all:1,body:2,corner:3};function d2(e,t,r){var n=t[Oe[r]].getCell(e);return!n&&rt(e)&&e<0&&(n=t[Oe[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function i8(e){var t=e||[];return t[0]=t[0]||[],t[1]=t[1]||[],t[0][0]=t[0][1]=t[1][0]=t[1][1]=NaN,t}function a8(e,t,r,n,i){MO(e[0],t,i,r,n,0),MO(e[1],t,i,r,n,1)}function MO(e,t,r,n,i,a){e[0]=1/0,e[1]=-1/0;var o=n[a],s=re(o)?o:[o],l=s.length,u=!!r;if(l>=1?(AO(e,t,s,u,i,a,0),l>1&&AO(e,t,s,u,i,a,l-1)):e[0]=e[1]=NaN,u){var c=-i[Oe[1-a]].getLocatorCount(a),h=i[Oe[a]].getLocatorCount(a)-1;r===Ro.body?c=nr(0,c):r===Ro.corner&&(h=ni(-1,h)),h=t[0]&&e[0]<=t[1]}function NO(e,t){e.id.set(t[0][0],t[1][0]),e.span.set(t[0][1]-e.id.x+1,t[1][1]-e.id.y+1)}function Zde(e,t){e[0][0]=t[0][0],e[0][1]=t[0][1],e[1][0]=t[1][0],e[1][1]=t[1][1]}function PO(e,t,r,n){var i=d2(t[n][0],r,n),a=d2(t[n][1],r,n);e[Oe[n]]=e[pr[n]]=NaN,i&&a&&(e[Oe[n]]=i.xy,e[pr[n]]=a.xy+a.wh-i.xy)}function Nd(e,t,r,n){return e[Oe[t]]=r,e[Oe[1-t]]=n,e}function $de(e){return e&&(e.type===wo.leaf||e.type===wo.nonLeaf)?e:null}function mx(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var IO=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=Yde(t);var n=r.get("data",!0);n!=null&&!re(n)&&(n=[]),n?this._initByDimModelData(n):this._initBySeriesData()}return e.prototype._initByDimModelData=function(t){var r=this,n=r._cells,i=r._levels,a=[],o=0;r._leavesCount=s(t,0,0),l();return;function s(u,c,h){var f=0;return u&&j(u,function(d,g){var m;he(d)?m={value:d}:ke(d)?(m=d,d.value!=null&&!he(d.value)&&(m={value:null})):m={value:null};var y={type:wo.nonLeaf,ordinal:NaN,level:h,firstLeafLocator:c,id:new Ne,span:Nd(new Ne,r.dimIdx,1,1),option:m,xy:NaN,wh:NaN,dim:r,rect:mx()};o++,(a[c]||(a[c]=[])).push(y),i[h]||(i[h]={type:wo.level,xy:NaN,wh:NaN,option:null,id:new Ne,dim:r});var x=s(m.children,c,h+1),_=Math.max(1,x);y.span[Oe[r.dimIdx]]=_,f+=_,c+=_}),f}function l(){for(var u=[];n.length=1,w=r[Oe[n]],S=a.getLocatorCount(n)-1,T=new Ws;for(o.resetLayoutIterator(T,n);T.next();)M(T.item);for(a.resetLayoutIterator(T,n);T.next();)M(T.item);function M(A){Xr(A.wh)&&(A.wh=x),A.xy=w,A.id[Oe[n]]===S&&!_&&(A.wh=r[Oe[n]]+r[pr[n]]-A.xy),w+=A.wh}}function BO(e,t){for(var r=t[Oe[e]].resetCellIterator();r.next();){var n=r.item;yx(n.rect,e,n.id,n.span,t),yx(n.rect,1-e,n.id,n.span,t),n.type===wo.nonLeaf&&(n.xy=n.rect[Oe[e]],n.wh=n.rect[pr[e]])}}function FO(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var i=r.spanRect,a=r.id;yx(i,0,a,n,t),yx(i,1,a,n,t)}})}function yx(e,t,r,n,i){e[pr[t]]=0;var a=r[Oe[t]],o=a<0?i[Oe[1-t]]:i[Oe[t]],s=o.getUnitLayoutInfo(t,r[Oe[t]]);if(e[Oe[t]]=s.xy,e[pr[t]]=s.wh,n[Oe[t]]>1){var l=o.getUnitLayoutInfo(t,r[Oe[t]]+n[Oe[t]]-1);e[pr[t]]=l.xy+l.wh-s.xy}}function sve(e,t,r){var n=P0(e,r[pr[t]]);return p2(n,r[pr[t]])}function p2(e,t){return Math.max(Math.min(e,be(t,1/0)),0)}function rS(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var $r={inBody:1,inCorner:2,outside:3},Ta={x:null,y:null,point:[]};function VO(e,t,r,n,i){var a=r[Oe[t]],o=r[Oe[1-t]],s=a.getUnitLayoutInfo(t,a.getLocatorCount(t)-1),l=a.getUnitLayoutInfo(t,0),u=o.getUnitLayoutInfo(t,-o.getLocatorCount(t)),c=o.shouldShow()?o.getUnitLayoutInfo(t,-1):null,h=e.point[t]=n[t];if(!l&&!c){e[Oe[t]]=$r.outside;return}if(i===Ro.body){l?(e[Oe[t]]=$r.inBody,h=ni(s.xy+s.wh,nr(l.xy,h)),e.point[t]=h):e[Oe[t]]=$r.outside;return}else if(i===Ro.corner){c?(e[Oe[t]]=$r.inCorner,h=ni(c.xy+c.wh,nr(u.xy,h)),e.point[t]=h):e[Oe[t]]=$r.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,d=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!i){e[Oe[t]]=$r.outside;return}h=g}e.point[t]=h,e[Oe[t]]=f<=h&&h<=g?$r.inBody:d<=h&&h<=f?$r.inCorner:$r.outside}function GO(e,t,r,n){var i=1-r;if(e[Oe[r]]!==$r.outside)for(n[Oe[r]].resetCellIterator(tS);tS.next();){var a=tS.item;if(HO(e.point[r],a.rect,r)&&HO(e.point[i],a.rect,i)){t[r]=a.ordinal,t[i]=a.id[Oe[i]];return}}}function WO(e,t,r,n){if(e[Oe[r]]!==$r.outside){var i=e[Oe[r]]===$r.inCorner?n[Oe[1-r]]:n[Oe[r]];for(i.resetLayoutIterator(ey,r);ey.next();)if(lve(e.point[r],ey.item)){t[r]=ey.item.id[Oe[r]];return}}}function lve(e,t){return t.xy<=e&&e<=t.xy+t.wh}function HO(e,t,r){return t[Oe[r]]<=e&&e<=t[Oe[r]]+t[pr[r]]}function uve(e){e.registerComponentModel(Jde),e.registerComponentView(nve),e.registerCoordinateSystem("matrix",ove)}function cve(e,t){var r=e.existing;if(t.id=e.keyInfo.id,!t.type&&r&&(t.type=r.type),t.parentId==null){var n=t.parentOption;n?t.parentId=n.id:r&&(t.parentId=r.parentId)}t.parentOption=null}function UO(e,t){var r;return j(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function hve(e,t,r){var n=Q({},r),i=e[t],a=r.$action||"merge";a==="merge"?i?(Ge(i,n,!0),Ka(i,n,{ignoreSize:!0}),A6(r,i),ty(r,i),ty(r,i,"shape"),ty(r,i,"style"),ty(r,i,"extra"),r.clipPath=i.clipPath):e[t]=n:a==="replace"?e[t]=n:a==="remove"&&i&&(e[t]=null)}var s8=["transition","enterFrom","leaveTo"],fve=s8.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function ty(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?s8:fve,i=0;i=0;c--){var h=i[c],f=br(h.id,null),d=f!=null?o.get(f):null;if(d){var g=d.parent,x=_i(g),_=g===a?{width:s,height:l}:{width:x.width,height:x.height},w={},S=C_(d,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!_i(d).isNew&&S){for(var T=h.transition,M={},A=0;A=0)?M[P]=I:d[P]=I}it(d,M,r,0)}else d.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(i){Gy(i,_i(i).option,n,r._lastGraphicModel)}),this._elMap=_e()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Mt);function g2(e){var t=ge(ZO,e)?ZO[e]:ip(e),r=new t({});return _i(r).type=e,r}function $O(e,t,r,n){var i=g2(r);return t.add(i),n.set(e,i),_i(i).id=e,_i(i).isNew=!0,i}function Gy(e,t,r,n){var i=e&&e.parent;i&&(e.type==="group"&&e.traverse(function(a){Gy(a,t,r,n)}),F_(e,t,n),r.removeKey(_i(e).id))}function YO(e,t,r,n){e.isGroup||j([["cursor",Ri.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(i){var a=i[0];ge(t,a)?e[a]=be(t[a],i[1]):e[a]==null&&(e[a]=i[1])}),j(Qe(t),function(i){if(i.indexOf("on")===0){var a=t[i];e[i]=we(a)?a:null}}),ge(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function gve(e){return e=Q({},e),j(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(S6),function(t){delete e[t]}),e}function mve(e,t,r){var n=De(e).eventData;!e.silent&&!e.ignore&&!n&&(n=De(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function yve(e){e.registerComponentModel(vve),e.registerComponentView(pve),e.registerPreprocessor(function(t){var r=t.graphic;re(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var XO=["x","y","radius","angle","single"],xve=["cartesian2d","polar","singleAxis"];function _ve(e){var t=e.get("coordinateSystem");return Ve(xve,t)>=0}function Ps(e){return e+"Axis"}function bve(e,t){var r=_e(),n=[],i=_e();e.eachComponent({mainType:"dataZoom",query:t},function(c){i.get(c.uid)||s(c)});var a;do a=!1,e.eachComponent("dataZoom",o);while(a);function o(c){!i.get(c.uid)&&l(c)&&(s(c),a=!0)}function s(c){i.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,d){var g=r.get(f);g&&g[d]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function l8(e){var t=e.ecModel,r={infoList:[],infoMap:_e()};return e.eachTargetAxis(function(n,i){var a=t.getComponent(Ps(n),i);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(a)}}}),r}var nS=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},e}(),Sp=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return t.prototype.init=function(r,n,i){var a=qO(r);this.settledOption=a,this.mergeDefaultAndTheme(r,i),this._doInit(a)},t.prototype.mergeOption=function(r){var n=qO(r);Ge(this.option,r,!0),Ge(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var i=this.settledOption;j([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(n[a[0]]=i[a[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=_e(),i=this._fillSpecifiedTargetAxis(n);i?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return j(XO,function(i){var a=this.getReferringComponents(Ps(i),Bq);if(a.specified){n=!0;var o=new nS;j(a.models,function(s){o.add(s.componentIndex)}),r.set(i,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var i=this.ecModel,a=!0;if(a){var o=n==="vertical"?"y":"x",s=i.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=i.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===n}});l(s,"single")}function l(u,c){var h=u[0];if(h){var f=new nS;if(f.add(h.componentIndex),r.set(c,f),a=!1,c==="x"||c==="y"){var d=h.getReferringComponents("grid",Ht).models[0];d&&j(u,function(g){h.componentIndex!==g.componentIndex&&d===g.getReferringComponents("grid",Ht).models[0]&&f.add(g.componentIndex)})}}}a&&j(XO,function(u){if(a){var c=i.findComponents({mainType:Ps(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new nS;h.add(c[0].componentIndex),r.set(u,h),a=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(r){var n=this._rangePropMode,i=this.get("rangeMode");j([["start","startValue"],["end","endValue"]],function(a,o){var s=r[a[0]]!=null,l=r[a[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":i?n[o]=i[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,i){r==null&&(r=this.ecModel.getComponent(Ps(n),i))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(i,a){j(i.indexList,function(o){r.call(n,a,o)})})},t.prototype.getAxisProxy=function(r,n){var i=this.getAxisModel(r,n);if(i)return i.__dzAxisProxy},t.prototype.getAxisModel=function(r,n){var i=this._targetAxisInfoMap.get(r);if(i&&i.indexMap[n])return this.ecModel.getComponent(Ps(r),n)},t.prototype.setRawRange=function(r){var n=this.option,i=this.settledOption;j([["start","startValue"],["end","endValue"]],function(a){(r[a[0]]!=null||r[a[1]]!=null)&&(n[a[0]]=i[a[0]]=r[a[0]],n[a[1]]=i[a[1]]=r[a[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;j(["start","startValue","end","endValue"],function(i){n[i]=r[i]})},t.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getDataPercentWindow()},t.prototype.getValueRange=function(r,n){if(r==null&&n==null){var i=this.findRepresentativeAxisProxy();if(i)return i.getDataValueWindow()}else return this.getAxisProxy(r,n).getDataValueWindow()},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return r.__dzAxisProxy;for(var n,i=this._targetAxisInfoMap.keys(),a=0;ao[1];if(w&&!S&&!T)return!0;w&&(y=!0),S&&(g=!0),T&&(m=!0)}return y&&g&&m})}else Uc(c,function(d){if(a==="empty")l.setData(u=u.map(d,function(m){return s(m)?m:NaN}));else{var g={};g[d]=o,u.selectRange(g)}});Uc(c,function(d){u.setApproximateExtent(o,d)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._dataExtent;Uc(["min","max"],function(i){var a=r.get(i+"Span"),o=r.get(i+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=ht(n[0]+o,n,[0,100],!0):a!=null&&(o=ht(a,[0,100],n,!0)-n[0]),t[i+"Span"]=a,t[i+"ValueSpan"]=o},this)},e.prototype._setAxisModel=function(){var t=this.getAxisModel(),r=this._percentWindow,n=this._valueWindow;if(r){var i=QM(n,[0,500]);i=Math.min(i,20);var a=t.axis.scale.rawExtentInfo;r[0]!==0&&a.setDeterminedMinMax("min",+n[0].toFixed(i)),r[1]!==100&&a.setDeterminedMinMax("max",+n[1].toFixed(i)),a.freeze()}},e}();function Tve(e,t,r){var n=[1/0,-1/0];Uc(r,function(o){Wre(n,o.getData(),t)});var i=e.getAxisModel(),a=sG(i.axis.scale,i,n).calculate();return[a.min,a.max]}var Mve={getTargetSeries:function(e){function t(i){e.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=e.getComponent(Ps(o),s);i(o,s,l,a)})})}t(function(i,a,o,s){o.__dzAxisProxy=null});var r=[];t(function(i,a,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new Cve(i,a,s,e),r.push(o.__dzAxisProxy))});var n=_e();return j(r,function(i){j(i.getTargetSeriesModels(),function(a){n.set(a.uid,a)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){r.eachTargetAxis(function(n,i){r.getAxisProxy(n,i).reset(r)}),r.eachTargetAxis(function(n,i){r.getAxisProxy(n,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var i=n.getDataPercentWindow(),a=n.getDataValueWindow();r.setCalculatedRange({start:i[0],end:i[1],startValue:a[0],endValue:a[1]})}})}};function Ave(e){e.registerAction("dataZoom",function(t,r){var n=bve(r,t);j(n,function(i){i.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var JO=!1;function hL(e){JO||(JO=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,Mve),Ave(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function kve(e){e.registerComponentModel(wve),e.registerComponentView(Sve),hL(e)}var Ci=function(){function e(){}return e}(),u8={};function Zc(e,t){u8[e]=t}function c8(e){return u8[e]}var Lve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var r=this.ecModel;j(this.option.feature,function(n,i){var a=c8(i);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(r)),Ge(n,a.defaultOption))})},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:K.color.accent50}},tooltip:{show:!1,position:"bottom"}},t}($e);function h8(e,t){var r=gf(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var i=new Ze({shape:{x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2],r:t.get("borderRadius")},style:n,silent:!0,z2:-1});return i}var Nve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){var o=this.group;if(o.removeAll(),!r.get("show"))return;var s=+r.get("itemSize"),l=r.get("orient")==="vertical",u=r.get("feature")||{},c=this._features||(this._features={}),h=[];j(u,function(_,w){h.push(w)}),new Zo(this._featureNames||[],h).add(f).update(f).remove(Fe(f,null)).execute(),this._featureNames=h;function f(_,w){var S=h[_],T=h[w],M=u[S],A=new qe(M,r,r.ecModel),P;if(a&&a.newTitle!=null&&a.featureName===S&&(M.title=a.newTitle),S&&!T){if(Pve(S))P={onclick:A.option.onclick,featureName:S};else{var I=c8(S);if(!I)return;P=new I}c[S]=P}else if(P=c[T],!P)return;P.uid=pf("toolbox-feature"),P.model=A,P.ecModel=n,P.api=i;var N=P instanceof Ci;if(!S&&T){N&&P.dispose&&P.dispose(n,i);return}if(!A.get("show")||N&&P.unusable){N&&P.remove&&P.remove(n,i);return}d(A,P,S),A.setIconStatus=function(D,O){var R=this.option,F=this.iconPaths;R.iconStatus=R.iconStatus||{},R.iconStatus[D]=O,F[D]&&(O==="emphasis"?Ho:Uo)(F[D])},P instanceof Ci&&P.render&&P.render(A,n,i,a)}function d(_,w,S){var T=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Ci&&w.getIcons?w.getIcons():_.get("icon"),P=_.get("title")||{},I,N;he(A)?(I={},I[S]=A):I=A,he(P)?(N={},N[S]=P):N=P;var D=_.iconPaths={};j(I,function(O,R){var F=df(O,{},{x:-s/2,y:-s/2,width:s,height:s});F.setStyle(T.getItemStyle());var H=F.ensureState("emphasis");H.style=M.getItemStyle();var W=new tt({style:{text:N[R],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:wA({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});F.setTextContent(W),Qo({el:F,componentModel:r,itemName:R,formatterParamsExtra:{title:N[R]}}),F.__title=N[R],F.on("mouseover",function(){var V=M.getItemStyle(),z=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";W.setStyle({fill:M.get("textFill")||V.fill||V.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),F.setTextConfig({position:M.get("textPosition")||z}),W.ignore=!r.get("showTitle"),i.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",R])!=="emphasis"&&i.leaveEmphasis(this),W.hide()}),(_.get(["iconStatus",R])==="emphasis"?Ho:Uo)(F),o.add(F),F.on("click",fe(w.onclick,w,n,i,R)),D[R]=F})}var g=Tr(r,i).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=It(m,g,y);wu(r.get("orient"),o,r.get("itemGap"),x.width,x.height),C_(o,m,g,y),o.add(h8(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),T=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!we(A)&&w){var P=A.style||(A.style={}),I=c_(w,tt.makeFont(P)),N=_.x+o.x,D=_.y+o.y+s,O=!1;D+I.height>i.getHeight()&&(T.position="top",O=!0);var R=O?-5-I.height:s+10;N+I.width/2>i.getWidth()?(T.position=["100%",R],P.align="right"):N-I.width/2<0&&(T.position=[0,R],P.align="left")}})},t.prototype.updateView=function(r,n,i,a){j(this._features,function(o){o instanceof Ci&&o.updateView&&o.updateView(o.model,n,i,a)})},t.prototype.remove=function(r,n){j(this._features,function(i){i instanceof Ci&&i.remove&&i.remove(r,n)}),this.group.removeAll()},t.prototype.dispose=function(r,n){j(this._features,function(i){i instanceof Ci&&i.dispose&&i.dispose(r,n)})},t.type="toolbox",t}(Mt);function Pve(e){return e.indexOf("my")===0}var Ive=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var i=this.model,a=i.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":i.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:i.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:i.get("connectedBackgroundColor"),excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")}),u=Je.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=a+"."+s,c.target="_blank",c.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var f=l.split(","),d=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];d&&(g=window.atob(g));var m=a+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,T=S.document;T.open("image/svg+xml","replace"),T.write(g),T.close(),S.focus(),T.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=i.get("lang"),A='',P=window.open();P.document.write(A),P.document.title=a}},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:K.color.neutral00,name:"",excludeComponents:["toolbox"],lang:r.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return n},t}(Ci),QO="__ec_magicType_stack__",Dve=[["line","bar"],["stack"]],Eve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var r=this.model,n=r.get("icon"),i={};return j(r.get("type"),function(a){n[a]&&(i[a]=n[a])}),i},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return n},t.prototype.onclick=function(r,n,i){var a=this.model,o=a.get(["seriesIndex",i]);if(e5[i]){var s={series:[]},l=function(h){var f=h.subType,d=h.id,g=e5[i](f,d,h,a);g&&(Ae(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(i==="line"||i==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,Ht).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var T=0;T<=S;T++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=i==="bar"}}};j(Dve,function(h){Ve(h,i)>=0&&j(h,function(f){a.setIconStatus(f,"normal")})}),a.setIconStatus(i,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=i;i==="stack"&&(u=Ge({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),a.get(["iconStatus",i])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Ci),e5={line:function(e,t,r,n){if(e==="bar")return Ge({id:t,type:"line",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(e,t,r,n){if(e==="line")return Ge({id:t,type:"bar",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(e,t,r,n){var i=r.get("stack")===QO;if(e==="line"||e==="bar")return n.setIconStatus("stack",i?"normal":"emphasis"),Ge({id:t,stack:i?"":QO},n.get(["option","stack"])||{},!0)}};pa({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var V_=new Array(60).join("-"),qh=" ";function jve(e){var t={},r=[],n=[];return e.eachRawSeries(function(i){var a=i.coordinateSystem;if(a&&(a.type==="cartesian2d"||a.type==="polar")){var o=a.getBaseAxis();if(o.type==="category"){var s=o.dim+"_"+o.index;t[s]||(t[s]={categoryAxis:o,valueAxis:a.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(i)}else r.push(i)}else r.push(i)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function Rve(e){var t=[];return j(e,function(r,n){var i=r.categoryAxis,a=r.valueAxis,o=a.dim,s=[" "].concat(ae(r.series,function(d){return d.name})),l=[i.model.getCategories()];j(r.series,function(d){var g=d.getRawData();l.push(d.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(qh)],c=0;c=0)return!0}var m2=new RegExp("["+qh+"]+","g");function Fve(e){for(var t=e.split(/\n+/g),r=xx(t.shift()).split(m2),n=[],i=ae(r,function(l){return{name:l,data:[]}}),a=0;a=0;a--){var o=r[a];if(o[i])break}if(a<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(s){var l=s.getPercentRange();r[0][i]={dataZoomId:i,start:l[0],end:l[1]}}}}),r.push(t)}function Zve(e){var t=fL(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return fH(r,function(i,a){for(var o=t.length-1;o>=0;o--)if(i=t[o][a],i){n[a]=i;break}}),n}function $ve(e){dH(e).snapshots=null}function Yve(e){return fL(e).length}function fL(e){var t=dH(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var Xve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){$ve(r),n.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(r){var n={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:r.getLocaleModel().get(["toolbox","restore","title"])};return n},t}(Ci);pa({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var qve=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],dL=function(){function e(t,r,n){var i=this;this._targetInfoList=[];var a=t5(r,t);j(Kve,function(o,s){(!n||!n.include||Ve(n.include,s)>=0)&&o(a,i._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,i,a){if((n.coordRanges||(n.coordRanges=[])).push(i),!n.coordRange){n.coordRange=i;var o=iS[n.brushType](0,a,i);n.__rangeOffset={offset:a5[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){j(t,function(i){var a=this.findTargetInfo(i,r);a&&a!==!0&&j(a.coordSyses,function(o){var s=iS[i.brushType](1,o,i.range,!0);n(i,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){j(t,function(n){var i=this.findTargetInfo(n,r);if(n.range=n.range||[],i&&i!==!0){n.panelId=i.panelId;var a=iS[n.brushType](0,i.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?a5[n.brushType](a.values,o.offset,Jve(a.xyMinMax,o.xyMinMax)):a.values}},this)},e.prototype.makePanelOpts=function(t,r){return ae(this._targetInfoList,function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:y8(i),isTargetByCursor:_8(i,t,n.coordSysModel),getLinearBrushOtherExtent:x8(i)}})},e.prototype.controlSeries=function(t,r,n){var i=this.findTargetInfo(t,n);return i===!0||i&&Ve(i.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,i=t5(r,t),a=0;ae[1]&&e.reverse(),e}function t5(e,t){return _h(e,t,{includeMainTypes:qve})}var Kve={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,i=e.gridModels,a=_e(),o={},s={};!r&&!n&&!i||(j(r,function(l){var u=l.axis.grid.model;a.set(u.id,u),o[u.id]=!0}),j(n,function(l){var u=l.axis.grid.model;a.set(u.id,u),s[u.id]=!0}),j(i,function(l){a.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),a.each(function(l){var u=l.coordinateSystem,c=[];j(u.getCartesians(),function(h,f){(Ve(r,h.getAxis("x").model)>=0||Ve(n,h.getAxis("y").model)>=0)&&c.push(h)}),t.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:n5.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){j(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:n5.geo})})}},r5=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,i=e.gridModel;return!i&&r&&(i=r.axis.grid.model),!i&&n&&(i=n.axis.grid.model),i&&i===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],n5={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Us(e)),t}},iS={lineX:Fe(i5,0),lineY:Fe(i5,1),rect:function(e,t,r,n){var i=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),a=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[y2([i[0],a[0]]),y2([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var i=[[1/0,-1/0],[1/0,-1/0]],a=ae(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return i[0][0]=Math.min(i[0][0],s[0]),i[1][0]=Math.min(i[1][0],s[1]),i[0][1]=Math.max(i[0][1],s[0]),i[1][1]=Math.max(i[1][1],s[1]),s});return{values:a,xyMinMax:i}}};function i5(e,t,r,n){var i=r.getAxis(["x","y"][e]),a=y2(ae([0,1],function(s){return t?i.coordToData(i.toLocalCoord(n[s]),!0):i.toGlobalCoord(i.dataToCoord(n[s]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var a5={lineX:Fe(o5,0),lineY:Fe(o5,1),rect:function(e,t,r){return[[e[0][0]-r[0]*t[0][0],e[0][1]-r[0]*t[0][1]],[e[1][0]-r[1]*t[1][0],e[1][1]-r[1]*t[1][1]]]},polygon:function(e,t,r){return ae(e,function(n,i){return[n[0]-r[0]*t[i][0],n[1]-r[1]*t[i][1]]})}};function o5(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function Jve(e,t){var r=s5(e),n=s5(t),i=[r[0]/n[0],r[1]/n[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function s5(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var x2=j,Qve=Eq("toolbox-dataZoom_"),epe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){this._brushController||(this._brushController=new zk(i.getZr()),this._brushController.on("brush",fe(this._onBrush,this)).mount()),npe(r,n,this,a,i),rpe(r,n)},t.prototype.onclick=function(r,n,i){tpe[i].call(this)},t.prototype.remove=function(r,n){this._brushController&&this._brushController.unmount()},t.prototype.dispose=function(r,n){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(r){var n=r.areas;if(!r.isEnd||!n.length)return;var i={},a=this.ecModel;this._brushController.updateCovers([]);var o=new dL(vL(this.model),a,{include:["grid"]});o.matchOutputRanges(n,a,function(u,c,h){if(h.type==="cartesian2d"){var f=u.brushType;f==="rect"?(s("x",h,c[0]),s("y",h,c[1])):s({lineX:"x",lineY:"y"}[f],h,c)}}),Uve(a,i),this._dispatchZoomAction(i);function s(u,c,h){var f=c.getAxis(u),d=f.model,g=l(u,d,a),m=g.findRepresentativeAxisProxy(d).getMinMaxSpan();(m.minValueSpan!=null||m.maxValueSpan!=null)&&(h=rl(0,h.slice(),f.scale.getExtent(),0,m.minValueSpan,m.maxValueSpan)),g&&(i[g.id]={dataZoomId:g.id,startValue:h[0],endValue:h[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(d){var g=d.getAxisModel(u,c.componentIndex);g&&(f=d)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];x2(r,function(i,a){n.push(Se(i))}),n.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:n})},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}};return n},t}(Ci),tpe={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(Zve(this.ecModel))}};function vL(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex="all"),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex="all"),t}function rpe(e,t){e.setIconStatus("back",Yve(t)>1?"emphasis":"normal")}function npe(e,t,r,n,i){var a=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(a=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=a,e.setIconStatus("zoom",a?"emphasis":"normal");var o=new dL(vL(e),t,{include:["grid"]}),s=o.makePanelOpts(i,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(a&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}pQ("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),i=[],a=vL(n),o=_h(e,a);x2(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),x2(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,f={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:Qve+u+h};f[c]=h,i.push(f)}return i});function ipe(e){e.registerComponentModel(Lve),e.registerComponentView(Nve),Zc("saveAsImage",Ive),Zc("magicType",Eve),Zc("dataView",Wve),Zc("dataZoom",epe),Zc("restore",Xve),He(kve)}var ape=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:K.color.borderShade,width:1,type:"dashed",textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}($e);function vH(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function pH(e){if(Je.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+i,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),d=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-h)/2)*100)/100;s+=";"+a+":-"+d+"px";var g=t+" solid "+i+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+g,"border-right:"+g,"background-color:"+n+";"];return'
'}function fpe(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",i="",a="";return r&&(i=" "+e/2+"s "+n,a="opacity"+i+",visibility"+i),t||(i=" "+e+"s "+n,a+=(a.length?",":"")+(Je.transformSupported?""+pL+i:",left"+i+",top"+i)),lpe+":"+a}function l5(e,t,r){var n=e.toFixed(0)+"px",i=t.toFixed(0)+"px";if(!Je.transformSupported)return r?"top:"+i+";left:"+n+";":[["top",i],["left",n]];var a=Je.transform3dSupported,o="translate"+(a?"3d":"")+"("+n+","+i+(a?",0":"")+")";return r?"top:0;left:0;"+pL+":"+o+";":[["top",0],["left",0],[gH,o]]}function dpe(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var i=be(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+i+"px");var a=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return a&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+a),j(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function vpe(e,t,r,n){var i=[],a=e.get("transitionDuration"),o=e.get("backgroundColor"),s=e.get("shadowBlur"),l=e.get("shadowColor"),u=e.get("shadowOffsetX"),c=e.get("shadowOffsetY"),h=e.getModel("textStyle"),f=aV(e,"html"),d=u+"px "+c+"px "+s+"px "+l;return i.push("box-shadow:"+d),t&&a>0&&i.push(fpe(a,r,n)),o&&i.push("background-color:"+o),j(["width","color","radius"],function(g){var m="border-"+g,y=jA(m),x=e.get(y);x!=null&&i.push(m+":"+x+(g==="color"?"":"px"))}),i.push(dpe(h)),f!=null&&i.push("padding:"+gf(f).join("px ")+"px"),i.join(";")+";"}function u5(e,t,r,n,i){var a=t&&t.painter;if(r){var o=a&&a.getViewportRoot();o&&QY(e,o,r,n,i)}else{e[0]=n,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var ppe=function(){function e(t,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,Je.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var i=this._zr=t.getZr(),a=r.appendTo,o=a&&(he(a)?document.querySelector(a):Eu(a)?a:we(a)&&a(t.getDom()));u5(this._styleCoord,i,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=i.handler,c=i.painter.getViewportRoot();mi(c,l,!0),u.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return e.prototype.update=function(t){if(!this._container){var r=this._api.getDom(),n=spe(r,"position"),i=r.style;i.position!=="absolute"&&n!=="absolute"&&(i.position="relative")}var a=t.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this._enableDisplayTransition=t.get("displayTransition")&&t.get("transitionDuration")>0,this.el.className=t.get("className")||""},e.prototype.show=function(t,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,a=this._styleCoord;n.innerHTML?i.cssText=upe+vpe(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+l5(a[0],a[1],!0)+("border-color:"+Vu(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,i,a){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(he(a)&&n.get("trigger")==="item"&&!vH(n)&&(s=hpe(n,i,a)),he(t))o.innerHTML=t+s;else if(t){o.innerHTML="",re(t)||(t=[t]);for(var l=0;l=0?this._tryShow(a,o):i==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,i=this._api,a=r.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!i.isDisposed()&&o.manuallyShowTip(r,n,i,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,i,a){if(!(a.from===this.uid||Je.node||!i.getDom())){var o=f5(a,i);this._ticket="";var s=a.dataByCoordSys,l=wpe(a,n,i);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var c=mpe;c.x=a.x,c.y=a.y,c.update(),De(c).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:c},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,i,a))return;var h=Q8(a,n),f=h.point[0],d=h.point[1];f!=null&&d!=null&&this._tryShow({offsetX:f,offsetY:d,target:h.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(i.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:i.getZr().findHover(a.x,a.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,i,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,a.from!==this.uid&&this._hide(f5(a,i))},t.prototype._manuallyAxisShowTip=function(r,n,i,a){var o=a.seriesIndex,s=a.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=n.getSeriesByIndex(o);if(u){var c=u.getData(),h=Id([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},t.prototype._tryShow=function(r,n){var i=r.target,a=this._tooltipModel;if(a){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(i){var s=De(i);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;vu(i,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(De(c).dataIndex!=null?l=c:De(c).tooltipConfig!=null&&(u=c))},!0),l?this._showSeriesItemTooltip(r,l,n):u?this._showComponentItemTooltip(r,u,n):this._hide(n)}else this._lastDataByCoordSys=null,this._hide(n)}},t.prototype._showOrMove=function(r,n){var i=r.get("showDelay");n=fe(n,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(n,i):n()},t.prototype._showAxisTooltip=function(r,n){var i=this._ecModel,a=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Id([n.tooltipOption],a),l=this._renderMode,u=[],c=gr("section",{blocks:[],noHeader:!0}),h=[],f=new Bb;j(r,function(_){j(_.dataByAxis,function(w){var S=i.getComponent(w.axisDim+"Axis",w.axisIndex),T=w.value;if(!(!S||T==null)){var M=X8(T,S.axis,i,w.seriesDataIndices,w.valueLabelOpt),A=gr("section",{header:M,noHeader:!Jn(M),sortBlocks:!0,blocks:[]});c.blocks.push(A),j(w.seriesDataIndices,function(P){var I=i.getSeriesByIndex(P.seriesIndex),N=P.dataIndexInside,D=I.getDataParams(N);if(!(D.dataIndex<0)){D.axisDim=w.axisDim,D.axisIndex=w.axisIndex,D.axisType=w.axisType,D.axisId=w.axisId,D.axisValue=q0(S.axis,{value:T}),D.axisValueLabel=M,D.marker=f.makeTooltipMarker("item",Vu(D.color),l);var O=kD(I.formatTooltip(N,!0,null)),R=O.frag;if(R){var F=Id([I],a).get("valueFormatter");A.blocks.push(F?Q({valueFormatter:F},R):R)}O.text&&h.push(O.text),u.push(D)}})}})}),c.blocks.reverse(),h.reverse();var d=n.position,g=s.get("order"),m=ED(c,f,l,g,i.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` +*`,"g")),n={series:[]};return j(r,function(i,a){if(Bve(i)){var o=Fve(i),s=t[a],l=s.axisDim+"Axis";s&&(n[l]=n[l]||[],n[l][s.axisIndex]={data:o.categories},n.series=n.series.concat(o.series))}else{var o=Vve(i);n.series.push(o)}}),n}var Wve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){setTimeout(function(){n.dispatchAction({type:"hideTip"})});var i=n.getDom(),a=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=a.get("backgroundColor")||K.color.neutral00;var s=document.createElement("h4"),l=a.get("lang")||[];s.innerHTML=l[0]||a.get("title"),s.style.cssText="margin:10px 20px",s.style.color=a.get("textColor");var u=document.createElement("div"),c=document.createElement("textarea");u.style.cssText="overflow:auto";var h=a.get("optionToContent"),f=a.get("contentToOption"),d=zve(r);if(we(h)){var g=h(n.getOption());he(g)?u.innerHTML=g:Eu(g)&&u.appendChild(g)}else{c.readOnly=a.get("readOnly");var m=c.style;m.cssText="display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none",m.color=a.get("textColor"),m.borderColor=a.get("textareaBorderColor"),m.backgroundColor=a.get("textareaColor"),c.value=d.value,u.appendChild(c)}var y=d.meta,x=document.createElement("div");x.style.cssText="position:absolute;bottom:5px;left:0;right:0";var _="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",w=document.createElement("div"),S=document.createElement("div");_+=";background-color:"+a.get("buttonColor"),_+=";color:"+a.get("buttonTextColor");var T=this;function M(){i.removeChild(o),T._dom=null}AC(w,"click",M),AC(S,"click",function(){if(f==null&&h!=null||f!=null&&h==null){M();return}var A;try{we(f)?A=f(u,n.getOption()):A=Gve(c.value,y)}catch(P){throw M(),new Error("Data view format error "+P)}A&&n.dispatchAction({type:"changeDataView",newOption:A}),M()}),w.innerHTML=l[1],S.innerHTML=l[2],S.style.cssText=w.style.cssText=_,!a.get("readOnly")&&x.appendChild(S),x.appendChild(w),o.appendChild(s),o.appendChild(u),o.appendChild(x),u.style.height=i.clientHeight-80+"px",i.appendChild(o),this._dom=o},t.prototype.remove=function(r,n){this._dom&&n.getDom().removeChild(this._dom)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.getDefaultOption=function(r){var n={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:r.getLocaleModel().get(["toolbox","dataView","title"]),lang:r.getLocaleModel().get(["toolbox","dataView","lang"]),backgroundColor:K.color.background,textColor:K.color.primary,textareaColor:K.color.background,textareaBorderColor:K.color.border,buttonColor:K.color.accent50,buttonTextColor:K.color.neutral00};return n},t}(Ci);function Hve(e,t){return ae(e,function(r,n){var i=t&&t[n];if(ke(i)&&!re(i)){var a=ke(r)&&!re(r);a||(r={value:r});var o=i.name!=null&&r.name==null;return r=Ae(r,i),o&&delete r.name,r}else return r})}pa({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(e,t){var r=[];j(e.newOption.series,function(n){var i=t.getSeriesByName(n.name)[0];if(!i)r.push(Q({type:"scatter"},n));else{var a=i.get("data");r.push({name:n.name,data:Hve(n.data,a)})}}),t.mergeOption(Ae({series:r},e.newOption))});var f8=j,d8=Ye();function Uve(e,t){var r=fL(e);f8(t,function(n,i){for(var a=r.length-1;a>=0;a--){var o=r[a];if(o[i])break}if(a<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(s){var l=s.getPercentRange();r[0][i]={dataZoomId:i,start:l[0],end:l[1]}}}}),r.push(t)}function Zve(e){var t=fL(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return f8(r,function(i,a){for(var o=t.length-1;o>=0;o--)if(i=t[o][a],i){n[a]=i;break}}),n}function $ve(e){d8(e).snapshots=null}function Yve(e){return fL(e).length}function fL(e){var t=d8(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var Xve=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){$ve(r),n.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(r){var n={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:r.getLocaleModel().get(["toolbox","restore","title"])};return n},t}(Ci);pa({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var qve=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],dL=function(){function e(t,r,n){var i=this;this._targetInfoList=[];var a=t5(r,t);j(Kve,function(o,s){(!n||!n.include||Ve(n.include,s)>=0)&&o(a,i._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,i,a){if((n.coordRanges||(n.coordRanges=[])).push(i),!n.coordRange){n.coordRange=i;var o=iS[n.brushType](0,a,i);n.__rangeOffset={offset:a5[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){j(t,function(i){var a=this.findTargetInfo(i,r);a&&a!==!0&&j(a.coordSyses,function(o){var s=iS[i.brushType](1,o,i.range,!0);n(i,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){j(t,function(n){var i=this.findTargetInfo(n,r);if(n.range=n.range||[],i&&i!==!0){n.panelId=i.panelId;var a=iS[n.brushType](0,i.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?a5[n.brushType](a.values,o.offset,Jve(a.xyMinMax,o.xyMinMax)):a.values}},this)},e.prototype.makePanelOpts=function(t,r){return ae(this._targetInfoList,function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:yH(i),isTargetByCursor:_H(i,t,n.coordSysModel),getLinearBrushOtherExtent:xH(i)}})},e.prototype.controlSeries=function(t,r,n){var i=this.findTargetInfo(t,n);return i===!0||i&&Ve(i.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,i=t5(r,t),a=0;ae[1]&&e.reverse(),e}function t5(e,t){return _h(e,t,{includeMainTypes:qve})}var Kve={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,i=e.gridModels,a=_e(),o={},s={};!r&&!n&&!i||(j(r,function(l){var u=l.axis.grid.model;a.set(u.id,u),o[u.id]=!0}),j(n,function(l){var u=l.axis.grid.model;a.set(u.id,u),s[u.id]=!0}),j(i,function(l){a.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),a.each(function(l){var u=l.coordinateSystem,c=[];j(u.getCartesians(),function(h,f){(Ve(r,h.getAxis("x").model)>=0||Ve(n,h.getAxis("y").model)>=0)&&c.push(h)}),t.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:n5.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){j(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:n5.geo})})}},r5=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,i=e.gridModel;return!i&&r&&(i=r.axis.grid.model),!i&&n&&(i=n.axis.grid.model),i&&i===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],n5={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Us(e)),t}},iS={lineX:Fe(i5,0),lineY:Fe(i5,1),rect:function(e,t,r,n){var i=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),a=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[y2([i[0],a[0]]),y2([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var i=[[1/0,-1/0],[1/0,-1/0]],a=ae(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return i[0][0]=Math.min(i[0][0],s[0]),i[1][0]=Math.min(i[1][0],s[1]),i[0][1]=Math.max(i[0][1],s[0]),i[1][1]=Math.max(i[1][1],s[1]),s});return{values:a,xyMinMax:i}}};function i5(e,t,r,n){var i=r.getAxis(["x","y"][e]),a=y2(ae([0,1],function(s){return t?i.coordToData(i.toLocalCoord(n[s]),!0):i.toGlobalCoord(i.dataToCoord(n[s]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var a5={lineX:Fe(o5,0),lineY:Fe(o5,1),rect:function(e,t,r){return[[e[0][0]-r[0]*t[0][0],e[0][1]-r[0]*t[0][1]],[e[1][0]-r[1]*t[1][0],e[1][1]-r[1]*t[1][1]]]},polygon:function(e,t,r){return ae(e,function(n,i){return[n[0]-r[0]*t[i][0],n[1]-r[1]*t[i][1]]})}};function o5(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function Jve(e,t){var r=s5(e),n=s5(t),i=[r[0]/n[0],r[1]/n[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function s5(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var x2=j,Qve=Eq("toolbox-dataZoom_"),epe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){this._brushController||(this._brushController=new zk(i.getZr()),this._brushController.on("brush",fe(this._onBrush,this)).mount()),npe(r,n,this,a,i),rpe(r,n)},t.prototype.onclick=function(r,n,i){tpe[i].call(this)},t.prototype.remove=function(r,n){this._brushController&&this._brushController.unmount()},t.prototype.dispose=function(r,n){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(r){var n=r.areas;if(!r.isEnd||!n.length)return;var i={},a=this.ecModel;this._brushController.updateCovers([]);var o=new dL(vL(this.model),a,{include:["grid"]});o.matchOutputRanges(n,a,function(u,c,h){if(h.type==="cartesian2d"){var f=u.brushType;f==="rect"?(s("x",h,c[0]),s("y",h,c[1])):s({lineX:"x",lineY:"y"}[f],h,c)}}),Uve(a,i),this._dispatchZoomAction(i);function s(u,c,h){var f=c.getAxis(u),d=f.model,g=l(u,d,a),m=g.findRepresentativeAxisProxy(d).getMinMaxSpan();(m.minValueSpan!=null||m.maxValueSpan!=null)&&(h=rl(0,h.slice(),f.scale.getExtent(),0,m.minValueSpan,m.maxValueSpan)),g&&(i[g.id]={dataZoomId:g.id,startValue:h[0],endValue:h[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(d){var g=d.getAxisModel(u,c.componentIndex);g&&(f=d)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];x2(r,function(i,a){n.push(Se(i))}),n.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:n})},t.getDefaultOption=function(r){var n={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:r.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}};return n},t}(Ci),tpe={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(Zve(this.ecModel))}};function vL(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex="all"),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex="all"),t}function rpe(e,t){e.setIconStatus("back",Yve(t)>1?"emphasis":"normal")}function npe(e,t,r,n,i){var a=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(a=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=a,e.setIconStatus("zoom",a?"emphasis":"normal");var o=new dL(vL(e),t,{include:["grid"]}),s=o.makePanelOpts(i,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(a&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}pQ("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),i=[],a=vL(n),o=_h(e,a);x2(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),x2(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,f={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:Qve+u+h};f[c]=h,i.push(f)}return i});function ipe(e){e.registerComponentModel(Lve),e.registerComponentView(Nve),Zc("saveAsImage",Ive),Zc("magicType",Eve),Zc("dataView",Wve),Zc("dataZoom",epe),Zc("restore",Xve),He(kve)}var ape=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:K.color.borderShade,width:1,type:"dashed",textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}($e);function v8(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function p8(e){if(Je.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+i,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),d=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-h)/2)*100)/100;s+=";"+a+":-"+d+"px";var g=t+" solid "+i+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+g,"border-right:"+g,"background-color:"+n+";"];return'
'}function fpe(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",i="",a="";return r&&(i=" "+e/2+"s "+n,a="opacity"+i+",visibility"+i),t||(i=" "+e+"s "+n,a+=(a.length?",":"")+(Je.transformSupported?""+pL+i:",left"+i+",top"+i)),lpe+":"+a}function l5(e,t,r){var n=e.toFixed(0)+"px",i=t.toFixed(0)+"px";if(!Je.transformSupported)return r?"top:"+i+";left:"+n+";":[["top",i],["left",n]];var a=Je.transform3dSupported,o="translate"+(a?"3d":"")+"("+n+","+i+(a?",0":"")+")";return r?"top:0;left:0;"+pL+":"+o+";":[["top",0],["left",0],[g8,o]]}function dpe(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var i=be(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+i+"px");var a=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return a&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+a),j(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function vpe(e,t,r,n){var i=[],a=e.get("transitionDuration"),o=e.get("backgroundColor"),s=e.get("shadowBlur"),l=e.get("shadowColor"),u=e.get("shadowOffsetX"),c=e.get("shadowOffsetY"),h=e.getModel("textStyle"),f=aV(e,"html"),d=u+"px "+c+"px "+s+"px "+l;return i.push("box-shadow:"+d),t&&a>0&&i.push(fpe(a,r,n)),o&&i.push("background-color:"+o),j(["width","color","radius"],function(g){var m="border-"+g,y=jA(m),x=e.get(y);x!=null&&i.push(m+":"+x+(g==="color"?"":"px"))}),i.push(dpe(h)),f!=null&&i.push("padding:"+gf(f).join("px ")+"px"),i.join(";")+";"}function u5(e,t,r,n,i){var a=t&&t.painter;if(r){var o=a&&a.getViewportRoot();o&&QY(e,o,r,n,i)}else{e[0]=n,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var ppe=function(){function e(t,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,Je.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var i=this._zr=t.getZr(),a=r.appendTo,o=a&&(he(a)?document.querySelector(a):Eu(a)?a:we(a)&&a(t.getDom()));u5(this._styleCoord,i,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=i.handler,c=i.painter.getViewportRoot();mi(c,l,!0),u.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return e.prototype.update=function(t){if(!this._container){var r=this._api.getDom(),n=spe(r,"position"),i=r.style;i.position!=="absolute"&&n!=="absolute"&&(i.position="relative")}var a=t.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this._enableDisplayTransition=t.get("displayTransition")&&t.get("transitionDuration")>0,this.el.className=t.get("className")||""},e.prototype.show=function(t,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,a=this._styleCoord;n.innerHTML?i.cssText=upe+vpe(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+l5(a[0],a[1],!0)+("border-color:"+Vu(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,i,a){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(he(a)&&n.get("trigger")==="item"&&!v8(n)&&(s=hpe(n,i,a)),he(t))o.innerHTML=t+s;else if(t){o.innerHTML="",re(t)||(t=[t]);for(var l=0;l=0?this._tryShow(a,o):i==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,i=this._api,a=r.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!i.isDisposed()&&o.manuallyShowTip(r,n,i,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,i,a){if(!(a.from===this.uid||Je.node||!i.getDom())){var o=f5(a,i);this._ticket="";var s=a.dataByCoordSys,l=wpe(a,n,i);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var c=mpe;c.x=a.x,c.y=a.y,c.update(),De(c).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:c},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,i,a))return;var h=QH(a,n),f=h.point[0],d=h.point[1];f!=null&&d!=null&&this._tryShow({offsetX:f,offsetY:d,target:h.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(i.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:i.getZr().findHover(a.x,a.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,i,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,a.from!==this.uid&&this._hide(f5(a,i))},t.prototype._manuallyAxisShowTip=function(r,n,i,a){var o=a.seriesIndex,s=a.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=n.getSeriesByIndex(o);if(u){var c=u.getData(),h=Id([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},t.prototype._tryShow=function(r,n){var i=r.target,a=this._tooltipModel;if(a){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(i){var s=De(i);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;vu(i,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(De(c).dataIndex!=null?l=c:De(c).tooltipConfig!=null&&(u=c))},!0),l?this._showSeriesItemTooltip(r,l,n):u?this._showComponentItemTooltip(r,u,n):this._hide(n)}else this._lastDataByCoordSys=null,this._hide(n)}},t.prototype._showOrMove=function(r,n){var i=r.get("showDelay");n=fe(n,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(n,i):n()},t.prototype._showAxisTooltip=function(r,n){var i=this._ecModel,a=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Id([n.tooltipOption],a),l=this._renderMode,u=[],c=gr("section",{blocks:[],noHeader:!0}),h=[],f=new Bb;j(r,function(_){j(_.dataByAxis,function(w){var S=i.getComponent(w.axisDim+"Axis",w.axisIndex),T=w.value;if(!(!S||T==null)){var M=XH(T,S.axis,i,w.seriesDataIndices,w.valueLabelOpt),A=gr("section",{header:M,noHeader:!Jn(M),sortBlocks:!0,blocks:[]});c.blocks.push(A),j(w.seriesDataIndices,function(P){var I=i.getSeriesByIndex(P.seriesIndex),N=P.dataIndexInside,D=I.getDataParams(N);if(!(D.dataIndex<0)){D.axisDim=w.axisDim,D.axisIndex=w.axisIndex,D.axisType=w.axisType,D.axisId=w.axisId,D.axisValue=q0(S.axis,{value:T}),D.axisValueLabel=M,D.marker=f.makeTooltipMarker("item",Vu(D.color),l);var O=kD(I.formatTooltip(N,!0,null)),R=O.frag;if(R){var F=Id([I],a).get("valueFormatter");A.blocks.push(F?Q({valueFormatter:F},R):R)}O.text&&h.push(O.text),u.push(D)}})}})}),c.blocks.reverse(),h.reverse();var d=n.position,g=s.get("order"),m=ED(c,f,l,g,i.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` -`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,d,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],d,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,i){var a=this._ecModel,o=De(n),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),d=this._renderMode,g=r.positionDefault,m=Id([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new Bb;x.marker=_.makeTooltipMarker("item",Vu(x.color),d);var w=kD(u.formatTooltip(c,!1,h)),S=m.get("order"),T=m.get("valueFormatter"),M=w.frag,A=M?ED(T?Q({valueFormatter:T},M):M,_,d,S,a.get("useUTC"),m.get("textStyle")):w.text,P="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,P,r.offsetX,r.offsetY,r.position,r.target,_)}),i({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,i){var a=this._renderMode==="html",o=De(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(he(l)){var c=l;l={content:c,formatter:c},u=!0}u&&a&&l.content&&(l=Se(l),l.content=hn(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var d=r.positionDefault,g=Id(h,this._tooltipModel,d?{position:d}:null),m=g.get("content"),y=Math.random()+"",x=new Bb;this._showOrMove(g,function(){var _=Se(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),i({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,i,a,o,s,l,u,c){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var f=r.get("formatter");l=l||r.get("position");var d=n,g=this._getNearestPoint([o,s],i,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(he(f)){var y=r.ecModel.get("useUTC"),x=re(i)?i[0]:i,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;d=f,_&&(d=Zp(x.axisValue,d,y)),d=RA(d,i,!0)}else if(we(f)){var w=fe(function(S,T){S===this._ticket&&(h.setContent(T,c,r,m,l),this._updatePosition(r,l,o,s,h,i,u))},this);this._ticket=a,d=f(i,a,w)}else d=f;h.setContent(d,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,i,u)}},t.prototype._getNearestPoint=function(r,n,i,a,o){if(i==="axis"||re(n))return{color:a||o};if(!re(n))return{color:a||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,i,a,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||r.get("position");var h=o.getSize(),f=r.get("align"),d=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),we(n)&&(n=n([i,a],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),re(n))i=ce(n[0],u),a=ce(n[1],c);else if(ke(n)){var m=n;m.width=h[0],m.height=h[1];var y=It(m,{width:u,height:c});i=y.x,a=y.y,f=null,d=null}else if(he(n)&&l){var x=bpe(n,g,h,r.get("borderWidth"));i=x[0],a=x[1]}else{var x=xpe(i,a,o,u,c,f?null:20,d?null:20);i=x[0],a=x[1]}if(f&&(i-=d5(f)?h[0]/2:f==="right"?h[0]:0),d&&(a-=d5(d)?h[1]/2:d==="bottom"?h[1]:0),vH(r)){var x=_pe(i,a,o,u,c);i=x[0],a=x[1]}o.moveTo(i,a)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var i=this._lastDataByCoordSys,a=this._cbParamsList,o=!!i&&i.length===r.length;return o&&j(i,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&j(u,function(f,d){var g=h[d]||{},m=f.seriesDataIndices||[],y=g.seriesDataIndices||[];o=o&&f.value===g.value&&f.axisType===g.axisType&&f.axisId===g.axisId&&m.length===y.length,o&&j(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),a&&j(f.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=a[_];w&&S&&S.data!==w.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},t.prototype._hide=function(r){this._lastDataByCoordSys=null,r({type:"hideTip",from:this.uid})},t.prototype.dispose=function(r,n){Je.node||!n.getDom()||(lp(this,"_updatePosition"),this._tooltipContent.dispose(),h2("itemTooltip",n))},t.type="tooltip",t}(Mt);function Id(e,t,r){var n=t.ecModel,i;r?(i=new qe(r,n,n),i=new qe(t.option,i,n)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof qe&&(o=o.get("tooltip",!0)),he(o)&&(o={formatter:o}),o&&(i=new qe(o,i,n)))}return i}function f5(e,t){return e.dispatchAction||fe(t.dispatchAction,t)}function xpe(e,t,r,n,i,a,o){var s=r.getSize(),l=s[0],u=s[1];return a!=null&&(e+l+a+2>n?e-=l+a:e+=a),o!=null&&(t+u+o>i?t-=u+o:t+=o),[e,t]}function _pe(e,t,r,n,i){var a=r.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function bpe(e,t,r,n){var i=r[0],a=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=t.width,c=t.height;switch(e){case"inside":s=t.x+u/2-i/2,l=t.y+c/2-a/2;break;case"top":s=t.x+u/2-i/2,l=t.y-a-o;break;case"bottom":s=t.x+u/2-i/2,l=t.y+c+o;break;case"left":s=t.x-i-o,l=t.y+c/2-a/2;break;case"right":s=t.x+u+o,l=t.y+c/2-a/2}return[s,l]}function d5(e){return e==="center"||e==="middle"}function wpe(e,t,r){var n=iA(e).queryOptionMap,i=n.keys()[0];if(!(!i||i==="series")){var a=lf(t,i,n.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=De(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:i,componentIndex:o.componentIndex,el:l}}}}function Spe(e){He(tg),e.registerComponentModel(ape),e.registerComponentView(ype),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},qt),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},qt)}var Cpe=["rect","polygon","keep","clear"];function Tpe(e,t){var r=Tt(e?e.brush:[]);if(r.length){var n=[];j(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var i=e&&e.toolbox;re(i)&&(i=i[0]),i||(i={feature:{}},e.toolbox=[i]);var a=i.feature||(i.feature={}),o=a.brush||(a.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),Mpe(s),t&&!s.length&&s.push.apply(s,Cpe)}}function Mpe(e){var t={};j(e,function(r){t[r]=1}),e.length=0,j(t,function(r,n){e.push(n)})}var v5=j;function p5(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function _2(e,t,r){var n={};return v5(t,function(a){var o=n[a]=i();v5(e[a],function(s,l){if(Ir.isValidType(l)){var u={type:l,visual:s};r&&r(u,a),o[l]=new Ir(u),l==="opacity"&&(u=Se(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Ir(u))}})}),n;function i(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function yH(e,t,r){var n;j(r,function(i){t.hasOwnProperty(i)&&p5(t[i])&&(n=!0)}),n&&j(r,function(i){t.hasOwnProperty(i)&&p5(t[i])?e[i]=Se(t[i]):delete e[i]})}function Ape(e,t,r,n,i,a){var o={};j(e,function(h){var f=Ir.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return ZA(r,s,h)}function u(h,f){pV(r,s,h,f)}r.each(c);function c(h,f){s=h;var d=r.getRawDataItem(s);if(!(d&&d.visualMap===!1))for(var g=n.call(i,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function kpe(e,t,r,n){var i={};return j(e,function(a){var o=Ir.prepareVisualTypes(t[a]);i[a]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(T){return ZA(s,h,T)}function c(T,M){pV(s,h,T,M)}for(var h,f=s.getStore();(h=o.next())!=null;){var d=s.getRawDataItem(h);if(!(d&&d.visualMap===!1))for(var g=n!=null?f.get(l,h):h,m=r(g),y=t[m],x=i[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=a[0]),a[1]t[1][1]&&(t[1][1]=a[1])}return t&&_5(t)}};function _5(e){return new Pe(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var jpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n,this.model,(this._brushController=new zk(n.getZr())).on("brush",fe(this._onBrush,this)).mount()},t.prototype.render=function(r,n,i,a){this.model=r,this._updateController(r,n,i,a)},t.prototype.updateTransform=function(r,n,i,a){xH(n),this._updateController(r,n,i,a)},t.prototype.updateVisual=function(r,n,i,a){this.updateTransform(r,n,i,a)},t.prototype.updateView=function(r,n,i,a){this._updateController(r,n,i,a)},t.prototype._updateController=function(r,n,i,a){(!a||a.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(i)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,i=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:Se(i),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:Se(i),$from:n})},t.type="brush",t}(Mt),Rpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.areas=[],r.brushOption={},r}return t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&yH(i,r,["inBrush","outOfBrush"]);var a=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:this.option.defaultOutOfBrushColor},a.hasOwnProperty("liftZ")||(a.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=ae(r,function(n){return b5(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=b5(this.option,r),this.brushType=this.brushOption.brushType},t.type="brush",t.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],t.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}($e);function b5(e,t){return Ge({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new qe(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var Ope=["rect","polygon","lineX","lineY","keep","clear"],zpe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i){var a,o,s;n.eachComponent({mainType:"brush"},function(l){a=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=a,this._brushMode=o,j(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===a)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,i){this.render(r,n,i)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),i={};return j(r.get("type",!0),function(a){n[a]&&(i[a]=n[a])}),i},t.prototype.onclick=function(r,n,i){var a=this._brushType,o=this._brushMode;i==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:i==="keep"?a:a===i?!1:i,brushMode:i==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:Ope.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:r.getLocaleModel().get(["toolbox","brush","title"])};return n},t}(Ci);function Bpe(e){e.registerComponentView(jpe),e.registerComponentModel(Rpe),e.registerPreprocessor(Tpe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Npe),e.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(t,r){r.eachComponent({mainType:"brush",query:t},function(n){n.setAreas(t.areas)})}),e.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},qt),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},qt),Zc("brush",zpe)}var Fpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode={type:"box",ignoreSize:!0},r}return t.type="title",t.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:K.size.m,backgroundColor:K.color.transparent,borderColor:K.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:K.color.primary},subtextStyle:{fontSize:12,color:K.color.quaternary}},t}($e),Vpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this.group.removeAll(),!!r.get("show")){var a=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=be(r.get("textBaseline"),r.get("textVerticalAlign")),c=new tt({style:Ct(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),d=new tt({style:Ct(s,{text:f,fill:s.getTextColor(),y:h.height+r.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=r.get("link"),m=r.get("sublink"),y=r.get("triggerEvent",!0);c.silent=!g&&!y,d.silent=!m&&!y,g&&c.on("click",function(){B0(g,"_"+r.get("target"))}),m&&d.on("click",function(){B0(m,"_"+r.get("subtarget"))}),De(c).eventData=De(d).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,a.add(c),f&&a.add(d);var x=a.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=Tr(r,i),S=It(_,w.refContainer,r.get("padding"));l||(l=r.get("left")||r.get("right"),l==="middle"&&(l="center"),l==="right"?S.x+=S.width:l==="center"&&(S.x+=S.width/2)),u||(u=r.get("top")||r.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?S.y+=S.height:u==="middle"&&(S.y+=S.height/2),u=u||"top"),a.x=S.x,a.y=S.y,a.markRedraw();var T={align:l,verticalAlign:u};c.setStyle(T),d.setStyle(T),x=a.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var P=new Ze({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});a.add(P)}},t.type="title",t}(Mt);function Gpe(e){e.registerComponentModel(Fpe),e.registerComponentView(Vpe)}var w5=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode="box",r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i),this._initData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(r){r==null&&(r=this.option.currentIndex);var n=this._data.count();this.option.loop?r=(r%n+n)%n:(r>=n&&(r=n-1),r<0&&(r=0)),this.option.currentIndex=r},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(r){this.option.autoPlay=!!r},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var r=this.option,n=r.data||[],i=r.axisType,a=this._names=[],o;i==="category"?(o=[],j(n,function(u,c){var h=br(sf(u),""),f;ke(u)?(f=Se(u),f.value=c):f=c,o.push(f),a.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[i]||"number",l=this._data=new dn([{name:"value",type:s}],this);l.initData(o,a)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:K.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:K.color.secondary},data:[]},t}($e),_H=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline.slider",t.defaultOption=fl(w5.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:K.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:K.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:K.color.tertiary},itemStyle:{color:K.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:K.color.accent60},itemStyle:{color:K.color.accent60,borderColor:K.color.accent60},controlStyle:{color:K.color.accent70,borderColor:K.color.accent70}},progress:{lineStyle:{color:K.color.accent30},itemStyle:{color:K.color.accent40}},data:[]}),t}(w5);Qt(_H,M_.prototype);var Wpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Mt),Hpe=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this,r,n,i)||this;return o.type=a||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Vi),oS=Math.PI,S5=Ye(),Upe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.api=n},t.prototype.render=function(r,n,i){if(this.model=r,this.api=i,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var a=this._layout(r,i),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(a,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return gr("nameValue",{noName:!0,value:c})},j(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](a,o,l,r)},this),this._renderAxisLabel(a,s,l,r),this._position(a,r)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(r,n){var i=r.get(["label","position"]),a=r.get("orient"),o=$pe(r,n),s;i==null||i==="auto"?s=a==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:oS/2},h=a==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),d=f.get("show",!0),g=d?f.get("itemSize"):0,m=d?f.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*oS/180;var _,w,S,T=f.get("position",!0),M=d&&f.get("showPlayBtn",!0),A=d&&f.get("showPrevBtn",!0),P=d&&f.get("showNextBtn",!0),I=0,N=h;T==="left"||T==="bottom"?(M&&(_=[0,0],I+=y),A&&(w=[I,0],I+=y),P&&(S=[N-g,0],N-=y)):(M&&(_=[N-g,0],N-=y),A&&(w=[0,0],I+=y),P&&(S=[N-g,0],N-=y));var D=[I,N];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:a,rotation:c[a],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[a],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[a],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var i=this._mainGroup,a=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=Pr(),l=o.x,u=o.y+o.height;ha(s,s,[-l,-u]),Ko(s,s,-oS/2),ha(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(i.getBoundingRect()),f=_(a.getBoundingRect()),d=[i.x,i.y],g=[a.x,a.y];g[0]=d[0]=c[0][0];var m=r.labelPosOpt;if(m==null||he(m)){var y=m==="+"?0:1;w(d,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(d,h,c,1,y),g[1]=d[1]+m}i.setPosition(d),a.setPosition(g),i.rotation=a.rotation=r.rotation,x(i),x(a);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,T,M,A,P){S[A]+=M[A][P]-T[A][P]}},t.prototype._createAxis=function(r,n){var i=n.getData(),a=n.get("axisType"),o=Zpe(n,a);o.getTicks=function(){return i.mapArray(["value"],function(u){return{value:u}})};var s=i.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new Hpe("value",o,r.axisExtent,a);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new Ce;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,i,a){var o=i.getExtent();if(a.get(["lineStyle","show"])){var s=new ar({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:Q({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new ar({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ae({lineCap:"round",lineWidth:s.style.lineWidth},a.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,i,a){var o=this,s=a.getData(),l=i.scale.getTicks();this._tickSymbols=[],j(l,function(u){var c=i.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),d=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:fe(o._changeTimeline,o,u.value)},y=C5(h,f,n,m);y.ensureState("emphasis").style=d.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),Hs(y);var x=De(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=a):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,i,a){var o=this,s=i.getLabelModel();if(s.get("show")){var l=a.getData(),u=i.getViewLabels();this._tickLabels=[],j(u,function(c){var h=c.tickValue,f=l.getItemModel(h),d=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=i.dataToCoord(c.tickValue),x=new tt({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:fe(o._changeTimeline,o,h),silent:!1,style:Ct(d,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=Ct(g),x.ensureState("progress").style=Ct(m),n.add(x),Hs(x),S5(x).dataIndex=h,o._tickLabels.push(x)})}},t.prototype._renderControl=function(r,n,i,a){var o=r.controlSize,s=r.rotation,l=a.getModel("controlStyle").getItemStyle(),u=a.getModel(["emphasis","controlStyle"]).getItemStyle(),c=a.getPlayState(),h=a.get("inverse",!0);f(r.nextBtnPosition,"next",fe(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",fe(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",fe(this._handlePlayClick,this,!c),!0);function f(d,g,m,y){if(d){var x=fa(be(a.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=Ype(a,g+"Icon",_,{x:d[0],y:d[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),Hs(w)}}},t.prototype._renderCurrentPointer=function(r,n,i,a){var o=a.getData(),s=a.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=fe(u._handlePointerDrag,u),h.ondragend=fe(u._handlePointerDragend,u),T5(h,u._progressLine,s,i,a,!0)},onUpdate:function(h){T5(h,u._progressLine,s,i,a)}};this._currentPointer=C5(l,l,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(r){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:r,from:this.uid})},t.prototype._handlePointerDrag=function(r,n,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var i=this._toAxisCoord(r)[0],a=this._axis,o=Qn(a.getExtent().slice());i>o[1]&&(i=o[1]),i=0&&(s[o]=+s[o].toFixed(g)),[s,d]}var ay={min:Fe(iy,"min"),max:Fe(iy,"max"),average:Fe(iy,"average"),median:Fe(iy,"median")};function Cp(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,i=n&&n.dimensions;if(!ege(t)&&!re(t.coord)&&re(i)){var a=bH(t,r,n,e);if(t=Se(t),t.type&&ay[t.type]&&a.baseAxis&&a.valueAxis){var o=Ve(i,a.baseAxis.dim),s=Ve(i,a.valueAxis.dim),l=ay[t.type](r,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!re(i)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ay[t.type]){var c=n.getOtherAxis(u);c&&(t.value=_x(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)ay[h[f]]&&(h[f]=_x(r,r.mapDimension(i[f]),h[f]));return t}}function bH(e,t,r,n){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,i.valueAxis=r.getAxis(tge(n,i.valueDataDim)),i.baseAxis=r.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=n.getBaseAxis(),i.valueAxis=r.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function tge(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Tp(e,t){return e&&e.containData&&t.coord&&!w2(t)?e.containData(t.coord):!0}function rge(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!w2(t)&&!w2(r)?e.containZone(t.coord,r.coord):!0}function wH(e,t){return e?function(r,n,i,a){var o=a<2?r.coord&&r.coord[a]:r.value;return $s(o,t[a])}:function(r,n,i,a){return $s(r.value,t[a])}}function _x(e,t,r){if(r==="average"){var n=0,i=0;return e.each(t,function(a,o){isNaN(a)||(n+=a,i++)}),n/i}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var sS=Ye(),mL=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){this.markerGroupMap=_e()},t.prototype.render=function(r,n,i){var a=this,o=this.markerGroupMap;o.each(function(s){sS(s).keep=!1}),n.eachSeries(function(s){var l=Qa.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,n,i)}),o.each(function(s){!sS(s).keep&&a.group.remove(s.group)}),nge(n,o,this.type)},t.prototype.markKeep=function(r){sS(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var i=this;j(r,function(a){var o=Qa.getMarkerModelFromSeries(a,i.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?OF(l):fA(l))})}})},t.type="marker",t}(Mt);function nge(e,t,r){e.eachSeries(function(n){var i=Qa.getMarkerModelFromSeries(n,r),a=t.get(n.id);if(i&&a&&a.group){var o=Fu(i),s=o.z,l=o.zlevel;w_(a.group,s,l)}})}function A5(e,t,r){var n=t.coordinateSystem,i=r.getWidth(),a=r.getHeight(),o=n&&n.getArea&&n.getArea();e.each(function(s){var l=e.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:i,h=u?o?o.height:0:a,f=u&&o?o.x:0,d=u&&o?o.y:0,g,m=ce(l.get("x"),c)+f,y=ce(l.get("y"),h)+d;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=e.get(n.dimensions[1],s);g=n.dataToPoint([x,_])}isNaN(m)||(g[0]=m),isNaN(y)||(g[1]=y),e.setItemLayout(s,g)})}var ige=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markPoint");o&&(A5(o.getData(),a,i),this.markerGroupMap.get(a.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Kp),h=age(o,r,n);n.setData(h),A5(n.getData(),r,a),h.each(function(f){var d=h.getItemModel(f),g=d.getShallow("symbol"),m=d.getShallow("symbolSize"),y=d.getShallow("symbolRotate"),x=d.getShallow("symbolOffset"),_=d.getShallow("symbolKeepAspect");if(we(g)||we(m)||we(y)||we(x)){var w=n.getRawValue(f),S=n.getDataParams(f);we(g)&&(g=g(w,S)),we(m)&&(m=m(w,S)),we(y)&&(y=y(w,S)),we(x)&&(x=x(w,S))}var T=d.getModel("itemStyle").getItemStyle(),M=d.get("z2"),A=Yp(l,"color");T.fill||(T.fill=A),h.setItemVisual(f,{z2:be(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:T})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(d){De(d).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(mL);function age(e,t,r){var n;e?n=ae(e&&e.dimensions,function(s){var l=t.getData().getDimensionInfo(t.getData().mapDimension(s))||{};return Q(Q({},l),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new dn(n,r),a=ae(r.get("data"),Fe(Cp,t));e&&(a=ot(a,Fe(Tp,e)));var o=wH(!!e,n);return i.initData(a,null,o),i}function oge(e){e.registerComponentModel(Qpe),e.registerComponentView(ige),e.registerPreprocessor(function(t){gL(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var sge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Qa),oy=Ye(),lge=function(e,t,r,n){var i=e.getData(),a;if(re(n))a=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=t.getAxis(n.yAxis!=null?"y":"x"),l=Fr(n.yAxis,n.xAxis);else{var u=bH(n,i,t,e);s=u.valueAxis;var c=ak(i,u.valueDataDim);l=_x(i,c,o)}var h=s.dim==="x"?0:1,f=1-h,d=Se(n),g={coord:[]};d.type=null,d.coord=[],d.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&rt(l)&&(l=+l.toFixed(Math.min(m,20))),d.coord[h]=g.coord[h]=l,a=[d,g,{type:o,valueIndex:n.valueIndex,value:l}]}else a=[]}var y=[Cp(e,a[0]),Cp(e,a[1]),Q({},a[2])];return y[2].type=y[2].type||null,Ge(y[2],y[0]),Ge(y[2],y[1]),y};function bx(e){return!isNaN(e)&&!isFinite(e)}function k5(e,t,r,n){var i=1-e,a=n.dimensions[e];return bx(t[i])&&bx(r[i])&&t[e]===r[e]&&n.getAxis(a).containData(t[e])}function uge(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(k5(1,r,n,e)||k5(0,r,n,e)))return!0}return Tp(e,t[0])&&Tp(e,t[1])}function lS(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=ce(o.get("x"),i.getWidth()),u=ce(o.get("y"),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=a.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=a.dataToPoint([h,f])}if(tl(a,"cartesian2d")){var d=a.getAxis("x"),g=a.getAxis("y"),c=a.dimensions;bx(e.get(c[0],t))?s[0]=d.toGlobalCoord(d.getExtent()[r?0:1]):bx(e.get(c[1],t))&&(s[1]=g.toGlobalCoord(g.getExtent()[r?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}e.setItemLayout(t,s)}var cge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=oy(o).from,u=oy(o).to;l.each(function(c){lS(l,c,!0,a,i),lS(u,c,!1,a,i)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Rk);this.group.add(c.group);var h=hge(o,r,n),f=h.from,d=h.to,g=h.line;oy(n).from=f,oy(n).to=d,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");re(m)||(m=[m,m]),re(y)||(y=[y,y]),re(x)||(x=[x,x]),re(_)||(_=[_,_]),h.from.each(function(S){w(f,S,!0),w(d,S,!1)}),g.each(function(S){var T=g.getItemModel(S),M=T.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),d.getItemLayout(S)]);var A=T.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:be(A,0),fromSymbolKeepAspect:f.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:f.getItemVisual(S,"symbolOffset"),fromSymbolRotate:f.getItemVisual(S,"symbolRotate"),fromSymbolSize:f.getItemVisual(S,"symbolSize"),fromSymbol:f.getItemVisual(S,"symbol"),toSymbolKeepAspect:d.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:d.getItemVisual(S,"symbolOffset"),toSymbolRotate:d.getItemVisual(S,"symbolRotate"),toSymbolSize:d.getItemVisual(S,"symbolSize"),toSymbol:d.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){De(S).dataModel=n,S.traverse(function(T){De(T).dataModel=n})});function w(S,T,M){var A=S.getItemModel(T);lS(S,T,M,r,a);var P=A.getModel("itemStyle").getItemStyle();P.fill==null&&(P.fill=Yp(l,"color")),S.setItemVisual(T,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:be(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:be(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:be(A.get("symbolSize"),y[M?0:1]),symbol:be(A.get("symbol",!0),m[M?0:1]),style:P})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(mL);function hge(e,t,r){var n;e?n=ae(e&&e.dimensions,function(u){var c=t.getData().getDimensionInfo(t.getData().mapDimension(u))||{};return Q(Q({},c),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new dn(n,r),a=new dn(n,r),o=new dn([],r),s=ae(r.get("data"),Fe(lge,t,e,r));e&&(s=ot(s,Fe(uge,e)));var l=wH(!!e,n);return i.initData(ae(s,function(u){return u[0]}),null,l),a.initData(ae(s,function(u){return u[1]}),null,l),o.initData(ae(s,function(u){return u[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function fge(e){e.registerComponentModel(sge),e.registerComponentView(cge),e.registerPreprocessor(function(t){gL(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var dge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},t}(Qa),sy=Ye(),vge=function(e,t,r,n){var i=n[0],a=n[1];if(!(!i||!a)){var o=Cp(e,i),s=Cp(e,a),l=o.coord,u=s.coord;l[0]=Fr(l[0],-1/0),l[1]=Fr(l[1],-1/0),u[0]=Fr(u[0],1/0),u[1]=Fr(u[1],1/0);var c=a_([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function Sx(e){return!isNaN(e)&&!isFinite(e)}function L5(e,t,r,n){var i=1-e;return Sx(t[i])&&Sx(r[i])}function pge(e,t){var r=t.coord[0],n=t.coord[1],i={coord:r,x:t.x0,y:t.y0},a={coord:n,x:t.x1,y:t.y1};return tl(e,"cartesian2d")?r&&n&&(L5(1,r,n)||L5(0,r,n))?!0:rge(e,i,a):Tp(e,i)||Tp(e,a)}function N5(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=ce(o.get(r[0]),i.getWidth()),u=ce(o.get(r[1]),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=e.getValues(["x0","y0"],t),h=e.getValues(["x1","y1"],t),f=a.clampData(c),d=a.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>d[0]?h[0]:c[0]:g[0]=f[0]>d[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>d[1]?h[1]:c[1]:g[1]=f[1]>d[1]?c[1]:h[1],s=n.getMarkerPosition(g,r,!0)}else{var m=e.get(r[0],t),y=e.get(r[1],t),x=[m,y];a.clampData&&a.clampData(x,x),s=a.dataToPoint(x,!0)}if(tl(a,"cartesian2d")){var _=a.getAxis("x"),w=a.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Sx(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Sx(y)&&(s[1]=w.toGlobalCoord(w.getExtent()[r[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var P5=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],gge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=ae(P5,function(h){return N5(s,l,h,a,i)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Ce});this.group.add(c.group),this.markKeep(c);var h=mge(o,r,n);n.setData(h),h.each(function(f){var d=ae(P5,function(N){return N5(h,f,N,r,a)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[g.parse(h.get("x0",f)),g.parse(h.get("x1",f))],w=[m.parse(h.get("y0",f)),m.parse(h.get("y1",f))];Qn(_),Qn(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[1]=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:K.size.m,align:"auto",backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,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:K.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}($e),zc=Fe,C2=j,ly=Ce,SH=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!1,r}return t.prototype.init=function(){this.group.add(this._contentGroup=new ly),this.group.add(this._selectorGroup=new ly),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,i){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,i,l,s,u);var c=Tr(r,i).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),d=It(h,c,f),g=this.layoutInner(r,o,d,a,l,u),m=It(Ae({width:g.width,height:g.height},h),c,f);this.group.x=m.x-g.x,this.group.y=m.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=hH(g,r))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(r,n,i,a,o,s,l){var u=this.getContentGroup(),c=_e(),h=n.get("selectedMode"),f=n.get("triggerEvent"),d=[];i.eachRawSeries(function(g){!g.get("legendHoverLink")&&d.push(g.id)}),C2(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` -`)){var _=new ly;_.newline=!0,u.add(_);return}var w=i.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),T=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),P=this._createItem(w,x,m,g,n,r,T,A,M,h,a);P.on("click",zc(I5,x,null,a,d)).on("mouseover",zc(T2,w.name,null,a,d)).on("mouseout",zc(M2,w.name,null,a,d)),i.ssr&&P.eachChild(function(I){var N=De(I);N.seriesIndex=w.seriesIndex,N.dataIndex=m,N.ssrType="legend"}),f&&P.eachChild(function(I){y.packEventData(I,n,w,m,x)}),c.set(x,!0)}else i.eachRawSeries(function(I){var N=this;if(!c.get(x)&&I.legendVisualProvider){var D=I.legendVisualProvider;if(!D.containName(x))return;var O=D.indexOfName(x),R=D.getItemVisual(O,"style"),F=D.getItemVisual(O,"legendIcon"),H=fn(R.fill);H&&H[3]===0&&(H[3]=.2,R=Q(Q({},R),{fill:Li(H,"rgba")}));var W=this._createItem(I,x,m,g,n,r,{},R,F,h,a);W.on("click",zc(I5,null,x,a,d)).on("mouseover",zc(T2,null,x,a,d)).on("mouseout",zc(M2,null,x,a,d)),i.ssr&&W.eachChild(function(V){var z=De(V);z.seriesIndex=I.seriesIndex,z.dataIndex=m,z.ssrType="legend"}),f&&W.eachChild(function(V){N.packEventData(V,n,I,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,a,s,l)},t.prototype.packEventData=function(r,n,i,a,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:a,value:o,seriesIndex:i.seriesIndex};De(r).eventData=s},t.prototype._createSelector=function(r,n,i,a,o){var s=this.getSelectorGroup();C2(r,function(u){var c=u.type,h=new tt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){i.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),d=n.getModel(["emphasis","selectorLabel"]);Dr(h,{normal:f,emphasis:d},{defaultText:u.title}),Hs(h)})},t.prototype._createItem=function(r,n,i,a,o,s,l,u,c,h,f){var d=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=a.get("symbolRotate"),_=a.get("symbolKeepAspect"),w=a.get("icon");c=w||c||"roundRect";var S=_ge(c,a,l,u,d,y,f),T=new ly,M=a.getModel("textStyle");if(we(r.getLegendIcon)&&(!w||w==="inherit"))T.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;T.add(bge({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var P=s==="left"?g+5:-5,I=s,N=o.get("formatter"),D=n;he(N)&&N?D=N.replace("{name}",n??""):we(N)&&(D=N(n));var O=y?M.getTextColor():a.get("inactiveColor");T.add(new tt({style:Ct(M,{text:D,x:P,y:m/2,fill:O,align:I,verticalAlign:"middle"},{inheritColor:O})}));var R=new Ze({shape:T.getBoundingRect(),style:{fill:"transparent"}}),F=a.getModel("tooltip");return F.get("show")&&Qo({el:R,componentModel:o,itemName:n,itemTooltipOption:F.option}),T.add(R),T.eachChild(function(H){H.silent=!0}),R.silent=!h,this.getContentGroup().add(T),Hs(T),T.__legendDataIndex=i,T},t.prototype.layoutInner=function(r,n,i,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();wu(r.get("orient"),l,r.get("itemGap"),i.width,i.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){wu("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),d=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?d[m]+=c[y]+g:h[m]+=f[y]+g,d[1-m]+=c[x]/2-f[x]/2,u.x=d[0],u.y=d[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[x]=Math.max(c[x],f[x]),w[_]=Math.min(0,f[_]+d[1-m]),w}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Mt);function _ge(e,t,r,n,i,a,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),C2(y,function(_,w){y[w]==="inherit"&&(y[w]=x[w])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),c=e.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?n.decal:Gh(h,o),u.fill==="inherit"&&(u.fill=n[i]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(i==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),d=f.getLineStyle();if(s(d,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),d.stroke==="auto"&&(d.stroke=n.fill),!a){var g=t.get("inactiveBorderWidth"),m=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&m?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),d.stroke=f.get("inactiveColor"),d.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:d}}function bge(e){var t=e.icon||"roundRect",r=sr(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return r.setStyle(e.itemStyle),r.rotation=(e.iconRotate||0)*Math.PI/180,r.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill=K.color.neutral00,r.style.lineWidth=2),r}function I5(e,t,r,n){M2(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),T2(e,t,r,n)}function CH(e){for(var t=e.getZr().storage.getDisplayList(),r,n=0,i=t.length;ni[o],y=[-d.x,-d.y];n||(y[a]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=be(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[a]+=i[o]-g[o]:x[a]+=g[o]+w}_[1-a]+=d[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),f.setPosition(_);var T={x:0,y:0};if(T[o]=m?i[o]:d[o],T[s]=Math.max(d[s],g[s]),T[l]=Math.min(0,g[l]+_[1-a]),h.__rectSize=i[o],m){var M={x:0,y:0};M[o]=Math.max(i[o]-g[o]-w,0),M[s]=T[s],h.setClipPath(new Ze({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(P){P.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&it(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),T},t.prototype._pageGo=function(r,n,i){var a=this._getPageInfo(n)[r];a!=null&&i.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var i=this._controllerGroup;j(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,d=i.childOfName(c);d&&(d.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),d.cursor=f?"pointer":"default")});var a=i.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;a&&o&&a.setStyle("text",he(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),i=this.getContentGroup(),a=this._containerGroup.__rectSize,o=r.getOrient().index,s=uS[o],l=cS[o],u=this._findTargetItemIndex(n),c=i.children(),h=c[u],f=c.length,d=f?1:0,g={contentPosition:[i.x,i.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=f;++y)w=S(c[y]),(!w&&_.e>x.s+a||w&&!T(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!T(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),P=A[l]+M[l];return{s:P,e:P+A[s],i:M.__legendDataIndex}}}function T(M,A){return M.e>=A&&M.s<=A+a}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,i=this.getContentGroup(),a;return i.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===r&&(n=s)}),n??a},t.type="legend.scroll",t}(SH);function Mge(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(i){i.setScrollDataIndex(n)})})}function Age(e){He(TH),e.registerComponentModel(Cge),e.registerComponentView(Tge),Mge(e)}function kge(e){He(TH),He(Age)}var Lge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=fl(Sp.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Sp),yL=Ye();function Nge(e,t,r){yL(e).coordSysRecordMap.each(function(n){var i=n.dataZoomInfoMap.get(t.uid);i&&(i.getRange=r)})}function Pge(e,t){for(var r=yL(e).coordSysRecordMap,n=r.keys(),i=0;ia[i+n]&&(n=u),o=o&&l.get("preventDefaultMouseMove",!0)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:r,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint}}}}function Rge(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(t,r){var n=yL(r),i=n.coordSysRecordMap||(n.coordSysRecordMap=_e());i.each(function(a){a.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=lH(a);j(o.infoList,function(s){var l=s.model.uid,u=i.get(l)||i.set(l,Ige(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=_e());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),i.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){MH(i,a);return}var c=jge(l,a,r);o.enable(c.controlType,c.opt),xf(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Oge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,i){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),Nge(i,r,{pan:fe(hS.pan,this),zoom:fe(hS.zoom,this),scrollMove:fe(hS.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Pge(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(cL),hS={zoom:function(e,t,r,n){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=fS[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(rl(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:R5(function(e,t,r,n,i,a){var o=fS[n]([a.oldX,a.oldY],[a.newX,a.newY],t,i,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:R5(function(e,t,r,n,i,a){var o=fS[n]([0,0],[a.scrollDelta,a.scrollDelta],t,i,r);return o.signal*(e[1]-e[0])*a.scrollDelta})};function R5(e){return function(t,r,n,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,i);if(rl(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var fS={grid:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem.getRect();return e=e||[0,0],a.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,r,n,i){var a=r.axis,o=i.model.coordinateSystem.getRect(),s={};return e=e||[0,0],a.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function AH(e){hL(e),e.registerComponentModel(Lge),e.registerComponentView(Oge),Rge(e)}var zge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=fl(Sp.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(Sp),jd=Ze,Bge=1,dS=30,Fge=7,Rd="horizontal",O5="vertical",Vge=5,Gge=["line","bar","candlestick","scatter"],Wge={easing:"cubicOut",duration:100,delay:0},Hge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=fe(this._onBrush,this),this._onBrushEnd=fe(this._onBrushEnd,this)},t.prototype.render=function(r,n,i,a){if(e.prototype.render.apply(this,arguments),xf(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){lp(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Ce;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,i=r.get("brushSelect"),a=i?Fge:0,o=Tr(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Rd?{right:o.width-s.x-s.width,top:o.height-dS-l-a,width:s.width,height:dS}:{right:l,top:s.y,width:dS,height:s.height},c=Ju(r.option);j(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=It(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===O5&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,i=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(i===Rd&&!o?{scaleY:l?1:-1,scaleX:1}:i===Rd&&o?{scaleY:l?1:-1,scaleX:-1}:i===O5&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]);r.x=n.x-u.x,r.y=n.y-u.y,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,i=this._displayables.sliderGroup,a=r.get("brushSelect");i.add(new jd({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new jd({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:fe(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),i.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,i=this._shadowSize||[],a=r.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==i[0]||n[1]!==i[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),d=(f[1]-f[0])*.3;f=[f[0]-d,f[1]+d];var g=[0,n[1]],m=[0,n[0]],y=[[n[0],0],[0,0]],x=[],_=m[1]/Math.max(1,o.count()-1),w=n[0]/(h[1]-h[0]),S=r.thisAxis.type==="time",T=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(O,R,F){if(M>0&&F%M){S||(T+=_);return}T=S?(+O-h[0])*w:T+_;var H=R==null||isNaN(R)||R==="",W=H?0:ht(R,f,g,!0);H&&!A&&F?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([T,0]),x.push([T,0])),H||(y.push([T,W]),x.push([T,W])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var P=this.dataZoomModel;function I(O){var R=P.getModel(O?"selectedDataBackground":"dataBackground"),F=new Ce,H=new en({shape:{points:u},segmentIgnoreThreshold:1,style:R.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),W=new Gr({shape:{points:c},segmentIgnoreThreshold:1,style:R.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return F.add(H),F.add(W),F}for(var N=0;N<3;N++){var D=I(N===1);this._displayables.sliderGroup.add(D),this._displayables.dataShadowSegs.push(D)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var i,a=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();j(l,function(u){if(!i&&!(n!==!0&&Ve(Gge,u.get("type"))<0)){var c=a.getComponent(Ps(o),s).axis,h=Uge(o),f,d=u.coordinateSystem;h!=null&&d.getOtherAxis&&(f=d.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);i={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),i}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,i=n.handles=[null,null],a=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,h=l.get("brushSelect"),f=n.filler=new jd({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new jd({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:Bge,fill:K.color.transparent}})),j([0,1],function(w){var S=l.get("handleIcon");!G0[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var T=sr(S,-1,0,2,2,null,!0);T.attr({cursor:Zge(this._orient),draggable:!0,drift:fe(this._onDragMove,this,w),ondragend:fe(this._onDragEnd,this),onmouseover:fe(this._showDataInfo,this,!0),onmouseout:fe(this._showDataInfo,this,!1),z2:5});var M=T.getBoundingRect(),A=l.get("handleSize");this._handleHeight=ce(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,T.setStyle(l.getModel("handleStyle").getItemStyle()),T.style.strokeNoScale=!0,T.rectHover=!0,T.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Hs(T);var P=l.get("handleColor");P!=null&&(T.style.fill=P),o.add(i[w]=T);var I=l.getModel("textStyle"),N=l.get("handleLabel")||{},D=N.show||!1;r.add(a[w]=new tt({silent:!0,invisible:!D,style:Ct(I,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:I.getTextColor(),font:I.getFont()}),z2:10}))},this);var d=f;if(h){var g=ce(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new Ze({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=sr(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));d=n.moveZone=new Ze({invisible:!0,shape:{y:s[1]-_,height:g+_}}),d.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(d)}d.attr({draggable:!0,cursor:"default",drift:fe(this._onDragMove,this,"all"),ondragstart:fe(this._showDataInfo,this,!0),ondragend:fe(this._onDragEnd,this),onmouseover:fe(this._showDataInfo,this,!0),onmouseout:fe(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[ht(r[0],[0,100],n,!0),ht(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var i=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=i.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];rl(n,a,o,i.get("zoomLock")?"all":r,s.minSpan!=null?ht(s.minSpan,l,o,!0):null,s.maxSpan!=null?ht(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Qn([ht(a[0],o,l,!0),ht(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,i=this._handleEnds,a=Qn(i.slice()),o=this._size;j([0,1],function(d){var g=n.handles[d],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:i[d]+(d?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;cn[0]||i[1]<0||i[1]>n[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",i[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,i=r.offsetY;this._brushStart=new Ne(n,i),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var i=n.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(i.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[i.x,i.x+i.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();rl(0,l,o,0,u.minSpan!=null?ht(u.minSpan,s,o,!0):null,u.maxSpan!=null?ht(u.maxSpan,s,o,!0):null),this._range=Qn([ht(l[0],o,s,!0),ht(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Wo(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var i=this._displayables,a=this.dataZoomModel,o=i.brushRect;o||(o=i.brushRect=new jd({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),i.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?Wge:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=lH(this.dataZoomModel).infoList;if(!r&&n.length){var i=n[0].model.coordinateSystem;r=i.getRect&&i.getRect()}if(!r){var a=this.api.getWidth(),o=this.api.getHeight();r={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(cL);function Uge(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function Zge(e){return e==="vertical"?"ns-resize":"ew-resize"}function kH(e){e.registerComponentModel(zge),e.registerComponentView(Hge),hL(e)}function $ge(e){He(AH),He(kH)}var LH={get:function(e,t,r){var n=Se((Yge[e]||{})[t]);return r&&re(n)?n[n.length-1]:n}},Yge={color:{active:["#006edd","#e0ffff"],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},z5=Ir.mapVisual,Xge=Ir.eachVisual,qge=re,B5=j,Kge=Qn,Jge=ht,Cx=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i)},t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&yH(i,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=fe(r,this),this.controllerVisuals=_2(this.option.controller,n,r),this.targetVisuals=_2(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this.option.seriesId,n=this.option.seriesIndex;n==null&&r==null&&(n="all");var i=lf(this.ecModel,"series",{index:n,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return ae(i,function(a){return a.componentIndex})},t.prototype.eachTargetSeries=function(r,n){j(this.getTargetSeriesIndices(),function(i){var a=this.ecModel.getSeriesByIndex(i);a&&r.call(n,a)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(i){i===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,i){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;i=i||["<",">"],re(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(he(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(we(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?i[0]+" "+c[1]:r[1]===s[1]?i[1]+" "+c[0]:c[0]+" - "+c[1];return c;function h(f){return f===s[0]?"min":f===s[1]?"max":(+f).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=Kge([r.min,r.max]);this._dataExtent=n},t.prototype.getDataDimensionIndex=function(r){var n=this.option.dimension;if(n!=null)return r.getDimensionIndex(n);for(var i=r.dimensions,a=i.length-1;a>=0;a--){var o=i[a],s=r.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,i={inRange:n.inRange,outOfRange:n.outOfRange},a=n.target||(n.target={}),o=n.controller||(n.controller={});Ge(a,i),Ge(o,i);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(h){qge(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,d){var g=h[f],m=h[d];g&&!m&&(m=h[d]={},B5(g,function(y,x){if(Ir.isValidType(x)){var _=LH.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,d=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";B5(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&Se(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=d&&Se(d)||(s?_[0]:[_[0],_[0]])),w.symbol=z5(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var T=-1/0;Xge(S,function(M){M>T&&(T=M)}),w.symbolSize=z5(S,function(M){return Jge(M,[0,T],[0,_[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}($e),F5=[20,140],Qge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(i){i.mappingMethod="linear",i.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=F5[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=F5[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):re(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),j(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=Qn((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=i[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(i){var a=[],o=i.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&a.push(l)},this),n.push({seriesId:i.id,dataIndex:a})},this),n},t.prototype.getVisualMeta=function(r){var n=V5(this,"outOfRange",this.getExtent()),i=V5(this,"inRange",this.option.range.slice()),a=[];function o(d,g){a.push({value:d,color:r(d,g)})}for(var s=0,l=0,u=i.length,c=n.length;lr[1])break;a.push({color:this.getControllerVisual(l,"color",n),offset:s/i})}return a.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),a},t.prototype._createBarPoints=function(r,n){var i=this.visualMapModel.itemSize;return[[i[0]-n[0],r[0]],[i[0],r[0]],[i[0],r[1]],[i[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,i=this.visualMapModel.get("inverse");return new Ce(n==="horizontal"&&!i?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&i?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!i?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var i=this._shapes,a=this.visualMapModel,o=i.handleThumbs,s=i.handleLabels,l=a.itemSize,u=a.getExtent(),c=this._applyTransform("left",i.mainGroup);eme([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var d=ka(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(d,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=sa(i.handleLabelPoints[h],Us(f,this.group));if(this._orient==="horizontal"){var y=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;m[1]+=y}s[h].setStyle({x:m[0],y:m[1],text:a.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",i.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,i,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,h=c.indicator;if(h){h.attr("invisible",!1);var f={convertOpacityToAlpha:!0},d=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=ka(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=sa(c.indicatorLabelPoint,Us(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),T=this._orient,M=T==="horizontal";w.setStyle({text:(i||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:d}},P={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var I={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,I),w.animateTo(P,I)}else h.attr(A),w.attr(P);this._firstShowIndicator=!1;var N=this._shapes.handleLabels;if(N)for(var D=0;Do[1]&&(h[1]=1/0),n&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var f=this._hoverLinkDataIndices,d=[];(n||U5(i))&&(d=this._hoverLinkDataIndices=i.findTargetDataIndices(h));var g=Oq(f,d);this._dispatchHighDown("downplay",Wy(g[0],i)),this._dispatchHighDown("highlight",Wy(g[1],i))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(vu(r.target,function(l){var u=De(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var i=this.ecModel.getSeriesByIndex(n.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(i)){var o=i.getData(n.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var i=0;i=0&&(a.dimension=o,n.push(a))}}),e.getData().setVisual("visualMeta",n)}}];function lme(e,t,r,n){for(var i=t.targetVisuals[n],a=Ir.prepareVisualTypes(i),o={color:Yp(e.getData(),"color")},s=0,l=a.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(ame,ome),j(sme,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(ume))}function DH(e){e.registerComponentModel(Qge),e.registerComponentView(nme),IH(e)}var cme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],hme[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var a=this.option.categories;this.resetVisual(function(o,s){i==="categories"?(o.mappingMethod="category",o.categories=Se(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=ae(this._pieceList,function(l){return l=Se(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},i=Ir.listVisualTypes(),a=this.isCategory();j(r.pieces,function(s){j(i,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),j(n,function(s,l){var u=!1;j(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&j(this.stateList,function(c){(r[c]||(r[c]={}))[l]=LH.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var i=this.option,a=this._pieceList,o=(n?i:r).selected||{};if(i.selected=o,j(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),i.selectedMode==="single"){var s=!1;j(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=Se(r)},t.prototype.getValueState=function(r){var n=Ir.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],i=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Ir.findPieceIndex(l,i);c===r&&o.push(u)},this),n.push({seriesId:a.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var i=r.interval||[];n=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],i=["",""],a=this;function o(c,h){var f=a.getRepresentValue({interval:c});h||(h=a.getValueState(f));var d=r(f,h);c[0]===-1/0?i[0]=d:c[1]===1/0?i[1]=d:n.push({value:c[0],color:d},{value:c[1],color:d})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return j(s,function(c){var h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:n,outerColors:i}},t.type="visualMap.piecewise",t.defaultOption=fl(Cx.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(Cx),hme={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(n[1]-n[0])/i;+a.toFixed(r)!==a&&r<5;)r++;t.precision=r,a=+a.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,i)},this)}};function X5(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var fme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,i=n.get("textGap"),a=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=Fr(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),j(l.viewPieceList,function(f){var d=f.piece,g=new Ce;g.onclick=fe(this._onItemClick,this,d),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(d);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=a.get("align")||o;g.add(new tt({style:Ct(a,{x:x==="right"?-i:s[0]+i,y:s[1]/2,text:d.text,verticalAlign:a.get("verticalAlign")||"middle",align:x,opacity:be(a.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),wu(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var i=this;r.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=i.visualMapModel;s.option.hoverLink&&i.api.dispatchAction({type:o,batch:Wy(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return PH(r,this.api,r.itemSize);var i=n.align;return(!i||i==="auto")&&(i="left"),i},t.prototype._renderEndsText=function(r,n,i,a,o){if(n){var s=new Ce,l=this.visualMapModel.textStyleModel;s.add(new tt({style:Ct(l,{x:a?o==="right"?i[0]:0:i[0]/2,y:i[1]/2,verticalAlign:"middle",align:a?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=ae(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),i=r.get("text"),a=r.get("orient"),o=r.get("inverse");return(a==="horizontal"?o:!o)?n.reverse():i&&(i=i.slice().reverse()),{viewPieceList:n,endsText:i}},t.prototype._createItemSymbol=function(r,n,i,a){var o=sr(this.getControllerVisual(n,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(n,"color"));o.silent=a,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,i=n.option,a=i.selectedMode;if(a){var o=Se(i.selected),s=n.getSelectedMapKey(r);a==="single"||a===!0?(o[s]=!0,j(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(NH);function EH(e){e.registerComponentModel(cme),e.registerComponentView(fme),IH(e)}function dme(e){He(DH),He(EH)}var vme=function(){function e(t){this._thumbnailModel=t}return e.prototype.reset=function(t){this._renderVersion=t.getMainProcessVersion()},e.prototype.renderContent=function(t){var r=t.api.getViewOfComponentModel(this._thumbnailModel);r&&(t.group.silent=!0,r.renderContent({group:t.group,targetTrans:t.targetTrans,z2Range:i6(t.group),roamType:t.roamType,viewportRect:t.viewportRect,renderVersion:this._renderVersion}))},e.prototype.updateWindow=function(t,r){var n=r.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:t,renderVersion:this._renderVersion})},e}(),pme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventAutoZ=!0,r}return t.prototype.optionUpdated=function(r,n){this._updateBridge()},t.prototype._updateBridge=function(){var r=this._birdge=this._birdge||new vme(this);if(this._target=null,this.ecModel.eachSeries(function(i){_R(i,null)}),this.shouldShow()){var n=this.getTarget();_R(n.baseMapProvider,r)}},t.prototype.shouldShow=function(){return this.getShallow("show",!0)},t.prototype.getBridge=function(){return this._birdge},t.prototype.getTarget=function(){if(this._target)return this._target;var r=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return r?r.subType!=="graph"&&(r=null):r=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:r},this._target},t.type="thumbnail",t.layoutMode="box",t.dependencies=["series","geo"],t.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:K.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:K.color.neutral30,borderColor:K.color.neutral40,opacity:.3},z:10},t}($e),gme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this._api=i,this._model=r,this._coordSys||(this._coordSys=new nc),!this._isEnabled()){this._clear();return}this._renderVersion=i.getMainProcessVersion();var a=this.group;a.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Tr(r,i).refContainer,u=It(C6(r,!0),l),c=s.lineWidth||0,h=this._contentRect=Bu(u.clone(),c/2,!0,!0),f=new Ce;a.add(f),f.setClipPath(new Ze({shape:h.plain()}));var d=this._targetGroup=new Ce;f.add(d);var g=u.plain();g.r=o.getShallow("borderRadius",!0),a.add(this._bgRect=new Ze({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new Ze({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),K5(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),K5(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,i=this._coordSys,a=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,i.setBoundingRect(s.x,s.y,s.width,s.height);var l=It({left:"center",top:"center",aspect:s.width/s.height},a);i.setViewRect(l.x,l.y,l.width,l.height),o.attr(i.getTransformInfo().raw),this._windowRect.z2=r.z2Range.max+10,this._resetRoamController(r.roamType)}}},t.prototype.updateWindow=function(r){var n=this._bridgeRendered;n&&n.renderVersion===r.renderVersion&&(n.targetTrans=r.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},t.prototype._dealUpdateWindow=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=ji([],r.targetTrans),i=aa([],this._coordSys.transform,n);this._transThisToTarget=ji([],i);var a=r.viewportRect;a?a=a.clone():a=new Pe(0,0,this._api.getWidth(),this._api.getHeight()),a.applyTransform(i);var o=this._windowRect,s=o.shape.r;o.setShape(Ae({r:s},a))}},t.prototype._resetRoamController=function(r){var n=this,i=this._api,a=this._roamController;if(a||(a=this._roamController=new rc(i.getZr())),!r||!this._isEnabled()){a.disable();return}a.enable(r,{api:i,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),a.off("pan").off("zoom").on("pan",fe(this._onPan,this)).on("zoom",fe(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.oldX,r.oldY],n),a=Kt([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(q5(this._model.getTarget().baseMapProvider,{dx:a[0]-i[0],dy:a[1]-i[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.originX,r.originY],n);this._api.dispatchAction(q5(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:i[0],originY:i[1]}))}},t.prototype._isEnabled=function(){var r=this._model;if(!r||!r.shouldShow())return!1;var n=r.getTarget().baseMapProvider;return!!n},t.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},t.prototype.remove=function(){this._clear()},t.prototype.dispose=function(){this._clear()},t.type="thumbnail",t}(Mt);function q5(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,Q(n,t),n}function K5(e,t){var r=Fu(e);w_(t.group,r.z,r.zlevel)}function mme(e){e.registerComponentModel(pme),e.registerComponentView(gme)}var yme={label:{enabled:!0},decal:{show:!1}},J5=Ye(),xme={};function _me(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=Se(yme);Ge(n.label,e.getLocaleModel().get("aria"),!1),Ge(r.option,n,!1),i(),a();function i(){var u=r.getModel("decal"),c=u.get("show");if(c){var h=_e();e.eachSeries(function(f){if(!f.isColorBySeries()){var d=h.get(f.type);d||(d={},h.set(f.type,d)),J5(f).scope=d}}),e.eachRawSeries(function(f){if(e.isSeriesFiltered(f))return;if(we(f.enableAriaDecal)){f.enableAriaDecal();return}var d=f.getData();if(f.isColorBySeries()){var _=fT(f.ecModel,f.name,xme,e.getSeriesCount()),w=d.getVisual("decal");d.setVisual("decal",S(w,_))}else{var g=f.getRawData(),m={},y=J5(f).scope;d.each(function(T){var M=d.getRawIndex(T);m[M]=T});var x=g.count();g.each(function(T){var M=m[T],A=g.getName(T)||T+"",P=fT(f.ecModel,A,y,x),I=d.getItemVisual(M,"decal");d.setItemVisual(M,"decal",S(I,P))})}function S(T,M){var A=T?Q(Q({},M),T):M;return A.dirty=!0,A}})}}function a(){var u=t.getZr().dom;if(u){var c=e.getLocaleModel().get("aria"),h=r.getModel("label");if(h.option=Ae(h.option,c),!!h.get("enabled")){if(u.setAttribute("role","img"),h.get("description")){u.setAttribute("aria-label",h.get("description"));return}var f=e.getSeriesCount(),d=h.get(["data","maxCount"])||10,g=h.get(["series","maxCount"])||10,m=Math.min(f,g),y;if(!(f<1)){var x=s();if(x){var _=h.get(["general","withTitle"]);y=o(_,{title:x})}else y=h.get(["general","withoutTitle"]);var w=[],S=f>1?h.get(["series","multiple","prefix"]):h.get(["series","single","prefix"]);y+=o(S,{seriesCount:f}),e.eachSeries(function(P,I){if(I1?h.get(["series","multiple",O]):h.get(["series","single",O]),N=o(N,{seriesId:P.seriesIndex,seriesName:P.get("name"),seriesType:l(P.subType)});var R=P.getData();if(R.count()>d){var F=h.get(["data","partialData"]);N+=o(F,{displayCnt:d})}else N+=h.get(["data","allData"]);for(var H=h.get(["data","separator","middle"]),W=h.get(["data","separator","end"]),V=h.get(["data","excludeDimensionId"]),z=[],Z=0;Z":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Sme=function(){function e(t){var r=this._condVal=he(t)?new RegExp(t):kB(t)?t:null;if(r==null){var n="";ft(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return he(r)?this._condVal.test(t):rt(r)?this._condVal.test(t+""):!1},e}(),Cme=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),Tme=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(i),i=[R,F]}function c(R,F,H,W){hh(R,H)&&hh(F,W)||i.push(R,F,H,W,H,W)}function h(R,F,H,W,V,z){var Z=Math.abs(F-R),U=Math.tan(Z/4)*4/3,$=FP:D2&&n.push(i),n}function k2(e,t,r,n,i,a,o,s,l,u){if(hh(e,r)&&hh(t,n)&&hh(i,o)&&hh(a,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,d=s-t,g=Math.sqrt(f*f+d*d);f/=g,d/=g;var m=r-e,y=n-t,x=i-o,_=a-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&P=0){l.push(o,s);return}var I=[],N=[];Qs(e,r,i,o,.5,I),Qs(t,n,a,s,.5,N),k2(I[0],N[0],I[1],N[1],I[2],N[2],I[3],N[3],l,u),k2(I[4],N[4],I[5],N[5],I[6],N[6],I[7],N[7],l,u)}function Bme(e,t){var r=A2(e),n=[];t=t||1;for(var i=0;i0)for(var u=0;uMath.abs(u),h=RH([l,u],c?0:1,t),f=(c?s:u)/h.length,d=0;di,o=RH([n,i],a?0:1,t),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",h=e[s]/o.length,f=0;f1?null:new Ne(m*l+e,m*u+t)}function Gme(e,t,r){var n=new Ne;Ne.sub(n,r,t),n.normalize();var i=new Ne;Ne.sub(i,e,t);var a=i.dot(n);return a}function Fc(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function Wme(e,t,r){for(var n=e.length,i=[],a=0;ao?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),Wme(t,u,c)}function Tx(e,t,r,n){if(r===1)n.push(t);else{var i=Math.floor(r/2),a=e(t);Tx(e,a[0],i,n),Tx(e,a[1],r-i,n)}return n}function Hme(e,t){for(var r=[],n=0;n0;u/=2){var c=0,h=0;(e&u)>0&&(c=1),(t&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function kx(e){var t=1/0,r=1/0,n=-1/0,i=-1/0,a=ae(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(h,r),n=Math.max(c,n),i=Math.max(h,i),[c,h]}),o=ae(a,function(s,l){return{cp:s,z:Qme(s[0],s[1],t,r,n,i),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function BH(e){return $me(e.path,e.count)}function L2(){return{fromIndividuals:[],toIndividuals:[],count:0}}function eye(e,t,r){var n=[];function i(T){for(var M=0;M=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var rye={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;s3(e)&&(u=e,c=t),s3(t)&&(u=t,c=e);function h(x,_,w,S,T){var M=x.many,A=x.one;if(M.length===1&&!T){var P=_?M[0]:A,I=_?A:M[0];if(Mx(P))h({many:[P],one:I},!0,w,S,!0);else{var N=s?Ae({delay:s(w,S)},l):l;_L(P,I,N),a(P,I,P,I,N)}}else for(var D=Ae({dividePath:rye[r],individualDelay:s&&function(V,z,Z,U){return s(V+w,S)}},l),O=_?eye(M,A,D):tye(A,M,D),R=O.fromIndividuals,F=O.toIndividuals,H=R.length,W=0;Wt.length,d=u?l3(c,u):l3(f?t:e,[f?e:t]),g=0,m=0;mFH))for(var a=n.getIndices(),o=0;o0&&M.group.traverse(function(P){P instanceof Ke&&!P.animators.length&&P.animateFrom({style:{opacity:0}},A)})})}function d3(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function v3(e){return re(e)?e.sort().join(","):e}function ys(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function uye(e,t){var r=_e(),n=_e(),i=_e();return j(e.oldSeries,function(a,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=d3(a),c=v3(u);n.set(c,{dataGroupId:s,data:l}),re(u)&&j(u,function(h){i.set(h,{key:c,dataGroupId:s,data:l})})}),j(t.updatedSeries,function(a){if(a.isUniversalTransitionEnabled()&&a.isAnimationEnabled()){var o=a.get("dataGroupId"),s=a.getData(),l=d3(a),u=v3(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:ys(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:ys(s),data:s}]});else if(re(l)){var h=[];j(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:ys(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:ys(s)}]})}else{var f=i.get(l);if(f){var d=r.get(f.key);d||(d={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:ys(f.data)}],newSeries:[]},r.set(f.key,d)),d.newSeries.push({dataGroupId:o,data:s,divide:ys(s)})}}}}),r}function p3(e,t){for(var r=0;r=0&&i.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:ys(t.oldData[s]),groupIdDim:o.dimension})}),j(Tt(e.to),function(o){var s=p3(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:ys(l),groupIdDim:o.dimension})}}),i.length>0&&a.length>0&&VH(i,a,n)}function hye(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){j(Tt(n.seriesTransition),function(i){j(Tt(i.to),function(a){for(var o=n.updatedSeries,s=0;so.vmin?r+=o.vmin-n+(t-o.vmin)/(o.vmax-o.vmin)*o.gapReal:r+=t-n,n=o.vmax,i=!1;break}r+=o.vmin-n+o.gapReal,n=o.vmax}return i&&(r+=t-n),r},e.prototype.unelapse=function(t){for(var r=g3,n=m3,i=!0,a=0,o=0;ol?a=s.vmin+(t-l)/(u-l)*(s.vmax-s.vmin):a=n+t-r,n=s.vmax,i=!1;break}r=u,n=s.vmax}return i&&(a=n+t-r),a},e}();function dye(){return new fye}var g3=0,m3=0;function vye(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},i=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},a={S:{tpAbs:i(),tpPrct:i()},E:{tpAbs:i(),tpPrct:i()}};j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=bL(s,t);if(u){var c=u.vmin!==s.vmin,h=u.vmax!==s.vmax,f=u.vmax-u.vmin;if(!(c&&h))if(c||h){var d=c?"S":"E";a[d][l.type].has=!0,a[d][l.type].span=f,a[d][l.type].inExtFrac=f/(s.vmax-s.vmin),a[d][l.type].val=l.val}else n[l.type].span+=f,n[l.type].val+=l.val}});var o=r*(0+(t[1]-t[0])+(n.tpAbs.val-n.tpAbs.span)+(a.S.tpAbs.has?(a.S.tpAbs.val-a.S.tpAbs.span)*a.S.tpAbs.inExtFrac:0)+(a.E.tpAbs.has?(a.E.tpAbs.val-a.E.tpAbs.span)*a.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(a.S.tpPrct.has?a.S.tpPrct.span*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.span*a.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(a.S.tpPrct.has?a.S.tpPrct.val*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.val*a.E.tpPrct.inExtFrac:0));j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?Math.max(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function pye(e,t,r,n,i,a){e!=="no"&&j(r,function(o){var s=bL(o,a);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=i*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}j(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:Se(o),vmin:t(o.start),vmax:t(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(he(o.gap)){var u=Jn(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;i(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var h=t(o.gap);(!isFinite(h)||h<0)&&(h=0),s.gapParsed.type="tpAbs",s.gapParsed.val=h}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),r&&r.noNegative&&j(["vmin","vmax"],function(d){s[d]<0&&(s[d]=0)}),s.vmin>s.vmax){var f=s.vmax;s.vmax=s.vmin,s.vmin=f}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var a=-1/0;return j(n,function(o,s){a>o.vmin&&(n[s]=null),a=o.vmax}),{breaks:n.filter(function(o){return!!o})}}function wL(e,t){return P2(t)===P2(e)}function P2(e){return e.start+"_\0_"+e.end}function mye(e,t,r){var n=[];j(e,function(a,o){var s=t(a);s&&s.type==="vmin"&&n.push([o])}),j(e,function(a,o){var s=t(a);if(s&&s.type==="vmax"){var l=ul(n,function(u){return wL(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var i=[];return j(n,function(a){a.length===2&&i.push(r?a:[e[a[0]],e[a[1]]])}),i}function yye(e,t,r,n){var i,a;if(e.break){var o=e.break.parsedBreak,s=ul(r,function(h){return wL(h.breakOption,e.break.parsedBreak.breakOption)}),l=n(Math.pow(t,o.vmin),s.vmin),u=n(Math.pow(t,o.vmax),s.vmax),c={type:o.gapParsed.type,val:o.gapParsed.type==="tpAbs"?ir(Math.pow(t,o.vmin+o.gapParsed.val))-l:o.gapParsed.val};i={type:e.break.type,parsedBreak:{breakOption:o.breakOption,vmin:l,vmax:u,gapParsed:c,gapReal:o.gapReal}},a=s[e.break.type]}return{brkRoundingCriterion:a,vBreak:i}}function xye(e,t,r){var n={noNegative:!0},i=N2(e,r,n),a=N2(e,r,n),o=Math.log(t);return a.breaks=ae(a.breaks,function(s){var l=Math.log(s.vmin)/o,u=Math.log(s.vmax)/o,c={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?Math.log(s.vmin+s.gapParsed.val)/o-l:s.gapParsed.val};return{vmin:l,vmax:u,gapParsed:c,gapReal:s.gapReal,breakOption:s.breakOption}}),{parsedOriginal:i,parsedLogged:a}}var _ye={vmin:"start",vmax:"end"};function bye(e,t){return t&&(e=e||{},e.break={type:_ye[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function wye(){HJ({createScaleBreakContext:dye,pruneTicksByBreak:pye,addBreaksToTicks:gye,parseAxisBreakOption:N2,identifyAxisBreak:wL,serializeAxisBreakIdentifier:P2,retrieveAxisBreakPairs:mye,getTicksLogTransformBreak:yye,logarithmicParseBreaksFromOption:xye,makeAxisLabelFormatterParamBreak:bye})}var y3=Ye();function Sye(e,t){var r=ul(e,function(n){return vr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function Cye(e){j(e,function(t){return t.shouldRemove=!0})}function Tye(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function Mye(e,t,r,n,i){var a=r.axis;if(a.scale.isBlank()||!vr())return;var o=vr().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:"only_break"}),function(I){return I.break},!1);if(!o.length)return;var s=r.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var h=s.get("expandOnClick"),f=s.get("zigzagZ"),d=s.getModel("itemStyle"),g=d.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new Ce({ignoreModelZ:!0}),S=a.isHorizontal(),T=y3(t).visualList||(y3(t).visualList=[]);Cye(T);for(var M=function(I){var N=o[I][0].break.parsedBreak,D=[];D[0]=a.toGlobalCoord(a.dataToCoord(N.vmin,!0)),D[1]=a.toGlobalCoord(a.dataToCoord(N.vmax,!0)),D[1]=z;le&&(te=z);var Ee=[],me=[];Ee[W]=D,me[W]=O,!se&&!le&&(Ee[W]+=Y?-l:l,me[W]-=Y?l:-l),Ee[V]=te,me[V]=te,U.push(Ee),$.push(me);var ye=void 0;if(ie_[1]&&_.reverse(),{coordPair:_,brkId:vr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.coordPair[0]});for(var u=o[0],c=null,h=0;h=0?l[0].width:l[1].width),f=(h+c.x)/2-u.x,d=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:d>0?d:0;s=(f-m)/c.x}var y=new Ne,x=new Ne;Ne.scale(y,n,-s),Ne.scale(x,n,1-s),IT(r[0],y),IT(r[1],x)}function Lye(e,t){var r={breaks:[]};return j(t.breaks,function(n){if(n){var i=ul(e.get("breaks",!0),function(s){return vr().identifyAxisBreak(s,n)});if(i){var a=t.type,o={isExpanded:!!i.isExpanded};i.isExpanded=a===D_?!0:a===lW?!1:a===uW?!i.isExpanded:i.isExpanded,r.breaks.push({start:i.start,end:i.end,isExpanded:!!i.isExpanded,old:o})}}}),r}function Nye(){Tae({adjustBreakLabelPair:kye,buildAxisBreakLine:Aye,rectCoordBuildBreakAxis:Mye,updateModelAxisBreak:Lye})}function Pye(e){Pae(e),wye(),Nye()}function Iye(){Jae(Dye)}function Dye(e,t){j(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=Eye(r);if(n){var i=r.isHorizontal()?"height":"width",a=r.model.get(["axisLabel","margin"]);t[i]-=n[i]+a,r.position==="top"?t.y+=n.height+a:r.position==="left"&&(t.x+=n.width+a)}}})}function Eye(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,i,a=r.getExtent();r instanceof Wh?i=r.count():(n=r.getTicks(),i=n.length);var o=e.getLabelModel(),s=wf(e),l,u=1;i>40&&(u=Math.ceil(i/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,i=null;return function(){for(var a=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function Kye(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function Jye(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function Qye({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useRef(null),[a,o]=G.useState("connected"),s=G.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=G.useMemo(()=>{let y=e;return a==="connected"?y=y.filter(x=>s.has(x.node_num)):a==="infra"&&(y=y.filter(x=>b3.includes(x.role))),y},[e,a,s]),u=G.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=G.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=G.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),f=G.useMemo(()=>{const y=l.map(_=>{const w=Kye(_.latitude),S=_3[w%_3.length],T=b3.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),P=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:Jye(_.role),itemStyle:{color:T?S:"#111827",borderColor:S,borderWidth:T?0:2,opacity:P?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:P?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:qye(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),d=G.useMemo(()=>({backgroundColor:"#111827",tooltip:{trigger:"item",backgroundColor:"#1e293b",borderColor:"#334155",textStyle:{color:"#e2e8f0",fontFamily:"JetBrains Mono, monospace",fontSize:11},formatter:y=>{if(y.data&&y.data.longName){const x=y.data;return`${x.name}
${x.longName}
Role: ${x.role}`}return""}},series:[{type:"graph",layout:"force",roam:!0,draggable:!0,animation:!1,data:f.nodes,links:f.links,force:{repulsion:200,edgeLength:[80,120],gravity:.1},emphasis:{focus:"adjacency",blurScope:"coordinateSystem",scale:1.1,lineStyle:{width:2}},blur:{itemStyle:{opacity:.15},lineStyle:{opacity:.04}},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace"},edgeLabel:{show:!1},edgeSymbol:["none","none"]}]}),[f]),g=G.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=G.useMemo(()=>({click:g}),[g]);return G.useEffect(()=>{var x;const y=(x=i.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(d,{notMerge:!1,lazyUpdate:!0})},[d]),v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsx(Xye,{ref:i,option:d,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),v.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2",children:[v.jsx(RM,{size:14,className:"text-slate-500"}),v.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>v.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${a===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),v.jsx("div",{className:"space-y-1",children:[{label:"Excellent (>12)",color:"#22c55e"},{label:"Good (8-12)",color:"#4ade80"},{label:"Fair (5-8)",color:"#f59e0b"},{label:"Marginal (3-5)",color:"#f97316"},{label:"Poor (<3)",color:"#ef4444"}].map(y=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),v.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),v.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function HH(e,t){const r=G.useRef(t);G.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}function e0e(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const t0e=1;function r0e(e){return Object.freeze({__version:t0e,map:e})}function UH(e,t){return Object.freeze({...e,...t})}const ZH=G.createContext(null),$H=ZH.Provider;function U_(){const e=G.useContext(ZH);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function n0e(e){function t(r,n){const{instance:i,context:a}=e(r).current;return G.useImperativeHandle(n,()=>i),r.children==null?null:Ch.createElement($H,{value:a},r.children)}return G.forwardRef(t)}function i0e(e){function t(r,n){const[i,a]=G.useState(!1),{instance:o}=e(r,a).current;G.useImperativeHandle(n,()=>o),G.useEffect(function(){i&&o.update()},[o,i,r.children]);const s=o._contentNode;return s?Z4.createPortal(r.children,s):null}return G.forwardRef(t)}function a0e(e){function t(r,n){const{instance:i}=e(r).current;return G.useImperativeHandle(n,()=>i),null}return G.forwardRef(t)}function ML(e,t){const r=G.useRef();G.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function Z_(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function o0e(e,t){return function(n,i){const a=U_(),o=e(Z_(n,a),a);return HH(a.map,n.attribution),ML(o.current,n.eventHandlers),t(o.current,a,n,i),o}}var E2={exports:{}};/* @preserve +`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,d,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],d,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,i){var a=this._ecModel,o=De(n),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),d=this._renderMode,g=r.positionDefault,m=Id([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new Bb;x.marker=_.makeTooltipMarker("item",Vu(x.color),d);var w=kD(u.formatTooltip(c,!1,h)),S=m.get("order"),T=m.get("valueFormatter"),M=w.frag,A=M?ED(T?Q({valueFormatter:T},M):M,_,d,S,a.get("useUTC"),m.get("textStyle")):w.text,P="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,P,r.offsetX,r.offsetY,r.position,r.target,_)}),i({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,i){var a=this._renderMode==="html",o=De(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(he(l)){var c=l;l={content:c,formatter:c},u=!0}u&&a&&l.content&&(l=Se(l),l.content=hn(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var d=r.positionDefault,g=Id(h,this._tooltipModel,d?{position:d}:null),m=g.get("content"),y=Math.random()+"",x=new Bb;this._showOrMove(g,function(){var _=Se(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),i({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,i,a,o,s,l,u,c){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var f=r.get("formatter");l=l||r.get("position");var d=n,g=this._getNearestPoint([o,s],i,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(he(f)){var y=r.ecModel.get("useUTC"),x=re(i)?i[0]:i,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;d=f,_&&(d=Zp(x.axisValue,d,y)),d=RA(d,i,!0)}else if(we(f)){var w=fe(function(S,T){S===this._ticket&&(h.setContent(T,c,r,m,l),this._updatePosition(r,l,o,s,h,i,u))},this);this._ticket=a,d=f(i,a,w)}else d=f;h.setContent(d,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,i,u)}},t.prototype._getNearestPoint=function(r,n,i,a,o){if(i==="axis"||re(n))return{color:a||o};if(!re(n))return{color:a||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,i,a,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||r.get("position");var h=o.getSize(),f=r.get("align"),d=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),we(n)&&(n=n([i,a],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),re(n))i=ce(n[0],u),a=ce(n[1],c);else if(ke(n)){var m=n;m.width=h[0],m.height=h[1];var y=It(m,{width:u,height:c});i=y.x,a=y.y,f=null,d=null}else if(he(n)&&l){var x=bpe(n,g,h,r.get("borderWidth"));i=x[0],a=x[1]}else{var x=xpe(i,a,o,u,c,f?null:20,d?null:20);i=x[0],a=x[1]}if(f&&(i-=d5(f)?h[0]/2:f==="right"?h[0]:0),d&&(a-=d5(d)?h[1]/2:d==="bottom"?h[1]:0),v8(r)){var x=_pe(i,a,o,u,c);i=x[0],a=x[1]}o.moveTo(i,a)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var i=this._lastDataByCoordSys,a=this._cbParamsList,o=!!i&&i.length===r.length;return o&&j(i,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&j(u,function(f,d){var g=h[d]||{},m=f.seriesDataIndices||[],y=g.seriesDataIndices||[];o=o&&f.value===g.value&&f.axisType===g.axisType&&f.axisId===g.axisId&&m.length===y.length,o&&j(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),a&&j(f.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=a[_];w&&S&&S.data!==w.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},t.prototype._hide=function(r){this._lastDataByCoordSys=null,r({type:"hideTip",from:this.uid})},t.prototype.dispose=function(r,n){Je.node||!n.getDom()||(lp(this,"_updatePosition"),this._tooltipContent.dispose(),h2("itemTooltip",n))},t.type="tooltip",t}(Mt);function Id(e,t,r){var n=t.ecModel,i;r?(i=new qe(r,n,n),i=new qe(t.option,i,n)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof qe&&(o=o.get("tooltip",!0)),he(o)&&(o={formatter:o}),o&&(i=new qe(o,i,n)))}return i}function f5(e,t){return e.dispatchAction||fe(t.dispatchAction,t)}function xpe(e,t,r,n,i,a,o){var s=r.getSize(),l=s[0],u=s[1];return a!=null&&(e+l+a+2>n?e-=l+a:e+=a),o!=null&&(t+u+o>i?t-=u+o:t+=o),[e,t]}function _pe(e,t,r,n,i){var a=r.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function bpe(e,t,r,n){var i=r[0],a=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=t.width,c=t.height;switch(e){case"inside":s=t.x+u/2-i/2,l=t.y+c/2-a/2;break;case"top":s=t.x+u/2-i/2,l=t.y-a-o;break;case"bottom":s=t.x+u/2-i/2,l=t.y+c+o;break;case"left":s=t.x-i-o,l=t.y+c/2-a/2;break;case"right":s=t.x+u+o,l=t.y+c/2-a/2}return[s,l]}function d5(e){return e==="center"||e==="middle"}function wpe(e,t,r){var n=iA(e).queryOptionMap,i=n.keys()[0];if(!(!i||i==="series")){var a=lf(t,i,n.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=De(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:i,componentIndex:o.componentIndex,el:l}}}}function Spe(e){He(tg),e.registerComponentModel(ape),e.registerComponentView(ype),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},qt),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},qt)}var Cpe=["rect","polygon","keep","clear"];function Tpe(e,t){var r=Tt(e?e.brush:[]);if(r.length){var n=[];j(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var i=e&&e.toolbox;re(i)&&(i=i[0]),i||(i={feature:{}},e.toolbox=[i]);var a=i.feature||(i.feature={}),o=a.brush||(a.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),Mpe(s),t&&!s.length&&s.push.apply(s,Cpe)}}function Mpe(e){var t={};j(e,function(r){t[r]=1}),e.length=0,j(t,function(r,n){e.push(n)})}var v5=j;function p5(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function _2(e,t,r){var n={};return v5(t,function(a){var o=n[a]=i();v5(e[a],function(s,l){if(Ir.isValidType(l)){var u={type:l,visual:s};r&&r(u,a),o[l]=new Ir(u),l==="opacity"&&(u=Se(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Ir(u))}})}),n;function i(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function y8(e,t,r){var n;j(r,function(i){t.hasOwnProperty(i)&&p5(t[i])&&(n=!0)}),n&&j(r,function(i){t.hasOwnProperty(i)&&p5(t[i])?e[i]=Se(t[i]):delete e[i]})}function Ape(e,t,r,n,i,a){var o={};j(e,function(h){var f=Ir.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return ZA(r,s,h)}function u(h,f){pV(r,s,h,f)}r.each(c);function c(h,f){s=h;var d=r.getRawDataItem(s);if(!(d&&d.visualMap===!1))for(var g=n.call(i,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function kpe(e,t,r,n){var i={};return j(e,function(a){var o=Ir.prepareVisualTypes(t[a]);i[a]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(T){return ZA(s,h,T)}function c(T,M){pV(s,h,T,M)}for(var h,f=s.getStore();(h=o.next())!=null;){var d=s.getRawDataItem(h);if(!(d&&d.visualMap===!1))for(var g=n!=null?f.get(l,h):h,m=r(g),y=t[m],x=i[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=a[0]),a[1]t[1][1]&&(t[1][1]=a[1])}return t&&_5(t)}};function _5(e){return new Pe(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var jpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n,this.model,(this._brushController=new zk(n.getZr())).on("brush",fe(this._onBrush,this)).mount()},t.prototype.render=function(r,n,i,a){this.model=r,this._updateController(r,n,i,a)},t.prototype.updateTransform=function(r,n,i,a){x8(n),this._updateController(r,n,i,a)},t.prototype.updateVisual=function(r,n,i,a){this.updateTransform(r,n,i,a)},t.prototype.updateView=function(r,n,i,a){this._updateController(r,n,i,a)},t.prototype._updateController=function(r,n,i,a){(!a||a.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(i)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,i=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:Se(i),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:Se(i),$from:n})},t.type="brush",t}(Mt),Rpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.areas=[],r.brushOption={},r}return t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&y8(i,r,["inBrush","outOfBrush"]);var a=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:this.option.defaultOutOfBrushColor},a.hasOwnProperty("liftZ")||(a.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=ae(r,function(n){return b5(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=b5(this.option,r),this.brushType=this.brushOption.brushType},t.type="brush",t.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],t.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}($e);function b5(e,t){return Ge({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new qe(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var Ope=["rect","polygon","lineX","lineY","keep","clear"],zpe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i){var a,o,s;n.eachComponent({mainType:"brush"},function(l){a=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=a,this._brushMode=o,j(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===a)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,i){this.render(r,n,i)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),i={};return j(r.get("type",!0),function(a){n[a]&&(i[a]=n[a])}),i},t.prototype.onclick=function(r,n,i){var a=this._brushType,o=this._brushMode;i==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:i==="keep"?a:a===i?!1:i,brushMode:i==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:Ope.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:r.getLocaleModel().get(["toolbox","brush","title"])};return n},t}(Ci);function Bpe(e){e.registerComponentView(jpe),e.registerComponentModel(Rpe),e.registerPreprocessor(Tpe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Npe),e.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(t,r){r.eachComponent({mainType:"brush",query:t},function(n){n.setAreas(t.areas)})}),e.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},qt),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},qt),Zc("brush",zpe)}var Fpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode={type:"box",ignoreSize:!0},r}return t.type="title",t.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:K.size.m,backgroundColor:K.color.transparent,borderColor:K.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:K.color.primary},subtextStyle:{fontSize:12,color:K.color.quaternary}},t}($e),Vpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this.group.removeAll(),!!r.get("show")){var a=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=be(r.get("textBaseline"),r.get("textVerticalAlign")),c=new tt({style:Ct(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),d=new tt({style:Ct(s,{text:f,fill:s.getTextColor(),y:h.height+r.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=r.get("link"),m=r.get("sublink"),y=r.get("triggerEvent",!0);c.silent=!g&&!y,d.silent=!m&&!y,g&&c.on("click",function(){B0(g,"_"+r.get("target"))}),m&&d.on("click",function(){B0(m,"_"+r.get("subtarget"))}),De(c).eventData=De(d).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,a.add(c),f&&a.add(d);var x=a.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=Tr(r,i),S=It(_,w.refContainer,r.get("padding"));l||(l=r.get("left")||r.get("right"),l==="middle"&&(l="center"),l==="right"?S.x+=S.width:l==="center"&&(S.x+=S.width/2)),u||(u=r.get("top")||r.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?S.y+=S.height:u==="middle"&&(S.y+=S.height/2),u=u||"top"),a.x=S.x,a.y=S.y,a.markRedraw();var T={align:l,verticalAlign:u};c.setStyle(T),d.setStyle(T),x=a.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var P=new Ze({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});a.add(P)}},t.type="title",t}(Mt);function Gpe(e){e.registerComponentModel(Fpe),e.registerComponentView(Vpe)}var w5=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode="box",r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i),this._initData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(r){r==null&&(r=this.option.currentIndex);var n=this._data.count();this.option.loop?r=(r%n+n)%n:(r>=n&&(r=n-1),r<0&&(r=0)),this.option.currentIndex=r},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(r){this.option.autoPlay=!!r},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var r=this.option,n=r.data||[],i=r.axisType,a=this._names=[],o;i==="category"?(o=[],j(n,function(u,c){var h=br(sf(u),""),f;ke(u)?(f=Se(u),f.value=c):f=c,o.push(f),a.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[i]||"number",l=this._data=new dn([{name:"value",type:s}],this);l.initData(o,a)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:K.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:K.color.secondary},data:[]},t}($e),_8=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline.slider",t.defaultOption=fl(w5.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:K.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:K.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:K.color.tertiary},itemStyle:{color:K.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:K.color.accent60},itemStyle:{color:K.color.accent60,borderColor:K.color.accent60},controlStyle:{color:K.color.accent70,borderColor:K.color.accent70}},progress:{lineStyle:{color:K.color.accent30},itemStyle:{color:K.color.accent40}},data:[]}),t}(w5);Qt(_8,M_.prototype);var Wpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Mt),Hpe=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this,r,n,i)||this;return o.type=a||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Vi),oS=Math.PI,S5=Ye(),Upe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.api=n},t.prototype.render=function(r,n,i){if(this.model=r,this.api=i,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var a=this._layout(r,i),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(a,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return gr("nameValue",{noName:!0,value:c})},j(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](a,o,l,r)},this),this._renderAxisLabel(a,s,l,r),this._position(a,r)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(r,n){var i=r.get(["label","position"]),a=r.get("orient"),o=$pe(r,n),s;i==null||i==="auto"?s=a==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:oS/2},h=a==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),d=f.get("show",!0),g=d?f.get("itemSize"):0,m=d?f.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*oS/180;var _,w,S,T=f.get("position",!0),M=d&&f.get("showPlayBtn",!0),A=d&&f.get("showPrevBtn",!0),P=d&&f.get("showNextBtn",!0),I=0,N=h;T==="left"||T==="bottom"?(M&&(_=[0,0],I+=y),A&&(w=[I,0],I+=y),P&&(S=[N-g,0],N-=y)):(M&&(_=[N-g,0],N-=y),A&&(w=[0,0],I+=y),P&&(S=[N-g,0],N-=y));var D=[I,N];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:a,rotation:c[a],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[a],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[a],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var i=this._mainGroup,a=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=Pr(),l=o.x,u=o.y+o.height;ha(s,s,[-l,-u]),Ko(s,s,-oS/2),ha(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(i.getBoundingRect()),f=_(a.getBoundingRect()),d=[i.x,i.y],g=[a.x,a.y];g[0]=d[0]=c[0][0];var m=r.labelPosOpt;if(m==null||he(m)){var y=m==="+"?0:1;w(d,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(d,h,c,1,y),g[1]=d[1]+m}i.setPosition(d),a.setPosition(g),i.rotation=a.rotation=r.rotation,x(i),x(a);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,T,M,A,P){S[A]+=M[A][P]-T[A][P]}},t.prototype._createAxis=function(r,n){var i=n.getData(),a=n.get("axisType"),o=Zpe(n,a);o.getTicks=function(){return i.mapArray(["value"],function(u){return{value:u}})};var s=i.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new Hpe("value",o,r.axisExtent,a);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new Ce;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,i,a){var o=i.getExtent();if(a.get(["lineStyle","show"])){var s=new ar({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:Q({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new ar({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ae({lineCap:"round",lineWidth:s.style.lineWidth},a.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,i,a){var o=this,s=a.getData(),l=i.scale.getTicks();this._tickSymbols=[],j(l,function(u){var c=i.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),d=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:fe(o._changeTimeline,o,u.value)},y=C5(h,f,n,m);y.ensureState("emphasis").style=d.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),Hs(y);var x=De(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=a):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,i,a){var o=this,s=i.getLabelModel();if(s.get("show")){var l=a.getData(),u=i.getViewLabels();this._tickLabels=[],j(u,function(c){var h=c.tickValue,f=l.getItemModel(h),d=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=i.dataToCoord(c.tickValue),x=new tt({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:fe(o._changeTimeline,o,h),silent:!1,style:Ct(d,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=Ct(g),x.ensureState("progress").style=Ct(m),n.add(x),Hs(x),S5(x).dataIndex=h,o._tickLabels.push(x)})}},t.prototype._renderControl=function(r,n,i,a){var o=r.controlSize,s=r.rotation,l=a.getModel("controlStyle").getItemStyle(),u=a.getModel(["emphasis","controlStyle"]).getItemStyle(),c=a.getPlayState(),h=a.get("inverse",!0);f(r.nextBtnPosition,"next",fe(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",fe(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",fe(this._handlePlayClick,this,!c),!0);function f(d,g,m,y){if(d){var x=fa(be(a.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=Ype(a,g+"Icon",_,{x:d[0],y:d[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),Hs(w)}}},t.prototype._renderCurrentPointer=function(r,n,i,a){var o=a.getData(),s=a.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=fe(u._handlePointerDrag,u),h.ondragend=fe(u._handlePointerDragend,u),T5(h,u._progressLine,s,i,a,!0)},onUpdate:function(h){T5(h,u._progressLine,s,i,a)}};this._currentPointer=C5(l,l,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(r){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:r,from:this.uid})},t.prototype._handlePointerDrag=function(r,n,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var i=this._toAxisCoord(r)[0],a=this._axis,o=Qn(a.getExtent().slice());i>o[1]&&(i=o[1]),i=0&&(s[o]=+s[o].toFixed(g)),[s,d]}var ay={min:Fe(iy,"min"),max:Fe(iy,"max"),average:Fe(iy,"average"),median:Fe(iy,"median")};function Cp(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,i=n&&n.dimensions;if(!ege(t)&&!re(t.coord)&&re(i)){var a=b8(t,r,n,e);if(t=Se(t),t.type&&ay[t.type]&&a.baseAxis&&a.valueAxis){var o=Ve(i,a.baseAxis.dim),s=Ve(i,a.valueAxis.dim),l=ay[t.type](r,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!re(i)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ay[t.type]){var c=n.getOtherAxis(u);c&&(t.value=_x(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)ay[h[f]]&&(h[f]=_x(r,r.mapDimension(i[f]),h[f]));return t}}function b8(e,t,r,n){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,i.valueAxis=r.getAxis(tge(n,i.valueDataDim)),i.baseAxis=r.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=n.getBaseAxis(),i.valueAxis=r.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function tge(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Tp(e,t){return e&&e.containData&&t.coord&&!w2(t)?e.containData(t.coord):!0}function rge(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!w2(t)&&!w2(r)?e.containZone(t.coord,r.coord):!0}function w8(e,t){return e?function(r,n,i,a){var o=a<2?r.coord&&r.coord[a]:r.value;return $s(o,t[a])}:function(r,n,i,a){return $s(r.value,t[a])}}function _x(e,t,r){if(r==="average"){var n=0,i=0;return e.each(t,function(a,o){isNaN(a)||(n+=a,i++)}),n/i}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var sS=Ye(),mL=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){this.markerGroupMap=_e()},t.prototype.render=function(r,n,i){var a=this,o=this.markerGroupMap;o.each(function(s){sS(s).keep=!1}),n.eachSeries(function(s){var l=Qa.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,n,i)}),o.each(function(s){!sS(s).keep&&a.group.remove(s.group)}),nge(n,o,this.type)},t.prototype.markKeep=function(r){sS(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var i=this;j(r,function(a){var o=Qa.getMarkerModelFromSeries(a,i.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?OF(l):fA(l))})}})},t.type="marker",t}(Mt);function nge(e,t,r){e.eachSeries(function(n){var i=Qa.getMarkerModelFromSeries(n,r),a=t.get(n.id);if(i&&a&&a.group){var o=Fu(i),s=o.z,l=o.zlevel;w_(a.group,s,l)}})}function A5(e,t,r){var n=t.coordinateSystem,i=r.getWidth(),a=r.getHeight(),o=n&&n.getArea&&n.getArea();e.each(function(s){var l=e.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:i,h=u?o?o.height:0:a,f=u&&o?o.x:0,d=u&&o?o.y:0,g,m=ce(l.get("x"),c)+f,y=ce(l.get("y"),h)+d;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=e.get(n.dimensions[1],s);g=n.dataToPoint([x,_])}isNaN(m)||(g[0]=m),isNaN(y)||(g[1]=y),e.setItemLayout(s,g)})}var ige=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markPoint");o&&(A5(o.getData(),a,i),this.markerGroupMap.get(a.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Kp),h=age(o,r,n);n.setData(h),A5(n.getData(),r,a),h.each(function(f){var d=h.getItemModel(f),g=d.getShallow("symbol"),m=d.getShallow("symbolSize"),y=d.getShallow("symbolRotate"),x=d.getShallow("symbolOffset"),_=d.getShallow("symbolKeepAspect");if(we(g)||we(m)||we(y)||we(x)){var w=n.getRawValue(f),S=n.getDataParams(f);we(g)&&(g=g(w,S)),we(m)&&(m=m(w,S)),we(y)&&(y=y(w,S)),we(x)&&(x=x(w,S))}var T=d.getModel("itemStyle").getItemStyle(),M=d.get("z2"),A=Yp(l,"color");T.fill||(T.fill=A),h.setItemVisual(f,{z2:be(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:T})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(d){De(d).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(mL);function age(e,t,r){var n;e?n=ae(e&&e.dimensions,function(s){var l=t.getData().getDimensionInfo(t.getData().mapDimension(s))||{};return Q(Q({},l),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new dn(n,r),a=ae(r.get("data"),Fe(Cp,t));e&&(a=ot(a,Fe(Tp,e)));var o=w8(!!e,n);return i.initData(a,null,o),i}function oge(e){e.registerComponentModel(Qpe),e.registerComponentView(ige),e.registerPreprocessor(function(t){gL(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var sge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Qa),oy=Ye(),lge=function(e,t,r,n){var i=e.getData(),a;if(re(n))a=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=t.getAxis(n.yAxis!=null?"y":"x"),l=Fr(n.yAxis,n.xAxis);else{var u=b8(n,i,t,e);s=u.valueAxis;var c=ak(i,u.valueDataDim);l=_x(i,c,o)}var h=s.dim==="x"?0:1,f=1-h,d=Se(n),g={coord:[]};d.type=null,d.coord=[],d.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&rt(l)&&(l=+l.toFixed(Math.min(m,20))),d.coord[h]=g.coord[h]=l,a=[d,g,{type:o,valueIndex:n.valueIndex,value:l}]}else a=[]}var y=[Cp(e,a[0]),Cp(e,a[1]),Q({},a[2])];return y[2].type=y[2].type||null,Ge(y[2],y[0]),Ge(y[2],y[1]),y};function bx(e){return!isNaN(e)&&!isFinite(e)}function k5(e,t,r,n){var i=1-e,a=n.dimensions[e];return bx(t[i])&&bx(r[i])&&t[e]===r[e]&&n.getAxis(a).containData(t[e])}function uge(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(k5(1,r,n,e)||k5(0,r,n,e)))return!0}return Tp(e,t[0])&&Tp(e,t[1])}function lS(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=ce(o.get("x"),i.getWidth()),u=ce(o.get("y"),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=a.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=a.dataToPoint([h,f])}if(tl(a,"cartesian2d")){var d=a.getAxis("x"),g=a.getAxis("y"),c=a.dimensions;bx(e.get(c[0],t))?s[0]=d.toGlobalCoord(d.getExtent()[r?0:1]):bx(e.get(c[1],t))&&(s[1]=g.toGlobalCoord(g.getExtent()[r?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}e.setItemLayout(t,s)}var cge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=oy(o).from,u=oy(o).to;l.each(function(c){lS(l,c,!0,a,i),lS(u,c,!1,a,i)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Rk);this.group.add(c.group);var h=hge(o,r,n),f=h.from,d=h.to,g=h.line;oy(n).from=f,oy(n).to=d,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");re(m)||(m=[m,m]),re(y)||(y=[y,y]),re(x)||(x=[x,x]),re(_)||(_=[_,_]),h.from.each(function(S){w(f,S,!0),w(d,S,!1)}),g.each(function(S){var T=g.getItemModel(S),M=T.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),d.getItemLayout(S)]);var A=T.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:be(A,0),fromSymbolKeepAspect:f.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:f.getItemVisual(S,"symbolOffset"),fromSymbolRotate:f.getItemVisual(S,"symbolRotate"),fromSymbolSize:f.getItemVisual(S,"symbolSize"),fromSymbol:f.getItemVisual(S,"symbol"),toSymbolKeepAspect:d.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:d.getItemVisual(S,"symbolOffset"),toSymbolRotate:d.getItemVisual(S,"symbolRotate"),toSymbolSize:d.getItemVisual(S,"symbolSize"),toSymbol:d.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){De(S).dataModel=n,S.traverse(function(T){De(T).dataModel=n})});function w(S,T,M){var A=S.getItemModel(T);lS(S,T,M,r,a);var P=A.getModel("itemStyle").getItemStyle();P.fill==null&&(P.fill=Yp(l,"color")),S.setItemVisual(T,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:be(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:be(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:be(A.get("symbolSize"),y[M?0:1]),symbol:be(A.get("symbol",!0),m[M?0:1]),style:P})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(mL);function hge(e,t,r){var n;e?n=ae(e&&e.dimensions,function(u){var c=t.getData().getDimensionInfo(t.getData().mapDimension(u))||{};return Q(Q({},c),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new dn(n,r),a=new dn(n,r),o=new dn([],r),s=ae(r.get("data"),Fe(lge,t,e,r));e&&(s=ot(s,Fe(uge,e)));var l=w8(!!e,n);return i.initData(ae(s,function(u){return u[0]}),null,l),a.initData(ae(s,function(u){return u[1]}),null,l),o.initData(ae(s,function(u){return u[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function fge(e){e.registerComponentModel(sge),e.registerComponentView(cge),e.registerPreprocessor(function(t){gL(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var dge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},t}(Qa),sy=Ye(),vge=function(e,t,r,n){var i=n[0],a=n[1];if(!(!i||!a)){var o=Cp(e,i),s=Cp(e,a),l=o.coord,u=s.coord;l[0]=Fr(l[0],-1/0),l[1]=Fr(l[1],-1/0),u[0]=Fr(u[0],1/0),u[1]=Fr(u[1],1/0);var c=a_([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function Sx(e){return!isNaN(e)&&!isFinite(e)}function L5(e,t,r,n){var i=1-e;return Sx(t[i])&&Sx(r[i])}function pge(e,t){var r=t.coord[0],n=t.coord[1],i={coord:r,x:t.x0,y:t.y0},a={coord:n,x:t.x1,y:t.y1};return tl(e,"cartesian2d")?r&&n&&(L5(1,r,n)||L5(0,r,n))?!0:rge(e,i,a):Tp(e,i)||Tp(e,a)}function N5(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=ce(o.get(r[0]),i.getWidth()),u=ce(o.get(r[1]),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=e.getValues(["x0","y0"],t),h=e.getValues(["x1","y1"],t),f=a.clampData(c),d=a.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>d[0]?h[0]:c[0]:g[0]=f[0]>d[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>d[1]?h[1]:c[1]:g[1]=f[1]>d[1]?c[1]:h[1],s=n.getMarkerPosition(g,r,!0)}else{var m=e.get(r[0],t),y=e.get(r[1],t),x=[m,y];a.clampData&&a.clampData(x,x),s=a.dataToPoint(x,!0)}if(tl(a,"cartesian2d")){var _=a.getAxis("x"),w=a.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Sx(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Sx(y)&&(s[1]=w.toGlobalCoord(w.getExtent()[r[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var P5=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],gge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=Qa.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=ae(P5,function(h){return N5(s,l,h,a,i)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Ce});this.group.add(c.group),this.markKeep(c);var h=mge(o,r,n);n.setData(h),h.each(function(f){var d=ae(P5,function(N){return N5(h,f,N,r,a)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[g.parse(h.get("x0",f)),g.parse(h.get("x1",f))],w=[m.parse(h.get("y0",f)),m.parse(h.get("y1",f))];Qn(_),Qn(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[1]=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:K.size.m,align:"auto",backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,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:K.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}($e),zc=Fe,C2=j,ly=Ce,S8=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!1,r}return t.prototype.init=function(){this.group.add(this._contentGroup=new ly),this.group.add(this._selectorGroup=new ly),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,i){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,i,l,s,u);var c=Tr(r,i).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),d=It(h,c,f),g=this.layoutInner(r,o,d,a,l,u),m=It(Ae({width:g.width,height:g.height},h),c,f);this.group.x=m.x-g.x,this.group.y=m.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=h8(g,r))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(r,n,i,a,o,s,l){var u=this.getContentGroup(),c=_e(),h=n.get("selectedMode"),f=n.get("triggerEvent"),d=[];i.eachRawSeries(function(g){!g.get("legendHoverLink")&&d.push(g.id)}),C2(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` +`)){var _=new ly;_.newline=!0,u.add(_);return}var w=i.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),T=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),P=this._createItem(w,x,m,g,n,r,T,A,M,h,a);P.on("click",zc(I5,x,null,a,d)).on("mouseover",zc(T2,w.name,null,a,d)).on("mouseout",zc(M2,w.name,null,a,d)),i.ssr&&P.eachChild(function(I){var N=De(I);N.seriesIndex=w.seriesIndex,N.dataIndex=m,N.ssrType="legend"}),f&&P.eachChild(function(I){y.packEventData(I,n,w,m,x)}),c.set(x,!0)}else i.eachRawSeries(function(I){var N=this;if(!c.get(x)&&I.legendVisualProvider){var D=I.legendVisualProvider;if(!D.containName(x))return;var O=D.indexOfName(x),R=D.getItemVisual(O,"style"),F=D.getItemVisual(O,"legendIcon"),H=fn(R.fill);H&&H[3]===0&&(H[3]=.2,R=Q(Q({},R),{fill:Li(H,"rgba")}));var W=this._createItem(I,x,m,g,n,r,{},R,F,h,a);W.on("click",zc(I5,null,x,a,d)).on("mouseover",zc(T2,null,x,a,d)).on("mouseout",zc(M2,null,x,a,d)),i.ssr&&W.eachChild(function(V){var z=De(V);z.seriesIndex=I.seriesIndex,z.dataIndex=m,z.ssrType="legend"}),f&&W.eachChild(function(V){N.packEventData(V,n,I,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,a,s,l)},t.prototype.packEventData=function(r,n,i,a,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:a,value:o,seriesIndex:i.seriesIndex};De(r).eventData=s},t.prototype._createSelector=function(r,n,i,a,o){var s=this.getSelectorGroup();C2(r,function(u){var c=u.type,h=new tt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){i.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),d=n.getModel(["emphasis","selectorLabel"]);Dr(h,{normal:f,emphasis:d},{defaultText:u.title}),Hs(h)})},t.prototype._createItem=function(r,n,i,a,o,s,l,u,c,h,f){var d=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=a.get("symbolRotate"),_=a.get("symbolKeepAspect"),w=a.get("icon");c=w||c||"roundRect";var S=_ge(c,a,l,u,d,y,f),T=new ly,M=a.getModel("textStyle");if(we(r.getLegendIcon)&&(!w||w==="inherit"))T.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;T.add(bge({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var P=s==="left"?g+5:-5,I=s,N=o.get("formatter"),D=n;he(N)&&N?D=N.replace("{name}",n??""):we(N)&&(D=N(n));var O=y?M.getTextColor():a.get("inactiveColor");T.add(new tt({style:Ct(M,{text:D,x:P,y:m/2,fill:O,align:I,verticalAlign:"middle"},{inheritColor:O})}));var R=new Ze({shape:T.getBoundingRect(),style:{fill:"transparent"}}),F=a.getModel("tooltip");return F.get("show")&&Qo({el:R,componentModel:o,itemName:n,itemTooltipOption:F.option}),T.add(R),T.eachChild(function(H){H.silent=!0}),R.silent=!h,this.getContentGroup().add(T),Hs(T),T.__legendDataIndex=i,T},t.prototype.layoutInner=function(r,n,i,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();wu(r.get("orient"),l,r.get("itemGap"),i.width,i.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){wu("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),d=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?d[m]+=c[y]+g:h[m]+=f[y]+g,d[1-m]+=c[x]/2-f[x]/2,u.x=d[0],u.y=d[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[x]=Math.max(c[x],f[x]),w[_]=Math.min(0,f[_]+d[1-m]),w}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Mt);function _ge(e,t,r,n,i,a,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),C2(y,function(_,w){y[w]==="inherit"&&(y[w]=x[w])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),c=e.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?n.decal:Gh(h,o),u.fill==="inherit"&&(u.fill=n[i]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(i==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),d=f.getLineStyle();if(s(d,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),d.stroke==="auto"&&(d.stroke=n.fill),!a){var g=t.get("inactiveBorderWidth"),m=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&m?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),d.stroke=f.get("inactiveColor"),d.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:d}}function bge(e){var t=e.icon||"roundRect",r=sr(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return r.setStyle(e.itemStyle),r.rotation=(e.iconRotate||0)*Math.PI/180,r.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill=K.color.neutral00,r.style.lineWidth=2),r}function I5(e,t,r,n){M2(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),T2(e,t,r,n)}function C8(e){for(var t=e.getZr().storage.getDisplayList(),r,n=0,i=t.length;ni[o],y=[-d.x,-d.y];n||(y[a]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=be(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[a]+=i[o]-g[o]:x[a]+=g[o]+w}_[1-a]+=d[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),f.setPosition(_);var T={x:0,y:0};if(T[o]=m?i[o]:d[o],T[s]=Math.max(d[s],g[s]),T[l]=Math.min(0,g[l]+_[1-a]),h.__rectSize=i[o],m){var M={x:0,y:0};M[o]=Math.max(i[o]-g[o]-w,0),M[s]=T[s],h.setClipPath(new Ze({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(P){P.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&it(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),T},t.prototype._pageGo=function(r,n,i){var a=this._getPageInfo(n)[r];a!=null&&i.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var i=this._controllerGroup;j(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,d=i.childOfName(c);d&&(d.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),d.cursor=f?"pointer":"default")});var a=i.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;a&&o&&a.setStyle("text",he(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),i=this.getContentGroup(),a=this._containerGroup.__rectSize,o=r.getOrient().index,s=uS[o],l=cS[o],u=this._findTargetItemIndex(n),c=i.children(),h=c[u],f=c.length,d=f?1:0,g={contentPosition:[i.x,i.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=f;++y)w=S(c[y]),(!w&&_.e>x.s+a||w&&!T(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!T(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),P=A[l]+M[l];return{s:P,e:P+A[s],i:M.__legendDataIndex}}}function T(M,A){return M.e>=A&&M.s<=A+a}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,i=this.getContentGroup(),a;return i.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===r&&(n=s)}),n??a},t.type="legend.scroll",t}(S8);function Mge(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(i){i.setScrollDataIndex(n)})})}function Age(e){He(T8),e.registerComponentModel(Cge),e.registerComponentView(Tge),Mge(e)}function kge(e){He(T8),He(Age)}var Lge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=fl(Sp.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Sp),yL=Ye();function Nge(e,t,r){yL(e).coordSysRecordMap.each(function(n){var i=n.dataZoomInfoMap.get(t.uid);i&&(i.getRange=r)})}function Pge(e,t){for(var r=yL(e).coordSysRecordMap,n=r.keys(),i=0;ia[i+n]&&(n=u),o=o&&l.get("preventDefaultMouseMove",!0)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:r,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint}}}}function Rge(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(t,r){var n=yL(r),i=n.coordSysRecordMap||(n.coordSysRecordMap=_e());i.each(function(a){a.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=l8(a);j(o.infoList,function(s){var l=s.model.uid,u=i.get(l)||i.set(l,Ige(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=_e());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),i.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){M8(i,a);return}var c=jge(l,a,r);o.enable(c.controlType,c.opt),xf(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Oge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,i){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),Nge(i,r,{pan:fe(hS.pan,this),zoom:fe(hS.zoom,this),scrollMove:fe(hS.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Pge(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(cL),hS={zoom:function(e,t,r,n){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=fS[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(rl(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:R5(function(e,t,r,n,i,a){var o=fS[n]([a.oldX,a.oldY],[a.newX,a.newY],t,i,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:R5(function(e,t,r,n,i,a){var o=fS[n]([0,0],[a.scrollDelta,a.scrollDelta],t,i,r);return o.signal*(e[1]-e[0])*a.scrollDelta})};function R5(e){return function(t,r,n,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,i);if(rl(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var fS={grid:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem.getRect();return e=e||[0,0],a.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,r,n,i){var a=r.axis,o=i.model.coordinateSystem.getRect(),s={};return e=e||[0,0],a.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function A8(e){hL(e),e.registerComponentModel(Lge),e.registerComponentView(Oge),Rge(e)}var zge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=fl(Sp.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(Sp),jd=Ze,Bge=1,dS=30,Fge=7,Rd="horizontal",O5="vertical",Vge=5,Gge=["line","bar","candlestick","scatter"],Wge={easing:"cubicOut",duration:100,delay:0},Hge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=fe(this._onBrush,this),this._onBrushEnd=fe(this._onBrushEnd,this)},t.prototype.render=function(r,n,i,a){if(e.prototype.render.apply(this,arguments),xf(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){lp(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Ce;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,i=r.get("brushSelect"),a=i?Fge:0,o=Tr(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Rd?{right:o.width-s.x-s.width,top:o.height-dS-l-a,width:s.width,height:dS}:{right:l,top:s.y,width:dS,height:s.height},c=Ju(r.option);j(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=It(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===O5&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,i=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(i===Rd&&!o?{scaleY:l?1:-1,scaleX:1}:i===Rd&&o?{scaleY:l?1:-1,scaleX:-1}:i===O5&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]);r.x=n.x-u.x,r.y=n.y-u.y,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,i=this._displayables.sliderGroup,a=r.get("brushSelect");i.add(new jd({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new jd({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:fe(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),i.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,i=this._shadowSize||[],a=r.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==i[0]||n[1]!==i[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),d=(f[1]-f[0])*.3;f=[f[0]-d,f[1]+d];var g=[0,n[1]],m=[0,n[0]],y=[[n[0],0],[0,0]],x=[],_=m[1]/Math.max(1,o.count()-1),w=n[0]/(h[1]-h[0]),S=r.thisAxis.type==="time",T=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(O,R,F){if(M>0&&F%M){S||(T+=_);return}T=S?(+O-h[0])*w:T+_;var H=R==null||isNaN(R)||R==="",W=H?0:ht(R,f,g,!0);H&&!A&&F?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([T,0]),x.push([T,0])),H||(y.push([T,W]),x.push([T,W])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var P=this.dataZoomModel;function I(O){var R=P.getModel(O?"selectedDataBackground":"dataBackground"),F=new Ce,H=new en({shape:{points:u},segmentIgnoreThreshold:1,style:R.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),W=new Gr({shape:{points:c},segmentIgnoreThreshold:1,style:R.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return F.add(H),F.add(W),F}for(var N=0;N<3;N++){var D=I(N===1);this._displayables.sliderGroup.add(D),this._displayables.dataShadowSegs.push(D)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var i,a=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();j(l,function(u){if(!i&&!(n!==!0&&Ve(Gge,u.get("type"))<0)){var c=a.getComponent(Ps(o),s).axis,h=Uge(o),f,d=u.coordinateSystem;h!=null&&d.getOtherAxis&&(f=d.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);i={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),i}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,i=n.handles=[null,null],a=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,h=l.get("brushSelect"),f=n.filler=new jd({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new jd({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:Bge,fill:K.color.transparent}})),j([0,1],function(w){var S=l.get("handleIcon");!G0[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var T=sr(S,-1,0,2,2,null,!0);T.attr({cursor:Zge(this._orient),draggable:!0,drift:fe(this._onDragMove,this,w),ondragend:fe(this._onDragEnd,this),onmouseover:fe(this._showDataInfo,this,!0),onmouseout:fe(this._showDataInfo,this,!1),z2:5});var M=T.getBoundingRect(),A=l.get("handleSize");this._handleHeight=ce(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,T.setStyle(l.getModel("handleStyle").getItemStyle()),T.style.strokeNoScale=!0,T.rectHover=!0,T.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Hs(T);var P=l.get("handleColor");P!=null&&(T.style.fill=P),o.add(i[w]=T);var I=l.getModel("textStyle"),N=l.get("handleLabel")||{},D=N.show||!1;r.add(a[w]=new tt({silent:!0,invisible:!D,style:Ct(I,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:I.getTextColor(),font:I.getFont()}),z2:10}))},this);var d=f;if(h){var g=ce(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new Ze({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=sr(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));d=n.moveZone=new Ze({invisible:!0,shape:{y:s[1]-_,height:g+_}}),d.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(d)}d.attr({draggable:!0,cursor:"default",drift:fe(this._onDragMove,this,"all"),ondragstart:fe(this._showDataInfo,this,!0),ondragend:fe(this._onDragEnd,this),onmouseover:fe(this._showDataInfo,this,!0),onmouseout:fe(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[ht(r[0],[0,100],n,!0),ht(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var i=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=i.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];rl(n,a,o,i.get("zoomLock")?"all":r,s.minSpan!=null?ht(s.minSpan,l,o,!0):null,s.maxSpan!=null?ht(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Qn([ht(a[0],o,l,!0),ht(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,i=this._handleEnds,a=Qn(i.slice()),o=this._size;j([0,1],function(d){var g=n.handles[d],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:i[d]+(d?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;cn[0]||i[1]<0||i[1]>n[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",i[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,i=r.offsetY;this._brushStart=new Ne(n,i),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var i=n.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(i.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[i.x,i.x+i.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();rl(0,l,o,0,u.minSpan!=null?ht(u.minSpan,s,o,!0):null,u.maxSpan!=null?ht(u.maxSpan,s,o,!0):null),this._range=Qn([ht(l[0],o,s,!0),ht(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Wo(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var i=this._displayables,a=this.dataZoomModel,o=i.brushRect;o||(o=i.brushRect=new jd({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),i.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?Wge:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=l8(this.dataZoomModel).infoList;if(!r&&n.length){var i=n[0].model.coordinateSystem;r=i.getRect&&i.getRect()}if(!r){var a=this.api.getWidth(),o=this.api.getHeight();r={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(cL);function Uge(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function Zge(e){return e==="vertical"?"ns-resize":"ew-resize"}function k8(e){e.registerComponentModel(zge),e.registerComponentView(Hge),hL(e)}function $ge(e){He(A8),He(k8)}var L8={get:function(e,t,r){var n=Se((Yge[e]||{})[t]);return r&&re(n)?n[n.length-1]:n}},Yge={color:{active:["#006edd","#e0ffff"],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},z5=Ir.mapVisual,Xge=Ir.eachVisual,qge=re,B5=j,Kge=Qn,Jge=ht,Cx=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i)},t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&y8(i,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=fe(r,this),this.controllerVisuals=_2(this.option.controller,n,r),this.targetVisuals=_2(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this.option.seriesId,n=this.option.seriesIndex;n==null&&r==null&&(n="all");var i=lf(this.ecModel,"series",{index:n,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return ae(i,function(a){return a.componentIndex})},t.prototype.eachTargetSeries=function(r,n){j(this.getTargetSeriesIndices(),function(i){var a=this.ecModel.getSeriesByIndex(i);a&&r.call(n,a)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(i){i===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,i){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;i=i||["<",">"],re(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(he(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(we(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?i[0]+" "+c[1]:r[1]===s[1]?i[1]+" "+c[0]:c[0]+" - "+c[1];return c;function h(f){return f===s[0]?"min":f===s[1]?"max":(+f).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=Kge([r.min,r.max]);this._dataExtent=n},t.prototype.getDataDimensionIndex=function(r){var n=this.option.dimension;if(n!=null)return r.getDimensionIndex(n);for(var i=r.dimensions,a=i.length-1;a>=0;a--){var o=i[a],s=r.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,i={inRange:n.inRange,outOfRange:n.outOfRange},a=n.target||(n.target={}),o=n.controller||(n.controller={});Ge(a,i),Ge(o,i);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(h){qge(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,d){var g=h[f],m=h[d];g&&!m&&(m=h[d]={},B5(g,function(y,x){if(Ir.isValidType(x)){var _=L8.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,d=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";B5(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&Se(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=d&&Se(d)||(s?_[0]:[_[0],_[0]])),w.symbol=z5(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var T=-1/0;Xge(S,function(M){M>T&&(T=M)}),w.symbolSize=z5(S,function(M){return Jge(M,[0,T],[0,_[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}($e),F5=[20,140],Qge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(i){i.mappingMethod="linear",i.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=F5[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=F5[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):re(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),j(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=Qn((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=i[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(i){var a=[],o=i.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&a.push(l)},this),n.push({seriesId:i.id,dataIndex:a})},this),n},t.prototype.getVisualMeta=function(r){var n=V5(this,"outOfRange",this.getExtent()),i=V5(this,"inRange",this.option.range.slice()),a=[];function o(d,g){a.push({value:d,color:r(d,g)})}for(var s=0,l=0,u=i.length,c=n.length;lr[1])break;a.push({color:this.getControllerVisual(l,"color",n),offset:s/i})}return a.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),a},t.prototype._createBarPoints=function(r,n){var i=this.visualMapModel.itemSize;return[[i[0]-n[0],r[0]],[i[0],r[0]],[i[0],r[1]],[i[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,i=this.visualMapModel.get("inverse");return new Ce(n==="horizontal"&&!i?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&i?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!i?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var i=this._shapes,a=this.visualMapModel,o=i.handleThumbs,s=i.handleLabels,l=a.itemSize,u=a.getExtent(),c=this._applyTransform("left",i.mainGroup);eme([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var d=ka(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(d,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=sa(i.handleLabelPoints[h],Us(f,this.group));if(this._orient==="horizontal"){var y=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;m[1]+=y}s[h].setStyle({x:m[0],y:m[1],text:a.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",i.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,i,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,h=c.indicator;if(h){h.attr("invisible",!1);var f={convertOpacityToAlpha:!0},d=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=ka(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=sa(c.indicatorLabelPoint,Us(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),T=this._orient,M=T==="horizontal";w.setStyle({text:(i||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:d}},P={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var I={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,I),w.animateTo(P,I)}else h.attr(A),w.attr(P);this._firstShowIndicator=!1;var N=this._shapes.handleLabels;if(N)for(var D=0;Do[1]&&(h[1]=1/0),n&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var f=this._hoverLinkDataIndices,d=[];(n||U5(i))&&(d=this._hoverLinkDataIndices=i.findTargetDataIndices(h));var g=Oq(f,d);this._dispatchHighDown("downplay",Wy(g[0],i)),this._dispatchHighDown("highlight",Wy(g[1],i))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(vu(r.target,function(l){var u=De(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var i=this.ecModel.getSeriesByIndex(n.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(i)){var o=i.getData(n.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var i=0;i=0&&(a.dimension=o,n.push(a))}}),e.getData().setVisual("visualMeta",n)}}];function lme(e,t,r,n){for(var i=t.targetVisuals[n],a=Ir.prepareVisualTypes(i),o={color:Yp(e.getData(),"color")},s=0,l=a.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(ame,ome),j(sme,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(ume))}function D8(e){e.registerComponentModel(Qge),e.registerComponentView(nme),I8(e)}var cme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],hme[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var a=this.option.categories;this.resetVisual(function(o,s){i==="categories"?(o.mappingMethod="category",o.categories=Se(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=ae(this._pieceList,function(l){return l=Se(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},i=Ir.listVisualTypes(),a=this.isCategory();j(r.pieces,function(s){j(i,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),j(n,function(s,l){var u=!1;j(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&j(this.stateList,function(c){(r[c]||(r[c]={}))[l]=L8.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var i=this.option,a=this._pieceList,o=(n?i:r).selected||{};if(i.selected=o,j(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),i.selectedMode==="single"){var s=!1;j(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=Se(r)},t.prototype.getValueState=function(r){var n=Ir.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],i=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Ir.findPieceIndex(l,i);c===r&&o.push(u)},this),n.push({seriesId:a.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var i=r.interval||[];n=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],i=["",""],a=this;function o(c,h){var f=a.getRepresentValue({interval:c});h||(h=a.getValueState(f));var d=r(f,h);c[0]===-1/0?i[0]=d:c[1]===1/0?i[1]=d:n.push({value:c[0],color:d},{value:c[1],color:d})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return j(s,function(c){var h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:n,outerColors:i}},t.type="visualMap.piecewise",t.defaultOption=fl(Cx.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(Cx),hme={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(n[1]-n[0])/i;+a.toFixed(r)!==a&&r<5;)r++;t.precision=r,a=+a.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,i)},this)}};function X5(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var fme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,i=n.get("textGap"),a=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=Fr(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),j(l.viewPieceList,function(f){var d=f.piece,g=new Ce;g.onclick=fe(this._onItemClick,this,d),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(d);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=a.get("align")||o;g.add(new tt({style:Ct(a,{x:x==="right"?-i:s[0]+i,y:s[1]/2,text:d.text,verticalAlign:a.get("verticalAlign")||"middle",align:x,opacity:be(a.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),wu(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var i=this;r.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=i.visualMapModel;s.option.hoverLink&&i.api.dispatchAction({type:o,batch:Wy(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return P8(r,this.api,r.itemSize);var i=n.align;return(!i||i==="auto")&&(i="left"),i},t.prototype._renderEndsText=function(r,n,i,a,o){if(n){var s=new Ce,l=this.visualMapModel.textStyleModel;s.add(new tt({style:Ct(l,{x:a?o==="right"?i[0]:0:i[0]/2,y:i[1]/2,verticalAlign:"middle",align:a?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=ae(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),i=r.get("text"),a=r.get("orient"),o=r.get("inverse");return(a==="horizontal"?o:!o)?n.reverse():i&&(i=i.slice().reverse()),{viewPieceList:n,endsText:i}},t.prototype._createItemSymbol=function(r,n,i,a){var o=sr(this.getControllerVisual(n,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(n,"color"));o.silent=a,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,i=n.option,a=i.selectedMode;if(a){var o=Se(i.selected),s=n.getSelectedMapKey(r);a==="single"||a===!0?(o[s]=!0,j(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(N8);function E8(e){e.registerComponentModel(cme),e.registerComponentView(fme),I8(e)}function dme(e){He(D8),He(E8)}var vme=function(){function e(t){this._thumbnailModel=t}return e.prototype.reset=function(t){this._renderVersion=t.getMainProcessVersion()},e.prototype.renderContent=function(t){var r=t.api.getViewOfComponentModel(this._thumbnailModel);r&&(t.group.silent=!0,r.renderContent({group:t.group,targetTrans:t.targetTrans,z2Range:i6(t.group),roamType:t.roamType,viewportRect:t.viewportRect,renderVersion:this._renderVersion}))},e.prototype.updateWindow=function(t,r){var n=r.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:t,renderVersion:this._renderVersion})},e}(),pme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventAutoZ=!0,r}return t.prototype.optionUpdated=function(r,n){this._updateBridge()},t.prototype._updateBridge=function(){var r=this._birdge=this._birdge||new vme(this);if(this._target=null,this.ecModel.eachSeries(function(i){_R(i,null)}),this.shouldShow()){var n=this.getTarget();_R(n.baseMapProvider,r)}},t.prototype.shouldShow=function(){return this.getShallow("show",!0)},t.prototype.getBridge=function(){return this._birdge},t.prototype.getTarget=function(){if(this._target)return this._target;var r=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return r?r.subType!=="graph"&&(r=null):r=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:r},this._target},t.type="thumbnail",t.layoutMode="box",t.dependencies=["series","geo"],t.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:K.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:K.color.neutral30,borderColor:K.color.neutral40,opacity:.3},z:10},t}($e),gme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this._api=i,this._model=r,this._coordSys||(this._coordSys=new nc),!this._isEnabled()){this._clear();return}this._renderVersion=i.getMainProcessVersion();var a=this.group;a.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Tr(r,i).refContainer,u=It(C6(r,!0),l),c=s.lineWidth||0,h=this._contentRect=Bu(u.clone(),c/2,!0,!0),f=new Ce;a.add(f),f.setClipPath(new Ze({shape:h.plain()}));var d=this._targetGroup=new Ce;f.add(d);var g=u.plain();g.r=o.getShallow("borderRadius",!0),a.add(this._bgRect=new Ze({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new Ze({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),K5(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),K5(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,i=this._coordSys,a=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,i.setBoundingRect(s.x,s.y,s.width,s.height);var l=It({left:"center",top:"center",aspect:s.width/s.height},a);i.setViewRect(l.x,l.y,l.width,l.height),o.attr(i.getTransformInfo().raw),this._windowRect.z2=r.z2Range.max+10,this._resetRoamController(r.roamType)}}},t.prototype.updateWindow=function(r){var n=this._bridgeRendered;n&&n.renderVersion===r.renderVersion&&(n.targetTrans=r.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},t.prototype._dealUpdateWindow=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=ji([],r.targetTrans),i=aa([],this._coordSys.transform,n);this._transThisToTarget=ji([],i);var a=r.viewportRect;a?a=a.clone():a=new Pe(0,0,this._api.getWidth(),this._api.getHeight()),a.applyTransform(i);var o=this._windowRect,s=o.shape.r;o.setShape(Ae({r:s},a))}},t.prototype._resetRoamController=function(r){var n=this,i=this._api,a=this._roamController;if(a||(a=this._roamController=new rc(i.getZr())),!r||!this._isEnabled()){a.disable();return}a.enable(r,{api:i,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),a.off("pan").off("zoom").on("pan",fe(this._onPan,this)).on("zoom",fe(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.oldX,r.oldY],n),a=Kt([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(q5(this._model.getTarget().baseMapProvider,{dx:a[0]-i[0],dy:a[1]-i[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.originX,r.originY],n);this._api.dispatchAction(q5(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:i[0],originY:i[1]}))}},t.prototype._isEnabled=function(){var r=this._model;if(!r||!r.shouldShow())return!1;var n=r.getTarget().baseMapProvider;return!!n},t.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},t.prototype.remove=function(){this._clear()},t.prototype.dispose=function(){this._clear()},t.type="thumbnail",t}(Mt);function q5(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,Q(n,t),n}function K5(e,t){var r=Fu(e);w_(t.group,r.z,r.zlevel)}function mme(e){e.registerComponentModel(pme),e.registerComponentView(gme)}var yme={label:{enabled:!0},decal:{show:!1}},J5=Ye(),xme={};function _me(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=Se(yme);Ge(n.label,e.getLocaleModel().get("aria"),!1),Ge(r.option,n,!1),i(),a();function i(){var u=r.getModel("decal"),c=u.get("show");if(c){var h=_e();e.eachSeries(function(f){if(!f.isColorBySeries()){var d=h.get(f.type);d||(d={},h.set(f.type,d)),J5(f).scope=d}}),e.eachRawSeries(function(f){if(e.isSeriesFiltered(f))return;if(we(f.enableAriaDecal)){f.enableAriaDecal();return}var d=f.getData();if(f.isColorBySeries()){var _=fT(f.ecModel,f.name,xme,e.getSeriesCount()),w=d.getVisual("decal");d.setVisual("decal",S(w,_))}else{var g=f.getRawData(),m={},y=J5(f).scope;d.each(function(T){var M=d.getRawIndex(T);m[M]=T});var x=g.count();g.each(function(T){var M=m[T],A=g.getName(T)||T+"",P=fT(f.ecModel,A,y,x),I=d.getItemVisual(M,"decal");d.setItemVisual(M,"decal",S(I,P))})}function S(T,M){var A=T?Q(Q({},M),T):M;return A.dirty=!0,A}})}}function a(){var u=t.getZr().dom;if(u){var c=e.getLocaleModel().get("aria"),h=r.getModel("label");if(h.option=Ae(h.option,c),!!h.get("enabled")){if(u.setAttribute("role","img"),h.get("description")){u.setAttribute("aria-label",h.get("description"));return}var f=e.getSeriesCount(),d=h.get(["data","maxCount"])||10,g=h.get(["series","maxCount"])||10,m=Math.min(f,g),y;if(!(f<1)){var x=s();if(x){var _=h.get(["general","withTitle"]);y=o(_,{title:x})}else y=h.get(["general","withoutTitle"]);var w=[],S=f>1?h.get(["series","multiple","prefix"]):h.get(["series","single","prefix"]);y+=o(S,{seriesCount:f}),e.eachSeries(function(P,I){if(I1?h.get(["series","multiple",O]):h.get(["series","single",O]),N=o(N,{seriesId:P.seriesIndex,seriesName:P.get("name"),seriesType:l(P.subType)});var R=P.getData();if(R.count()>d){var F=h.get(["data","partialData"]);N+=o(F,{displayCnt:d})}else N+=h.get(["data","allData"]);for(var H=h.get(["data","separator","middle"]),W=h.get(["data","separator","end"]),V=h.get(["data","excludeDimensionId"]),z=[],Z=0;Z":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Sme=function(){function e(t){var r=this._condVal=he(t)?new RegExp(t):kB(t)?t:null;if(r==null){var n="";ft(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return he(r)?this._condVal.test(t):rt(r)?this._condVal.test(t+""):!1},e}(),Cme=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),Tme=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(i),i=[R,F]}function c(R,F,H,W){hh(R,H)&&hh(F,W)||i.push(R,F,H,W,H,W)}function h(R,F,H,W,V,z){var Z=Math.abs(F-R),U=Math.tan(Z/4)*4/3,$=FP:D2&&n.push(i),n}function k2(e,t,r,n,i,a,o,s,l,u){if(hh(e,r)&&hh(t,n)&&hh(i,o)&&hh(a,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,d=s-t,g=Math.sqrt(f*f+d*d);f/=g,d/=g;var m=r-e,y=n-t,x=i-o,_=a-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&P=0){l.push(o,s);return}var I=[],N=[];Qs(e,r,i,o,.5,I),Qs(t,n,a,s,.5,N),k2(I[0],N[0],I[1],N[1],I[2],N[2],I[3],N[3],l,u),k2(I[4],N[4],I[5],N[5],I[6],N[6],I[7],N[7],l,u)}function Bme(e,t){var r=A2(e),n=[];t=t||1;for(var i=0;i0)for(var u=0;uMath.abs(u),h=R8([l,u],c?0:1,t),f=(c?s:u)/h.length,d=0;di,o=R8([n,i],a?0:1,t),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",h=e[s]/o.length,f=0;f1?null:new Ne(m*l+e,m*u+t)}function Gme(e,t,r){var n=new Ne;Ne.sub(n,r,t),n.normalize();var i=new Ne;Ne.sub(i,e,t);var a=i.dot(n);return a}function Fc(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function Wme(e,t,r){for(var n=e.length,i=[],a=0;ao?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),Wme(t,u,c)}function Tx(e,t,r,n){if(r===1)n.push(t);else{var i=Math.floor(r/2),a=e(t);Tx(e,a[0],i,n),Tx(e,a[1],r-i,n)}return n}function Hme(e,t){for(var r=[],n=0;n0;u/=2){var c=0,h=0;(e&u)>0&&(c=1),(t&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function kx(e){var t=1/0,r=1/0,n=-1/0,i=-1/0,a=ae(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(h,r),n=Math.max(c,n),i=Math.max(h,i),[c,h]}),o=ae(a,function(s,l){return{cp:s,z:Qme(s[0],s[1],t,r,n,i),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function B8(e){return $me(e.path,e.count)}function L2(){return{fromIndividuals:[],toIndividuals:[],count:0}}function eye(e,t,r){var n=[];function i(T){for(var M=0;M=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var rye={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;s3(e)&&(u=e,c=t),s3(t)&&(u=t,c=e);function h(x,_,w,S,T){var M=x.many,A=x.one;if(M.length===1&&!T){var P=_?M[0]:A,I=_?A:M[0];if(Mx(P))h({many:[P],one:I},!0,w,S,!0);else{var N=s?Ae({delay:s(w,S)},l):l;_L(P,I,N),a(P,I,P,I,N)}}else for(var D=Ae({dividePath:rye[r],individualDelay:s&&function(V,z,Z,U){return s(V+w,S)}},l),O=_?eye(M,A,D):tye(A,M,D),R=O.fromIndividuals,F=O.toIndividuals,H=R.length,W=0;Wt.length,d=u?l3(c,u):l3(f?t:e,[f?e:t]),g=0,m=0;mF8))for(var a=n.getIndices(),o=0;o0&&M.group.traverse(function(P){P instanceof Ke&&!P.animators.length&&P.animateFrom({style:{opacity:0}},A)})})}function d3(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function v3(e){return re(e)?e.sort().join(","):e}function ys(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function uye(e,t){var r=_e(),n=_e(),i=_e();return j(e.oldSeries,function(a,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=d3(a),c=v3(u);n.set(c,{dataGroupId:s,data:l}),re(u)&&j(u,function(h){i.set(h,{key:c,dataGroupId:s,data:l})})}),j(t.updatedSeries,function(a){if(a.isUniversalTransitionEnabled()&&a.isAnimationEnabled()){var o=a.get("dataGroupId"),s=a.getData(),l=d3(a),u=v3(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:ys(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:ys(s),data:s}]});else if(re(l)){var h=[];j(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:ys(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:ys(s)}]})}else{var f=i.get(l);if(f){var d=r.get(f.key);d||(d={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:ys(f.data)}],newSeries:[]},r.set(f.key,d)),d.newSeries.push({dataGroupId:o,data:s,divide:ys(s)})}}}}),r}function p3(e,t){for(var r=0;r=0&&i.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:ys(t.oldData[s]),groupIdDim:o.dimension})}),j(Tt(e.to),function(o){var s=p3(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:ys(l),groupIdDim:o.dimension})}}),i.length>0&&a.length>0&&V8(i,a,n)}function hye(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){j(Tt(n.seriesTransition),function(i){j(Tt(i.to),function(a){for(var o=n.updatedSeries,s=0;so.vmin?r+=o.vmin-n+(t-o.vmin)/(o.vmax-o.vmin)*o.gapReal:r+=t-n,n=o.vmax,i=!1;break}r+=o.vmin-n+o.gapReal,n=o.vmax}return i&&(r+=t-n),r},e.prototype.unelapse=function(t){for(var r=g3,n=m3,i=!0,a=0,o=0;ol?a=s.vmin+(t-l)/(u-l)*(s.vmax-s.vmin):a=n+t-r,n=s.vmax,i=!1;break}r=u,n=s.vmax}return i&&(a=n+t-r),a},e}();function dye(){return new fye}var g3=0,m3=0;function vye(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},i=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},a={S:{tpAbs:i(),tpPrct:i()},E:{tpAbs:i(),tpPrct:i()}};j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=bL(s,t);if(u){var c=u.vmin!==s.vmin,h=u.vmax!==s.vmax,f=u.vmax-u.vmin;if(!(c&&h))if(c||h){var d=c?"S":"E";a[d][l.type].has=!0,a[d][l.type].span=f,a[d][l.type].inExtFrac=f/(s.vmax-s.vmin),a[d][l.type].val=l.val}else n[l.type].span+=f,n[l.type].val+=l.val}});var o=r*(0+(t[1]-t[0])+(n.tpAbs.val-n.tpAbs.span)+(a.S.tpAbs.has?(a.S.tpAbs.val-a.S.tpAbs.span)*a.S.tpAbs.inExtFrac:0)+(a.E.tpAbs.has?(a.E.tpAbs.val-a.E.tpAbs.span)*a.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(a.S.tpPrct.has?a.S.tpPrct.span*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.span*a.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(a.S.tpPrct.has?a.S.tpPrct.val*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.val*a.E.tpPrct.inExtFrac:0));j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?Math.max(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function pye(e,t,r,n,i,a){e!=="no"&&j(r,function(o){var s=bL(o,a);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=i*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}j(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:Se(o),vmin:t(o.start),vmax:t(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(he(o.gap)){var u=Jn(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;i(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var h=t(o.gap);(!isFinite(h)||h<0)&&(h=0),s.gapParsed.type="tpAbs",s.gapParsed.val=h}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),r&&r.noNegative&&j(["vmin","vmax"],function(d){s[d]<0&&(s[d]=0)}),s.vmin>s.vmax){var f=s.vmax;s.vmax=s.vmin,s.vmin=f}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var a=-1/0;return j(n,function(o,s){a>o.vmin&&(n[s]=null),a=o.vmax}),{breaks:n.filter(function(o){return!!o})}}function wL(e,t){return P2(t)===P2(e)}function P2(e){return e.start+"_\0_"+e.end}function mye(e,t,r){var n=[];j(e,function(a,o){var s=t(a);s&&s.type==="vmin"&&n.push([o])}),j(e,function(a,o){var s=t(a);if(s&&s.type==="vmax"){var l=ul(n,function(u){return wL(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var i=[];return j(n,function(a){a.length===2&&i.push(r?a:[e[a[0]],e[a[1]]])}),i}function yye(e,t,r,n){var i,a;if(e.break){var o=e.break.parsedBreak,s=ul(r,function(h){return wL(h.breakOption,e.break.parsedBreak.breakOption)}),l=n(Math.pow(t,o.vmin),s.vmin),u=n(Math.pow(t,o.vmax),s.vmax),c={type:o.gapParsed.type,val:o.gapParsed.type==="tpAbs"?ir(Math.pow(t,o.vmin+o.gapParsed.val))-l:o.gapParsed.val};i={type:e.break.type,parsedBreak:{breakOption:o.breakOption,vmin:l,vmax:u,gapParsed:c,gapReal:o.gapReal}},a=s[e.break.type]}return{brkRoundingCriterion:a,vBreak:i}}function xye(e,t,r){var n={noNegative:!0},i=N2(e,r,n),a=N2(e,r,n),o=Math.log(t);return a.breaks=ae(a.breaks,function(s){var l=Math.log(s.vmin)/o,u=Math.log(s.vmax)/o,c={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?Math.log(s.vmin+s.gapParsed.val)/o-l:s.gapParsed.val};return{vmin:l,vmax:u,gapParsed:c,gapReal:s.gapReal,breakOption:s.breakOption}}),{parsedOriginal:i,parsedLogged:a}}var _ye={vmin:"start",vmax:"end"};function bye(e,t){return t&&(e=e||{},e.break={type:_ye[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function wye(){HJ({createScaleBreakContext:dye,pruneTicksByBreak:pye,addBreaksToTicks:gye,parseAxisBreakOption:N2,identifyAxisBreak:wL,serializeAxisBreakIdentifier:P2,retrieveAxisBreakPairs:mye,getTicksLogTransformBreak:yye,logarithmicParseBreaksFromOption:xye,makeAxisLabelFormatterParamBreak:bye})}var y3=Ye();function Sye(e,t){var r=ul(e,function(n){return vr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function Cye(e){j(e,function(t){return t.shouldRemove=!0})}function Tye(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function Mye(e,t,r,n,i){var a=r.axis;if(a.scale.isBlank()||!vr())return;var o=vr().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:"only_break"}),function(I){return I.break},!1);if(!o.length)return;var s=r.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var h=s.get("expandOnClick"),f=s.get("zigzagZ"),d=s.getModel("itemStyle"),g=d.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new Ce({ignoreModelZ:!0}),S=a.isHorizontal(),T=y3(t).visualList||(y3(t).visualList=[]);Cye(T);for(var M=function(I){var N=o[I][0].break.parsedBreak,D=[];D[0]=a.toGlobalCoord(a.dataToCoord(N.vmin,!0)),D[1]=a.toGlobalCoord(a.dataToCoord(N.vmax,!0)),D[1]=z;le&&(te=z);var Ee=[],me=[];Ee[W]=D,me[W]=O,!se&&!le&&(Ee[W]+=Y?-l:l,me[W]-=Y?l:-l),Ee[V]=te,me[V]=te,U.push(Ee),$.push(me);var ye=void 0;if(ie_[1]&&_.reverse(),{coordPair:_,brkId:vr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.coordPair[0]});for(var u=o[0],c=null,h=0;h=0?l[0].width:l[1].width),f=(h+c.x)/2-u.x,d=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:d>0?d:0;s=(f-m)/c.x}var y=new Ne,x=new Ne;Ne.scale(y,n,-s),Ne.scale(x,n,1-s),IT(r[0],y),IT(r[1],x)}function Lye(e,t){var r={breaks:[]};return j(t.breaks,function(n){if(n){var i=ul(e.get("breaks",!0),function(s){return vr().identifyAxisBreak(s,n)});if(i){var a=t.type,o={isExpanded:!!i.isExpanded};i.isExpanded=a===D_?!0:a===lW?!1:a===uW?!i.isExpanded:i.isExpanded,r.breaks.push({start:i.start,end:i.end,isExpanded:!!i.isExpanded,old:o})}}}),r}function Nye(){Tae({adjustBreakLabelPair:kye,buildAxisBreakLine:Aye,rectCoordBuildBreakAxis:Mye,updateModelAxisBreak:Lye})}function Pye(e){Pae(e),wye(),Nye()}function Iye(){Jae(Dye)}function Dye(e,t){j(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=Eye(r);if(n){var i=r.isHorizontal()?"height":"width",a=r.model.get(["axisLabel","margin"]);t[i]-=n[i]+a,r.position==="top"?t.y+=n.height+a:r.position==="left"&&(t.x+=n.width+a)}}})}function Eye(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,i,a=r.getExtent();r instanceof Wh?i=r.count():(n=r.getTicks(),i=n.length);var o=e.getLabelModel(),s=wf(e),l,u=1;i>40&&(u=Math.ceil(i/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,i=null;return function(){for(var a=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function Kye(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function Jye(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function Qye({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useRef(null),[a,o]=G.useState("connected"),s=G.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=G.useMemo(()=>{let y=e;return a==="connected"?y=y.filter(x=>s.has(x.node_num)):a==="infra"&&(y=y.filter(x=>b3.includes(x.role))),y},[e,a,s]),u=G.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=G.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=G.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),f=G.useMemo(()=>{const y=l.map(_=>{const w=Kye(_.latitude),S=_3[w%_3.length],T=b3.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),P=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:Jye(_.role),itemStyle:{color:T?S:"#111827",borderColor:S,borderWidth:T?0:2,opacity:P?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:P?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:qye(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),d=G.useMemo(()=>({backgroundColor:"#111827",tooltip:{trigger:"item",backgroundColor:"#1e293b",borderColor:"#334155",textStyle:{color:"#e2e8f0",fontFamily:"JetBrains Mono, monospace",fontSize:11},formatter:y=>{if(y.data&&y.data.longName){const x=y.data;return`${x.name}
${x.longName}
Role: ${x.role}`}return""}},series:[{type:"graph",layout:"force",roam:!0,draggable:!0,animation:!1,data:f.nodes,links:f.links,force:{repulsion:200,edgeLength:[80,120],gravity:.1},emphasis:{focus:"adjacency",blurScope:"coordinateSystem",scale:1.1,lineStyle:{width:2}},blur:{itemStyle:{opacity:.15},lineStyle:{opacity:.04}},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace"},edgeLabel:{show:!1},edgeSymbol:["none","none"]}]}),[f]),g=G.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=G.useMemo(()=>({click:g}),[g]);return G.useEffect(()=>{var x;const y=(x=i.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(d,{notMerge:!1,lazyUpdate:!0})},[d]),v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsx(Xye,{ref:i,option:d,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),v.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2",children:[v.jsx(RM,{size:14,className:"text-slate-500"}),v.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>v.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${a===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),v.jsx("div",{className:"space-y-1",children:[{label:"Excellent (>12)",color:"#22c55e"},{label:"Good (8-12)",color:"#4ade80"},{label:"Fair (5-8)",color:"#f59e0b"},{label:"Marginal (3-5)",color:"#f97316"},{label:"Poor (<3)",color:"#ef4444"}].map(y=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),v.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),v.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function H8(e,t){const r=G.useRef(t);G.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}function e0e(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const t0e=1;function r0e(e){return Object.freeze({__version:t0e,map:e})}function U8(e,t){return Object.freeze({...e,...t})}const Z8=G.createContext(null),$8=Z8.Provider;function U_(){const e=G.useContext(Z8);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function n0e(e){function t(r,n){const{instance:i,context:a}=e(r).current;return G.useImperativeHandle(n,()=>i),r.children==null?null:Ch.createElement($8,{value:a},r.children)}return G.forwardRef(t)}function i0e(e){function t(r,n){const[i,a]=G.useState(!1),{instance:o}=e(r,a).current;G.useImperativeHandle(n,()=>o),G.useEffect(function(){i&&o.update()},[o,i,r.children]);const s=o._contentNode;return s?Z4.createPortal(r.children,s):null}return G.forwardRef(t)}function a0e(e){function t(r,n){const{instance:i}=e(r).current;return G.useImperativeHandle(n,()=>i),null}return G.forwardRef(t)}function ML(e,t){const r=G.useRef();G.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function Z_(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function o0e(e,t){return function(n,i){const a=U_(),o=e(Z_(n,a),a);return H8(a.map,n.attribution),ML(o.current,n.eventHandlers),t(o.current,a,n,i),o}}var E2={exports:{}};/* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */(function(e,t){(function(r,n){n(t)})(nU,function(r){var n="1.9.4";function i(p){var b,C,k,E;for(C=1,k=arguments.length;C"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(p){return this.clone()._add(U(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract(U(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new z(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new z(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Z(this.x),this.y=Z(this.y),this},distanceTo:function(p){p=U(p);var b=p.x-this.x,C=p.y-this.y;return Math.sqrt(b*b+C*C)},equals:function(p){return p=U(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=U(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+f(this.x)+", "+f(this.y)+")"}};function U(p,b,C){return p instanceof z?p:w(p)?new z(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new z(p.x,p.y):new z(p,b,C)}function $(p,b){if(p)for(var C=b?[p,b]:p,k=0,E=C.length;k=this.min.x&&C.x<=this.max.x&&b.y>=this.min.y&&C.y<=this.max.y},intersects:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>=b.x&&k.x<=C.x,X=E.y>=b.y&&k.y<=C.y;return B&&X},overlaps:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>b.x&&k.xb.y&&k.y=b.lat&&E.lat<=C.lat&&k.lng>=b.lng&&E.lng<=C.lng},intersects:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>=b.lat&&k.lat<=C.lat,X=E.lng>=b.lng&&k.lng<=C.lng;return B&&X},overlaps:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>b.lat&&k.latb.lng&&k.lng1,gl=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),ee=function(){return!!document.createElement("canvas").getContext}(),xt=!!(document.createElementNS&&et("svg").createSVGRect),pt=!!xt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),dt=!xt&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),ur=navigator.platform.indexOf("Mac")===0,oo=navigator.platform.indexOf("Linux")===0;function rn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var Be={ie:lr,ielt9:Mr,edge:Gn,webkit:Wn,android:io,android23:Af,androidStock:ig,opera:ac,chrome:ag,gecko:jt,safari:$_,phantom:og,opera12:sg,win:Ue,ie3d:lg,webkit3d:kf,gecko3d:ao,any3d:tn,mobile:pl,mobileWebkit:ug,mobileWebkit3d:cg,msPointer:Lf,pointer:Nf,touch:Ut,touchNative:xe,mobileOpera:Hn,mobileGecko:ui,retina:Gi,passiveEvents:gl,canvas:ee,svg:xt,vml:dt,inlineSvg:pt,mac:ur,linux:oo},Pf=Be.msPointer?"MSPointerDown":"pointerdown",If=Be.msPointer?"MSPointerMove":"pointermove",Df=Be.msPointer?"MSPointerUp":"pointerup",Ef=Be.msPointer?"MSPointerCancel":"pointercancel",oc={touchstart:Pf,touchmove:If,touchend:Df,touchcancel:Ef},jf={touchstart:r7,touchmove:dg,touchend:dg,touchcancel:dg},so={},Rf=!1;function hg(p,b,C){return b==="touchstart"&&Ft(),jf[b]?(C=jf[b].bind(this,C),p.addEventListener(oc[b],C,!1),C):(console.warn("wrong event specified:",b),h)}function Of(p,b,C){if(!oc[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(oc[b],C,!1)}function fg(p){so[p.pointerId]=p}function Bt(p){so[p.pointerId]&&(so[p.pointerId]=p)}function wt(p){delete so[p.pointerId]}function Ft(){Rf||(document.addEventListener(Pf,fg,!0),document.addEventListener(If,Bt,!0),document.addEventListener(Df,wt,!0),document.addEventListener(Ef,wt,!0),Rf=!0)}function dg(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var C in so)b.touches.push(so[C]);b.changedTouches=[b],p(b)}}function r7(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&Hr(b),dg(p,b)}function n7(p){var b={},C,k;for(k in p)C=p[k],b[k]=C&&C.bind?C.bind(p):C;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var i7=200;function a7(p,b){p.addEventListener("dblclick",b);var C=0,k;function E(B){if(B.detail!==1){k=B.detail;return}if(!(B.pointerType==="mouse"||B.sourceCapabilities&&!B.sourceCapabilities.firesTouchEvents)){var X=EL(B);if(!(X.some(function(ne){return ne instanceof HTMLLabelElement&&ne.attributes.for})&&!X.some(function(ne){return ne instanceof HTMLInputElement||ne instanceof HTMLSelectElement}))){var J=Date.now();J-C<=i7?(k++,k===2&&b(n7(B))):k=1,C=J}}}return p.addEventListener("click",E),{dblclick:b,simDblclick:E}}function o7(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Y_=gg(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),zf=gg(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),NL=zf==="webkitTransition"||zf==="OTransition"?zf+"End":"transitionend";function PL(p){return typeof p=="string"?document.getElementById(p):p}function Bf(p,b){var C=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!C||C==="auto")&&document.defaultView){var k=document.defaultView.getComputedStyle(p,null);C=k?k[b]:null}return C==="auto"?null:C}function St(p,b,C){var k=document.createElement(p);return k.className=b||"",C&&C.appendChild(k),k}function Zt(p){var b=p.parentNode;b&&b.removeChild(p)}function vg(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function sc(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function lc(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function X_(p,b){if(p.classList!==void 0)return p.classList.contains(b);var C=pg(p);return C.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(C)}function at(p,b){if(p.classList!==void 0)for(var C=g(b),k=0,E=C.length;k0?2*window.devicePixelRatio:1;function RL(p){return Be.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/u7:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function s1(p,b){var C=b.relatedTarget;if(!C)return!0;try{for(;C&&C!==p;)C=C.parentNode}catch{return!1}return C!==p}var c7={__proto__:null,on:nt,off:Rt,stopPropagation:xl,disableScrollPropagation:o1,disableClickPropagation:Wf,preventDefault:Hr,stop:_l,getPropagationPath:EL,getMousePosition:jL,getWheelDelta:RL,isExternalTarget:s1,addListener:nt,removeListener:Rt},OL=V.extend({run:function(p,b,C,k){this.stop(),this._el=p,this._inProgress=!0,this._duration=C||.25,this._easeOutPower=1/Math.max(k||.5,.2),this._startPos=yl(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,C=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var C=this.getCenter(),k=this._limitCenter(C,this._zoom,ie(p));return C.equals(k)||this.panTo(k,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var C=U(b.paddingTopLeft||b.padding||[0,0]),k=U(b.paddingBottomRight||b.padding||[0,0]),E=this.project(this.getCenter()),B=this.project(p),X=this.getPixelBounds(),J=Y([X.min.add(C),X.max.subtract(k)]),ne=J.getSize();if(!J.contains(B)){this._enforcingBounds=!0;var ue=B.subtract(J.getCenter()),Ie=J.extend(B).getSize().subtract(ne);E.x+=ue.x<0?-Ie.x:Ie.x,E.y+=ue.y<0?-Ie.y:Ie.y,this.panTo(this.unproject(E),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=i({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var C=this.getSize(),k=b.divideBy(2).round(),E=C.divideBy(2).round(),B=k.subtract(E);return!B.x&&!B.y?this:(p.animate&&p.pan?this.panBy(B):(p.pan&&this._rawPanBy(B),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:C}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=i({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),C=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,C,p):navigator.geolocation.getCurrentPosition(b,C,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,C=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+C+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,C=p.coords.longitude,k=new se(b,C),E=k.toBounds(p.coords.accuracy*2),B=this._locateOptions;if(B.setView){var X=this.getBoundsZoom(E);this.setView(k,B.maxZoom?Math.min(X,B.maxZoom):X)}var J={latlng:k,bounds:E,timestamp:p.timestamp};for(var ne in p.coords)typeof p.coords[ne]=="number"&&(J[ne]=p.coords[ne]);this.fire("locationfound",J)}},addHandler:function(p,b){if(!b)return this;var C=this[p]=new b(this);return this._handlers.push(C),this.options[p]&&C.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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Zt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)Zt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var C="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),k=St("div",C,b||this._mapPane);return p&&(this._panes[p]=k),k},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),C=this.unproject(p.getTopRight());return new te(b,C)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,C){p=ie(p),C=U(C||[0,0]);var k=this.getZoom()||0,E=this.getMinZoom(),B=this.getMaxZoom(),X=p.getNorthWest(),J=p.getSouthEast(),ne=this.getSize().subtract(C),ue=Y(this.project(J,k),this.project(X,k)).getSize(),Ie=Be.any3d?this.options.zoomSnap:1,Xe=ne.x/ue.x,ut=ne.y/ue.y,pn=b?Math.max(Xe,ut):Math.min(Xe,ut);return k=this.getScaleZoom(pn,k),Ie&&(k=Math.round(k/(Ie/100))*(Ie/100),k=b?Math.ceil(k/Ie)*Ie:Math.floor(k/Ie)*Ie),Math.max(E,Math.min(B,k))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var C=this._getTopLeftPoint(p,b);return new $(C,C.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var C=this.options.crs;return b=b===void 0?this._zoom:b,C.scale(p)/C.scale(b)},getScaleZoom:function(p,b){var C=this.options.crs;b=b===void 0?this._zoom:b;var k=C.zoom(p*C.scale(b));return isNaN(k)?1/0:k},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(le(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng(U(p),b)},layerPointToLatLng:function(p){var b=U(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(le(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(le(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(ie(p))},distance:function(p,b){return this.options.crs.distance(le(p),le(b))},containerPointToLayerPoint:function(p){return U(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return U(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint(U(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(le(p)))},mouseEventToContainerPoint:function(p){return jL(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=PL(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");nt(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&Be.any3d,at(p,"leaflet-container"+(Be.touch?" leaflet-touch":"")+(Be.retina?" leaflet-retina":"")+(Be.ielt9?" leaflet-oldie":"")+(Be.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=Bf(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),mr(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(at(p.markerPane,"leaflet-zoom-hide"),at(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,C){mr(this._mapPane,new z(0,0));var k=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var E=this._zoom!==b;this._moveStart(E,C)._move(p,b)._moveEnd(E),this.fire("viewreset"),k&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,C,k){b===void 0&&(b=this._zoom);var E=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),k?C&&C.pinch&&this.fire("zoom",C):((E||C&&C.pinch)&&this.fire("zoom",C),this.fire("move",C)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){mr(this._mapPane,this._getMapPanePos().subtract(p))},_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(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Rt:nt;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),Be.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var C=[],k,E=b==="mouseout"||b==="mouseover",B=p.target||p.srcElement,X=!1;B;){if(k=this._targets[l(B)],k&&(b==="click"||b==="preclick")&&this._draggableMoved(k)){X=!0;break}if(k&&k.listens(b,!0)&&(E&&!s1(B,p)||(C.push(k),E))||B===this._container)break;B=B.parentNode}return!C.length&&!X&&!E&&this.listens(b,!0)&&(C=[this]),C},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var C=p.type;C==="mousedown"&&t1(b),this._fireDOMEvent(p,C)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,C){if(p.type==="click"){var k=i({},p);k.type="preclick",this._fireDOMEvent(k,k.type,C)}var E=this._findEventTargets(p,b);if(C){for(var B=[],X=0;X0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),C=this.getMaxZoom(),k=Be.any3d?this.options.zoomSnap:1;return k&&(p=Math.round(p/k)*k),Math.max(b,Math.min(C,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){cr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var C=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(C)?!1:(this.panBy(C,b),!0)},_createAnimProxy:function(){var p=this._proxy=St("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var C=Y_,k=this._proxy.style[C];ml(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),k===this._proxy.style[C]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Zt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();ml(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,C){if(this._animatingZoom)return!0;if(C=C||{},!this._zoomAnimated||C.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var k=this.getZoomScale(b),E=this._getCenterOffset(p)._divideBy(1-1/k);return C.animate!==!0&&!this.getSize().contains(E)?!1:(D(function(){this._moveStart(!0,C.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,C,k){this._mapPane&&(C&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,at(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:k}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&cr(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 h7(p,b){return new mt(p,b)}var Wi=F.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),C=this.getPosition(),k=p._controlCorners[C];return at(b,"leaflet-control"),C.indexOf("bottom")!==-1?k.insertBefore(b,k.firstChild):k.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Zt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),Hf=function(p){return new Wi(p)};mt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",C=this._controlContainer=St("div",b+"control-container",this._container);function k(E,B){var X=b+E+" "+b+B;p[E+B]=St("div",X,C)}k("top","left"),k("top","right"),k("bottom","left"),k("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)Zt(this._controlCorners[p]);Zt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var zL=Wi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,C,k){return C1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),C=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;C&&this._map.fire(C,b)},_createRadioElement:function(p,b){var C='",k=document.createElement("div");return k.innerHTML=C,k.firstChild},_addItem:function(p){var b=document.createElement("label"),C=this._map.hasLayer(p.layer),k;p.overlay?(k=document.createElement("input"),k.type="checkbox",k.className="leaflet-control-layers-selector",k.defaultChecked=C):k=this._createRadioElement("leaflet-base-layers_"+l(this),C),this._layerControlInputs.push(k),k.layerId=l(p.layer),nt(k,"click",this._onInputClick,this);var E=document.createElement("span");E.innerHTML=" "+p.name;var B=document.createElement("span");b.appendChild(B),B.appendChild(k),B.appendChild(E);var X=p.overlay?this._overlaysList:this._baseLayersList;return X.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,C,k=[],E=[];this._handlingClick=!0;for(var B=p.length-1;B>=0;B--)b=p[B],C=this._getLayer(b.layerId).layer,b.checked?k.push(C):b.checked||E.push(C);for(B=0;B=0;E--)b=p[E],C=this._getLayer(b.layerId).layer,b.disabled=C.options.minZoom!==void 0&&kC.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,nt(p,"click",Hr),this.expand();var b=this;setTimeout(function(){Rt(p,"click",Hr),b._preventClick=!1})}}),f7=function(p,b,C){return new zL(p,b,C)},l1=Wi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",C=St("div",b+" leaflet-bar"),k=this.options;return this._zoomInButton=this._createButton(k.zoomInText,k.zoomInTitle,b+"-in",C,this._zoomIn),this._zoomOutButton=this._createButton(k.zoomOutText,k.zoomOutTitle,b+"-out",C,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),C},onRemove:function(p){p.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(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,C,k,E){var B=St("a",C,k);return B.innerHTML=p,B.href="#",B.title=b,B.setAttribute("role","button"),B.setAttribute("aria-label",b),Wf(B),nt(B,"click",_l),nt(B,"click",E,this),nt(B,"click",this._refocusOnMap,this),B},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";cr(this._zoomInButton,b),cr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(at(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(at(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});mt.mergeOptions({zoomControl:!0}),mt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new l1,this.addControl(this.zoomControl))});var d7=function(p){return new l1(p)},BL=Wi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",C=St("div",b),k=this.options;return this._addScales(k,b+"-line",C),p.on(k.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),C},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,C){p.metric&&(this._mScale=St("div",b,C)),p.imperial&&(this._iScale=St("div",b,C))},_update:function(){var p=this._map,b=p.getSize().y/2,C=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(C)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),C=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,C,b/p)},_updateImperial:function(p){var b=p*3.2808399,C,k,E;b>5280?(C=b/5280,k=this._getRoundNum(C),this._updateScale(this._iScale,k+" mi",k/C)):(E=this._getRoundNum(b),this._updateScale(this._iScale,E+" ft",E/b))},_updateScale:function(p,b,C){p.style.width=Math.round(this.options.maxWidth*C)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),C=p/b;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:1,b*C}}),v7=function(p){return new BL(p)},p7='',u1=Wi.extend({options:{position:"bottomright",prefix:''+(Be.inlineSvg?p7+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=St("div","leaflet-control-attribution"),Wf(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var C=[];this.options.prefix&&C.push(this.options.prefix),p.length&&C.push(p.join(", ")),this._container.innerHTML=C.join(' ')}}});mt.mergeOptions({attributionControl:!0}),mt.addInitHook(function(){this.options.attributionControl&&new u1().addTo(this)});var g7=function(p){return new u1(p)};Wi.Layers=zL,Wi.Zoom=l1,Wi.Scale=BL,Wi.Attribution=u1,Hf.layers=f7,Hf.zoom=d7,Hf.scale=v7,Hf.attribution=g7;var ma=F.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ma.addTo=function(p,b){return p.addHandler(b,this),this};var m7={Events:W},FL=Be.touch?"touchstart mousedown":"mousedown",es=V.extend({options:{clickTolerance:3},initialize:function(p,b,C,k){m(this,k),this._element=p,this._dragStartTarget=b||p,this._preventOutline=C},enable:function(){this._enabled||(nt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(es._dragging===this&&this.finishDrag(!0),Rt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!X_(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){es._dragging===this&&this.finishDrag();return}if(!(es._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(es._dragging=this,this._preventOutline&&t1(this._element),J_(),Ff(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,C=IL(this._element);this._startPoint=new z(b.clientX,b.clientY),this._startPos=yl(this._element),this._parentScale=r1(C);var k=p.type==="mousedown";nt(document,k?"mousemove":"touchmove",this._onMove,this),nt(document,k?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,C=new z(b.clientX,b.clientY)._subtract(this._startPoint);!C.x&&!C.y||Math.abs(C.x)+Math.abs(C.y)B&&(X=J,B=ne);B>C&&(b[X]=1,h1(p,b,C,k,X),h1(p,b,C,X,E))}function b7(p,b){for(var C=[p[0]],k=1,E=0,B=p.length;kb&&(C.push(p[k]),E=k);return Eb.max.x&&(C|=2),p.yb.max.y&&(C|=8),C}function w7(p,b){var C=b.x-p.x,k=b.y-p.y;return C*C+k*k}function Uf(p,b,C,k){var E=b.x,B=b.y,X=C.x-E,J=C.y-B,ne=X*X+J*J,ue;return ne>0&&(ue=((p.x-E)*X+(p.y-B)*J)/ne,ue>1?(E=C.x,B=C.y):ue>0&&(E+=X*ue,B+=J*ue)),X=p.x-E,J=p.y-B,k?X*X+J*J:new z(E,B)}function hi(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function $L(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),hi(p)}function YL(p,b){var C,k,E,B,X,J,ne,ue;if(!p||p.length===0)throw new Error("latlngs not passed");hi(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var Ie=le([0,0]),Xe=ie(p),ut=Xe.getNorthWest().distanceTo(Xe.getSouthWest())*Xe.getNorthEast().distanceTo(Xe.getNorthWest());ut<1700&&(Ie=c1(p));var pn=p.length,jr=[];for(C=0;Ck){ne=(B-k)/E,ue=[J.x-ne*(J.x-X.x),J.y-ne*(J.y-X.y)];break}var An=b.unproject(U(ue));return le([An.lat+Ie.lat,An.lng+Ie.lng])}var S7={__proto__:null,simplify:WL,pointToSegmentDistance:HL,closestPointOnSegment:x7,clipSegment:ZL,_getEdgeIntersection:xg,_getBitCode:bl,_sqClosestPointOnSegment:Uf,isFlat:hi,_flat:$L,polylineCenter:YL},f1={project:function(p){return new z(p.lng,p.lat)},unproject:function(p){return new se(p.y,p.x)},bounds:new $([-180,-90],[180,90])},d1={R:6378137,R_MINOR:6356752314245179e-9,bounds:new $([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,C=this.R,k=p.lat*b,E=this.R_MINOR/C,B=Math.sqrt(1-E*E),X=B*Math.sin(k),J=Math.tan(Math.PI/4-k/2)/Math.pow((1-X)/(1+X),B/2);return k=-C*Math.log(Math.max(J,1e-10)),new z(p.lng*b*C,k)},unproject:function(p){for(var b=180/Math.PI,C=this.R,k=this.R_MINOR/C,E=Math.sqrt(1-k*k),B=Math.exp(-p.y/C),X=Math.PI/2-2*Math.atan(B),J=0,ne=.1,ue;J<15&&Math.abs(ne)>1e-7;J++)ue=E*Math.sin(X),ue=Math.pow((1-ue)/(1+ue),E/2),ne=Math.PI/2-2*Math.atan(B*ue)-X,X+=ne;return new se(X*b,p.x*b/C)}},C7={__proto__:null,LonLat:f1,Mercator:d1,SphericalMercator:Me},T7=i({},me,{code:"EPSG:3395",projection:d1,transformation:function(){var p=.5/(Math.PI*d1.R);return Te(p,.5,-p,.5)}()}),XL=i({},me,{code:"EPSG:4326",projection:f1,transformation:Te(1/180,1,-1/180,.5)}),M7=i({},Ee,{projection:f1,transformation:Te(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var C=b.lng-p.lng,k=b.lat-p.lat;return Math.sqrt(C*C+k*k)},infinite:!0});Ee.Earth=me,Ee.EPSG3395=T7,Ee.EPSG3857=st,Ee.EPSG900913=ze,Ee.EPSG4326=XL,Ee.Simple=M7;var Hi=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var C=this.getEvents();b.on(C,this),this.once("remove",function(){b.off(C,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});mt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var C in this._layers)p.call(b,this._layers[C]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,C=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof se&&b[0].equals(b[C-1])&&b.pop(),b},_setLatLngs:function(p){uo.prototype._setLatLngs.call(this,p),hi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return hi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,C=new z(b,b);if(p=new $(p.min.subtract(C),p.max.add(C)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var k=0,E=this._rings.length,B;kp.y!=E.y>p.y&&p.x<(E.x-k.x)*(p.y-k.y)/(E.y-k.y)+k.x&&(b=!b);return b||uo.prototype._containsPoint.call(this,p,!0)}});function E7(p,b){return new hc(p,b)}var co=lo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,C,k,E;if(b){for(C=0,k=b.length;C0&&E.push(E[0].slice()),E}function fc(p,b){return p.feature?i({},p.feature,{geometry:b}):Tg(b)}function Tg(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var m1={toGeoJSON:function(p){return fc(this,{type:"Point",coordinates:g1(this.getLatLng(),p)})}};_g.include(m1),v1.include(m1),bg.include(m1),uo.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=Cg(this._latlngs,b?1:0,!1,p);return fc(this,{type:(b?"Multi":"")+"LineString",coordinates:C})}}),hc.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=b&&!hi(this._latlngs[0]),k=Cg(this._latlngs,C?2:b?1:0,!0,p);return b||(k=[k]),fc(this,{type:(C?"Multi":"")+"Polygon",coordinates:k})}}),uc.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(C){b.push(C.toGeoJSON(p).geometry.coordinates)}),fc(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var C=b==="GeometryCollection",k=[];return this.eachLayer(function(E){if(E.toGeoJSON){var B=E.toGeoJSON(p);if(C)k.push(B.geometry);else{var X=Tg(B);X.type==="FeatureCollection"?k.push.apply(k,X.features):k.push(X)}}}),C?fc(this,{geometries:k,type:"GeometryCollection"}):{type:"FeatureCollection",features:k}}});function JL(p,b){return new co(p,b)}var j7=JL,Mg=Hi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,C){this._url=p,this._bounds=ie(b),m(this,C)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(at(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Zt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&sc(this._image),this},bringToBack:function(){return this._map&&lc(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=ie(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:St("img");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),C=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;ml(this._image,C,b)},_reset:function(){var p=this._image,b=new $(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),C=b.getSize();mr(p,b.min),p.style.width=C.x+"px",p.style.height=C.y+"px"},_updateOpacity:function(){ci(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),R7=function(p,b,C){return new Mg(p,b,C)},QL=Mg.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:St("video");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var C=b.getElementsByTagName("source"),k=[],E=0;E0?k:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var B=0;BE?(b.height=E+"px",at(p,B)):cr(p,B),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),C=this._getAnchor();mr(this._container,b.add(C))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(Bf(this._container,"marginBottom"),10)||0,C=this._container.offsetHeight+b,k=this._containerWidth,E=new z(this._containerLeft,-C-this._containerBottom);E._add(yl(this._container));var B=p.layerPointToContainerPoint(E),X=U(this.options.autoPanPadding),J=U(this.options.autoPanPaddingTopLeft||X),ne=U(this.options.autoPanPaddingBottomRight||X),ue=p.getSize(),Ie=0,Xe=0;B.x+k+ne.x>ue.x&&(Ie=B.x+k-ue.x+ne.x),B.x-Ie-J.x<0&&(Ie=B.x-J.x),B.y+C+ne.y>ue.y&&(Xe=B.y+C-ue.y+ne.y),B.y-Xe-J.y<0&&(Xe=B.y-J.y),(Ie||Xe)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([Ie,Xe]))}},_getAnchor:function(){return U(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),B7=function(p,b){return new Ag(p,b)};mt.mergeOptions({closePopupOnClick:!0}),mt.include({openPopup:function(p,b,C){return this._initOverlay(Ag,p,b,C).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Hi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Ag,this._popup,p,b),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(p){return this._popup&&(this instanceof lo||(this._popup._source=this),this._popup._prepareOpen(p||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():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){_l(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ts)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var kg=ya.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){ya.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){ya.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=ya.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=St("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,C,k=this._map,E=this._container,B=k.latLngToContainerPoint(k.getCenter()),X=k.layerPointToContainerPoint(p),J=this.options.direction,ne=E.offsetWidth,ue=E.offsetHeight,Ie=U(this.options.offset),Xe=this._getAnchor();J==="top"?(b=ne/2,C=ue):J==="bottom"?(b=ne/2,C=0):J==="center"?(b=ne/2,C=ue/2):J==="right"?(b=0,C=ue/2):J==="left"?(b=ne,C=ue/2):X.xthis.options.maxZoom||Ck?this._retainParent(E,B,X,k):!1)},_retainChildren:function(p,b,C,k){for(var E=2*p;E<2*p+2;E++)for(var B=2*b;B<2*b+2;B++){var X=new z(E,B);X.z=C+1;var J=this._tileCoordsToKey(X),ne=this._tiles[J];if(ne&&ne.active){ne.retain=!0;continue}else ne&&ne.loaded&&(ne.retain=!0);C+1this.options.maxZoom||this.options.minZoom!==void 0&&E1){this._setView(p,C);return}for(var Xe=E.min.y;Xe<=E.max.y;Xe++)for(var ut=E.min.x;ut<=E.max.x;ut++){var pn=new z(ut,Xe);if(pn.z=this._tileZoom,!!this._isValidTile(pn)){var jr=this._tiles[this._tileCoordsToKey(pn)];jr?jr.current=!0:X.push(pn)}}if(X.sort(function(An,vc){return An.distanceTo(B)-vc.distanceTo(B)}),X.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var fi=document.createDocumentFragment();for(ut=0;utC.max.x)||!b.wrapLat&&(p.yC.max.y))return!1}if(!this.options.bounds)return!0;var k=this._tileCoordsToBounds(p);return ie(this.options.bounds).overlaps(k)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,C=this.getTileSize(),k=p.scaleBy(C),E=k.add(C),B=b.unproject(k,p.z),X=b.unproject(E,p.z);return[B,X]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),C=new te(b[0],b[1]);return this.options.noWrap||(C=this._map.wrapLatLngBounds(C)),C},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),C=new z(+b[0],+b[1]);return C.z=+b[2],C},_removeTile:function(p){var b=this._tiles[p];b&&(Zt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){at(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,Be.ielt9&&this.options.opacity<1&&ci(p,this.options.opacity)},_addTile:function(p,b){var C=this._getTilePos(p),k=this._tileCoordsToKey(p),E=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(E),this.createTile.length<2&&D(o(this._tileReady,this,p,null,E)),mr(E,C),this._tiles[k]={el:E,coords:p,current:!0},b.appendChild(E),this.fire("tileloadstart",{tile:E,coords:p})},_tileReady:function(p,b,C){b&&this.fire("tileerror",{error:b,tile:C,coords:p});var k=this._tileCoordsToKey(p);C=this._tiles[k],C&&(C.loaded=+new Date,this._map._fadeAnimated?(ci(C.el,0),O(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(C.active=!0,this._pruneTiles()),b||(at(C.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:C.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Be.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new z(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new $(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function G7(p){return new $f(p)}var dc=$f.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&Be.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var C=document.createElement("img");return nt(C,"load",o(this._tileOnLoad,this,b,C)),nt(C,"error",o(this._tileOnError,this,b,C)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(C.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(C.referrerPolicy=this.options.referrerPolicy),C.alt="",C.src=this.getTileUrl(p),C},getTileUrl:function(p){var b={r:Be.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var C=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=C),b["-y"]=C}return _(this._url,i(b,this.options))},_tileOnLoad:function(p,b){Be.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,C){var k=this.options.errorTileUrl;k&&b.getAttribute("src")!==k&&(b.src=k),p(C,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,C=this.options.zoomReverse,k=this.options.zoomOffset;return C&&(p=b-p),p+k},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=T;var C=this._tiles[p].coords;Zt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:C})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",T),$f.prototype._removeTile.call(this,p)},_tileReady:function(p,b,C){if(!(!this._map||C&&C.getAttribute("src")===T))return $f.prototype._tileReady.call(this,p,b,C)}});function rN(p,b){return new dc(p,b)}var nN=dc.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var C=i({},this.defaultWmsParams);for(var k in b)k in this.options||(C[k]=b[k]);b=m(this,b);var E=b.detectRetina&&Be.retina?2:1,B=this.getTileSize();C.width=B.x*E,C.height=B.y*E,this.wmsParams=C},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,dc.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),C=this._crs,k=Y(C.project(b[0]),C.project(b[1])),E=k.min,B=k.max,X=(this._wmsVersion>=1.3&&this._crs===XL?[E.y,E.x,B.y,B.x]:[E.x,E.y,B.x,B.y]).join(","),J=dc.prototype.getTileUrl.call(this,p);return J+y(this.wmsParams,J,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+X},setParams:function(p,b){return i(this.wmsParams,p),b||this.redraw(),this}});function W7(p,b){return new nN(p,b)}dc.WMS=nN,rN.wms=W7;var ho=Hi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),at(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var C=this._map.getZoomScale(b,this._zoom),k=this._map.getSize().multiplyBy(.5+this.options.padding),E=this._map.project(this._center,b),B=k.multiplyBy(-C).add(E).subtract(this._map._getNewPixelOrigin(p,b));Be.any3d?ml(this._container,B,C):mr(this._container,B)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),C=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new $(C,C.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iN=ho.extend({options:{tolerance:0},getEvents:function(){var p=ho.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ho.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");nt(p,"mousemove",this._onMouseMove,this),nt(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,Zt(this._container),Rt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=this._container,C=p.getSize(),k=Be.retina?2:1;mr(b,p.min),b.width=k*C.x,b.height=k*C.y,b.style.width=C.x+"px",b.style.height=C.y+"px",Be.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){ho.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,C=b.next,k=b.prev;C?C.prev=k:this._drawLast=k,k?k.next=C:this._drawFirst=C,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),C=[],k,E;for(E=0;E')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),H7={_initContainer:function(){this._container=St("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ho.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Yf("shape");at(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Yf("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;Zt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,C=p._fill,k=p.options,E=p._container;E.stroked=!!k.stroke,E.filled=!!k.fill,k.stroke?(b||(b=p._stroke=Yf("stroke")),E.appendChild(b),b.weight=k.weight+"px",b.color=k.color,b.opacity=k.opacity,k.dashArray?b.dashStyle=w(k.dashArray)?k.dashArray.join(" "):k.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=k.lineCap.replace("butt","flat"),b.joinstyle=k.lineJoin):b&&(E.removeChild(b),p._stroke=null),k.fill?(C||(C=p._fill=Yf("fill")),E.appendChild(C),C.color=k.fillColor||k.color,C.opacity=k.fillOpacity):C&&(E.removeChild(C),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),C=Math.round(p._radius),k=Math.round(p._radiusY||C);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+C+","+k+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){sc(p._container)},_bringToBack:function(p){lc(p._container)}},Lg=Be.vml?Yf:et,Xf=ho.extend({_initContainer:function(){this._container=Lg("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Lg("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Zt(this._container),Rt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=p.getSize(),C=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,C.setAttribute("width",b.x),C.setAttribute("height",b.y)),mr(C,p.min),C.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Lg("path");p.options.className&&at(b,p.options.className),p.options.interactive&&at(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){Zt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,C=p.options;b&&(C.stroke?(b.setAttribute("stroke",C.color),b.setAttribute("stroke-opacity",C.opacity),b.setAttribute("stroke-width",C.weight),b.setAttribute("stroke-linecap",C.lineCap),b.setAttribute("stroke-linejoin",C.lineJoin),C.dashArray?b.setAttribute("stroke-dasharray",C.dashArray):b.removeAttribute("stroke-dasharray"),C.dashOffset?b.setAttribute("stroke-dashoffset",C.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),C.fill?(b.setAttribute("fill",C.fillColor||C.color),b.setAttribute("fill-opacity",C.fillOpacity),b.setAttribute("fill-rule",C.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,lt(p._parts,b))},_updateCircle:function(p){var b=p._point,C=Math.max(Math.round(p._radius),1),k=Math.max(Math.round(p._radiusY),1)||C,E="a"+C+","+k+" 0 1,0 ",B=p._empty()?"M0 0":"M"+(b.x-C)+","+b.y+E+C*2+",0 "+E+-C*2+",0 ";this._setPath(p,B)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){sc(p._path)},_bringToBack:function(p){lc(p._path)}});Be.vml&&Xf.include(H7);function oN(p){return Be.svg||Be.vml?new Xf(p):null}mt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&aN(p)||oN(p)}});var sN=hc.extend({initialize:function(p,b){hc.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=ie(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function U7(p,b){return new sN(p,b)}Xf.create=Lg,Xf.pointsToPath=lt,co.geometryToLayer=wg,co.coordsToLatLng=p1,co.coordsToLatLngs=Sg,co.latLngToCoords=g1,co.latLngsToCoords=Cg,co.getFeature=fc,co.asFeature=Tg,mt.mergeOptions({boxZoom:!0});var lN=ma.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Rt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Zt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Ff(),J_(),this._startPoint=this._map.mouseEventToContainerPoint(p),nt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=St("div","leaflet-zoom-box",this._container),at(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new $(this._point,this._startPoint),C=b.getSize();mr(this._box,b.min),this._box.style.width=C.x+"px",this._box.style.height=C.y+"px"},_finish:function(){this._moved&&(Zt(this._box),cr(this._container,"leaflet-crosshair")),Vf(),Q_(),Rt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new te(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});mt.addInitHook("addHandler","boxZoom",lN),mt.mergeOptions({doubleClickZoom:!0});var uN=ma.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,C=b.getZoom(),k=b.options.zoomDelta,E=p.originalEvent.shiftKey?C-k:C+k;b.options.doubleClickZoom==="center"?b.setZoom(E):b.setZoomAround(p.containerPoint,E)}});mt.addInitHook("addHandler","doubleClickZoom",uN),mt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var cN=ma.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new es(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}at(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){cr(this._map._container,"leaflet-grab"),cr(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 p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=ie(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,C=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(C),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),C=this._initialWorldOffset,k=this._draggable._newPos.x,E=(k-b+C)%p+b-C,B=(k+b+C)%p-b-C,X=Math.abs(E+C)0?B:-B))-b;this._delta=0,this._startTime=null,X&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+X):p.setZoomAround(this._lastMousePos,b+X))}});mt.addInitHook("addHandler","scrollWheelZoom",fN);var Z7=600;mt.mergeOptions({tapHold:Be.touchNative&&Be.safari&&Be.mobile,tapTolerance:15});var dN=ma.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Rt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new z(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",Hr),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),Z7),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Rt(document,"touchend",Hr),Rt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Rt(document,"touchend touchcancel contextmenu",this._cancel,this),Rt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new z(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var C=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});C._simulated=!0,b.target.dispatchEvent(C)}});mt.addInitHook("addHandler","tapHold",dN),mt.mergeOptions({touchZoom:Be.touch,bounceAtZoomLimits:!0});var vN=ma.extend({addHooks:function(){at(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){cr(this._map._container,"leaflet-touch-zoom"),Rt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(C.add(k)._divideBy(2))),this._startDist=C.distanceTo(k),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),Hr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]),E=C.distanceTo(k)/this._startDist;if(this._zoom=b.getScaleZoom(E,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&E>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,E===1)return}else{var B=C._add(k)._divideBy(2)._subtract(this._centerPoint);if(E===1&&B.x===0&&B.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(B),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var X=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(X,this,!0),Hr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Rt(document,"touchmove",this._onTouchMove,this),Rt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});mt.addInitHook("addHandler","touchZoom",vN),mt.BoxZoom=lN,mt.DoubleClickZoom=uN,mt.Drag=cN,mt.Keyboard=hN,mt.ScrollWheelZoom=fN,mt.TapHold=dN,mt.TouchZoom=vN,r.Bounds=$,r.Browser=Be,r.CRS=Ee,r.Canvas=iN,r.Circle=v1,r.CircleMarker=bg,r.Class=F,r.Control=Wi,r.DivIcon=tN,r.DivOverlay=ya,r.DomEvent=c7,r.DomUtil=l7,r.Draggable=es,r.Evented=V,r.FeatureGroup=lo,r.GeoJSON=co,r.GridLayer=$f,r.Handler=ma,r.Icon=cc,r.ImageOverlay=Mg,r.LatLng=se,r.LatLngBounds=te,r.Layer=Hi,r.LayerGroup=uc,r.LineUtil=S7,r.Map=mt,r.Marker=_g,r.Mixin=m7,r.Path=ts,r.Point=z,r.PolyUtil=y7,r.Polygon=hc,r.Polyline=uo,r.Popup=Ag,r.PosAnimation=OL,r.Projection=C7,r.Rectangle=sN,r.Renderer=ho,r.SVG=Xf,r.SVGOverlay=eN,r.TileLayer=dc,r.Tooltip=kg,r.Transformation=pe,r.Util=R,r.VideoOverlay=QL,r.bind=o,r.bounds=Y,r.canvas=aN,r.circle=I7,r.circleMarker=P7,r.control=Hf,r.divIcon=V7,r.extend=i,r.featureGroup=k7,r.geoJSON=JL,r.geoJson=j7,r.gridLayer=G7,r.icon=L7,r.imageOverlay=R7,r.latLng=le,r.latLngBounds=ie,r.layerGroup=A7,r.map=h7,r.marker=N7,r.point=U,r.polygon=E7,r.polyline=D7,r.popup=B7,r.rectangle=U7,r.setOptions=m,r.stamp=l,r.svg=oN,r.svgOverlay=z7,r.tileLayer=rN,r.tooltip=F7,r.transformation=Te,r.version=n,r.videoOverlay=O7;var $7=window.L;r.noConflict=function(){return window.L=$7,this},window.L=r})})(E2,E2.exports);var ic=E2.exports;const YH=R2(ic);function rg(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function AL(e,t){return t==null?function(n,i){const a=G.useRef();return a.current||(a.current=e(n,i)),a}:function(n,i){const a=G.useRef();a.current||(a.current=e(n,i));const o=G.useRef(n),{instance:s}=a.current;return G.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,i]),a}}function XH(e,t){G.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function s0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return HH(n.map,r.attribution),ML(i.current,r.eventHandlers),XH(i.current,n),i}}function l0e(e,t){const r=G.useRef();G.useEffect(function(){if(t.pathOptions!==r.current){const i=t.pathOptions??{};e.instance.setStyle(i),r.current=i}},[e,t])}function u0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return ML(i.current,r.eventHandlers),XH(i.current,n),l0e(i.current,r),i}}function qH(e,t){const r=AL(e),n=o0e(r,t);return i0e(n)}function KH(e,t){const r=AL(e,t),n=u0e(r);return n0e(n)}function c0e(e,t){const r=AL(e,t),n=s0e(r);return a0e(n)}function h0e(e,t,r){const{opacity:n,zIndex:i}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function f0e(){return U_().map}const d0e=KH(function({center:t,children:r,...n},i){const a=new ic.CircleMarker(t,n);return rg(a,UH(i,{overlayContainer:a}))},e0e);function j2(){return j2=Object.assign||function(e){for(var t=1;t(d==null?void 0:d.map)??null,[d]);const m=G.useCallback(x=>{if(x!==null&&d===null){const _=new ic.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(r0e(_))}},[]);G.useEffect(()=>()=>{d==null||d.map.remove()},[d]);const y=d?Ch.createElement($H,{value:d},n):o??null;return Ch.createElement("div",j2({},f,{ref:m}),y)}const p0e=G.forwardRef(v0e),g0e=KH(function({positions:t,...r},n){const i=new ic.Polyline(t,r);return rg(i,UH(n,{overlayContainer:i}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),m0e=qH(function(t,r){const n=new ic.Popup(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),i(!0))}function l(u){u.popup===o&&i(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,i,n])}),y0e=c0e(function({url:t,...r},n){const i=new ic.TileLayer(t,Z_(r,n));return rg(i,n)},function(t,r,n){h0e(t,r,n);const{url:i}=r;i!=null&&i!==n.url&&t.setUrl(i)}),x0e=qH(function(t,r){const n=new ic.Tooltip(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),i(!0))},u=c=>{c.tooltip===s&&i(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,i,n])}),_0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",b0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",w0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete YH.Icon.Default.prototype._getIconUrl;YH.Icon.Default.mergeOptions({iconUrl:_0e,iconRetinaUrl:b0e,shadowUrl:w0e});const w3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],S0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C0e(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function T0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function M0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function A0e({bounds:e}){const t=f0e();return G.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function k0e({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return v.jsxs("div",{className:"min-w-[200px]",children:[v.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),v.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[v.jsx("div",{className:"text-slate-500",children:"Role"}),v.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),v.jsx("div",{className:"text-slate-500",children:"Hardware"}),v.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),v.jsx("div",{className:"text-slate-500",children:"Battery"}),v.jsx("div",{className:"text-slate-700",children:r}),v.jsx("div",{className:"text-slate-500",children:"Last Heard"}),v.jsx("div",{className:"text-slate-700",children:M0e(e.last_heard)})]}),t&&v.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"OSM"]})]})]})}function L0e({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),a=e.length-i.length,o=G.useMemo(()=>new Map(i.map(h=>[h.node_num,h])),[i]),s=G.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=G.useMemo(()=>{if(i.length===0)return null;const h=i.map(d=>d.latitude),f=i.map(d=>d.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[i]),u=[43.6,-114.4],c=G.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsxs(p0e,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[v.jsx(y0e,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),v.jsx(A0e,{bounds:l}),s.map((h,f)=>{const d=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return v.jsx(g0e,{positions:[[d.latitude,d.longitude],[g.latitude,g.longitude]],color:C0e(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),i.map(h=>{const f=h.node_num===r,d=c.has(h.node_num),g=r===null||f||d,m=S0e.includes(h.role),y=T0e(h.latitude),x=w3[y%w3.length];return v.jsxs(d0e,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[v.jsx(x0e,{direction:"top",offset:[0,-8],children:v.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),v.jsx(m0e,{children:v.jsx(k0e,{node:h})})]},h.node_num)})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[v.jsx(nf,{size:12}),v.jsxs("span",{children:["Showing ",i.length," of ",e.length," nodes",a>0&&v.jsxs("span",{className:"text-slate-500",children:[" (",a," without coordinates)"]})]})]})]})}const S3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],N0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C3(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function P0e(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function I0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function D0e(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function E0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function j0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function R0e({node:e,edges:t,nodes:r,onSelectNode:n}){const i=G.useMemo(()=>{if(!e)return[];const h=new Map(r.map(d=>[d.node_num,d])),f=[];return t.forEach(d=>{if(d.from_node===e.node_num){const g=h.get(d.to_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}else if(d.to_node===e.node_num){const g=h.get(d.from_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}}),f.sort((d,g)=>g.snr-d.snr)},[e,t,r]);if(!e)return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:v.jsx(Di,{size:24,className:"text-slate-500"})}),v.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const a=N0e.includes(e.role),o=I0e(e.latitude),s=S3[o%S3.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[v.jsxs("div",{className:"p-4 border-b border-border",children:[v.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),v.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),v.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),v.jsx("div",{className:`text-sm font-medium ${a?"text-accent":"text-slate-300"}`,children:e.role})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),v.jsx("div",{className:"text-sm text-slate-300",children:D0e(o)})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),v.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&v.jsx(Dh,{size:12,className:"text-amber-400"}),u]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${j0e(e.last_heard)}`}),v.jsx("span",{className:"text-sm text-slate-300",children:E0e(e.last_heard)})]})]}),v.jsxs("div",{className:"col-span-2",children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),v.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&v.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Ih,{size:10}),"OSM"]})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",i.length,")"]}),i.length>0?v.jsx("div",{className:"divide-y divide-border",children:i.map(h=>v.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:C3(h.snr)},children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),v.jsxs("div",{className:"text-right flex-shrink-0",children:[v.jsxs("div",{className:"text-xs font-mono",style:{color:C3(h.snr)},children:[h.snr.toFixed(1)," dB"]}),v.jsx("div",{className:"text-xs text-slate-500",children:P0e(h.snr)})]})]},h.node.node_num))}):v.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const T3=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function O0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function z0e(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function B0e(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function M3(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function F0e({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,i]=G.useState(""),[a,o]=G.useState("short_name"),[s,l]=G.useState("asc"),[u,c]=G.useState("all"),h=G.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>T3.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||M3(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(a){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,a,s,u]),f=g=>{a===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},d=({field:g})=>a!==g?null:s==="asc"?v.jsx(V$,{size:14,className:"inline ml-1"}):v.jsx(ll,{size:14,className:"inline ml-1"});return v.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[v.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[v.jsxs("div",{className:"relative flex-1 max-w-xs",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>i(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(RM,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>v.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),v.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),v.jsxs("div",{className:"overflow-x-auto",children:[v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[v.jsx("th",{className:"w-8 px-3 py-2"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",v.jsx(d,{field:"short_name"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",v.jsx(d,{field:"role"})]}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[v.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",v.jsx(d,{field:"battery_level"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[v.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",v.jsx(d,{field:"last_heard"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",v.jsx(d,{field:"hardware"})]})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=T3.includes(g.role),y=g.node_num===t;return v.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[v.jsx("td",{className:"px-3 py-2",children:v.jsx("div",{className:`w-2 h-2 rounded-full ${O0e(g.last_heard)}`})}),v.jsxs("td",{className:"px-3 py-2",children:[v.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),v.jsx("td",{className:"px-3 py-2",children:v.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-accent":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:M3(g.latitude)}),v.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:B0e(g)}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:z0e(g.last_heard)}),v.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&v.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&v.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function V0e(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState("topo"),[c,h]=G.useState(!0),[f,d]=G.useState(null);G.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([tY(),rY(),oY()]).then(([y,x,_])=>{t(y),n(x),a(_),h(!1)}).catch(y=>{d(y.message),h(!1)})},[]);const g=G.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=G.useCallback(y=>{s(y)},[]);return c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),v.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[v.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(dB,{size:14}),v.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),v.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(X$,{size:14}),v.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),v.jsxs("div",{className:"flex gap-0",children:[v.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?v.jsx(Qye,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):v.jsx(L0e,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),v.jsx(R0e,{node:g,edges:r,nodes:e,onSelectNode:m})]}),v.jsx(F0e,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function kL({label:e,value:t,onChange:r,helper:n,info:i,roleFilter:a,valueType:o="short_name"}){const[s,l]=G.useState([]),[u,c]=G.useState(!0),[h,f]=G.useState(""),[d,g]=G.useState(!1);G.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=G.useMemo(()=>{let S=s;if(a&&(S=S.filter(T=>a==="ROUTER"||a==="infrastructure"?T.is_infrastructure||T.role==="ROUTER"||T.role==="ROUTER_CLIENT"||T.role==="REPEATER":T.role===a)),h.trim()){const T=h.toLowerCase();S=S.filter(M=>{var A,P,I,N;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(T))||((P=M.long_name)==null?void 0:P.toLowerCase().includes(T))||((I=M.role)==null?void 0:I.toLowerCase().includes(T))||((N=M.node_id_hex)==null?void 0:N.toLowerCase().includes(T))})}return S.sort((T,M)=>(T.short_name||"").localeCompare(M.short_name||""))},[s,h,a]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const T=y(S);return t.includes(T)},_=S=>{const T=y(S);t.includes(T)?r(t.filter(M=>M!==T)):r([...t,T])},w=S=>{const T=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&T.push(`— ${S.long_name}`),S.role&&T.push(`(${S.role})`),T.join(" ")};return!u&&s.length===0?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),v.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(T=>T.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const T=s.find(M=>y(M)===S);return v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[T?T.short_name:S,v.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:v.jsx(ca,{size:14})})]},S)})}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),d&&!u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] shadow-xl",children:m.length===0?v.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>v.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LL(e){const[t,r]=G.useState([]),[n,i]=G.useState(!0);G.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),i(!1)}).catch(()=>{r([]),i(!1)})},[]);const a=f=>{const d=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${d?` (${d})`:""}`};if(!n&&t.length===0)return e.mode==="single"?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const d=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(d)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:d,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),v.jsxs("select",{value:f,onChange:_=>d(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&v.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>v.jsx("option",{value:_.index,children:a(_)},_.index))]}),m&&v.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(d=>d!==f)):s([...o,f].sort((d,g)=>d-g))};return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),v.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>v.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-sm text-slate-200",children:a(f)})]},f.index)),c.length===0&&v.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&v.jsx("p",{className:"text-xs text-slate-600",children:u})]})}const A3=[{key:"bot",label:"Bot",icon:O$},{key:"connection",label:"Connection",icon:t_},{key:"response",label:"Response",icon:OM},{key:"history",label:"History",icon:uB},{key:"memory",label:"Memory",icon:z$},{key:"context",label:"Context",icon:jM},{key:"commands",label:"Commands",icon:gB},{key:"llm",label:"LLM",icon:lB},{key:"weather",label:"Weather",icon:Du},{key:"meshmonitor",label:"MeshMonitor",icon:Di},{key:"knowledge",label:"Knowledge",icon:oB},{key:"mesh_sources",label:"Mesh Sources",icon:hB},{key:"mesh_intelligence",label:"Intelligence",icon:rf},{key:"dashboard",label:"Dashboard",icon:fB}],Fn={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},G0e=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"sub",description:"Subscribe to scheduled reports or alerts"},{name:"unsub",description:"Remove a subscription"},{name:"mysubs",description:"List your active subscriptions"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],W0e=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function eo({info:e,link:t,linkText:r="Learn more"}){const[n,i]=G.useState(!1),a=G.useRef(null);return G.useEffect(()=>{if(!n)return;function o(l){a.current&&!a.current.contains(l.target)&&i(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),v.jsxs("div",{className:"relative inline-block",ref:a,children:[v.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),i(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&v.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:[v.jsx("button",{type:"button",onClick:()=>i(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(ca,{size:12})}),v.jsx("div",{className:"pr-4",children:e}),t&&v.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",v.jsx(Ih,{size:10})]})]})]})}function Vn({text:e}){return v.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function ct({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o="",infoLink:s=""}){const[l,u]=G.useState(!1),c=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(eo,{info:o,link:s})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&v.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function We({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s="",infoLink:l=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(eo,{info:s,link:l})]}),v.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function or({label:e,checked:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Ln({label:e,value:t,onChange:r,options:n,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>v.jsx("option",{value:s.value,children:s.label},s.value))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function H0e({label:e,value:t,onChange:r,rows:n=4,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function ou({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function U0e({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function sn({label:e,description:t,checked:r,onChange:n,threshold:i,onThresholdChange:a,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return v.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("span",{className:"text-sm text-slate-300",children:e}),v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&i!==void 0&&a&&v.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[v.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),v.jsx("input",{type:"number",value:i,onChange:h=>a(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&v.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function Z0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.bot}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),v.jsx(ct,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."})]}),v.jsx(or,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),v.jsx(or,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function $0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.connection}),v.jsx(Ln,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?v.jsx(ct,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),placeholder:"/dev/ttyUSB0",helper:"Device path for your USB radio",info:"Usually /dev/ttyUSB0 on Linux or /dev/ttyACM0. Check with 'ls /dev/tty*' after plugging in your radio."}):v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),v.jsx(We,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]})]})}function Y0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.response}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),v.jsx(We,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),v.jsx(We,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function X0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.history}),v.jsx(ct,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),v.jsx(We,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),v.jsx(or,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),v.jsx(We,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.memory}),v.jsx(or,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),v.jsx(We,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function K0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.context}),v.jsx(or,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Observe Channels",value:e.observe_channels,onChange:r=>t({...e,observe_channels:r}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),v.jsx(kL,{label:"Ignore Nodes",value:e.ignore_nodes,onChange:r=>t({...e,ignore_nodes:r}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Age (sec)",value:e.max_age,onChange:r=>t({...e,max_age:r}),min:0,helper:"Ignore messages older than this"}),v.jsx(We,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})]})]})}function J0e({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(i=>i.toLowerCase())),n=i=>{const a=i.toLowerCase();r.has(a)?t({...e,disabled_commands:e.disabled_commands.filter(o=>o.toLowerCase()!==a)}):t({...e,disabled_commands:[...e.disabled_commands,i]})};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.commands}),v.jsx(or,{label:"Enable Commands",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Allow !commands on the mesh"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Command Prefix",value:e.prefix,onChange:i=>t({...e,prefix:i}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",v.jsx(eo,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),v.jsx("div",{className:"grid gap-1",children:G0e.map(i=>{const a=!r.has(i.name.toLowerCase());return v.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("code",{className:"text-accent text-sm",children:["!",i.name]}),v.jsx("span",{className:"text-xs text-slate-500",children:i.description})]}),v.jsx("button",{type:"button",onClick:()=>n(i.name),className:`relative w-9 h-5 rounded-full transition-colors ${a?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${a?"translate-x-4":""}`})})]},i.name)})})]})]})]})}function Q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.llm}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),v.jsx(ct,{label:"Model",value:e.model,onChange:r=>t({...e,model:r}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),v.jsx(ct,{label:"API Key",value:e.api_key,onChange:r=>t({...e,api_key:r}),type:"password",helper:"Supports ${ENV_VAR} syntax",info:"Your API key from the provider. You can also use ${ENV_VAR} syntax to read from an environment variable instead of storing the key in the config file."}),v.jsx(ct,{label:"Base URL",value:e.base_url,onChange:r=>t({...e,base_url:r}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Timeout (sec)",value:e.timeout,onChange:r=>t({...e,timeout:r}),min:5,max:120,helper:"Maximum seconds to wait for response"}),v.jsx(We,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:r=>t({...e,max_response_tokens:r}),min:100,helper:"Token limit for LLM responses"})]}),v.jsx(or,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:r=>t({...e,use_system_prompt:r}),helper:"Enable custom system instructions"}),e.use_system_prompt&&v.jsx(H0e,{label:"System Prompt",value:e.system_prompt,onChange:r=>t({...e,system_prompt:r}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),v.jsx(or,{label:"Web Search",checked:e.web_search,onChange:r=>t({...e,web_search:r}),helper:"Enable web search tool (Open WebUI feature)"}),v.jsx(or,{label:"Google Grounding",checked:e.google_grounding,onChange:r=>t({...e,google_grounding:r}),helper:"Ground responses in web search (Gemini only)"})]})}function exe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.weather}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),v.jsx(Ln,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),v.jsx(ct,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"})]})}function txe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.meshmonitor}),v.jsx(or,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),v.jsx(or,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function rxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.knowledge}),v.jsx(or,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),v.jsx(We,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),v.jsx(ct,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),v.jsx(We,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),v.jsx(or,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),v.jsx(ct,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),v.jsx(We,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function nxe({source:e,onChange:t,onDelete:r}){const[n,i]=G.useState(!1),a={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>i(!n),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[n?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),v.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),v.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),v.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),n&&v.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),v.jsx(Ln,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:a[e.type]||""})]}),e.type!=="mqtt"&&v.jsx(ct,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&v.jsx(ct,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),v.jsx(We,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),v.jsx(ct,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),v.jsx(ct,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),v.jsx(or,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),v.jsx(or,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function ixe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.mesh_sources}),e.map((n,i)=>v.jsx(nxe,{source:n,onChange:a=>{const o=[...e];o[i]=a,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((a,o)=>o!==i))}},i)),v.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Source"]})]})}function axe({data:e,onChange:t}){const[r,n]=G.useState(null);return v.jsxs("div",{className:"space-y-6",children:[v.jsx(Vn,{text:Fn.mesh_intelligence}),v.jsx(or,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Activate health scoring and alerting"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:i=>t({...e,locality_radius_miles:i}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),v.jsx(We,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:i=>t({...e,offline_threshold_hours:i}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Packet Threshold",value:e.packet_threshold,onChange:i=>t({...e,packet_threshold:i}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),v.jsx(We,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:i=>t({...e,battery_warning_percent:i}),min:1,max:100,helper:"Global battery warning level"})]}),v.jsx(kL,{label:"Critical Nodes",value:e.critical_nodes,onChange:i=>t({...e,critical_nodes:i}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(LL,{label:"Alert Channel",value:e.alert_channel,onChange:i=>t({...e,alert_channel:i}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),v.jsx(We,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:i=>t({...e,alert_cooldown_minutes:i}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",v.jsx(eo,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((i,a)=>v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===a?null:a),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[r===a?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("span",{className:"font-medium text-slate-200",children:i.name||"Unnamed Region"}),v.jsx("span",{className:"text-xs text-slate-500",children:i.local_name})]}),v.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${i.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==a);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),r===a&&v.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:i.name,onChange:o=>{const s=[...e.regions];s[a]={...i,name:o},t({...e,regions:s})}}),v.jsx(ct,{label:"Local Name",value:i.local_name,onChange:o=>{const s=[...e.regions];s[a]={...i,local_name:o},t({...e,regions:s})}})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Latitude",value:i.lat,onChange:o=>{const s=[...e.regions];s[a]={...i,lat:o},t({...e,regions:s})},step:1e-4}),v.jsx(We,{label:"Longitude",value:i.lon,onChange:o=>{const s=[...e.regions];s[a]={...i,lon:o},t({...e,regions:s})},step:1e-4})]}),v.jsx(ct,{label:"Description",value:i.description,onChange:o=>{const s=[...e.regions];s[a]={...i,description:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Aliases",value:i.aliases,onChange:o=>{const s=[...e.regions];s[a]={...i,aliases:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Cities",value:i.cities,onChange:o=>{const s=[...e.regions];s[a]={...i,cities:o},t({...e,regions:s})}})]})]},a)),v.jsxs("button",{onClick:()=>{const i={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,i]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Region"]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",v.jsx(eo,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),v.jsx(sn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_offline:i}})}),v.jsx(sn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:i}})}),v.jsx(sn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:i=>t({...e,alert_rules:{...e.alert_rules,new_router:i}})}),v.jsx(sn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:i}})}),v.jsx(sn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:i}})}),v.jsx(sn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),v.jsx(sn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning:i}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:i}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical:i}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:i}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:i}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:i}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:i}})}),v.jsx(sn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:i=>t({...e,alert_rules:{...e.alert_rules,power_source_change:i}})}),v.jsx(sn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:i=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),v.jsx(sn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:i=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:i}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:i}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),v.jsx(sn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood:i}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:i}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),v.jsx(sn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:i}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),v.jsx(sn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:i}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function oxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.dashboard}),v.jsx(or,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),v.jsx(We,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function sxe(){var I;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState("bot"),[o,s]=G.useState(!0),[l,u]=G.useState(!1),[c,h]=G.useState(null),[f,d]=G.useState(null),[g,m]=G.useState(!1),[y,x]=G.useState(!1),_=G.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error("Failed to fetch config");const D=await N.json();t(D),n(JSON.parse(JSON.stringify(D))),x(!1),h(null)}catch(N){h(N instanceof Error?N.message:"Unknown error")}finally{s(!1)}},[]);G.useEffect(()=>{document.title="Config — MeshAI",_()},[_]),G.useEffect(()=>{e&&r&&x(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const w=async()=>{if(e){u(!0),h(null),d(null);try{const N=e[i],D=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),O=await D.json();if(!D.ok)throw new Error(O.detail||"Save failed");d(`${i} saved successfully`),n(JSON.parse(JSON.stringify(e))),x(!1),O.restart_required&&(m(!0),hY(Array.isArray(O.changed_keys)?O.changed_keys:[])),setTimeout(()=>d(null),3e3)}catch(N){h(N instanceof Error?N.message:"Save failed")}finally{u(!1)}}},S=()=>{r&&(t(JSON.parse(JSON.stringify(r))),x(!1))},T=async()=>{try{await fetch("/api/restart",{method:"POST"}),m(!1),d("Restart initiated")}catch{h("Restart failed")}},M=(N,D)=>{e&&t({...e,[N]:D})};if(o)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const A=()=>{switch(i){case"bot":return v.jsx(Z0e,{data:e.bot,onChange:N=>M("bot",N)});case"connection":return v.jsx($0e,{data:e.connection,onChange:N=>M("connection",N)});case"response":return v.jsx(Y0e,{data:e.response,onChange:N=>M("response",N)});case"history":return v.jsx(X0e,{data:e.history,onChange:N=>M("history",N)});case"memory":return v.jsx(q0e,{data:e.memory,onChange:N=>M("memory",N)});case"context":return v.jsx(K0e,{data:e.context,onChange:N=>M("context",N)});case"commands":return v.jsx(J0e,{data:e.commands,onChange:N=>M("commands",N)});case"llm":return v.jsx(Q0e,{data:e.llm,onChange:N=>M("llm",N)});case"weather":return v.jsx(exe,{data:e.weather,onChange:N=>M("weather",N)});case"meshmonitor":return v.jsx(txe,{data:e.meshmonitor,onChange:N=>M("meshmonitor",N)});case"knowledge":return v.jsx(rxe,{data:e.knowledge,onChange:N=>M("knowledge",N)});case"mesh_sources":return v.jsx(ixe,{data:e.mesh_sources,onChange:N=>M("mesh_sources",N)});case"mesh_intelligence":return v.jsx(axe,{data:e.mesh_intelligence,onChange:N=>M("mesh_intelligence",N)});case"dashboard":return v.jsx(oxe,{data:e.dashboard,onChange:N=>M("dashboard",N)});default:return null}},P=((I=A3.find(N=>N.key===i))==null?void 0:I.label)||i;return v.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[v.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:A3.map(({key:N,label:D,icon:O})=>v.jsxs("button",{onClick:()=>a(N),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===N?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[v.jsx(O,{size:16}),v.jsx("span",{children:D}),y&&i===N&&v.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},N))}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center justify-between mb-6",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(vB,{size:20,className:"text-slate-500"}),v.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:P})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[y&&v.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[v.jsx(Jx,{size:14}),"Discard"]}),v.jsxs("button",{onClick:w,disabled:l||!y,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[l?v.jsx($v,{size:14,className:"animate-spin"}):v.jsx(zM,{size:14}),"Save"]})]})]}),g&&v.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[v.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[v.jsx($a,{size:16}),v.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),v.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),c&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 text-red-400",children:[v.jsx(ca,{size:16}),v.jsx("span",{className:"text-sm",children:c})]}),f&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 text-green-400",children:[v.jsx(Za,{size:16}),v.jsx("span",{className:"text-sm",children:f})]}),v.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:v.jsx("div",{className:"bg-bg-card border border-border p-6",children:A()})})]})]})}function lxe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return v.jsxs("div",{className:"bg-bg-hover p-4",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),v.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),v.jsx("span",{className:"text-xs text-[#777]",children:r})]}),v.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[v.jsxs("div",{children:["Events: ",e.event_count]}),v.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&v.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function uxe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Vo,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:$a,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:qx,color:"text-sky-400"},n=r.Icon;return v.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:16,className:r.color}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),v.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),v.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function JH({value:e,onChange:t,disabled:r,centralDisabled:n}){const i="px-2 py-1 text-xs transition-colors";return v.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[v.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${i} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),v.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${i} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function cxe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:i,onFeedSource:a,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h}){const f=s||!o;return v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&v.jsx("p",{className:"text-xs text-[#666]",children:t})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(JH,{value:i,onChange:a,disabled:!r,centralDisabled:f})]}),v.jsx(or,{label:"",checked:r,onChange:n})]})]}),!l&&v.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key not configured — contact admin"}),s&&v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),v.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&v.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[v.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?v.jsx(lxe,{feed:u}):v.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&v.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((d,g)=>v.jsx(uxe,{event:d},g))})]})]})}const hs={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0}},_S=[{key:"central",label:"Central",icon:K$,adapters:[]},{key:"weather",label:"Weather",icon:Du,adapters:["nws"]},{key:"fire",label:"Fire",icon:Xx,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:Di,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:$x,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:Kx,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:Qx,adapters:[]},{key:"mesh",label:"Mesh Health",icon:rf,adapters:[]}];function hxe(){var Lf,Nf;const[e,t]=G.useState(null),[r,n]=G.useState(""),[i,a]=G.useState(null),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(!1),[_,w]=G.useState("weather"),[S,T]=G.useState("nws"),[M,A]=G.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[P,I]=G.useState(""),[N,D]=G.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[O,R]=G.useState(""),[F,H]=G.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[W,V]=G.useState(""),[z,Z]=G.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[U,$]=G.useState(""),[Y,te]=G.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[ie,se]=G.useState(""),[le,Ee]=G.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[me,ye]=G.useState(""),[Me,pe]=G.useState({min_danger_level:3}),[Te,st]=G.useState(""),[ze,et]=G.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[lt,Et]=G.useState("");G.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var xe,Ut,Hn,ui,Gi,gl,ee,xt,pt,dt,ur,oo,rn,Be,Pf,If,Df,Ef,oc,jf,so,Rf,hg;try{const fg=await(await fetch("/api/config/environmental")).json();t(fg),n(JSON.stringify(fg));try{const Bt=await fetch("/api/adapter-config/wfigs");if(Bt.ok){const wt=await Bt.json(),Ft={allowed_incident_types:((xe=wt.allowed_incident_types)==null?void 0:xe.value)??["WF"],freshness_seconds:((Ut=wt.freshness_seconds)==null?void 0:Ut.value)??0,cooldown_seconds:((Hn=wt.cooldown_seconds)==null?void 0:Hn.value)??28800,broadcast_on_acres:((ui=wt.broadcast_on_acres)==null?void 0:ui.value)??!0,broadcast_on_contained:((Gi=wt.broadcast_on_contained)==null?void 0:Gi.value)??!0};A(Ft),I(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/fires");if(Bt.ok){const wt=await Bt.json(),Ft={digest_enabled:((gl=wt.digest_enabled)==null?void 0:gl.value)??!0,digest_schedule:((ee=wt.digest_schedule)==null?void 0:ee.value)??["06:00","18:00"],digest_timezone:((xt=wt.digest_timezone)==null?void 0:xt.value)??"America/Boise"};D(Ft),R(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/tomtom_incidents");if(Bt.ok){const wt=await Bt.json(),Ft={min_magnitude:((pt=wt.min_magnitude)==null?void 0:pt.value)??4,drop_non_present:((dt=wt.drop_non_present)==null?void 0:dt.value)??!0,drop_zero_magnitude:((ur=wt.drop_zero_magnitude)==null?void 0:ur.value)??!0};H(Ft),V(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/itd_511");if(Bt.ok){const wt=await Bt.json(),Ft={min_severity:((oo=wt.min_severity)==null?void 0:oo.value)??"None",enabled_categories:((rn=wt.enabled_categories)==null?void 0:rn.value)??["incident","closure"],enabled_sub_types:((Be=wt.enabled_sub_types)==null?void 0:Be.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ft),$(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/wzdx");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast:((Pf=wt.broadcast)==null?void 0:Pf.value)??!1,min_severity:((If=wt.min_severity)==null?void 0:If.value)??"Minor",sub_types:((Df=wt.sub_types)==null?void 0:Df.value)??["road_works","lane_closed","road_closed"]};te(Ft),se(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/nws");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast_severities:((Ef=wt.broadcast_severities)==null?void 0:Ef.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((oc=wt.duplicate_allowed_after_seconds)==null?void 0:oc.value)??3600};Ee(Ft),ye(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/avalanche");if(Bt.ok){const Ft={min_danger_level:((jf=(await Bt.json()).min_danger_level)==null?void 0:jf.value)??3};pe(Ft),st(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/swpc");if(Bt.ok){const wt=await Bt.json(),Ft={geomag_kp_floor:((so=wt.geomag_kp_floor)==null?void 0:so.value)??7,flare_class_floor:((Rf=wt.flare_class_floor)==null?void 0:Rf.value)??"X1",proton_pfu_floor:((hg=wt.proton_pfu_floor)==null?void 0:hg.value)??10};et(Ft),Et(JSON.stringify(Ft))}}catch{}}catch(Of){d(Of instanceof Error?Of.message:"Failed to load config")}finally{u(!1)}})()},[]),G.useEffect(()=>{const xe=async()=>{try{a(await xB()),s(await _B())}catch{}};xe();const Ut=setInterval(xe,3e4);return()=>clearInterval(Ut)},[]);const lr=e!==null&&JSON.stringify(e)!==r,Mr=JSON.stringify(M)!==P,Gn=JSON.stringify(N)!==O,Wn=JSON.stringify(F)!==W,io=JSON.stringify(z)!==U,Af=JSON.stringify(Y)!==ie,ng=JSON.stringify(le)!==me,ig=JSON.stringify(Me)!==Te,ac=JSON.stringify(ze)!==lt,ag=lr||Mr||Gn||Wn||io||Af||ng||ig||ac,jt=async(xe,Ut,Hn)=>{const ui=await fetch(`/api/adapter-config/${xe}/${Ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Hn})});if(!ui.ok){const Gi=await ui.json().catch(()=>({}));throw new Error(Gi.detail||`Failed to save ${xe}.${Ut}`)}},$_=async()=>{if(e){h(!0),d(null),m(null);try{if(lr){const xe=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Ut=await xe.json();if(!xe.ok)throw new Error(Ut.detail||"Save failed");n(JSON.stringify(e)),Ut.restart_required&&x(!0)}if(Mr){const xe=JSON.parse(P);M.freshness_seconds!==xe.freshness_seconds&&await jt("wfigs","freshness_seconds",M.freshness_seconds),JSON.stringify(M.allowed_incident_types)!==JSON.stringify(xe.allowed_incident_types)&&await jt("wfigs","allowed_incident_types",M.allowed_incident_types),M.cooldown_seconds!==xe.cooldown_seconds&&await jt("wfigs","cooldown_seconds",M.cooldown_seconds),M.broadcast_on_acres!==xe.broadcast_on_acres&&await jt("wfigs","broadcast_on_acres",M.broadcast_on_acres),M.broadcast_on_contained!==xe.broadcast_on_contained&&await jt("wfigs","broadcast_on_contained",M.broadcast_on_contained),I(JSON.stringify(M))}if(Gn){const xe=JSON.parse(O);N.digest_enabled!==xe.digest_enabled&&await jt("fires","digest_enabled",N.digest_enabled),JSON.stringify(N.digest_schedule)!==JSON.stringify(xe.digest_schedule)&&await jt("fires","digest_schedule",N.digest_schedule),N.digest_timezone!==xe.digest_timezone&&await jt("fires","digest_timezone",N.digest_timezone),R(JSON.stringify(N))}if(Wn){const xe=JSON.parse(W);F.min_magnitude!==xe.min_magnitude&&await jt("tomtom_incidents","min_magnitude",F.min_magnitude),F.drop_non_present!==xe.drop_non_present&&await jt("tomtom_incidents","drop_non_present",F.drop_non_present),F.drop_zero_magnitude!==xe.drop_zero_magnitude&&await jt("tomtom_incidents","drop_zero_magnitude",F.drop_zero_magnitude),V(JSON.stringify(F))}if(io){const xe=JSON.parse(U);z.min_severity!==xe.min_severity&&await jt("itd_511","min_severity",z.min_severity),JSON.stringify(z.enabled_categories)!==JSON.stringify(xe.enabled_categories)&&await jt("itd_511","enabled_categories",z.enabled_categories),JSON.stringify(z.enabled_sub_types)!==JSON.stringify(xe.enabled_sub_types)&&await jt("itd_511","enabled_sub_types",z.enabled_sub_types),$(JSON.stringify(z))}if(Af){const xe=JSON.parse(ie);Y.broadcast!==xe.broadcast&&await jt("wzdx","broadcast",Y.broadcast),Y.min_severity!==xe.min_severity&&await jt("wzdx","min_severity",Y.min_severity),JSON.stringify(Y.sub_types)!==JSON.stringify(xe.sub_types)&&await jt("wzdx","sub_types",Y.sub_types),se(JSON.stringify(Y))}if(ng){const xe=JSON.parse(me);JSON.stringify(le.broadcast_severities)!==JSON.stringify(xe.broadcast_severities)&&await jt("nws","broadcast_severities",le.broadcast_severities),le.duplicate_allowed_after_seconds!==xe.duplicate_allowed_after_seconds&&await jt("nws","duplicate_allowed_after_seconds",le.duplicate_allowed_after_seconds),ye(JSON.stringify(le))}if(ig){const xe=JSON.parse(Te);Me.min_danger_level!==xe.min_danger_level&&await jt("avalanche","min_danger_level",Me.min_danger_level),st(JSON.stringify(Me))}if(ac){const xe=JSON.parse(lt);ze.geomag_kp_floor!==xe.geomag_kp_floor&&await jt("swpc","geomag_kp_floor",ze.geomag_kp_floor),ze.flare_class_floor!==xe.flare_class_floor&&await jt("swpc","flare_class_floor",ze.flare_class_floor),ze.proton_pfu_floor!==xe.proton_pfu_floor&&await jt("swpc","proton_pfu_floor",ze.proton_pfu_floor),Et(JSON.stringify(ze))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(xe){d(xe instanceof Error?xe.message:"Save failed")}finally{h(!1)}}},og=()=>{e&&t(JSON.parse(r)),A(JSON.parse(P||JSON.stringify(M))),D(JSON.parse(O||JSON.stringify(N))),H(JSON.parse(W||JSON.stringify(F))),Z(JSON.parse(U||JSON.stringify(z))),te(JSON.parse(ie||JSON.stringify(Y))),Ee(JSON.parse(me||JSON.stringify(le))),pe(JSON.parse(Te||JSON.stringify(Me))),et(JSON.parse(lt||JSON.stringify(ze)))},sg=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{d("Restart failed")}},Ue=xe=>e&&t({...e,...xe});if(l)return v.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const lg=xe=>i==null?void 0:i.feeds.find(Ut=>Ut.source===hs[xe].health),kf=xe=>o.filter(Ut=>Ut.source===hs[xe].health),ao=_S.find(xe=>xe.key===_),tn=ao.adapters.length===0?null:S&&ao.adapters.includes(S)?S:ao.adapters[0],pl=xe=>{var Ut,Hn,ui,Gi,gl;switch(xe){case"nws":return v.jsxs(v.Fragment,{children:[v.jsx(ou,{label:"NWS Zones",value:e.nws_zones,onChange:ee=>Ue({nws_zones:ee}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),e.nws.feed_source!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"User Agent",value:e.nws.user_agent,onChange:ee=>Ue({nws:{...e.nws,user_agent:ee}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:ee=>Ue({nws:{...e.nws,tick_seconds:ee}}),min:30}),v.jsx(Ln,{label:"Min Severity",value:e.nws.severity_min,onChange:ee=>Ue({nws:{...e.nws,severity_min:ee}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsxs("div",{className:"mb-3",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),v.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:le.broadcast_severities.includes(ee),onChange:xt=>{const pt=le.broadcast_severities;Ee({...le,broadcast_severities:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:ee})]},ee))})]}),v.jsx(We,{label:"Re-broadcast Cooldown (seconds)",value:le.duplicate_allowed_after_seconds,onChange:ee=>Ee({...le,duplicate_allowed_after_seconds:ee}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return v.jsx("div",{className:"space-y-6",children:v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ln,{label:"Geomag Kp Floor",value:String(ze.geomag_kp_floor),onChange:ee=>et({...ze,geomag_kp_floor:Number(ee)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),v.jsx(Ln,{label:"Flare Class Floor",value:ze.flare_class_floor,onChange:ee=>et({...ze,flare_class_floor:ee}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),v.jsx(Ln,{label:"Proton pfu Floor",value:String(ze.proton_pfu_floor),onChange:ee=>et({...ze,proton_pfu_floor:Number(ee)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:ee=>Ue({ducting:{...e.ducting,tick_seconds:ee}}),min:60}),v.jsx(We,{label:"Latitude",value:e.ducting.latitude,onChange:ee=>Ue({ducting:{...e.ducting,latitude:ee}}),step:.01}),v.jsx(We,{label:"Longitude",value:e.ducting.longitude,onChange:ee=>Ue({ducting:{...e.ducting,longitude:ee}}),step:.01})]});case"fires":return v.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:ee=>Ue({fires:{...e.fires,tick_seconds:ee}}),min:60}),v.jsx(Ln,{label:"State",value:e.fires.state,onChange:ee=>Ue({fires:{...e.fires,state:ee}}),options:W0e})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),v.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([ee,xt])=>{var pt;return v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:((pt=M.allowed_incident_types)==null?void 0:pt.includes(ee))??ee==="WF",onChange:dt=>{const ur=M.allowed_incident_types??["WF"];A({...M,allowed_incident_types:dt.target.checked?[...ur,ee]:ur.filter(oo=>oo!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee)})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_acres,onChange:ee=>A({...M,broadcast_on_acres:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_contained,onChange:ee=>A({...M,broadcast_on_contained:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Update Cooldown (hours)",value:Math.round(M.cooldown_seconds/3600),onChange:ee=>A({...M,cooldown_seconds:ee*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),v.jsx(We,{label:"Freshness Window (hours)",value:Math.round(M.freshness_seconds/3600),onChange:ee=>A({...M,freshness_seconds:ee*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return v.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:ee=>Ue({avalanche:{...e.avalanche,tick_seconds:ee}}),min:60}),v.jsx(U0e,{label:"Season Months",value:e.avalanche.season_months,onChange:ee=>Ue({avalanche:{...e.avalanche,season_months:ee}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),v.jsx(ou,{label:"Center IDs",value:e.avalanche.center_ids,onChange:ee=>Ue({avalanche:{...e.avalanche,center_ids:ee}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Ln,{label:"Min Danger Level",value:String(Me.min_danger_level),onChange:ee=>pe({...Me,min_danger_level:Number(ee)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return v.jsxs(v.Fragment,{children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:ee=>Ue({usgs:{...e.usgs,tick_seconds:ee}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),v.jsx(ou,{label:"Site IDs",value:e.usgs.sites,onChange:ee=>Ue({usgs:{...e.usgs,sites:ee}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"})]});case"usgs_quake":return v.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,tick_seconds:ee}}),min:60}),v.jsx(ct,{label:"Region Tag",value:e.usgs_quake.region,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,region:ee}})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,global_mag_floor:ee}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),v.jsx(We,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_mag_floor:ee}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),v.jsx(We,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_radius_mi:ee}}),min:50,helper:"Radius around region centroid for reduced floor"}),v.jsx(We,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,escalate_mag_floor:ee}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),v.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),v.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(ee),onChange:xt=>{const pt=e.usgs_quake.broadcast_pager_alerts??[];Ue({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)}})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:ee})]},ee))})]})]});case"traffic":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"API Key",value:e.traffic.api_key,onChange:ee=>Ue({traffic:{...e.traffic,api_key:ee}}),type:"password",helper:"developer.tomtom.com"}),v.jsx(We,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:ee=>Ue({traffic:{...e.traffic,tick_seconds:ee}}),min:60}),v.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((ee,xt)=>v.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[v.jsx(ct,{label:"Name",value:ee.name,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,name:pt},Ue({traffic:{...e.traffic,corridors:dt}})}}),v.jsx(We,{label:"Lat",value:ee.lat,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lat:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx(We,{label:"Lon",value:ee.lon,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lon:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((pt,dt)=>dt!==xt)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},xt)),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),v.jsxs("select",{value:F.min_magnitude,onChange:ee=>H({...F,min_magnitude:parseInt(ee.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:1,children:"1 — Minor (all)"}),v.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),v.jsx("option",{value:3,children:"3 — Major (orange+)"}),v.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),v.jsxs("div",{className:"mt-3 space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),v.jsx("input",{type:"checkbox",checked:F.drop_non_present,onChange:ee=>H({...F,drop_non_present:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),v.jsx("input",{type:"checkbox",checked:F.drop_zero_magnitude,onChange:ee=>H({...F,drop_zero_magnitude:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:e.roads511.base_url,onChange:ee=>Ue({roads511:{...e.roads511,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:e.roads511.api_key,onChange:ee=>Ue({roads511:{...e.roads511,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:ee=>Ue({roads511:{...e.roads511,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:e.roads511.endpoints,onChange:ee=>Ue({roads511:{...e.roads511,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.roads511.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.roads511.bbox||[0,0,0,0]];ur[xt]=dt,Ue({roads511:{...e.roads511,bbox:ur}})},step:.01},ee)})}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),v.jsxs("select",{value:z.min_severity,onChange:ee=>Z({...z,min_severity:ee.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),v.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_categories.includes(ee),onChange:pt=>{const dt=z.enabled_categories;Z({...z,enabled_categories:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_sub_types.includes(ee),onChange:pt=>{const dt=z.enabled_sub_types;Z({...z,enabled_sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]})]})]});case"wzdx":return v.jsxs(v.Fragment,{children:[((Ut=e.wzdx)==null?void 0:Ut.feed_source)!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:((Hn=e.wzdx)==null?void 0:Hn.base_url)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:((ui=e.wzdx)==null?void 0:ui.api_key)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:((Gi=e.wzdx)==null?void 0:Gi.tick_seconds)??300,onChange:ee=>Ue({wzdx:{...e.wzdx,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:((gl=e.wzdx)==null?void 0:gl.endpoints)??["/get/event"],onChange:ee=>Ue({wzdx:{...e.wzdx,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt,dt;return v.jsx(We,{label:ee,value:((dt=(pt=e.wzdx)==null?void 0:pt.bbox)==null?void 0:dt[xt])??0,onChange:ur=>{var rn;const oo=[...((rn=e.wzdx)==null?void 0:rn.bbox)||[0,0,0,0]];oo[xt]=ur,Ue({wzdx:{...e.wzdx,bbox:oo}})},step:.01},ee)})}),v.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"})]}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),v.jsx("input",{type:"checkbox",checked:Y.broadcast,onChange:ee=>te({...Y,broadcast:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),Y.broadcast?v.jsxs("div",{className:"space-y-3 mt-3",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),v.jsxs("select",{value:Y.min_severity,onChange:ee=>te({...Y,min_severity:ee.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:Y.sub_types.includes(ee),onChange:pt=>{const dt=Y.sub_types;te({...Y,sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]})]}):v.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"MAP Key",value:e.firms.map_key,onChange:ee=>Ue({firms:{...e.firms,map_key:ee}}),type:"password",helper:"firms.modaps.eosdis.nasa.gov/api/area/",infoLink:"https://firms.modaps.eosdis.nasa.gov/api/area/"}),v.jsx(We,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:ee=>Ue({firms:{...e.firms,tick_seconds:ee}}),min:300}),v.jsx(Ln,{label:"Satellite Source",value:e.firms.source,onChange:ee=>Ue({firms:{...e.firms,source:ee}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Day Range",value:e.firms.day_range,onChange:ee=>Ue({firms:{...e.firms,day_range:ee}}),min:1,max:10}),v.jsx(Ln,{label:"Min Confidence",value:e.firms.confidence_min,onChange:ee=>Ue({firms:{...e.firms,confidence_min:ee}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),v.jsx(We,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:ee=>Ue({firms:{...e.firms,proximity_km:ee}}),step:.5})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.firms.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.firms.bbox||[0,0,0,0]];ur[xt]=dt,Ue({firms:{...e.firms,bbox:ur}})},step:.01},ee)})})]})}},ug=e,cg=(xe,Ut)=>{const Hn=e[xe]||{};Ue({[xe]:{...Hn,...Ut}})};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h1",{className:"text-xl font-semibold text-white",children:"Environment"}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(or,{label:"Feeds Enabled",checked:e.enabled,onChange:xe=>Ue({enabled:xe})}),ag&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:og,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[v.jsx(Jx,{size:14})," Discard"]}),v.jsxs("button",{onClick:$_,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[v.jsx(zM,{size:14})," ",c?"Saving…":"Save"]})]})]})]}),f&&v.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&v.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&v.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx($v,{size:14})," A restart is required for some changes to take effect."]}),v.jsx("button",{onClick:sg,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),v.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:_S.map(({key:xe,label:Ut,icon:Hn})=>v.jsxs("button",{onClick:()=>{w(xe);const ui=_S.find(Gi=>Gi.key===xe);T(ui.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===xe?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[v.jsx(Hn,{size:15})," ",Ut]},xe))}),_==="central"&&e.central&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),v.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),v.jsx(or,{label:"",checked:!!e.central.enabled,onChange:xe=>Ue({central:{...e.central,enabled:xe}})})]}),v.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[v.jsx(ct,{label:"URL",value:e.central.url||"",onChange:xe=>Ue({central:{...e.central,url:xe}}),placeholder:"nats://central.echo6.mesh:4222"}),v.jsx(ct,{label:"Durable",value:e.central.durable||"",onChange:xe=>Ue({central:{...e.central,durable:xe}}),placeholder:"meshai-v04"}),v.jsx(ct,{label:"Region",value:e.central.region||"",onChange:xe=>Ue({central:{...e.central,region:xe}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="tracking"&&v.jsxs("div",{className:"flex flex-col items-center justify-center h-[40vh] text-center",children:[v.jsx(Qx,{size:32,className:"text-[#666] mb-4"}),v.jsx("p",{className:"text-[#666] max-w-md",children:"No adapters yet. ADS-B / AIS / satellite passes are planned for v0.5."})]}),_==="mesh"&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),v.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(JH,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),ao.adapters.length>0&&tn&&v.jsxs(v.Fragment,{children:[ao.adapters.length>1&&v.jsx("div",{className:"flex gap-1",children:ao.adapters.map(xe=>v.jsx("button",{onClick:()=>T(xe),className:`px-3 py-1.5 text-sm ${tn===xe?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:hs[xe].label},xe))}),v.jsx(cxe,{title:hs[tn].label,subtitle:hs[tn].subtitle,enabled:((Lf=ug[tn])==null?void 0:Lf.enabled)??!1,onEnabled:xe=>cg(tn,{enabled:xe}),feedSource:((Nf=ug[tn])==null?void 0:Nf.feed_source)??"native",onFeedSource:xe=>cg(tn,{feed_source:xe}),hasCentral:hs[tn].hasCentral,nativeOnly:hs[tn].nativeOnly,hasKey:hs[tn].hasKey,health:lg(tn),events:kf(tn),children:pl(tn)})]})]})}const k3={infra_offline:mB,infra_recovery:t_,battery_warning:Z1,battery_critical:Z1,battery_emergency:Z1,hf_blackout:Dh,uhf_ducting:Di,weather_warning:Du,weather_watch:Du,new_router:Di,packet_flood:$a,sustained_high_util:$a,region_blackout:Vo,default:Zv};function fxe(e){return k3[e]||k3.default}function QH(e){switch(e==null?void 0:e.toLowerCase()){case"immediate":return{bg:"bg-red-500/10",border:"border-red-500",badge:"bg-red-500/20 text-red-400",iconColor:"text-red-500"};case"priority":return{bg:"bg-amber-500/10",border:"border-amber-500",badge:"bg-amber-500/20 text-amber-400",iconColor:"text-amber-500"};case"routine":default:return{bg:"bg-[#f59e0b]/10",border:"border-[#f59e0b]",badge:"bg-[#f59e0b]/20 text-[#f59e0b]",iconColor:"text-[#f59e0b]"}}}function dxe(e){const t=typeof e=="number"?new Date(e*1e3):new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24);return i<60?"Just now":a<60?`${a}m ago`:o<24?`${o}h ago`:`${s}d ago`}function vxe(e){return(typeof e=="number"?new Date(e*1e3):new Date(e)).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function pxe(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d`}function gxe({alert:e,onAcknowledge:t}){var i;const r=QH(e.severity),n=fxe(e.type);return v.jsx("div",{className:`p-4 ${r.bg} border-l-4 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:20,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.badge}`,children:(i=e.severity)==null?void 0:i.toUpperCase()}),v.jsx("span",{className:"text-xs text-slate-500",children:e.type})]}),v.jsx("div",{className:"text-sm text-slate-200",children:e.message}),v.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(Iu,{size:12}),e.timestamp?dxe(e.timestamp):"Just now"]}),e.scope_value&&v.jsxs("span",{children:[e.scope_type,": ",e.scope_value]})]})]}),v.jsx("button",{onClick:()=>t(e),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200 border border-border rounded hover:bg-bg-hover transition-colors",children:"Acknowledge"})]})})}function mxe({history:e,typeFilter:t,severityFilter:r,onTypeFilterChange:n,onSeverityFilterChange:i,page:a,totalPages:o,onPageChange:s}){const l=["all","infra_offline","infra_recovery","battery_warning","battery_critical","hf_blackout","uhf_ducting","weather_warning","new_router","packet_flood"],u=["all","immediate","priority","routine"];return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(RM,{size:14,className:"text-slate-400"}),v.jsx("span",{className:"text-sm text-slate-400",children:"Filter:"})]}),v.jsx("select",{value:t,onChange:c=>n(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:l.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Types":c.replace(/_/g," ")},c))}),v.jsx("select",{value:r,onChange:c=>i(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:u.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Severities":c.charAt(0).toUpperCase()+c.slice(1)},c))})]}),v.jsx("div",{className:"overflow-x-auto",children:v.jsxs("table",{className:"w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"border-b border-border",children:[v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Time"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Type"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Severity"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Message"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Duration"})]})}),v.jsx("tbody",{children:e.length>0?e.map((c,h)=>{const f=QH(c.severity);return v.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover",children:[v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono whitespace-nowrap",children:vxe(c.timestamp)}),v.jsx("td",{className:"p-4 text-sm text-slate-300",children:c.type.replace(/_/g," ")}),v.jsx("td",{className:"p-4",children:v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f.badge}`,children:c.severity})}),v.jsx("td",{className:"p-4 text-sm text-slate-200 max-w-md truncate",children:c.message}),v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono",children:c.duration?pxe(c.duration):"-"})]},c.id||h)}):v.jsx("tr",{children:v.jsx("td",{colSpan:5,className:"p-8 text-center text-slate-500",children:"No alert history available"})})})]})}),o>1&&v.jsxs("div",{className:"p-4 border-t border-border flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm text-slate-400",children:["Page ",a," of ",o]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:()=>s(a-1),disabled:a<=1,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(F$,{size:16})}),v.jsx("button",{onClick:()=>s(a+1),disabled:a>=o,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(Js,{size:16})})]})]})]})}function yxe({subscription:e,nodes:t}){const r=o=>{const s=t.find(l=>l.node_id_hex===o||String(l.node_num)===o||l.short_name===o);return s?s.long_name&&s.long_name!==s.short_name?`${s.short_name} (${s.long_name})`:s.short_name:o},n=()=>{if(e.sub_type==="alerts")return"Real-time";const o=e.schedule_time||"0000",s=parseInt(o.slice(0,2)),l=o.slice(2),u=s>=12?"PM":"AM";let h=`${s%12||12}:${l} ${u}`;return e.sub_type==="weekly"&&e.schedule_day&&(h+=` ${e.schedule_day.charAt(0).toUpperCase()}${e.schedule_day.slice(1)}`),h},a=(()=>{switch(e.sub_type){case"alerts":return Zv;case"daily":return Iu;case"weekly":return Iu;default:return Zv}})();return v.jsx("div",{className:"p-4 bg-bg-hover border border-border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 bg-[#f59e0b]/10 flex items-center justify-center",children:v.jsx(a,{size:18,className:"text-[#f59e0b]"})}),v.jsxs("div",{className:"flex-1",children:[v.jsxs("div",{className:"text-sm text-slate-200 font-medium",children:[e.sub_type.charAt(0).toUpperCase()+e.sub_type.slice(1),e.scope_type!=="mesh"&&e.scope_value&&v.jsxs("span",{className:"text-slate-400 font-normal ml-2",children:["(",e.scope_type,": ",e.scope_value,")"]})]}),v.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[n()," • ",r(e.user_id)]})]}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`})]})})}function xxe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(null),[f,d]=G.useState("all"),[g,m]=G.useState("all"),[y,x]=G.useState(1),[_,w]=G.useState(1),S=20,[T,M]=G.useState(new Set),{lastAlert:A}=FM();G.useEffect(()=>{document.title="Alerts — MeshAI"},[]),G.useEffect(()=>{Promise.all([yB().catch(()=>[]),OP(S,0).catch(()=>({items:[],total:0})),iY().catch(()=>[]),fetch("/api/nodes").then(N=>N.json()).catch(()=>[])]).then(([N,D,O,R])=>{t(N),Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S))),a(O),s(R),u(!1)}).catch(N=>{h(N.message),u(!1)})},[]),G.useEffect(()=>{A&&t(N=>N.some(O=>O.type===A.type&&O.message===A.message)?N:[A,...N])},[A]),G.useEffect(()=>{const N=(y-1)*S;OP(S,N,f,g).then(D=>{Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S)))}).catch(()=>{})},[y,f,g]);const P=G.useCallback(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;M(O=>new Set([...O,D]))},[]),I=e.filter(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;return!T.has(D)});return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading alerts..."})}):c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",c]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx($a,{size:14}),"Active Alerts (",I.length,")"]}),I.length>0?v.jsx("div",{className:"space-y-3",children:I.map((N,D)=>v.jsx(gxe,{alert:N,onAcknowledge:P},`${N.type}-${N.timestamp}-${D}`))}):v.jsxs("div",{className:"flex items-center gap-2 text-slate-500 py-8",children:[v.jsx(EM,{size:20,className:"text-green-500"}),v.jsx("span",{children:"No active alerts — all systems nominal"})]})]}),v.jsxs("div",{children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Iu,{size:14}),"Alert History"]}),v.jsx(mxe,{history:r,typeFilter:f,severityFilter:g,onTypeFilterChange:N=>{d(N),x(1)},onSeverityFilterChange:N=>{m(N),x(1)},page:y,totalPages:_,onPageChange:x})]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Q$,{size:14}),"Mesh Subscriptions (",i.length,")"]}),i.length>0?v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.map(N=>v.jsx(yxe,{subscription:N,nodes:o},N.id))}):v.jsxs("div",{className:"text-slate-500 py-4",children:[v.jsx("p",{children:"No active subscriptions."}),v.jsxs("p",{className:"text-xs mt-2",children:["Manage subscriptions via ",v.jsx("code",{className:"text-[#f59e0b]",children:"!subscribe"})," on mesh. Broadcasts arrive with one of three prefixes — ",v.jsx("strong",{children:"New:"})," (first sight), ",v.jsx("strong",{children:"Update:"})," (material change), or ",v.jsx("strong",{children:"Active:"})," (clock-driven reminder while the event is still live). See ",v.jsx("a",{href:"/reference#broadcast-types",className:"text-[#f59e0b] hover:underline",children:"Broadcast Types"})," and ",v.jsx("a",{href:"/reference#reminders",className:"text-[#f59e0b] hover:underline",children:"Reminder System"})," in Reference."]})]})]})]})}const Hy=[{value:"routine",label:"Routine",description:"Informational, no time pressure (ducting, new node, weather advisory, battery declining)"},{value:"priority",label:"Priority",description:"Needs attention soon (severe weather, fire nearby, node offline, HF blackout)"},{value:"immediate",label:"Immediate",description:"Act now, drop everything (fire at infrastructure, extreme weather, region blackout)"}],L3=[{id:"mesh_health",name:"Mesh Health Monitoring",description:"Infrastructure problems - offline nodes, low battery, channel congestion",rule:{name:"Mesh Health Monitoring",enabled:!0,trigger_type:"condition",categories:["infra_offline","critical_node_down","infra_recovery","battery_warning","battery_critical","battery_emergency","high_utilization","packet_flood","mesh_score_low"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"weather_fire",name:"Weather & Fire Alerts",description:"Environmental threats - severe weather, nearby wildfires, new ignitions, flooding",rule:{name:"Weather & Fire Alerts",enabled:!0,trigger_type:"condition",categories:["weather_warning","fire_proximity","new_ignition","stream_flood_warning"],min_severity:"priority",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:15,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"rf_conditions",name:"RF Conditions",description:"Propagation changes - solar events, HF blackouts, tropospheric ducting",rule:{name:"RF Conditions",enabled:!0,trigger_type:"condition",categories:["hf_blackout","tropospheric_ducting","geomagnetic_storm"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:60,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"road_traffic",name:"Road & Traffic",description:"Road closures and severe congestion",rule:{name:"Road & Traffic",enabled:!0,trigger_type:"condition",categories:["road_closure","traffic_congestion"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"everything_critical",name:"Everything Critical",description:"All emergency-level events regardless of type",rule:{name:"Everything Critical",enabled:!0,trigger_type:"condition",categories:[],min_severity:"immediate",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:5,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"morning_briefing",name:"Morning Briefing",description:"Daily health and conditions summary at 7am",rule:{name:"Morning Briefing",enabled:!0,trigger_type:"schedule",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"mesh_health_summary",custom_message:"",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}}];function uy(e){if(!e)return"Never";const r=Date.now()/1e3-e;return r<60?"Just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Ai({info:e}){const[t,r]=G.useState(!1);return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),v.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function xs({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o=""}){const[s,l]=G.useState(!1),u=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(Ai,{info:o})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&v.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Mp({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(Ai,{info:s})]}),v.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Lx({label:e,checked:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(Ai,{info:i})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Mv({label:e,value:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(Ai,{info:i})]}),v.jsx("input",{type:"time",value:t,onChange:a=>r(a.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Uy({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:i="",info:a=""}){const[o,s]=G.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(Ai,{info:a})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),v.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:v.jsx(af,{size:16})})]}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,v.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:v.jsx(ca,{size:14})})]},h))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function e7({value:e,onChange:t}){const[r,n]=G.useState(!1),i=Hy.find(a=>a.value===e)||Hy[0];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Severity Threshold",v.jsx(Ai,{info:"Only alerts at or above this severity trigger this rule. ROUTINE = informational, PRIORITY = needs attention, IMMEDIATE = act now."})]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{type:"button",onClick:()=>n(!r),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-left flex items-center justify-between hover:border-accent transition-colors",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-slate-200",children:i.label}),v.jsxs("span",{className:"text-slate-500 ml-2",children:["- ",i.description]})]}),v.jsx(ll,{size:16,className:`text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>n(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-[#0a0e17] border border-[#1e2a3a] shadow-xl overflow-hidden",children:Hy.map(a=>v.jsxs("button",{type:"button",onClick:()=>{t(a.value),n(!1)},className:`w-full px-3 py-2.5 text-left text-sm hover:bg-[#1e2a3a] transition-colors ${e===a.value?"bg-accent/10":""}`,children:[v.jsx("div",{className:"font-medium text-slate-200",children:a.label}),v.jsx("div",{className:"text-xs text-slate-500",children:a.description})]},a.value))})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:'Lower = more notifications. "Warning" recommended for most rules.'})]})}function cy({rule:e}){const[t,r]=G.useState(!1),[n,i]=G.useState(null),a=async()=>{r(!0),i(null);try{let s={type:e.delivery_type};e.delivery_type==="mesh_broadcast"?s.channel_index=e.broadcast_channel:e.delivery_type==="mesh_dm"?s.node_ids=e.node_ids:e.delivery_type==="email"?s={type:"email",smtp_host:e.smtp_host,smtp_port:e.smtp_port,smtp_user:e.smtp_user,smtp_password:e.smtp_password,smtp_tls:e.smtp_tls,from_address:e.from_address,recipients:e.recipients}:e.delivery_type==="webhook"&&(s={type:"webhook",url:e.webhook_url,headers:e.webhook_headers});const u=await(await fetch("/api/notifications/channels/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();i(u)}catch(s){i({success:!1,message:"Test failed",error:s instanceof Error?s.message:"Unknown error",details:{}})}finally{r(!1)}};if(!e.delivery_type)return null;const o={mesh_broadcast:v.jsx(Di,{size:14}),mesh_dm:v.jsx(OM,{size:14}),email:v.jsx(Y$,{size:14}),webhook:v.jsx(Z$,{size:14})}[e.delivery_type]||v.jsx(t_,{size:14});return v.jsxs("div",{className:"space-y-2",children:[v.jsx("button",{type:"button",onClick:a,disabled:t,className:"flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",children:t?v.jsxs(v.Fragment,{children:[v.jsx($v,{size:14,className:"animate-spin"}),"Testing..."]}):v.jsxs(v.Fragment,{children:[o,"Test Channel"]})}),n&&v.jsx("div",{className:`p-2 rounded text-xs ${n.success?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[n.success?v.jsx(Za,{size:14,className:"mt-0.5 flex-shrink-0"}):v.jsx(ca,{size:14,className:"mt-0.5 flex-shrink-0"}),v.jsxs("div",{children:[v.jsx("div",{className:"font-medium",children:n.message}),n.error&&v.jsx("div",{className:"mt-1 text-red-300",children:n.error})]})]})})]})}function _xe({rule:e,ruleIndex:t,categories:r,regions:n,onChange:i,onDelete:a,onDuplicate:o,onTest:s}){var O,R,F,H,W;const[l,u]=G.useState(!e.name),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null);G.useEffect(()=>{var V;e.name&&t>=0&&(fetch(`/api/notifications/rules/${t}/stats`).then(z=>z.json()).then(z=>d(z)).catch(()=>{}),(V=e.categories)!=null&&V.length&&fetch("/api/notifications/rules/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e.categories})}).then(z=>z.json()).then(z=>m(z)).catch(()=>{}))},[e.name,t,e.categories]);const y=[{value:"",label:"(None)",description:"Rule matches but does not deliver"},{value:"mesh_broadcast",label:"Mesh Broadcast",description:"Send to a mesh radio channel"},{value:"mesh_dm",label:"Mesh DM",description:"Direct message to specific nodes"},{value:"email",label:"Email",description:"Send via SMTP"},{value:"webhook",label:"Webhook",description:"POST to any URL"}],x=[{value:"daily",label:"Daily"},{value:"twice_daily",label:"Twice Daily"},{value:"weekly",label:"Weekly"}],_=[{value:"mesh_health_summary",label:"Mesh Health Summary",description:"Current health score, pillar breakdown, problem nodes"},{value:"rf_propagation_report",label:"RF Propagation Report",description:"Solar indices, Kp, ducting conditions"},{value:"alerts_digest",label:"Active Alerts Digest",description:"Summary of all active environmental alerts"},{value:"environmental_conditions",label:"Environmental Conditions",description:"Full conditions: weather, fire, streams, roads"},{value:"custom",label:"Custom Message",description:"Write your own with template tokens"}],w=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],S=V=>{const z=e.categories||[];z.includes(V)?i({...e,categories:z.filter(Z=>Z!==V)}):i({...e,categories:[...z,V]})},T=(V,z)=>{const Z=e.categories||[];if(z==="add"){const U=Array.from(new Set([...Z,...V]));i({...e,categories:U})}else{const U=new Set(V);i({...e,categories:Z.filter($=>!U.has($))})}},M=V=>{const z=e.region_scope||[];z.includes(V)?i({...e,region_scope:z.filter(Z=>Z!==V)}):i({...e,region_scope:[...z,V]})},A=V=>{const z=e.schedule_days||[];z.includes(V)?i({...e,schedule_days:z.filter(Z=>Z!==V)}):i({...e,schedule_days:[...z,V]})},P=async()=>{h(!0),await s(),h(!1)},I=()=>{if(e.trigger_type==="schedule")return"[Scheduled report preview would appear here]";const V=e.categories||[];if(V.length===0&&r.length>0)return r[0].example_message||"Alert notification";const z=r.find(Z=>V.includes(Z.id));return(z==null?void 0:z.example_message)||"Alert notification"},N=()=>{var z,Z,U,$,Y,te,ie,se;const V=[];if(e.trigger_type==="schedule"){const le=((z=x.find(me=>me.value===e.schedule_frequency))==null?void 0:z.label)||e.schedule_frequency,Ee=((Z=_.find(me=>me.value===e.message_type))==null?void 0:Z.label)||e.message_type;V.push(`${le} at ${e.schedule_time||"??:??"}`),V.push(Ee)}else{const le=((U=e.categories)==null?void 0:U.length)||0,Ee=le===0?"All":r.filter(ye=>{var Me;return(Me=e.categories)==null?void 0:Me.includes(ye.id)}).map(ye=>ye.name).slice(0,2).join(", ")+(le>2?` +${le-2}`:""),me=(($=Hy.find(ye=>ye.value===e.min_severity))==null?void 0:$.label)||e.min_severity;V.push(`${Ee} at ${me}+`)}if(!e.delivery_type)V.push("No delivery");else{const le=((Y=y.find(me=>me.value===e.delivery_type))==null?void 0:Y.label)||e.delivery_type;let Ee="";if(e.delivery_type==="mesh_broadcast")Ee=`Ch ${e.broadcast_channel}`;else if(e.delivery_type==="mesh_dm")Ee=`${((te=e.node_ids)==null?void 0:te.length)||0} nodes`;else if(e.delivery_type==="email")Ee=(ie=e.recipients)!=null&&ie.length?e.recipients[0]+(e.recipients.length>1?` +${e.recipients.length-1}`:""):"no recipients";else if(e.delivery_type==="webhook")try{Ee=new URL(e.webhook_url).hostname}catch{Ee=((se=e.webhook_url)==null?void 0:se.slice(0,20))||"no URL"}V.push(`${le}${Ee?` (${Ee})`:""}`)}return V.join(" -> ")},D=()=>{var z;if(!g||!((z=e.categories)!=null&&z.length))return null;const V=new Map;for(const[,Z]of Object.entries(g)){const U=V.get(Z.source);U?(U.events+=Z.active_events,U.enabled=U.enabled&&Z.enabled):V.set(Z.source,{enabled:Z.enabled,events:Z.active_events})}return Array.from(V.entries()).map(([Z,{enabled:U,events:$}])=>v.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ${U?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,title:U?`${$} active`:"Not enabled",children:[U?v.jsx(t_,{size:10}):v.jsx(mB,{size:10}),Z.toUpperCase(),U&&$>0&&` (${$})`]},Z))};return v.jsxs("div",{className:`border overflow-hidden ${e.enabled?"border-[#1e2a3a]":"border-slate-700 opacity-60"}`,children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>u(!l),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l?v.jsx(ll,{size:16,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:16,className:"text-slate-500 flex-shrink-0"}),v.jsx("button",{onClick:V=>{V.stopPropagation(),i({...e,enabled:!e.enabled})},className:`w-2 h-2 rounded-full flex-shrink-0 ${e.enabled?"bg-green-500":"bg-slate-500"}`,title:e.enabled?"Enabled":"Disabled"}),e.trigger_type==="schedule"?v.jsx(Iu,{size:14,className:"text-[#f59e0b] flex-shrink-0"}):v.jsx(Dh,{size:14,className:"text-yellow-400 flex-shrink-0"}),v.jsx("span",{className:"font-medium text-slate-200 truncate",title:e.name||void 0,children:e.name||"New Rule"}),!l&&v.jsx("span",{className:`text-xs truncate hidden sm:block ${e.delivery_type?"text-slate-500":"text-amber-400"}`,children:N()})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!l&&(()=>{const V="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs mr-2";if(!e.enabled)return v.jsx("span",{className:`${V} bg-slate-800 text-slate-500`,children:"Disabled"});if(!f)return null;const z=f.fire_count||0,Z=f.last_fired,U=Date.now()/1e3-7*86400;return z>0&&Z&&Z>=U?v.jsx("span",{className:`${V} bg-green-500/10 text-green-400`,title:`Last fired ${uy(Z)}`,children:"Active"}):z>0&&Z?v.jsx("span",{className:`${V} bg-yellow-500/10 text-yellow-400`,title:`Last fired ${uy(Z)}`,children:"Idle (no recent activity)"}):v.jsx("span",{className:`${V} bg-slate-800 text-slate-400`,children:"No activity yet"})})(),!l&&v.jsx("div",{className:"hidden md:flex items-center gap-1 mr-2",children:D()}),v.jsx("button",{onClick:V=>{V.stopPropagation(),P()},disabled:c||!e.name,className:"p-1.5 text-[#f59e0b] hover:text-[#d97706] hover:bg-[#f59e0b]/10 rounded disabled:opacity-50",title:"Test rule",children:v.jsx(_C,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),o()},className:"p-1.5 text-slate-400 hover:text-slate-200 hover:bg-slate-500/10 rounded",title:"Duplicate",children:v.jsx(H$,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),a()},className:"p-1.5 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",title:"Delete",children:v.jsx(Ep,{size:14})})]})]}),!l&&e.name&&v.jsxs("div",{className:"px-3 pb-2 pt-0 bg-[#0a0e17] flex items-center gap-2 flex-wrap text-xs",children:[!e.delivery_type&&v.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:[v.jsx(Vo,{size:10}),"No delivery method"]}),(f==null?void 0:f.fire_count)!==void 0&&f.fire_count>0&&v.jsxs("span",{className:"text-slate-500",children:["Fired ",f.fire_count,"x"]})]}),l&&v.jsxs("div",{className:"p-4 space-y-6 border-t border-[#1e2a3a]",children:[v.jsx(xs,{label:"Rule Name",value:e.name,onChange:V=>i({...e,name:V}),placeholder:"e.g., Emergency Broadcast, Daily Health Report",helper:"A descriptive name for this rule"}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Trigger Type"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"condition"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type!=="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Dh,{size:16}),v.jsx("span",{children:"Condition"})]}),v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"schedule"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type==="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Iu,{size:16}),v.jsx("span",{children:"Schedule"})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:e.trigger_type==="schedule"?"Send reports on a schedule (daily briefings, weekly digests)":"React to alert conditions (fires, outages, weather warnings)"})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx($a,{size:14}),"WHEN (Condition)"]}),v.jsx(e7,{value:e.min_severity,onChange:V=>i({...e,min_severity:V})}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Categories",v.jsx(Ai,{info:"Select which types of alerts trigger this rule. Leave all unchecked to match ALL categories. Categories are grouped by family — use the 'All' / 'Clear' buttons in each header to bulk-toggle."})]}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:(((O=e.categories)==null?void 0:O.length)||0)===0?"All categories (none selected)":`${(R=e.categories)==null?void 0:R.length} selected`}),v.jsx(bxe,{categories:r,selected:e.categories||[],onToggle:S,onSelectMany:T})]}),g&&Object.keys(g).length>0&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Data Sources"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:D()})]})]}),e.trigger_type==="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(B$,{size:14}),"WHEN (Schedule)"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Frequency"}),v.jsx("select",{value:e.schedule_frequency||"daily",onChange:V=>i({...e,schedule_frequency:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:x.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mv,{label:"Time",value:e.schedule_time||"07:00",onChange:V=>i({...e,schedule_time:V})}),e.schedule_frequency==="twice_daily"&&v.jsx(Mv,{label:"Second Time",value:e.schedule_time_2||"19:00",onChange:V=>i({...e,schedule_time_2:V})})]}),e.schedule_frequency==="weekly"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Days"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(V=>{var z;return v.jsx("button",{type:"button",onClick:()=>A(V),className:`px-3 py-1.5 rounded text-sm capitalize transition-colors ${(z=e.schedule_days)!=null&&z.includes(V)?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:V.slice(0,3)},V)})})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Report Type"}),v.jsx("select",{value:e.message_type||"mesh_health_summary",onChange:V=>i({...e,message_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:_.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(F=_.find(V=>V.value===e.message_type))==null?void 0:F.description})]}),e.message_type==="custom"&&v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Message",v.jsx(Ai,{info:"Available tokens: {MESH_SCORE}, {NODE_COUNT}, {NODES_ONLINE}, {ACTIVE_ALERTS}, {KP}, {SFI}, {DATE}, {TIME}"})]}),v.jsx("textarea",{value:e.custom_message||"",onChange:V=>i({...e,custom_message:V.target.value}),rows:4,placeholder:"Good morning! Mesh health: {MESH_SCORE}/100 with {NODE_COUNT} nodes online.",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"})]})]}),v.jsxs("div",{className:"space-y-2 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(nf,{size:14}),"REGIONS",v.jsx(Ai,{info:"Limit this rule to alerts from specific regions. Empty selection = all regions (backward compatible). Region names come from /api/regions."})]}),v.jsx("div",{className:"text-xs text-slate-500",children:(((H=e.region_scope)==null?void 0:H.length)||0)===0?"All regions (none selected)":`${e.region_scope.length} of ${n.length} selected`}),n.length===0?v.jsx("div",{className:"text-xs text-slate-600 italic",children:"No regions configured."}):v.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(V=>{const z=(e.region_scope||[]).includes(V.name);return v.jsx("button",{type:"button",onClick:()=>M(V.name),className:`px-3 py-1.5 rounded text-sm transition-colors ${z?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,title:V.local_name||V.name,children:V.local_name||V.name},V.name)})})]}),v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(_C,{size:14}),"SEND VIA"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Delivery Method",v.jsx(Ai,{info:"Where this notification gets delivered. Select (None) to save the rule without delivery - it will match conditions but won't send until you configure a delivery method."})]}),v.jsx("select",{value:e.delivery_type||"",onChange:V=>i({...e,delivery_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:y.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(W=y.find(V=>V.value===(e.delivery_type||"")))==null?void 0:W.description})]}),!e.delivery_type&&v.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[v.jsx(Vo,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),v.jsx("div",{className:"text-sm text-amber-300",children:"Rule will log matches but not deliver until a delivery method is configured."})]}),e.delivery_type==="mesh_broadcast"&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Broadcast Channel",value:e.broadcast_channel??0,onChange:V=>i({...e,broadcast_channel:V}),helper:"Select the mesh radio channel",mode:"single"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="mesh_dm"&&v.jsxs(v.Fragment,{children:[v.jsx(kL,{label:"Recipient Nodes",value:e.node_ids||[],onChange:V=>i({...e,node_ids:V}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="email"&&v.jsxs("div",{className:"space-y-4",children:[v.jsx(Uy,{label:"Recipients",value:e.recipients||[],onChange:V=>i({...e,recipients:V}),placeholder:"email@example.com",helper:"Email addresses to receive alerts"}),v.jsxs("details",{className:"group",children:[v.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[v.jsx(Js,{size:14,className:"group-open:rotate-90 transition-transform"}),"SMTP Configuration"]}),v.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"SMTP Host",value:e.smtp_host||"",onChange:V=>i({...e,smtp_host:V}),placeholder:"smtp.gmail.com"}),v.jsx(Mp,{label:"SMTP Port",value:e.smtp_port??587,onChange:V=>i({...e,smtp_port:V}),min:1,max:65535})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"Username",value:e.smtp_user||"",onChange:V=>i({...e,smtp_user:V})}),v.jsx(xs,{label:"Password",value:e.smtp_password||"",onChange:V=>i({...e,smtp_password:V}),type:"password",info:"Gmail users: use an App Password from myaccount.google.com/apppasswords"})]}),v.jsx(Lx,{label:"Use TLS",checked:e.smtp_tls??!0,onChange:V=>i({...e,smtp_tls:V})}),v.jsx(xs,{label:"From Address",value:e.from_address||"",onChange:V=>i({...e,from_address:V}),placeholder:"alerts@yourdomain.com"})]})]}),v.jsx(cy,{rule:e})]}),e.delivery_type==="webhook"&&v.jsxs(v.Fragment,{children:[v.jsx(xs,{label:"Webhook URL",value:e.webhook_url||"",onChange:V=>i({...e,webhook_url:V}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON",info:"Works with Discord webhooks, ntfy.sh, Slack, Home Assistant, Pushover, or any HTTP POST endpoint."}),v.jsx(cy,{rule:e})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mp,{label:"Cooldown (minutes)",value:e.cooldown_minutes??10,onChange:V=>i({...e,cooldown_minutes:V}),min:0,helper:"Min time between repeat sends",info:"Prevents alert spam. Same condition won't re-trigger this rule within this window."})," "]}),f&&v.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[v.jsxs("span",{children:["Last fired: ",uy(f.last_fired)]}),v.jsxs("span",{children:["Last tested: ",uy(f.last_test)]}),v.jsxs("span",{children:["Total fires: ",f.fire_count]})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Example Message"}),v.jsx("div",{className:"p-3 bg-[#1e2a3a]/50 border border-[#1e2a3a]",children:v.jsx("p",{className:"text-sm text-slate-300 font-mono",children:I()})}),v.jsx("p",{className:"text-xs text-slate-600",children:"This is an example of what this rule would send."})]})]})]})}const Zy=[{key:"mesh_health",label:"Mesh Health",Icon:rf},{key:"weather",label:"Weather",Icon:Du},{key:"fire",label:"Fire",Icon:Xx},{key:"rf_propagation",label:"RF Propagation",Icon:Di},{key:"roads",label:"Roads",Icon:$x},{key:"avalanche",label:"Avalanche",Icon:J$},{key:"seismic",label:"Seismic",Icon:Kx},{key:"tracking",label:"Tracking",Icon:nf}];function bxe({categories:e,selected:t,onToggle:r,onSelectMany:n}){const i=new Set(Zy.map(f=>f.key)),a=new Map;Zy.forEach(f=>a.set(f.key,[]));const o=[];for(const f of e){const d=f.toggle;d&&i.has(d)?a.get(d).push(f):o.push(f)}const s=new Set;for(const[f,d]of a)d.some(g=>t.includes(g.id))&&s.add(f);o.some(f=>t.includes(f.id))&&s.add("other");const[l,u]=G.useState(s),c=f=>{u(d=>{const g=new Set(d);return g.has(f)?g.delete(f):g.add(f),g})},h=(f,d,g,m)=>{if(!m.length)return null;const y=l.has(f),x=m.map(w=>w.id),_=x.filter(w=>t.includes(w)).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded",children:[v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-[#0d1420]",children:[v.jsxs("button",{type:"button",onClick:()=>c(f),className:"flex items-center gap-2 text-sm text-slate-200 flex-1 min-w-0",children:[y?v.jsx(ll,{size:14,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:14,className:"text-slate-500 flex-shrink-0"}),g&&v.jsx(g,{size:14,className:"text-slate-400 flex-shrink-0"}),v.jsxs("span",{className:"truncate",children:[d," (",m.length,")"]}),_>0&&v.jsxs("span",{className:"ml-1 text-xs text-accent",children:[_," selected"]})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"add")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-accent hover:bg-accent/10",title:"Select all in family",children:"All"}),v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"remove")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-red-400 hover:bg-red-500/10",title:"Clear family",children:"Clear"})]})]}),y&&v.jsx("div",{className:"p-1 space-y-1",children:m.map(w=>v.jsxs("label",{onClick:()=>r(w.id),className:"flex items-start gap-2 p-2 rounded hover:bg-[#1e2a3a]/50 cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 mt-0.5 rounded border flex items-center justify-center flex-shrink-0 ${t.includes(w.id)?"bg-accent border-accent":"border-slate-600"}`,children:t.includes(w.id)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200",children:w.name}),v.jsx("div",{className:"text-xs text-slate-500",children:w.description})]})]},w.id))})]},f)};return v.jsxs("div",{className:"max-h-96 overflow-y-auto border border-[#1e2a3a] p-2 space-y-2",children:[Zy.map(f=>h(f.key,f.label,f.Icon,a.get(f.key)||[])),h("other","Other",null,o)]})}const N3=["digest","mesh_broadcast","mesh_dm","email","webhook"],wxe=["routine","priority","immediate"];function Sxe({toggles:e,onChange:t}){const[r,n]=G.useState(null),i=(a,o)=>t({...e,[a]:{...e[a]||{},name:a,...o}});return v.jsxs("div",{className:"space-y-3 mb-8",children:[v.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Master Toggles",v.jsx(Ai,{info:"Per-family notification policy: enable a family, set its severity threshold, choose which channels fire at each severity, and scope to regions (PagerDuty/Grafana-style)."})]}),v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Zy.map(({key:a,label:o,Icon:s})=>{const l=e[a]||{},u=r===a,c=Object.values(l.severity_channels||{}).reduce((f,d)=>f+((d==null?void 0:d.length)||0),0),h=(l.regions||[]).length;return v.jsxs("div",{className:"border border-[#1e2a3a] p-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("button",{type:"button",onClick:()=>n(u?null:a),className:"flex items-center gap-2 text-sm text-slate-200",children:[v.jsx(s,{size:15})," ",o,u?v.jsx(ll,{size:14}):v.jsx(Js,{size:14})]}),v.jsx(Lx,{label:"",checked:!!l.enabled,onChange:f=>i(a,{enabled:f})})]}),!u&&v.jsx("div",{className:"text-xs text-slate-600 mt-1",children:l.enabled?`${h||"all"} region${h===1?"":"s"}, ${c} channel${c===1?"":"s"} at ${l.min_severity||"priority"}+`:"OFF"}),u&&v.jsxs("div",{className:`mt-3 space-y-3 ${l.enabled?"":"opacity-40 pointer-events-none select-none"}`,children:[v.jsx(e7,{value:l.min_severity||"priority",onChange:f=>i(a,{min_severity:f})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Severity → channels"}),v.jsxs("table",{className:"text-xs w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{}),N3.map(f=>v.jsx("th",{className:"text-slate-500 font-normal px-1",children:f.replace("_"," ")},f))]})}),v.jsx("tbody",{children:wxe.map(f=>v.jsxs("tr",{children:[v.jsx("td",{className:"text-slate-400 pr-2",children:f}),N3.map(d=>{var m;const g=(((m=l.severity_channels)==null?void 0:m[f])||[]).includes(d);return v.jsx("td",{className:"text-center",children:v.jsx("input",{type:"checkbox",checked:g,onChange:y=>{const x={...l.severity_channels||{}},_=new Set(x[f]||[]);y.target.checked?_.add(d):_.delete(d),x[f]=Array.from(_),i(a,{severity_channels:x})}})},d)})]},f))})]}),v.jsx(Uy,{label:"Regions (empty = all)",value:l.regions||[],onChange:f=>i(a,{regions:f}),placeholder:"Add region..."})," ",v.jsx("div",{className:"text-xs text-slate-500 pt-1",children:"Channel config"}),v.jsx(Mp,{label:"Broadcast channel",value:l.broadcast_channel??0,onChange:f=>i(a,{broadcast_channel:f})}),v.jsx(Uy,{label:"DM node IDs",value:l.node_ids||[],onChange:f=>i(a,{node_ids:f}),placeholder:"!nodeid"}),v.jsx(Uy,{label:"Email recipients",value:l.recipients||[],onChange:f=>i(a,{recipients:f}),placeholder:"ops@example.com"}),v.jsx(xs,{label:"SMTP host",value:l.smtp_host||"",onChange:f=>i(a,{smtp_host:f}),placeholder:"smtp.example.com"}),v.jsx(Mp,{label:"SMTP port",value:l.smtp_port??587,onChange:f=>i(a,{smtp_port:f})}),v.jsx(xs,{label:"Webhook URL",value:l.webhook_url||"",onChange:f=>i(a,{webhook_url:f}),placeholder:"https://..."})]})]},a)})})]})}function Cxe(){var z,Z,U;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(null),[_,w]=G.useState({open:!1,ruleIndex:-1,loading:!1,action:""}),[S,T]=G.useState(!1),[M,A]=G.useState(!1),P=G.useCallback(async()=>{try{const[$,Y,te]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/categories"),fetch("/api/regions")]);if(!$.ok)throw new Error("Failed to fetch notifications config");const ie=await $.json(),se=await Y.json(),le=te.ok?await te.json():[];t(ie),n(JSON.parse(JSON.stringify(ie))),a(se),s(Array.isArray(le)?le:[]),A(!1),d(null)}catch($){d($ instanceof Error?$.message:"Unknown error")}finally{u(!1)}},[]);G.useEffect(()=>{document.title="Notifications - MeshAI",P()},[P]),G.useEffect(()=>{e&&r&&A(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const I=async()=>{if(e){h(!0),d(null),m(null);try{const $=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Y=await $.json();if(!$.ok)throw new Error(Y.detail||"Save failed");m("Notifications config saved successfully"),n(JSON.parse(JSON.stringify(e))),A(!1),setTimeout(()=>m(null),3e3)}catch($){d($ instanceof Error?$.message:"Save failed")}finally{h(!1)}}},N=()=>{r&&(t(JSON.parse(JSON.stringify(r))),A(!1))},D=()=>({name:"",enabled:!0,trigger_type:"condition",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"19:00",schedule_days:["monday"],message_type:"mesh_health_summary",custom_message:"",delivery_type:"",broadcast_channel:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{},cooldown_minutes:10,region_scope:[]}),O=()=>{e&&t({...e,rules:[...e.rules||[],D()]})},R=$=>{if(!e)return;const Y=L3.find(te=>te.id===$);Y&&(t({...e,rules:[...e.rules||[],{...D(),...Y.rule}]}),T(!1))},F=$=>{if(!e)return;const Y=e.rules[$],te={...JSON.parse(JSON.stringify(Y)),name:`${Y.name} (copy)`},ie=[...e.rules];ie.splice($+1,0,te),t({...e,rules:ie})},H=async $=>{w({open:!0,ruleIndex:$,loading:!0,action:""});try{const te=await(await fetch(`/api/notifications/rules/${$}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})})).json();x(te),w(ie=>({...ie,loading:!1}))}catch{x({success:!1,message:"Failed to get preview"}),w(Y=>({...Y,loading:!1}))}},W=async $=>{const Y=_.ruleIndex;w(te=>({...te,loading:!0,action:$}));try{const ie=await(await fetch(`/api/notifications/rules/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:$})})).json();x(ie),w(se=>({...se,loading:!1}))}catch{x({success:!1,message:`Failed to ${$}`}),w(te=>({...te,loading:!1}))}},V=()=>{w({open:!1,ruleIndex:-1,loading:!1,action:""}),x(null)};return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):e?v.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[_.open&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:v.jsxs("div",{className:"bg-[#1a2332] border border-[#2a3a4a] shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] overflow-auto",children:[v.jsxs("div",{className:"p-4 border-b border-[#2a3a4a] flex items-center justify-between sticky top-0 bg-[#1a2332]",children:[v.jsx("h3",{className:"text-lg font-semibold",children:"Test Notification Rule"}),v.jsx("button",{onClick:V,className:"text-slate-500 hover:text-slate-300",children:v.jsx(ca,{size:20})})]}),v.jsx("div",{className:"p-4 space-y-4",children:_.loading?v.jsxs("div",{className:"flex items-center justify-center py-8",children:[v.jsx($v,{size:20,className:"animate-spin text-slate-400 mr-2"}),v.jsx("div",{className:"text-slate-400",children:_.action?`${_.action.replace("_"," ").replace("send ","Sending ")}...`:"Loading current data..."})]}):y?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Current Data"}),y.live_data_summary&&y.live_data_summary.length>0?v.jsx("div",{className:"p-3 bg-slate-800/50 rounded space-y-1",children:y.live_data_summary.map(($,Y)=>v.jsx("div",{className:`text-sm font-mono ${$.startsWith("[!]")?"text-amber-400":""}`,children:$},Y))}):v.jsx("div",{className:"p-3 bg-slate-800/50 rounded text-sm text-slate-500",children:"No live data available for this rule's categories"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Rule Matching"}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.conditions_matched&&y.conditions_matched>0?v.jsxs("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 rounded text-sm",children:[y.conditions_matched," condition",y.conditions_matched!==1?"s":""," match - this rule WOULD fire"]}):v.jsx("span",{className:"px-2 py-1 bg-slate-700 text-slate-400 rounded text-sm",children:"No conditions trigger this rule right now"}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded text-sm",children:[y.conditions_below_threshold," below threshold"]})]}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-sm space-y-2",children:[v.jsx("div",{className:"text-yellow-300",children:y.below_threshold_summary}),y.below_threshold_events&&y.below_threshold_events.length>0&&v.jsx("div",{className:"space-y-1 text-yellow-200/80",children:y.below_threshold_events.slice(0,3).map(($,Y)=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 rounded",children:$.severity}),v.jsx("span",{children:$.headline})]},Y))}),y.suggestion&&v.jsxs("div",{className:"text-yellow-400 text-xs mt-2",children:["Tip: ",y.suggestion]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:y.is_example?"Example Messages":"Messages That Would Fire"}),(z=y.preview_messages)==null?void 0:z.map(($,Y)=>v.jsx("div",{className:"p-3 bg-slate-800 rounded text-sm font-mono break-words",children:$},Y))]}),y.delivered!==void 0&&y.delivery_result&&v.jsx("div",{className:`p-3 rounded text-sm ${y.delivered?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[y.delivered?v.jsx(Za,{size:16,className:"mt-0.5"}):v.jsx(ca,{size:16,className:"mt-0.5"}),v.jsxs("div",{children:[v.jsx("div",{children:y.delivery_result}),y.delivery_error&&v.jsx("div",{className:"mt-1 text-red-300",children:y.delivery_error})]})]})}),y.message&&!y.preview_messages&&v.jsx("div",{className:`p-3 rounded text-sm ${y.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:y.message})]}):null}),v.jsxs("div",{className:"p-4 border-t border-[#2a3a4a] flex justify-between sticky bottom-0 bg-[#1a2332]",children:[v.jsx("button",{onClick:V,className:"px-4 py-2 text-slate-400 hover:text-slate-200",children:"Close"}),y&&!y.delivered&&v.jsx("div",{className:"flex gap-2",children:y.delivery_method?v.jsxs(v.Fragment,{children:[y.live_data_summary&&y.live_data_summary.length>0&&v.jsx("button",{onClick:()=>W("send_status"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send current conditions summary",children:"Send Current Conditions"}),v.jsx("button",{onClick:()=>W("send_test"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send example alert message",children:"Send Example Alert"}),y.can_send_live&&v.jsx("button",{onClick:()=>W("send_live"),disabled:_.loading,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm disabled:opacity-50",title:"Send actual live alert",children:"Send Live Alert"})]}):v.jsx("span",{className:"px-3 py-2 text-amber-400 text-sm",children:"Configure a delivery method to send test messages"})})]})]})}),v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{children:v.jsx("p",{className:"text-sm text-slate-500",children:"Alert delivery and scheduled reports. Rules define what triggers a notification and where it gets sent."})}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:P,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:v.jsx($v,{size:18})}),v.jsxs("button",{onClick:N,disabled:!M,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[v.jsx(Jx,{size:16}),"Discard"]}),v.jsxs("button",{onClick:I,disabled:c||!M,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[v.jsx(zM,{size:16}),c?"Saving...":"Save"]})]})]}),f&&v.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&v.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[v.jsx(Za,{size:14,className:"inline mr-2"}),g]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-6",children:[v.jsx(Lx,{label:"Enable Notifications",checked:e.enabled,onChange:$=>t({...e,enabled:$}),helper:"Master switch for all notification delivery",info:"When disabled, no alerts or scheduled messages will be delivered. Alerts still get recorded to history."}),e.enabled&&v.jsxs(v.Fragment,{children:[" ",v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),v.jsx(Mp,{label:"Grace period (seconds)",value:e.cold_start_grace_seconds??60,onChange:$=>t({...e,cold_start_grace_seconds:$}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),v.jsx(Lx,{label:"Enable scheduled band-conditions broadcasts",checked:e.band_conditions_enabled??!0,onChange:$=>t({...e,band_conditions_enabled:$}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(e.band_conditions_enabled??!0)&&v.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[v.jsx(Mv,{label:"Slot 1",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[0]=$,t({...e,band_conditions_schedule:Y})},helper:"Morning (default 06:00 MT)"}),v.jsx(Mv,{label:"Slot 2",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[1]=$,t({...e,band_conditions_schedule:Y})},helper:"Afternoon (default 14:00 MT)"}),v.jsx(Mv,{label:"Slot 3",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[2]=$,t({...e,band_conditions_schedule:Y})},helper:"Night (default 22:00 MT)"})]}),v.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),e.toggles&&v.jsx(Sxe,{toggles:e.toggles,onChange:$=>t({...e,toggles:$})}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Notification Rules",v.jsx(Ai,{info:"Each rule is self-contained: define what triggers it (condition or schedule), where to send it (mesh, email, webhook), and behavior settings."})]}),v.jsxs("span",{className:"text-xs text-slate-500",children:[((Z=e.rules)==null?void 0:Z.length)||0," rule",(((U=e.rules)==null?void 0:U.length)||0)!==1?"s":""]})]}),(e.rules||[]).map(($,Y)=>v.jsx(_xe,{rule:$,ruleIndex:Y,categories:i,regions:o,onChange:te=>{const ie=[...e.rules||[]];ie[Y]=te,t({...e,rules:ie})},onDelete:()=>{confirm(`Delete rule "${$.name||"New Rule"}"?`)&&t({...e,rules:(e.rules||[]).filter((te,ie)=>ie!==Y)})},onDuplicate:()=>F(Y),onTest:()=>H(Y)},Y)),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{onClick:O,className:"flex-1 py-3 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Rule"]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>T(!S),className:"py-3 px-4 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center gap-2 transition-colors",children:[v.jsx(hB,{size:16})," Add from Template"]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(!1)}),v.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-80 bg-[#1a2332] border border-[#2a3a4a] shadow-xl overflow-hidden",children:[v.jsx("div",{className:"p-2 border-b border-[#2a3a4a] text-xs text-slate-500 uppercase",children:"Rule Templates"}),L3.map($=>v.jsxs("button",{onClick:()=>R($.id),className:"w-full p-3 text-left hover:bg-[#2a3a4a] transition-colors",children:[v.jsx("div",{className:"font-medium text-slate-200",children:$.name}),v.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:$.description})]},$.id))]})]})]})]})]})]})]})]}):v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const P3=[{id:"stream-gauges",label:"Stream Gauges",icon:Yx},{id:"wildfire",label:"Wildfire",icon:Xx},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:Qx},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:U$},{id:"weather-alerts",label:"Weather Alerts",icon:G$},{id:"solar",label:"Solar & Geomagnetic",icon:pB},{id:"ducting",label:"Tropospheric Ducting",icon:Di},{id:"avalanche",label:"Avalanche Danger",icon:Kx},{id:"traffic",label:"Traffic Flow",icon:$x},{id:"roads-511",label:"Road Conditions (511)",icon:sB},{id:"mesh-health",label:"Mesh Health",icon:rf},{id:"broadcast-types",label:"Broadcast Types",icon:_C},{id:"reminders",label:"Reminder System",icon:Iu},{id:"notifications",label:"Notifications",icon:Zv},{id:"commands",label:"Commands",icon:gB},{id:"llm-dm",label:"LLM DM Queries",icon:OM},{id:"or-not-and",label:"OR-not-AND Architecture",icon:dB},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:BM},{id:"curation",label:"Curation: Gauges & Towns",icon:uB},{id:"schema",label:"Schema Migrations",icon:$$},{id:"api",label:"API Reference",icon:W$}];function $t({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return v.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function yt({headers:e,rows:t}){return v.jsx("div",{className:"overflow-x-auto my-4",children:v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>v.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),v.jsx("tbody",{children:t.map((r,n)=>v.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((i,a)=>v.jsx("td",{className:"px-4 py-2 text-slate-300",children:i},a))},n))})]})})}function Pt({href:e,children:t}){return v.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",v.jsx(Ih,{size:12})]})}function de({children:e}){return v.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function fs({children:e}){return v.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function oe({children:e}){return v.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function hr({id:e,title:t,children:r}){return v.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[v.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),v.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function Txe(){const e=tf(),[t,r]=G.useState(""),[n,i]=G.useState("stream-gauges"),a=G.useRef(null);G.useEffect(()=>{const l=e.hash.replace("#","");if(l&&P3.find(u=>u.id===l)){i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=P3.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return v.jsxs("div",{className:"flex h-full -m-6",children:[v.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[v.jsx("div",{className:"p-4 border-b border-border",children:v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),v.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return v.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[v.jsx(u,{size:16}),l.label]},l.id)})})]}),v.jsx("div",{ref:a,className:"flex-1 overflow-y-auto p-6",children:v.jsxs("div",{className:"max-w-4xl",children:[v.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),v.jsxs(hr,{id:"stream-gauges",title:"Stream Gauges",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"A small creek: 50-200 CFS"}),v.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),v.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),v.jsx(de,{children:"When Does It Flood?"}),v.jsxs("p",{children:["Flood levels are set by the ",v.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),v.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),v.jsx(de,{children:"Low Water / Drought"}),v.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Find your gauge at ",v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),v.jsxs("li",{children:["Copy the site number (like ",v.jsx(oe,{children:"13090500"}),")"]}),v.jsx("li",{children:"Add it in Config → Environmental → USGS"}),v.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),v.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),v.jsxs(hr,{id:"wildfire",title:"Wildfire",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),v.jsx(de,{children:"Fire Size — How Big Is It?"}),v.jsx(yt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),v.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),v.jsx(de,{children:"Containment — Is It Under Control?"}),v.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),v.jsx(de,{children:"How Far Away Should I Worry?"}),v.jsx(yt,{headers:["Distance","What To Do"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Under 5 km (3 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 5-15 km (3-10 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 15-30 km (10-20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Over 30 km (20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),v.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),v.jsx(de,{children:"Which Matters More — Size or Distance?"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("p",{children:["Just configure your state code (like ",v.jsx(oe,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),v.jsxs(hr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),v.jsxs("p",{children:[v.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",v.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),v.jsx(de,{children:"Confidence — Is It Really a Fire?"}),v.jsx("p",{children:"Each detection gets a confidence rating:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),v.jsx(de,{children:"FRP — How Intense Is It?"}),v.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),v.jsx(yt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),v.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),v.jsx(de,{children:"New Ignition Detection"}),v.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",v.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),v.jsx(de,{children:"Timing"}),v.jsxs("p",{children:["Satellite data arrives ",v.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",v.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),v.jsx("li",{children:'Click "Get MAP_KEY"'}),v.jsx("li",{children:"Register for a free Earthdata account"}),v.jsx("li",{children:"Your key arrives by email"}),v.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),v.jsxs(hr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[v.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),v.jsx(de,{children:"What you'll see on the mesh"}),v.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),v.jsx(yt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[v.jsx(oe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[v.jsx(oe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",v.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[v.jsx(oe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[v.jsx(oe,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[v.jsx(oe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",v.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[v.jsx(oe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),v.jsx(de,{children:"Daily LLM digest"}),v.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",v.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",v.jsx(oe,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),v.jsx(de,{children:"How attribution works"}),v.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",v.jsx(oe,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),v.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",v.jsx(oe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",v.jsx(oe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",v.jsx(oe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",v.jsx(oe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),v.jsx(de,{children:"How movement is computed"}),v.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",v.jsx(oe,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",v.jsx(oe,{children:"growth_drift_threshold_mi"})," the"," ",v.jsx(oe,{children:"wildfire_growth"})," broadcast fires."]}),v.jsx(de,{children:"How spotting is detected"}),v.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",v.jsx(oe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",v.jsx(oe,{children:"wildfire_spotting"})," broadcast at ",v.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",v.jsx(oe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),v.jsx(de,{children:"Tunable knobs (Adapter Config → fires)"}),v.jsx(yt,{headers:["Key","Default","What it does"],rows:[[v.jsx(oe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[v.jsx(oe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[v.jsx(oe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[v.jsx(oe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[v.jsx(oe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[v.jsx(oe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[v.jsx(oe,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[v.jsx(oe,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[v.jsx(oe,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[v.jsx(oe,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),v.jsxs(hr,{id:"weather-alerts",title:"Weather Alerts",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),v.jsx(de,{children:"Alert Severity — How Serious Is It?"}),v.jsx(yt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),v.jsx(de,{children:"When Should I Act? (Urgency)"}),v.jsx(yt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),v.jsx(de,{children:"How Sure Are They? (Certainty)"}),v.jsx(yt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),v.jsx(de,{children:"These Are Separate Scales"}),v.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),v.jsx(de,{children:"What Minimum Severity Should I Set?"}),v.jsx(yt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),v.jsx(de,{children:"Finding Your NWS Zone"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://www.weather.gov",children:"weather.gov"})]}),v.jsx("li",{children:"Enter your location"}),v.jsxs("li",{children:["Find your zone code at ",v.jsx(Pt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),v.jsxs("li",{children:["Zone codes look like: ",v.jsx(oe,{children:"IDZ016"}),", ",v.jsx(oe,{children:"UTZ040"}),", etc."]})]}),v.jsx(de,{children:"The User-Agent Field"}),v.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),v.jsx("p",{children:v.jsx(oe,{children:"(meshai, you@email.com)"})}),v.jsx("p",{children:"No registration. No waiting. Just type it in."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),v.jsxs(hr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),v.jsx(de,{children:"Solar Flux Index (SFI)"}),v.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),v.jsx(yt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),v.jsx(de,{children:"Kp Index"}),v.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),v.jsx(yt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[v.jsx("strong",{children:"5"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[v.jsx("strong",{children:"6"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[v.jsx("strong",{children:"7"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[v.jsx("strong",{children:"8-9"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),v.jsx(de,{children:"R / S / G Scales"}),v.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),v.jsx(fs,{children:"R (Radio Blackouts) — from solar flares:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),v.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),v.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),v.jsx(fs,{children:"S (Solar Radiation Storms) — from energetic particles:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Mostly affects polar regions and satellites"}),v.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),v.jsx(fs,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),v.jsx(de,{children:"Bz — The Storm Predictor"}),v.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),v.jsx(yt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),v.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),v.jsxs(hr,{id:"ducting",title:"Tropospheric Ducting",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),v.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),v.jsx(de,{children:"How Do I Know If Ducting Is Happening?"}),v.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),v.jsx(yt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),v.jsx(de,{children:"What You'll Actually Notice"}),v.jsx("p",{children:"When ducting happens on your mesh:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),v.jsx("li",{children:"Nodes appear from far outside your normal range"}),v.jsx("li",{children:"You hear FM radio stations from other cities"}),v.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),v.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),v.jsx(de,{children:"The dM/dz Number"}),v.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),v.jsx(de,{children:"When Does Ducting Happen?"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),v.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),v.jsx("li",{children:"Most common in late summer and early fall"}),v.jsx("li",{children:"Strongest along coastlines and over water"}),v.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),v.jsxs(hr,{id:"avalanche",title:"Avalanche Danger",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),v.jsx(de,{children:"The Danger Scale"}),v.jsx(yt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",v.jsx($t,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",v.jsx($t,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",v.jsx($t,{color:"orange"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",v.jsx($t,{color:"red"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",v.jsx($t,{color:"black"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),v.jsx(de,{children:"The Most Important Thing to Know"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),v.jsx(de,{children:"Seasonal"}),v.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),v.jsx(de,{children:"Finding Your Avalanche Center"}),v.jsxs("p",{children:["Go to ",v.jsx(Pt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"UAC"})," — Utah"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"CAIC"})," — Colorado"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"SAC"})," — Sierra Nevada (CA)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),v.jsxs(hr,{id:"traffic",title:"Traffic Flow",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),v.jsx(de,{children:"Speed Ratio — The Key Number"}),v.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),v.jsx(yt,{headers:["Ratio","What It Means"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),v.jsx(de,{children:"Confidence — Can You Trust the Data?"}),v.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),v.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),v.jsx(de,{children:"Setting Up Corridors"}),v.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Go to Google Maps, find the road"}),v.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),v.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),v.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Sign up at ",v.jsx(Pt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),v.jsx("li",{children:"Create an app → get your API key"}),v.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),v.jsxs(hr,{id:"roads-511",title:"Road Conditions (511)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),v.jsx("p",{children:"Configure in Config → Environmental → 511:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"API Key"})," — if required by your state"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),v.jsxs(hr,{id:"mesh-health",title:"Mesh Health",children:[v.jsx(de,{children:"Health Score"}),v.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),v.jsx(yt,{headers:["Pillar","Weight","What It Measures"],rows:[[v.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[v.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[v.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[v.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[v.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),v.jsx("p",{children:"The overall score is the weighted sum:"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),v.jsx(de,{children:"How Each Pillar Is Calculated"}),v.jsx(fs,{children:"Infrastructure (30%)"}),v.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),v.jsxs("p",{children:["Only nodes with the ",v.jsx(oe,{children:"ROUTER"}),", ",v.jsx(oe,{children:"ROUTER_LATE"}),", or ",v.jsx(oe,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),v.jsx(fs,{children:"Utilization (25%)"}),v.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",v.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),v.jsx("p",{children:v.jsx("strong",{children:"How it works:"})}),v.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[v.jsxs("li",{children:["Collect ",v.jsx(oe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),v.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),v.jsxs("li",{children:["Use the ",v.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),v.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),v.jsxs("p",{className:"mt-4",children:[v.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),v.jsx(yt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),v.jsx(fs,{children:"Coverage (20%)"}),v.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),v.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",v.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),v.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),v.jsx(yt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),v.jsx(fs,{children:"Behavior (15%)"}),v.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),v.jsxs("p",{children:[v.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),v.jsx(yt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),v.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),v.jsx(fs,{children:"Power (10%)"}),v.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),v.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),v.jsxs("p",{children:[v.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),v.jsx(de,{children:"Health Tiers"}),v.jsx(yt,{headers:["Score","Tier","What It Means"],rows:[["90-100",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),v.jsx(de,{children:"Channel Utilization — Is the Radio Channel Full?"}),v.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),v.jsx(yt,{headers:["Utilization","What's Happening"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),v.jsx(de,{children:"Packet Flooding"}),v.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:v.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),v.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),v.jsx(yt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),v.jsx(de,{children:"Battery Levels"}),v.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),v.jsx(yt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[v.jsx("strong",{children:"3.60V"}),v.jsx("strong",{children:"~30%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[v.jsx("strong",{children:"3.50V"}),v.jsx("strong",{children:"~15%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"🔴 Low — charge it now"})})],[v.jsx("strong",{children:"3.40V"}),v.jsx("strong",{children:"~7%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),v.jsx(de,{children:"Node Offline Detection"}),v.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),v.jsx(yt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",v.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),v.jsxs(hr,{id:"broadcast-types",title:"Broadcast Types",children:[v.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),v.jsx(yt,{headers:["Prefix","What it means","When you see it"],rows:[[v.jsx(oe,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[v.jsx(oe,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[v.jsx(oe,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),v.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),v.jsxs(hr,{id:"reminders",title:"Reminder System",children:[v.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",v.jsx(oe,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),v.jsx(de,{children:"Cadences"}),v.jsx(yt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[v.jsx(oe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),v.jsx(de,{children:"The tombstone"}),v.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",v.jsx(oe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",v.jsx(oe,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),v.jsx(de,{children:"Turning reminders off"}),v.jsxs("p",{children:["Per-adapter on/off lives in ",v.jsx(oe,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),v.jsxs(hr,{id:"notifications",title:"Notifications",children:[v.jsx(de,{children:"How It Works"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),v.jsx(de,{children:"Building Rules"}),v.jsx("p",{children:"Each rule answers three questions:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),v.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),v.jsx(de,{children:"Severity Levels — What Should I Set?"}),v.jsx(yt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),v.jsx(de,{children:"Webhook — The Swiss Army Knife"}),v.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"ntfy.sh"})," — POST to ",v.jsx(oe,{children:"https://ntfy.sh/your-topic"})]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),v.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),v.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),v.jsxs(hr,{id:"commands",title:"Commands",children:[v.jsxs("p",{children:["All commands use the ",v.jsx(oe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),v.jsx(de,{children:"Basic Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!help"}),"Shows all available commands"],[v.jsx(oe,{children:"!ping"}),"Tests if the bot is alive"],[v.jsx(oe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[v.jsx(oe,{children:"!health"}),"Detailed health report with pillar scores"],[v.jsx(oe,{children:"!weather"}),"Current weather for your area"]]}),v.jsx(de,{children:"Environmental Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!solar"})," (or ",v.jsx(oe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[v.jsx(oe,{children:"!fire"}),"Active wildfires near your mesh"],[v.jsx(oe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!streams"})," (or ",v.jsx(oe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!roads"})," (or ",v.jsx(oe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[v.jsx(oe,{children:"!hotspots"}),"Satellite fire detections"]]}),v.jsx(de,{children:"Subscription Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!subscribe"}),"Lists all alert categories you can subscribe to"],[v.jsx(oe,{children:"!subscribe fire_proximity"}),"Subscribe to a specific category"],[v.jsx(oe,{children:"!subscribe all"}),"Subscribe to everything"],[v.jsx(oe,{children:"!unsubscribe fire_proximity"}),"Unsubscribe from a category"],[v.jsx(oe,{children:"!subscriptions"}),"Shows what you're currently subscribed to"]]}),v.jsx(de,{children:"Conversational"}),v.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",v.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),v.jsxs(hr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[v.jsxs("p",{children:["Bang commands like ",v.jsx(oe,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),v.jsx(de,{children:"What it can answer"}),v.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),v.jsx(yt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[v.jsx(oe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[v.jsx(oe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[v.jsx(oe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[v.jsx(oe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[v.jsx(oe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[v.jsx(oe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[v.jsx(oe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),v.jsx(de,{children:"The grounding rule"}),v.jsxs("p",{children:["The bot is told to answer ",v.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),v.jsx(de,{children:"Excluding an adapter from LLM context"}),v.jsxs("p",{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",v.jsx(oe,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),v.jsx(de,{children:"What it can't answer"}),v.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),v.jsxs(hr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[v.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),v.jsx(de,{children:"Why mutually exclusive"}),v.jsxs("p",{children:["An adapter is set to ",v.jsx("strong",{children:"either"})," Central ",v.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",v.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),v.jsx(de,{children:"The per-adapter source toggle"}),v.jsxs("p",{children:["Set ",v.jsx(oe,{children:"feed_source"})," on each adapter's row in Environment:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),v.jsxs("li",{children:[v.jsx(oe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),v.jsxs("p",{children:["On the GUI, adapters with ",v.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),v.jsx(de,{children:"Where this surfaces in tooltips"}),v.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",v.jsxs(oe,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),v.jsxs(hr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[v.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),v.jsx(de,{children:"The CONFIG-vs-CODE rule"}),v.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),v.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),v.jsx(de,{children:"Restart-required vs live"}),v.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Anything under the ",v.jsx(oe,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),v.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),v.jsx("li",{children:"The dispatcher cold-start grace window."})]}),v.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),v.jsxs(de,{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle"]}),v.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,v.jsx(oe,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),v.jsxs(hr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[v.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),v.jsx(de,{children:"Gauge Sites"}),v.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),v.jsxs("p",{children:[v.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",v.jsx(oe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),v.jsx(de,{children:"Town Anchors"}),v.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),v.jsx("li",{children:"Town Anchors table (your curated list)"}),v.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),v.jsx("li",{children:"County + state fallback"}),v.jsx("li",{children:"Bare lat/lon coords"})]}),v.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),v.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",v.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),v.jsxs(hr,{id:"schema",title:"Schema Migrations",children:[v.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",v.jsx(oe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",v.jsx(oe,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",v.jsx(oe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),v.jsx(de,{children:"v0.6 + v0.7 additions"}),v.jsx(yt,{headers:["Migration","What it added"],rows:[[v.jsx(oe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[v.jsx(oe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[v.jsx(oe,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[v.jsx(oe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[v.jsx(oe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[v.jsx(oe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),v.jsx(de,{children:"When migrations fail"}),v.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",v.jsx(oe,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),v.jsxs(hr,{id:"api",title:"API Reference",children:[v.jsxs("p",{children:["MeshAI's REST API is available at ",v.jsx(oe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),v.jsx(de,{children:"System"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/status"})," — version, uptime, node count"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/channels"})," — radio channel list"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"POST /api/restart"})," — restart the bot"]})]}),v.jsx(de,{children:"Mesh Data"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/health"})," — health score and pillars"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/regions"})," — region summaries"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/sources"})," — data source health"]})]}),v.jsx(de,{children:"Configuration"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/config"})," — full config"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["GET /api/config/","{section}"]})," — one section"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),v.jsx(de,{children:"Environmental"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/status"})," — per-feed health"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/active"})," — all active events"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),v.jsx(de,{children:"Alerts"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/active"})," — current alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/history"})," — past alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),v.jsx(de,{children:"Real-time"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(oe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const Mxe=1500;function Axe(){const[e,t]=G.useState({}),[r,n]=G.useState({}),[i,a]=G.useState(!0),[o,s]=G.useState(null),[l,u]=G.useState({}),[c,h]=G.useState({}),[f,d]=G.useState({}),g=G.useCallback(async()=>{a(!0),s(null);try{const[S,T]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!S.ok)throw new Error(`GET /adapter-config: ${S.status}`);if(!T.ok)throw new Error(`GET /adapter-meta: ${T.status}`);t(await S.json()),n(await T.json())}catch(S){s(String(S))}finally{a(!1)}},[]);G.useEffect(()=>{g()},[g]);const m=G.useCallback((S,T,M)=>{h(A=>({...A,[S]:T})),M&&d(A=>({...A,[S]:M})),T==="saved"&&setTimeout(()=>{h(A=>A[S]==="saved"?{...A,[S]:"idle"}:A)},Mxe)},[]),y=G.useCallback(async(S,T,M)=>{const A=`${S}.${T}`;m(A,"saving");try{const P=await fetch(`/api/adapter-config/${S}/${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:M})});if(!P.ok){const D=(await P.json().catch(()=>({}))).detail||P.statusText;m(A,"error",String(D));return}const I=await P.json();t(N=>({...N,[S]:(N[S]||[]).map(D=>D.key===T?I:D)})),m(A,"saved")}catch(P){m(A,"error",String(P))}},[m]),x=G.useCallback(async(S,T)=>{const M=`${S}.${T}`;m(M,"saving");try{const A=await fetch(`/api/adapter-config/${S}/${T}/reset`,{method:"POST"});if(!A.ok){m(M,"error",`reset failed (${A.status})`);return}const P=await A.json();t(I=>({...I,[S]:(I[S]||[]).map(N=>N.key===T?P:N)})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]),_=G.useCallback(async(S,T)=>{const M=`meta:${S}`;m(M,"saving");try{const A=await fetch(`/api/adapter-meta/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const I=await A.json().catch(()=>({}));m(M,"error",String(I.detail||A.statusText));return}const P=await A.json();n(I=>({...I,[S]:P})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]);if(i)return v.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(o)return v.jsxs("div",{className:"p-6 text-red-400",children:[v.jsx(Vo,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",o]});const w=Array.from(new Set([...Object.keys(r),...Object.keys(e)])).sort();return v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 text-white",children:[v.jsx(BM,{className:"w-5 h-5"}),v.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),v.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.values(e).reduce((S,T)=>S+T.length,0)," settings across ",w.length," adapters"]})]}),v.jsxs("p",{className:"text-xs text-[#777] max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",v.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",v.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),w.map(S=>{const T=r[S]||{display_name:S,include_in_llm_context:!0,description:""},M=e[S]||[],A=l[S]??!1,P=`meta:${S}`,I=c[P]||"idle";return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 flex items-start gap-4",children:[v.jsx("button",{onClick:()=>u(N=>({...N,[S]:!N[S]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:A?v.jsx(ll,{className:"w-5 h-5"}):v.jsx(Js,{className:"w-5 h-5"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"text-base font-semibold text-white",children:T.display_name}),v.jsx("code",{className:"text-xs text-[#666]",children:S}),M.length>0&&v.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",M.length," settings)"]}),M.length===0&&v.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:"(meta only)"})]}),T.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:T.description})]}),v.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[v.jsx("input",{type:"checkbox",checked:T.include_in_llm_context,onChange:N=>_(S,{include_in_llm_context:N.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",v.jsx(t7,{status:I,error:f[P]})]})]}),A&&M.length>0&&v.jsx("div",{className:"border-t border-border divide-y divide-border",children:M.map(N=>v.jsx(kxe,{row:N,status:c[`${S}.${N.key}`]||"idle",error:f[`${S}.${N.key}`],onCommit:D=>y(S,N.key,D),onReset:()=>x(S,N.key)},N.key))})]},S)})]})}function kxe({row:e,status:t,error:r,onCommit:n,onReset:i}){const[a,o]=G.useState(bS(e));G.useEffect(()=>{o(bS(e))},[e.value,e.type]);const s=a!==bS(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=Lxe(a,e.type);c.error||c.changed(e.value)&&n(c.value)};return v.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),v.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&v.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),v.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?v.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?v.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:a,onChange:c=>o(c.target.value),onBlur:u}):v.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-[#0d0d0d] border border-border px-2 py-1 text-sm text-white",value:a,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),v.jsx(t7,{status:t,error:r,dirty:s}),v.jsx("button",{onClick:i,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:v.jsx(Jx,{className:"w-4 h-4"})})]})]})}function t7({status:e,error:t,dirty:r}){return e==="saving"?v.jsx(Dp,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?v.jsx(Za,{className:"w-4 h-4 text-green-500"}):e==="error"?v.jsx("span",{title:t,className:"text-red-400 cursor-help",children:v.jsx(Vo,{className:"w-4 h-4"})}):r?v.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):v.jsx("span",{className:"w-4 h-4"})}function bS(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function Lxe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const wS={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function Nxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(wS),[c,h]=G.useState(!1),[f,d]=G.useState("unknown"),g=G.useCallback(async()=>{n(!0),a(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){a(String(S))}finally{n(!1)}},[]);G.useEffect(()=>{g()},[g]),G.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var T;return d(((T=S==null?void 0:S.usgs)==null?void 0:T.feed_source)||"unknown")}).catch(()=>d("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...wS})},x=()=>{s(null),h(!1),u(wS)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const T=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!T.ok){alert(`delete failed: ${T.status}`);return}g()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Yx,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),v.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add site"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(S=>o===S.site_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:9,className:"px-3 py-2",children:v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),v.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),v.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function I3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i,feedSource:a}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=G.useState(!1),[u,c]=G.useState(null),h=a!=="native"||!e.site_id.trim(),f=a!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",d=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a] rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",v.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[v.jsx("input",{className:"flex-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!i}),v.jsxs("button",{type:"button",onClick:d,disabled:h||s,title:f,className:"px-2 py-1 bg-slate-700 hover:bg-slate-600 disabled:opacity-30 disabled:cursor-not-allowed rounded text-xs text-slate-100 flex items-center gap-1",children:[s?v.jsx(Dp,{className:"w-3 h-3 animate-spin"}):v.jsx(e_,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&v.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}const SS={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function Pxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(!1),[c,h]=G.useState(SS),f=G.useCallback(async()=>{n(!0),a(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){a(String(_))}finally{n(!1)}},[]);G.useEffect(()=>{f()},[f]);const d=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...SS})},m=()=>{s(null),u(!1),h(SS)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const T=await S.json().catch(()=>({}));alert(`save failed: ${T.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nf,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),v.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add town"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(_=>o===_.anchor_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:6,className:"px-3 py-2",children:v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>d(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function D3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i}){const a=(o,s)=>t({...e,[o]:s});return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a] rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.name,onChange:o=>a("name",o.target.value),disabled:!i})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["State",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>a("state",o.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>a("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:o=>a("lat",parseFloat(o.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:o=>a("lon",parseFloat(o.target.value))})]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}function Ixe(){return v.jsx(cY,{children:v.jsx(pY,{children:v.jsxs(b$,{children:[v.jsx($i,{path:"/",element:v.jsx(CY,{})}),v.jsx($i,{path:"/mesh",element:v.jsx(V0e,{})}),v.jsx($i,{path:"/environment",element:v.jsx(hxe,{})}),v.jsx($i,{path:"/config",element:v.jsx(sxe,{})}),v.jsx($i,{path:"/alerts",element:v.jsx(xxe,{})}),v.jsx($i,{path:"/notifications",element:v.jsx(Cxe,{})}),v.jsx($i,{path:"/reference",element:v.jsx(Txe,{})}),v.jsx($i,{path:"/adapter-config",element:v.jsx(Axe,{})}),v.jsx($i,{path:"/gauge-sites",element:v.jsx(Nxe,{})}),v.jsx($i,{path:"/town-anchors",element:v.jsx(Pxe,{})})]})})})}CS.createRoot(document.getElementById("root")).render(v.jsx(Ch.StrictMode,{children:v.jsx(k$,{children:v.jsx(Ixe,{})})})); + */(function(e,t){(function(r,n){n(t)})(nU,function(r){var n="1.9.4";function i(p){var b,C,k,E;for(C=1,k=arguments.length;C"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(p){return this.clone()._add(U(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract(U(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new z(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new z(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Z(this.x),this.y=Z(this.y),this},distanceTo:function(p){p=U(p);var b=p.x-this.x,C=p.y-this.y;return Math.sqrt(b*b+C*C)},equals:function(p){return p=U(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=U(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+f(this.x)+", "+f(this.y)+")"}};function U(p,b,C){return p instanceof z?p:w(p)?new z(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new z(p.x,p.y):new z(p,b,C)}function $(p,b){if(p)for(var C=b?[p,b]:p,k=0,E=C.length;k=this.min.x&&C.x<=this.max.x&&b.y>=this.min.y&&C.y<=this.max.y},intersects:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>=b.x&&k.x<=C.x,X=E.y>=b.y&&k.y<=C.y;return B&&X},overlaps:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>b.x&&k.xb.y&&k.y=b.lat&&E.lat<=C.lat&&k.lng>=b.lng&&E.lng<=C.lng},intersects:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>=b.lat&&k.lat<=C.lat,X=E.lng>=b.lng&&k.lng<=C.lng;return B&&X},overlaps:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>b.lat&&k.latb.lng&&k.lng1,gl=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),ee=function(){return!!document.createElement("canvas").getContext}(),xt=!!(document.createElementNS&&et("svg").createSVGRect),pt=!!xt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),dt=!xt&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),ur=navigator.platform.indexOf("Mac")===0,oo=navigator.platform.indexOf("Linux")===0;function rn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var Be={ie:lr,ielt9:Mr,edge:Gn,webkit:Wn,android:io,android23:Af,androidStock:ig,opera:ac,chrome:ag,gecko:jt,safari:$_,phantom:og,opera12:sg,win:Ue,ie3d:lg,webkit3d:kf,gecko3d:ao,any3d:tn,mobile:pl,mobileWebkit:ug,mobileWebkit3d:cg,msPointer:Lf,pointer:Nf,touch:Ut,touchNative:xe,mobileOpera:Hn,mobileGecko:ui,retina:Gi,passiveEvents:gl,canvas:ee,svg:xt,vml:dt,inlineSvg:pt,mac:ur,linux:oo},Pf=Be.msPointer?"MSPointerDown":"pointerdown",If=Be.msPointer?"MSPointerMove":"pointermove",Df=Be.msPointer?"MSPointerUp":"pointerup",Ef=Be.msPointer?"MSPointerCancel":"pointercancel",oc={touchstart:Pf,touchmove:If,touchend:Df,touchcancel:Ef},jf={touchstart:r7,touchmove:dg,touchend:dg,touchcancel:dg},so={},Rf=!1;function hg(p,b,C){return b==="touchstart"&&Ft(),jf[b]?(C=jf[b].bind(this,C),p.addEventListener(oc[b],C,!1),C):(console.warn("wrong event specified:",b),h)}function Of(p,b,C){if(!oc[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(oc[b],C,!1)}function fg(p){so[p.pointerId]=p}function Bt(p){so[p.pointerId]&&(so[p.pointerId]=p)}function wt(p){delete so[p.pointerId]}function Ft(){Rf||(document.addEventListener(Pf,fg,!0),document.addEventListener(If,Bt,!0),document.addEventListener(Df,wt,!0),document.addEventListener(Ef,wt,!0),Rf=!0)}function dg(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var C in so)b.touches.push(so[C]);b.changedTouches=[b],p(b)}}function r7(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&Hr(b),dg(p,b)}function n7(p){var b={},C,k;for(k in p)C=p[k],b[k]=C&&C.bind?C.bind(p):C;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var i7=200;function a7(p,b){p.addEventListener("dblclick",b);var C=0,k;function E(B){if(B.detail!==1){k=B.detail;return}if(!(B.pointerType==="mouse"||B.sourceCapabilities&&!B.sourceCapabilities.firesTouchEvents)){var X=EL(B);if(!(X.some(function(ne){return ne instanceof HTMLLabelElement&&ne.attributes.for})&&!X.some(function(ne){return ne instanceof HTMLInputElement||ne instanceof HTMLSelectElement}))){var J=Date.now();J-C<=i7?(k++,k===2&&b(n7(B))):k=1,C=J}}}return p.addEventListener("click",E),{dblclick:b,simDblclick:E}}function o7(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Y_=gg(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),zf=gg(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),NL=zf==="webkitTransition"||zf==="OTransition"?zf+"End":"transitionend";function PL(p){return typeof p=="string"?document.getElementById(p):p}function Bf(p,b){var C=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!C||C==="auto")&&document.defaultView){var k=document.defaultView.getComputedStyle(p,null);C=k?k[b]:null}return C==="auto"?null:C}function St(p,b,C){var k=document.createElement(p);return k.className=b||"",C&&C.appendChild(k),k}function Zt(p){var b=p.parentNode;b&&b.removeChild(p)}function vg(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function sc(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function lc(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function X_(p,b){if(p.classList!==void 0)return p.classList.contains(b);var C=pg(p);return C.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(C)}function at(p,b){if(p.classList!==void 0)for(var C=g(b),k=0,E=C.length;k0?2*window.devicePixelRatio:1;function RL(p){return Be.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/u7:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function s1(p,b){var C=b.relatedTarget;if(!C)return!0;try{for(;C&&C!==p;)C=C.parentNode}catch{return!1}return C!==p}var c7={__proto__:null,on:nt,off:Rt,stopPropagation:xl,disableScrollPropagation:o1,disableClickPropagation:Wf,preventDefault:Hr,stop:_l,getPropagationPath:EL,getMousePosition:jL,getWheelDelta:RL,isExternalTarget:s1,addListener:nt,removeListener:Rt},OL=V.extend({run:function(p,b,C,k){this.stop(),this._el=p,this._inProgress=!0,this._duration=C||.25,this._easeOutPower=1/Math.max(k||.5,.2),this._startPos=yl(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,C=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var C=this.getCenter(),k=this._limitCenter(C,this._zoom,ie(p));return C.equals(k)||this.panTo(k,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var C=U(b.paddingTopLeft||b.padding||[0,0]),k=U(b.paddingBottomRight||b.padding||[0,0]),E=this.project(this.getCenter()),B=this.project(p),X=this.getPixelBounds(),J=Y([X.min.add(C),X.max.subtract(k)]),ne=J.getSize();if(!J.contains(B)){this._enforcingBounds=!0;var ue=B.subtract(J.getCenter()),Ie=J.extend(B).getSize().subtract(ne);E.x+=ue.x<0?-Ie.x:Ie.x,E.y+=ue.y<0?-Ie.y:Ie.y,this.panTo(this.unproject(E),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=i({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var C=this.getSize(),k=b.divideBy(2).round(),E=C.divideBy(2).round(),B=k.subtract(E);return!B.x&&!B.y?this:(p.animate&&p.pan?this.panBy(B):(p.pan&&this._rawPanBy(B),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:C}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=i({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),C=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,C,p):navigator.geolocation.getCurrentPosition(b,C,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,C=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+C+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,C=p.coords.longitude,k=new se(b,C),E=k.toBounds(p.coords.accuracy*2),B=this._locateOptions;if(B.setView){var X=this.getBoundsZoom(E);this.setView(k,B.maxZoom?Math.min(X,B.maxZoom):X)}var J={latlng:k,bounds:E,timestamp:p.timestamp};for(var ne in p.coords)typeof p.coords[ne]=="number"&&(J[ne]=p.coords[ne]);this.fire("locationfound",J)}},addHandler:function(p,b){if(!b)return this;var C=this[p]=new b(this);return this._handlers.push(C),this.options[p]&&C.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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Zt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)Zt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var C="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),k=St("div",C,b||this._mapPane);return p&&(this._panes[p]=k),k},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),C=this.unproject(p.getTopRight());return new te(b,C)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,C){p=ie(p),C=U(C||[0,0]);var k=this.getZoom()||0,E=this.getMinZoom(),B=this.getMaxZoom(),X=p.getNorthWest(),J=p.getSouthEast(),ne=this.getSize().subtract(C),ue=Y(this.project(J,k),this.project(X,k)).getSize(),Ie=Be.any3d?this.options.zoomSnap:1,Xe=ne.x/ue.x,ut=ne.y/ue.y,pn=b?Math.max(Xe,ut):Math.min(Xe,ut);return k=this.getScaleZoom(pn,k),Ie&&(k=Math.round(k/(Ie/100))*(Ie/100),k=b?Math.ceil(k/Ie)*Ie:Math.floor(k/Ie)*Ie),Math.max(E,Math.min(B,k))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var C=this._getTopLeftPoint(p,b);return new $(C,C.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var C=this.options.crs;return b=b===void 0?this._zoom:b,C.scale(p)/C.scale(b)},getScaleZoom:function(p,b){var C=this.options.crs;b=b===void 0?this._zoom:b;var k=C.zoom(p*C.scale(b));return isNaN(k)?1/0:k},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(le(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng(U(p),b)},layerPointToLatLng:function(p){var b=U(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(le(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(le(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(ie(p))},distance:function(p,b){return this.options.crs.distance(le(p),le(b))},containerPointToLayerPoint:function(p){return U(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return U(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint(U(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(le(p)))},mouseEventToContainerPoint:function(p){return jL(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=PL(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");nt(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&Be.any3d,at(p,"leaflet-container"+(Be.touch?" leaflet-touch":"")+(Be.retina?" leaflet-retina":"")+(Be.ielt9?" leaflet-oldie":"")+(Be.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=Bf(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),mr(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(at(p.markerPane,"leaflet-zoom-hide"),at(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,C){mr(this._mapPane,new z(0,0));var k=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var E=this._zoom!==b;this._moveStart(E,C)._move(p,b)._moveEnd(E),this.fire("viewreset"),k&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,C,k){b===void 0&&(b=this._zoom);var E=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),k?C&&C.pinch&&this.fire("zoom",C):((E||C&&C.pinch)&&this.fire("zoom",C),this.fire("move",C)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){mr(this._mapPane,this._getMapPanePos().subtract(p))},_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(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Rt:nt;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),Be.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var C=[],k,E=b==="mouseout"||b==="mouseover",B=p.target||p.srcElement,X=!1;B;){if(k=this._targets[l(B)],k&&(b==="click"||b==="preclick")&&this._draggableMoved(k)){X=!0;break}if(k&&k.listens(b,!0)&&(E&&!s1(B,p)||(C.push(k),E))||B===this._container)break;B=B.parentNode}return!C.length&&!X&&!E&&this.listens(b,!0)&&(C=[this]),C},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var C=p.type;C==="mousedown"&&t1(b),this._fireDOMEvent(p,C)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,C){if(p.type==="click"){var k=i({},p);k.type="preclick",this._fireDOMEvent(k,k.type,C)}var E=this._findEventTargets(p,b);if(C){for(var B=[],X=0;X0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),C=this.getMaxZoom(),k=Be.any3d?this.options.zoomSnap:1;return k&&(p=Math.round(p/k)*k),Math.max(b,Math.min(C,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){cr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var C=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(C)?!1:(this.panBy(C,b),!0)},_createAnimProxy:function(){var p=this._proxy=St("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var C=Y_,k=this._proxy.style[C];ml(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),k===this._proxy.style[C]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Zt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();ml(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,C){if(this._animatingZoom)return!0;if(C=C||{},!this._zoomAnimated||C.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var k=this.getZoomScale(b),E=this._getCenterOffset(p)._divideBy(1-1/k);return C.animate!==!0&&!this.getSize().contains(E)?!1:(D(function(){this._moveStart(!0,C.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,C,k){this._mapPane&&(C&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,at(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:k}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&cr(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 h7(p,b){return new mt(p,b)}var Wi=F.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),C=this.getPosition(),k=p._controlCorners[C];return at(b,"leaflet-control"),C.indexOf("bottom")!==-1?k.insertBefore(b,k.firstChild):k.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Zt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),Hf=function(p){return new Wi(p)};mt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",C=this._controlContainer=St("div",b+"control-container",this._container);function k(E,B){var X=b+E+" "+b+B;p[E+B]=St("div",X,C)}k("top","left"),k("top","right"),k("bottom","left"),k("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)Zt(this._controlCorners[p]);Zt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var zL=Wi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,C,k){return C1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),C=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;C&&this._map.fire(C,b)},_createRadioElement:function(p,b){var C='",k=document.createElement("div");return k.innerHTML=C,k.firstChild},_addItem:function(p){var b=document.createElement("label"),C=this._map.hasLayer(p.layer),k;p.overlay?(k=document.createElement("input"),k.type="checkbox",k.className="leaflet-control-layers-selector",k.defaultChecked=C):k=this._createRadioElement("leaflet-base-layers_"+l(this),C),this._layerControlInputs.push(k),k.layerId=l(p.layer),nt(k,"click",this._onInputClick,this);var E=document.createElement("span");E.innerHTML=" "+p.name;var B=document.createElement("span");b.appendChild(B),B.appendChild(k),B.appendChild(E);var X=p.overlay?this._overlaysList:this._baseLayersList;return X.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,C,k=[],E=[];this._handlingClick=!0;for(var B=p.length-1;B>=0;B--)b=p[B],C=this._getLayer(b.layerId).layer,b.checked?k.push(C):b.checked||E.push(C);for(B=0;B=0;E--)b=p[E],C=this._getLayer(b.layerId).layer,b.disabled=C.options.minZoom!==void 0&&kC.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,nt(p,"click",Hr),this.expand();var b=this;setTimeout(function(){Rt(p,"click",Hr),b._preventClick=!1})}}),f7=function(p,b,C){return new zL(p,b,C)},l1=Wi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",C=St("div",b+" leaflet-bar"),k=this.options;return this._zoomInButton=this._createButton(k.zoomInText,k.zoomInTitle,b+"-in",C,this._zoomIn),this._zoomOutButton=this._createButton(k.zoomOutText,k.zoomOutTitle,b+"-out",C,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),C},onRemove:function(p){p.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(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,C,k,E){var B=St("a",C,k);return B.innerHTML=p,B.href="#",B.title=b,B.setAttribute("role","button"),B.setAttribute("aria-label",b),Wf(B),nt(B,"click",_l),nt(B,"click",E,this),nt(B,"click",this._refocusOnMap,this),B},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";cr(this._zoomInButton,b),cr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(at(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(at(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});mt.mergeOptions({zoomControl:!0}),mt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new l1,this.addControl(this.zoomControl))});var d7=function(p){return new l1(p)},BL=Wi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",C=St("div",b),k=this.options;return this._addScales(k,b+"-line",C),p.on(k.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),C},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,C){p.metric&&(this._mScale=St("div",b,C)),p.imperial&&(this._iScale=St("div",b,C))},_update:function(){var p=this._map,b=p.getSize().y/2,C=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(C)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),C=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,C,b/p)},_updateImperial:function(p){var b=p*3.2808399,C,k,E;b>5280?(C=b/5280,k=this._getRoundNum(C),this._updateScale(this._iScale,k+" mi",k/C)):(E=this._getRoundNum(b),this._updateScale(this._iScale,E+" ft",E/b))},_updateScale:function(p,b,C){p.style.width=Math.round(this.options.maxWidth*C)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),C=p/b;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:1,b*C}}),v7=function(p){return new BL(p)},p7='',u1=Wi.extend({options:{position:"bottomright",prefix:''+(Be.inlineSvg?p7+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=St("div","leaflet-control-attribution"),Wf(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var C=[];this.options.prefix&&C.push(this.options.prefix),p.length&&C.push(p.join(", ")),this._container.innerHTML=C.join(' ')}}});mt.mergeOptions({attributionControl:!0}),mt.addInitHook(function(){this.options.attributionControl&&new u1().addTo(this)});var g7=function(p){return new u1(p)};Wi.Layers=zL,Wi.Zoom=l1,Wi.Scale=BL,Wi.Attribution=u1,Hf.layers=f7,Hf.zoom=d7,Hf.scale=v7,Hf.attribution=g7;var ma=F.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ma.addTo=function(p,b){return p.addHandler(b,this),this};var m7={Events:W},FL=Be.touch?"touchstart mousedown":"mousedown",es=V.extend({options:{clickTolerance:3},initialize:function(p,b,C,k){m(this,k),this._element=p,this._dragStartTarget=b||p,this._preventOutline=C},enable:function(){this._enabled||(nt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(es._dragging===this&&this.finishDrag(!0),Rt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!X_(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){es._dragging===this&&this.finishDrag();return}if(!(es._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(es._dragging=this,this._preventOutline&&t1(this._element),J_(),Ff(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,C=IL(this._element);this._startPoint=new z(b.clientX,b.clientY),this._startPos=yl(this._element),this._parentScale=r1(C);var k=p.type==="mousedown";nt(document,k?"mousemove":"touchmove",this._onMove,this),nt(document,k?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,C=new z(b.clientX,b.clientY)._subtract(this._startPoint);!C.x&&!C.y||Math.abs(C.x)+Math.abs(C.y)B&&(X=J,B=ne);B>C&&(b[X]=1,h1(p,b,C,k,X),h1(p,b,C,X,E))}function b7(p,b){for(var C=[p[0]],k=1,E=0,B=p.length;kb&&(C.push(p[k]),E=k);return Eb.max.x&&(C|=2),p.yb.max.y&&(C|=8),C}function w7(p,b){var C=b.x-p.x,k=b.y-p.y;return C*C+k*k}function Uf(p,b,C,k){var E=b.x,B=b.y,X=C.x-E,J=C.y-B,ne=X*X+J*J,ue;return ne>0&&(ue=((p.x-E)*X+(p.y-B)*J)/ne,ue>1?(E=C.x,B=C.y):ue>0&&(E+=X*ue,B+=J*ue)),X=p.x-E,J=p.y-B,k?X*X+J*J:new z(E,B)}function hi(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function $L(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),hi(p)}function YL(p,b){var C,k,E,B,X,J,ne,ue;if(!p||p.length===0)throw new Error("latlngs not passed");hi(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var Ie=le([0,0]),Xe=ie(p),ut=Xe.getNorthWest().distanceTo(Xe.getSouthWest())*Xe.getNorthEast().distanceTo(Xe.getNorthWest());ut<1700&&(Ie=c1(p));var pn=p.length,jr=[];for(C=0;Ck){ne=(B-k)/E,ue=[J.x-ne*(J.x-X.x),J.y-ne*(J.y-X.y)];break}var An=b.unproject(U(ue));return le([An.lat+Ie.lat,An.lng+Ie.lng])}var S7={__proto__:null,simplify:WL,pointToSegmentDistance:HL,closestPointOnSegment:x7,clipSegment:ZL,_getEdgeIntersection:xg,_getBitCode:bl,_sqClosestPointOnSegment:Uf,isFlat:hi,_flat:$L,polylineCenter:YL},f1={project:function(p){return new z(p.lng,p.lat)},unproject:function(p){return new se(p.y,p.x)},bounds:new $([-180,-90],[180,90])},d1={R:6378137,R_MINOR:6356752314245179e-9,bounds:new $([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,C=this.R,k=p.lat*b,E=this.R_MINOR/C,B=Math.sqrt(1-E*E),X=B*Math.sin(k),J=Math.tan(Math.PI/4-k/2)/Math.pow((1-X)/(1+X),B/2);return k=-C*Math.log(Math.max(J,1e-10)),new z(p.lng*b*C,k)},unproject:function(p){for(var b=180/Math.PI,C=this.R,k=this.R_MINOR/C,E=Math.sqrt(1-k*k),B=Math.exp(-p.y/C),X=Math.PI/2-2*Math.atan(B),J=0,ne=.1,ue;J<15&&Math.abs(ne)>1e-7;J++)ue=E*Math.sin(X),ue=Math.pow((1-ue)/(1+ue),E/2),ne=Math.PI/2-2*Math.atan(B*ue)-X,X+=ne;return new se(X*b,p.x*b/C)}},C7={__proto__:null,LonLat:f1,Mercator:d1,SphericalMercator:Me},T7=i({},me,{code:"EPSG:3395",projection:d1,transformation:function(){var p=.5/(Math.PI*d1.R);return Te(p,.5,-p,.5)}()}),XL=i({},me,{code:"EPSG:4326",projection:f1,transformation:Te(1/180,1,-1/180,.5)}),M7=i({},Ee,{projection:f1,transformation:Te(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var C=b.lng-p.lng,k=b.lat-p.lat;return Math.sqrt(C*C+k*k)},infinite:!0});Ee.Earth=me,Ee.EPSG3395=T7,Ee.EPSG3857=st,Ee.EPSG900913=ze,Ee.EPSG4326=XL,Ee.Simple=M7;var Hi=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var C=this.getEvents();b.on(C,this),this.once("remove",function(){b.off(C,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});mt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var C in this._layers)p.call(b,this._layers[C]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,C=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof se&&b[0].equals(b[C-1])&&b.pop(),b},_setLatLngs:function(p){uo.prototype._setLatLngs.call(this,p),hi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return hi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,C=new z(b,b);if(p=new $(p.min.subtract(C),p.max.add(C)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var k=0,E=this._rings.length,B;kp.y!=E.y>p.y&&p.x<(E.x-k.x)*(p.y-k.y)/(E.y-k.y)+k.x&&(b=!b);return b||uo.prototype._containsPoint.call(this,p,!0)}});function E7(p,b){return new hc(p,b)}var co=lo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,C,k,E;if(b){for(C=0,k=b.length;C0&&E.push(E[0].slice()),E}function fc(p,b){return p.feature?i({},p.feature,{geometry:b}):Tg(b)}function Tg(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var m1={toGeoJSON:function(p){return fc(this,{type:"Point",coordinates:g1(this.getLatLng(),p)})}};_g.include(m1),v1.include(m1),bg.include(m1),uo.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=Cg(this._latlngs,b?1:0,!1,p);return fc(this,{type:(b?"Multi":"")+"LineString",coordinates:C})}}),hc.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=b&&!hi(this._latlngs[0]),k=Cg(this._latlngs,C?2:b?1:0,!0,p);return b||(k=[k]),fc(this,{type:(C?"Multi":"")+"Polygon",coordinates:k})}}),uc.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(C){b.push(C.toGeoJSON(p).geometry.coordinates)}),fc(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var C=b==="GeometryCollection",k=[];return this.eachLayer(function(E){if(E.toGeoJSON){var B=E.toGeoJSON(p);if(C)k.push(B.geometry);else{var X=Tg(B);X.type==="FeatureCollection"?k.push.apply(k,X.features):k.push(X)}}}),C?fc(this,{geometries:k,type:"GeometryCollection"}):{type:"FeatureCollection",features:k}}});function JL(p,b){return new co(p,b)}var j7=JL,Mg=Hi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,C){this._url=p,this._bounds=ie(b),m(this,C)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(at(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Zt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&sc(this._image),this},bringToBack:function(){return this._map&&lc(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=ie(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:St("img");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),C=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;ml(this._image,C,b)},_reset:function(){var p=this._image,b=new $(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),C=b.getSize();mr(p,b.min),p.style.width=C.x+"px",p.style.height=C.y+"px"},_updateOpacity:function(){ci(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),R7=function(p,b,C){return new Mg(p,b,C)},QL=Mg.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:St("video");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var C=b.getElementsByTagName("source"),k=[],E=0;E0?k:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var B=0;BE?(b.height=E+"px",at(p,B)):cr(p,B),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),C=this._getAnchor();mr(this._container,b.add(C))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(Bf(this._container,"marginBottom"),10)||0,C=this._container.offsetHeight+b,k=this._containerWidth,E=new z(this._containerLeft,-C-this._containerBottom);E._add(yl(this._container));var B=p.layerPointToContainerPoint(E),X=U(this.options.autoPanPadding),J=U(this.options.autoPanPaddingTopLeft||X),ne=U(this.options.autoPanPaddingBottomRight||X),ue=p.getSize(),Ie=0,Xe=0;B.x+k+ne.x>ue.x&&(Ie=B.x+k-ue.x+ne.x),B.x-Ie-J.x<0&&(Ie=B.x-J.x),B.y+C+ne.y>ue.y&&(Xe=B.y+C-ue.y+ne.y),B.y-Xe-J.y<0&&(Xe=B.y-J.y),(Ie||Xe)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([Ie,Xe]))}},_getAnchor:function(){return U(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),B7=function(p,b){return new Ag(p,b)};mt.mergeOptions({closePopupOnClick:!0}),mt.include({openPopup:function(p,b,C){return this._initOverlay(Ag,p,b,C).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Hi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Ag,this._popup,p,b),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(p){return this._popup&&(this instanceof lo||(this._popup._source=this),this._popup._prepareOpen(p||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():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){_l(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ts)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var kg=ya.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){ya.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){ya.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=ya.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=St("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,C,k=this._map,E=this._container,B=k.latLngToContainerPoint(k.getCenter()),X=k.layerPointToContainerPoint(p),J=this.options.direction,ne=E.offsetWidth,ue=E.offsetHeight,Ie=U(this.options.offset),Xe=this._getAnchor();J==="top"?(b=ne/2,C=ue):J==="bottom"?(b=ne/2,C=0):J==="center"?(b=ne/2,C=ue/2):J==="right"?(b=0,C=ue/2):J==="left"?(b=ne,C=ue/2):X.xthis.options.maxZoom||Ck?this._retainParent(E,B,X,k):!1)},_retainChildren:function(p,b,C,k){for(var E=2*p;E<2*p+2;E++)for(var B=2*b;B<2*b+2;B++){var X=new z(E,B);X.z=C+1;var J=this._tileCoordsToKey(X),ne=this._tiles[J];if(ne&&ne.active){ne.retain=!0;continue}else ne&&ne.loaded&&(ne.retain=!0);C+1this.options.maxZoom||this.options.minZoom!==void 0&&E1){this._setView(p,C);return}for(var Xe=E.min.y;Xe<=E.max.y;Xe++)for(var ut=E.min.x;ut<=E.max.x;ut++){var pn=new z(ut,Xe);if(pn.z=this._tileZoom,!!this._isValidTile(pn)){var jr=this._tiles[this._tileCoordsToKey(pn)];jr?jr.current=!0:X.push(pn)}}if(X.sort(function(An,vc){return An.distanceTo(B)-vc.distanceTo(B)}),X.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var fi=document.createDocumentFragment();for(ut=0;utC.max.x)||!b.wrapLat&&(p.yC.max.y))return!1}if(!this.options.bounds)return!0;var k=this._tileCoordsToBounds(p);return ie(this.options.bounds).overlaps(k)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,C=this.getTileSize(),k=p.scaleBy(C),E=k.add(C),B=b.unproject(k,p.z),X=b.unproject(E,p.z);return[B,X]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),C=new te(b[0],b[1]);return this.options.noWrap||(C=this._map.wrapLatLngBounds(C)),C},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),C=new z(+b[0],+b[1]);return C.z=+b[2],C},_removeTile:function(p){var b=this._tiles[p];b&&(Zt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){at(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,Be.ielt9&&this.options.opacity<1&&ci(p,this.options.opacity)},_addTile:function(p,b){var C=this._getTilePos(p),k=this._tileCoordsToKey(p),E=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(E),this.createTile.length<2&&D(o(this._tileReady,this,p,null,E)),mr(E,C),this._tiles[k]={el:E,coords:p,current:!0},b.appendChild(E),this.fire("tileloadstart",{tile:E,coords:p})},_tileReady:function(p,b,C){b&&this.fire("tileerror",{error:b,tile:C,coords:p});var k=this._tileCoordsToKey(p);C=this._tiles[k],C&&(C.loaded=+new Date,this._map._fadeAnimated?(ci(C.el,0),O(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(C.active=!0,this._pruneTiles()),b||(at(C.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:C.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Be.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new z(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new $(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function G7(p){return new $f(p)}var dc=$f.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&Be.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var C=document.createElement("img");return nt(C,"load",o(this._tileOnLoad,this,b,C)),nt(C,"error",o(this._tileOnError,this,b,C)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(C.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(C.referrerPolicy=this.options.referrerPolicy),C.alt="",C.src=this.getTileUrl(p),C},getTileUrl:function(p){var b={r:Be.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var C=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=C),b["-y"]=C}return _(this._url,i(b,this.options))},_tileOnLoad:function(p,b){Be.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,C){var k=this.options.errorTileUrl;k&&b.getAttribute("src")!==k&&(b.src=k),p(C,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,C=this.options.zoomReverse,k=this.options.zoomOffset;return C&&(p=b-p),p+k},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=T;var C=this._tiles[p].coords;Zt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:C})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",T),$f.prototype._removeTile.call(this,p)},_tileReady:function(p,b,C){if(!(!this._map||C&&C.getAttribute("src")===T))return $f.prototype._tileReady.call(this,p,b,C)}});function rN(p,b){return new dc(p,b)}var nN=dc.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var C=i({},this.defaultWmsParams);for(var k in b)k in this.options||(C[k]=b[k]);b=m(this,b);var E=b.detectRetina&&Be.retina?2:1,B=this.getTileSize();C.width=B.x*E,C.height=B.y*E,this.wmsParams=C},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,dc.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),C=this._crs,k=Y(C.project(b[0]),C.project(b[1])),E=k.min,B=k.max,X=(this._wmsVersion>=1.3&&this._crs===XL?[E.y,E.x,B.y,B.x]:[E.x,E.y,B.x,B.y]).join(","),J=dc.prototype.getTileUrl.call(this,p);return J+y(this.wmsParams,J,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+X},setParams:function(p,b){return i(this.wmsParams,p),b||this.redraw(),this}});function W7(p,b){return new nN(p,b)}dc.WMS=nN,rN.wms=W7;var ho=Hi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),at(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var C=this._map.getZoomScale(b,this._zoom),k=this._map.getSize().multiplyBy(.5+this.options.padding),E=this._map.project(this._center,b),B=k.multiplyBy(-C).add(E).subtract(this._map._getNewPixelOrigin(p,b));Be.any3d?ml(this._container,B,C):mr(this._container,B)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),C=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new $(C,C.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iN=ho.extend({options:{tolerance:0},getEvents:function(){var p=ho.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ho.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");nt(p,"mousemove",this._onMouseMove,this),nt(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,Zt(this._container),Rt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=this._container,C=p.getSize(),k=Be.retina?2:1;mr(b,p.min),b.width=k*C.x,b.height=k*C.y,b.style.width=C.x+"px",b.style.height=C.y+"px",Be.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){ho.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,C=b.next,k=b.prev;C?C.prev=k:this._drawLast=k,k?k.next=C:this._drawFirst=C,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),C=[],k,E;for(E=0;E')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),H7={_initContainer:function(){this._container=St("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ho.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Yf("shape");at(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Yf("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;Zt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,C=p._fill,k=p.options,E=p._container;E.stroked=!!k.stroke,E.filled=!!k.fill,k.stroke?(b||(b=p._stroke=Yf("stroke")),E.appendChild(b),b.weight=k.weight+"px",b.color=k.color,b.opacity=k.opacity,k.dashArray?b.dashStyle=w(k.dashArray)?k.dashArray.join(" "):k.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=k.lineCap.replace("butt","flat"),b.joinstyle=k.lineJoin):b&&(E.removeChild(b),p._stroke=null),k.fill?(C||(C=p._fill=Yf("fill")),E.appendChild(C),C.color=k.fillColor||k.color,C.opacity=k.fillOpacity):C&&(E.removeChild(C),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),C=Math.round(p._radius),k=Math.round(p._radiusY||C);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+C+","+k+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){sc(p._container)},_bringToBack:function(p){lc(p._container)}},Lg=Be.vml?Yf:et,Xf=ho.extend({_initContainer:function(){this._container=Lg("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Lg("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Zt(this._container),Rt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=p.getSize(),C=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,C.setAttribute("width",b.x),C.setAttribute("height",b.y)),mr(C,p.min),C.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Lg("path");p.options.className&&at(b,p.options.className),p.options.interactive&&at(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){Zt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,C=p.options;b&&(C.stroke?(b.setAttribute("stroke",C.color),b.setAttribute("stroke-opacity",C.opacity),b.setAttribute("stroke-width",C.weight),b.setAttribute("stroke-linecap",C.lineCap),b.setAttribute("stroke-linejoin",C.lineJoin),C.dashArray?b.setAttribute("stroke-dasharray",C.dashArray):b.removeAttribute("stroke-dasharray"),C.dashOffset?b.setAttribute("stroke-dashoffset",C.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),C.fill?(b.setAttribute("fill",C.fillColor||C.color),b.setAttribute("fill-opacity",C.fillOpacity),b.setAttribute("fill-rule",C.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,lt(p._parts,b))},_updateCircle:function(p){var b=p._point,C=Math.max(Math.round(p._radius),1),k=Math.max(Math.round(p._radiusY),1)||C,E="a"+C+","+k+" 0 1,0 ",B=p._empty()?"M0 0":"M"+(b.x-C)+","+b.y+E+C*2+",0 "+E+-C*2+",0 ";this._setPath(p,B)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){sc(p._path)},_bringToBack:function(p){lc(p._path)}});Be.vml&&Xf.include(H7);function oN(p){return Be.svg||Be.vml?new Xf(p):null}mt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&aN(p)||oN(p)}});var sN=hc.extend({initialize:function(p,b){hc.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=ie(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function U7(p,b){return new sN(p,b)}Xf.create=Lg,Xf.pointsToPath=lt,co.geometryToLayer=wg,co.coordsToLatLng=p1,co.coordsToLatLngs=Sg,co.latLngToCoords=g1,co.latLngsToCoords=Cg,co.getFeature=fc,co.asFeature=Tg,mt.mergeOptions({boxZoom:!0});var lN=ma.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Rt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Zt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Ff(),J_(),this._startPoint=this._map.mouseEventToContainerPoint(p),nt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=St("div","leaflet-zoom-box",this._container),at(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new $(this._point,this._startPoint),C=b.getSize();mr(this._box,b.min),this._box.style.width=C.x+"px",this._box.style.height=C.y+"px"},_finish:function(){this._moved&&(Zt(this._box),cr(this._container,"leaflet-crosshair")),Vf(),Q_(),Rt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new te(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});mt.addInitHook("addHandler","boxZoom",lN),mt.mergeOptions({doubleClickZoom:!0});var uN=ma.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,C=b.getZoom(),k=b.options.zoomDelta,E=p.originalEvent.shiftKey?C-k:C+k;b.options.doubleClickZoom==="center"?b.setZoom(E):b.setZoomAround(p.containerPoint,E)}});mt.addInitHook("addHandler","doubleClickZoom",uN),mt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var cN=ma.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new es(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}at(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){cr(this._map._container,"leaflet-grab"),cr(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 p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=ie(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,C=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(C),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),C=this._initialWorldOffset,k=this._draggable._newPos.x,E=(k-b+C)%p+b-C,B=(k+b+C)%p-b-C,X=Math.abs(E+C)0?B:-B))-b;this._delta=0,this._startTime=null,X&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+X):p.setZoomAround(this._lastMousePos,b+X))}});mt.addInitHook("addHandler","scrollWheelZoom",fN);var Z7=600;mt.mergeOptions({tapHold:Be.touchNative&&Be.safari&&Be.mobile,tapTolerance:15});var dN=ma.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Rt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new z(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",Hr),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),Z7),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Rt(document,"touchend",Hr),Rt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Rt(document,"touchend touchcancel contextmenu",this._cancel,this),Rt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new z(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var C=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});C._simulated=!0,b.target.dispatchEvent(C)}});mt.addInitHook("addHandler","tapHold",dN),mt.mergeOptions({touchZoom:Be.touch,bounceAtZoomLimits:!0});var vN=ma.extend({addHooks:function(){at(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){cr(this._map._container,"leaflet-touch-zoom"),Rt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(C.add(k)._divideBy(2))),this._startDist=C.distanceTo(k),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),Hr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]),E=C.distanceTo(k)/this._startDist;if(this._zoom=b.getScaleZoom(E,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&E>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,E===1)return}else{var B=C._add(k)._divideBy(2)._subtract(this._centerPoint);if(E===1&&B.x===0&&B.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(B),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var X=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(X,this,!0),Hr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Rt(document,"touchmove",this._onTouchMove,this),Rt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});mt.addInitHook("addHandler","touchZoom",vN),mt.BoxZoom=lN,mt.DoubleClickZoom=uN,mt.Drag=cN,mt.Keyboard=hN,mt.ScrollWheelZoom=fN,mt.TapHold=dN,mt.TouchZoom=vN,r.Bounds=$,r.Browser=Be,r.CRS=Ee,r.Canvas=iN,r.Circle=v1,r.CircleMarker=bg,r.Class=F,r.Control=Wi,r.DivIcon=tN,r.DivOverlay=ya,r.DomEvent=c7,r.DomUtil=l7,r.Draggable=es,r.Evented=V,r.FeatureGroup=lo,r.GeoJSON=co,r.GridLayer=$f,r.Handler=ma,r.Icon=cc,r.ImageOverlay=Mg,r.LatLng=se,r.LatLngBounds=te,r.Layer=Hi,r.LayerGroup=uc,r.LineUtil=S7,r.Map=mt,r.Marker=_g,r.Mixin=m7,r.Path=ts,r.Point=z,r.PolyUtil=y7,r.Polygon=hc,r.Polyline=uo,r.Popup=Ag,r.PosAnimation=OL,r.Projection=C7,r.Rectangle=sN,r.Renderer=ho,r.SVG=Xf,r.SVGOverlay=eN,r.TileLayer=dc,r.Tooltip=kg,r.Transformation=pe,r.Util=R,r.VideoOverlay=QL,r.bind=o,r.bounds=Y,r.canvas=aN,r.circle=I7,r.circleMarker=P7,r.control=Hf,r.divIcon=V7,r.extend=i,r.featureGroup=k7,r.geoJSON=JL,r.geoJson=j7,r.gridLayer=G7,r.icon=L7,r.imageOverlay=R7,r.latLng=le,r.latLngBounds=ie,r.layerGroup=A7,r.map=h7,r.marker=N7,r.point=U,r.polygon=E7,r.polyline=D7,r.popup=B7,r.rectangle=U7,r.setOptions=m,r.stamp=l,r.svg=oN,r.svgOverlay=z7,r.tileLayer=rN,r.tooltip=F7,r.transformation=Te,r.version=n,r.videoOverlay=O7;var $7=window.L;r.noConflict=function(){return window.L=$7,this},window.L=r})})(E2,E2.exports);var ic=E2.exports;const Y8=R2(ic);function rg(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function AL(e,t){return t==null?function(n,i){const a=G.useRef();return a.current||(a.current=e(n,i)),a}:function(n,i){const a=G.useRef();a.current||(a.current=e(n,i));const o=G.useRef(n),{instance:s}=a.current;return G.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,i]),a}}function X8(e,t){G.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function s0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return H8(n.map,r.attribution),ML(i.current,r.eventHandlers),X8(i.current,n),i}}function l0e(e,t){const r=G.useRef();G.useEffect(function(){if(t.pathOptions!==r.current){const i=t.pathOptions??{};e.instance.setStyle(i),r.current=i}},[e,t])}function u0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return ML(i.current,r.eventHandlers),X8(i.current,n),l0e(i.current,r),i}}function q8(e,t){const r=AL(e),n=o0e(r,t);return i0e(n)}function K8(e,t){const r=AL(e,t),n=u0e(r);return n0e(n)}function c0e(e,t){const r=AL(e,t),n=s0e(r);return a0e(n)}function h0e(e,t,r){const{opacity:n,zIndex:i}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function f0e(){return U_().map}const d0e=K8(function({center:t,children:r,...n},i){const a=new ic.CircleMarker(t,n);return rg(a,U8(i,{overlayContainer:a}))},e0e);function j2(){return j2=Object.assign||function(e){for(var t=1;t(d==null?void 0:d.map)??null,[d]);const m=G.useCallback(x=>{if(x!==null&&d===null){const _=new ic.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(r0e(_))}},[]);G.useEffect(()=>()=>{d==null||d.map.remove()},[d]);const y=d?Ch.createElement($8,{value:d},n):o??null;return Ch.createElement("div",j2({},f,{ref:m}),y)}const p0e=G.forwardRef(v0e),g0e=K8(function({positions:t,...r},n){const i=new ic.Polyline(t,r);return rg(i,U8(n,{overlayContainer:i}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),m0e=q8(function(t,r){const n=new ic.Popup(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),i(!0))}function l(u){u.popup===o&&i(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,i,n])}),y0e=c0e(function({url:t,...r},n){const i=new ic.TileLayer(t,Z_(r,n));return rg(i,n)},function(t,r,n){h0e(t,r,n);const{url:i}=r;i!=null&&i!==n.url&&t.setUrl(i)}),x0e=q8(function(t,r){const n=new ic.Tooltip(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),i(!0))},u=c=>{c.tooltip===s&&i(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,i,n])}),_0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",b0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",w0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete Y8.Icon.Default.prototype._getIconUrl;Y8.Icon.Default.mergeOptions({iconUrl:_0e,iconRetinaUrl:b0e,shadowUrl:w0e});const w3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],S0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C0e(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function T0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function M0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function A0e({bounds:e}){const t=f0e();return G.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function k0e({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return v.jsxs("div",{className:"min-w-[200px]",children:[v.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),v.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[v.jsx("div",{className:"text-slate-500",children:"Role"}),v.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),v.jsx("div",{className:"text-slate-500",children:"Hardware"}),v.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),v.jsx("div",{className:"text-slate-500",children:"Battery"}),v.jsx("div",{className:"text-slate-700",children:r}),v.jsx("div",{className:"text-slate-500",children:"Last Heard"}),v.jsx("div",{className:"text-slate-700",children:M0e(e.last_heard)})]}),t&&v.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"OSM"]})]})]})}function L0e({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),a=e.length-i.length,o=G.useMemo(()=>new Map(i.map(h=>[h.node_num,h])),[i]),s=G.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=G.useMemo(()=>{if(i.length===0)return null;const h=i.map(d=>d.latitude),f=i.map(d=>d.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[i]),u=[43.6,-114.4],c=G.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsxs(p0e,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[v.jsx(y0e,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),v.jsx(A0e,{bounds:l}),s.map((h,f)=>{const d=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return v.jsx(g0e,{positions:[[d.latitude,d.longitude],[g.latitude,g.longitude]],color:C0e(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),i.map(h=>{const f=h.node_num===r,d=c.has(h.node_num),g=r===null||f||d,m=S0e.includes(h.role),y=T0e(h.latitude),x=w3[y%w3.length];return v.jsxs(d0e,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[v.jsx(x0e,{direction:"top",offset:[0,-8],children:v.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),v.jsx(m0e,{children:v.jsx(k0e,{node:h})})]},h.node_num)})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[v.jsx(nf,{size:12}),v.jsxs("span",{children:["Showing ",i.length," of ",e.length," nodes",a>0&&v.jsxs("span",{className:"text-slate-500",children:[" (",a," without coordinates)"]})]})]})]})}const S3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],N0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C3(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function P0e(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function I0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function D0e(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function E0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function j0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function R0e({node:e,edges:t,nodes:r,onSelectNode:n}){const i=G.useMemo(()=>{if(!e)return[];const h=new Map(r.map(d=>[d.node_num,d])),f=[];return t.forEach(d=>{if(d.from_node===e.node_num){const g=h.get(d.to_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}else if(d.to_node===e.node_num){const g=h.get(d.from_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}}),f.sort((d,g)=>g.snr-d.snr)},[e,t,r]);if(!e)return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:v.jsx(Di,{size:24,className:"text-slate-500"})}),v.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const a=N0e.includes(e.role),o=I0e(e.latitude),s=S3[o%S3.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[v.jsxs("div",{className:"p-4 border-b border-border",children:[v.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),v.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),v.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),v.jsx("div",{className:`text-sm font-medium ${a?"text-accent":"text-slate-300"}`,children:e.role})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),v.jsx("div",{className:"text-sm text-slate-300",children:D0e(o)})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),v.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&v.jsx(Dh,{size:12,className:"text-amber-400"}),u]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${j0e(e.last_heard)}`}),v.jsx("span",{className:"text-sm text-slate-300",children:E0e(e.last_heard)})]})]}),v.jsxs("div",{className:"col-span-2",children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),v.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&v.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Ih,{size:10}),"OSM"]})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",i.length,")"]}),i.length>0?v.jsx("div",{className:"divide-y divide-border",children:i.map(h=>v.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:C3(h.snr)},children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),v.jsxs("div",{className:"text-right flex-shrink-0",children:[v.jsxs("div",{className:"text-xs font-mono",style:{color:C3(h.snr)},children:[h.snr.toFixed(1)," dB"]}),v.jsx("div",{className:"text-xs text-slate-500",children:P0e(h.snr)})]})]},h.node.node_num))}):v.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const T3=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function O0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function z0e(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function B0e(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function M3(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function F0e({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,i]=G.useState(""),[a,o]=G.useState("short_name"),[s,l]=G.useState("asc"),[u,c]=G.useState("all"),h=G.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>T3.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||M3(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(a){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,a,s,u]),f=g=>{a===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},d=({field:g})=>a!==g?null:s==="asc"?v.jsx(V$,{size:14,className:"inline ml-1"}):v.jsx(ll,{size:14,className:"inline ml-1"});return v.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[v.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[v.jsxs("div",{className:"relative flex-1 max-w-xs",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>i(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(RM,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>v.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),v.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),v.jsxs("div",{className:"overflow-x-auto",children:[v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[v.jsx("th",{className:"w-8 px-3 py-2"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",v.jsx(d,{field:"short_name"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",v.jsx(d,{field:"role"})]}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[v.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",v.jsx(d,{field:"battery_level"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[v.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",v.jsx(d,{field:"last_heard"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",v.jsx(d,{field:"hardware"})]})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=T3.includes(g.role),y=g.node_num===t;return v.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[v.jsx("td",{className:"px-3 py-2",children:v.jsx("div",{className:`w-2 h-2 rounded-full ${O0e(g.last_heard)}`})}),v.jsxs("td",{className:"px-3 py-2",children:[v.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),v.jsx("td",{className:"px-3 py-2",children:v.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-accent":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:M3(g.latitude)}),v.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:B0e(g)}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:z0e(g.last_heard)}),v.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&v.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&v.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function V0e(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState("topo"),[c,h]=G.useState(!0),[f,d]=G.useState(null);G.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([tY(),rY(),oY()]).then(([y,x,_])=>{t(y),n(x),a(_),h(!1)}).catch(y=>{d(y.message),h(!1)})},[]);const g=G.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=G.useCallback(y=>{s(y)},[]);return c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),v.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[v.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(dB,{size:14}),v.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),v.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(X$,{size:14}),v.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),v.jsxs("div",{className:"flex gap-0",children:[v.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?v.jsx(Qye,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):v.jsx(L0e,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),v.jsx(R0e,{node:g,edges:r,nodes:e,onSelectNode:m})]}),v.jsx(F0e,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function kL({label:e,value:t,onChange:r,helper:n,info:i,roleFilter:a,valueType:o="short_name"}){const[s,l]=G.useState([]),[u,c]=G.useState(!0),[h,f]=G.useState(""),[d,g]=G.useState(!1);G.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=G.useMemo(()=>{let S=s;if(a&&(S=S.filter(T=>a==="ROUTER"||a==="infrastructure"?T.is_infrastructure||T.role==="ROUTER"||T.role==="ROUTER_CLIENT"||T.role==="REPEATER":T.role===a)),h.trim()){const T=h.toLowerCase();S=S.filter(M=>{var A,P,I,N;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(T))||((P=M.long_name)==null?void 0:P.toLowerCase().includes(T))||((I=M.role)==null?void 0:I.toLowerCase().includes(T))||((N=M.node_id_hex)==null?void 0:N.toLowerCase().includes(T))})}return S.sort((T,M)=>(T.short_name||"").localeCompare(M.short_name||""))},[s,h,a]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const T=y(S);return t.includes(T)},_=S=>{const T=y(S);t.includes(T)?r(t.filter(M=>M!==T)):r([...t,T])},w=S=>{const T=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&T.push(`— ${S.long_name}`),S.role&&T.push(`(${S.role})`),T.join(" ")};return!u&&s.length===0?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),v.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(T=>T.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const T=s.find(M=>y(M)===S);return v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[T?T.short_name:S,v.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:v.jsx(ca,{size:14})})]},S)})}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),d&&!u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] shadow-xl",children:m.length===0?v.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>v.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LL(e){const[t,r]=G.useState([]),[n,i]=G.useState(!0);G.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),i(!1)}).catch(()=>{r([]),i(!1)})},[]);const a=f=>{const d=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${d?` (${d})`:""}`};if(!n&&t.length===0)return e.mode==="single"?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const d=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(d)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:d,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),v.jsxs("select",{value:f,onChange:_=>d(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&v.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>v.jsx("option",{value:_.index,children:a(_)},_.index))]}),m&&v.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(d=>d!==f)):s([...o,f].sort((d,g)=>d-g))};return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),v.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>v.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-sm text-slate-200",children:a(f)})]},f.index)),c.length===0&&v.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&v.jsx("p",{className:"text-xs text-slate-600",children:u})]})}const A3=[{key:"bot",label:"Bot",icon:O$},{key:"connection",label:"Connection",icon:t_},{key:"response",label:"Response",icon:OM},{key:"history",label:"History",icon:uB},{key:"memory",label:"Memory",icon:z$},{key:"context",label:"Context",icon:jM},{key:"commands",label:"Commands",icon:gB},{key:"llm",label:"LLM",icon:lB},{key:"weather",label:"Weather",icon:Du},{key:"meshmonitor",label:"MeshMonitor",icon:Di},{key:"knowledge",label:"Knowledge",icon:oB},{key:"mesh_sources",label:"Mesh Sources",icon:hB},{key:"mesh_intelligence",label:"Intelligence",icon:rf},{key:"dashboard",label:"Dashboard",icon:fB}],Fn={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},G0e=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"sub",description:"Subscribe to scheduled reports or alerts"},{name:"unsub",description:"Remove a subscription"},{name:"mysubs",description:"List your active subscriptions"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],W0e=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function eo({info:e,link:t,linkText:r="Learn more"}){const[n,i]=G.useState(!1),a=G.useRef(null);return G.useEffect(()=>{if(!n)return;function o(l){a.current&&!a.current.contains(l.target)&&i(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),v.jsxs("div",{className:"relative inline-block",ref:a,children:[v.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),i(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&v.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:[v.jsx("button",{type:"button",onClick:()=>i(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(ca,{size:12})}),v.jsx("div",{className:"pr-4",children:e}),t&&v.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",v.jsx(Ih,{size:10})]})]})]})}function Vn({text:e}){return v.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function ct({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o="",infoLink:s=""}){const[l,u]=G.useState(!1),c=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(eo,{info:o,link:s})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&v.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function We({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s="",infoLink:l=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(eo,{info:s,link:l})]}),v.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function or({label:e,checked:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Ln({label:e,value:t,onChange:r,options:n,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>v.jsx("option",{value:s.value,children:s.label},s.value))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function H0e({label:e,value:t,onChange:r,rows:n=4,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function ou({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function U0e({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function sn({label:e,description:t,checked:r,onChange:n,threshold:i,onThresholdChange:a,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return v.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("span",{className:"text-sm text-slate-300",children:e}),v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&i!==void 0&&a&&v.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[v.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),v.jsx("input",{type:"number",value:i,onChange:h=>a(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&v.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function Z0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.bot}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),v.jsx(ct,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."})]}),v.jsx(or,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),v.jsx(or,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function $0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.connection}),v.jsx(Ln,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?v.jsx(ct,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),placeholder:"/dev/ttyUSB0",helper:"Device path for your USB radio",info:"Usually /dev/ttyUSB0 on Linux or /dev/ttyACM0. Check with 'ls /dev/tty*' after plugging in your radio."}):v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),v.jsx(We,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]})]})}function Y0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.response}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),v.jsx(We,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),v.jsx(We,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function X0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.history}),v.jsx(ct,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),v.jsx(We,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),v.jsx(or,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),v.jsx(We,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.memory}),v.jsx(or,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),v.jsx(We,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function K0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.context}),v.jsx(or,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Observe Channels",value:e.observe_channels,onChange:r=>t({...e,observe_channels:r}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),v.jsx(kL,{label:"Ignore Nodes",value:e.ignore_nodes,onChange:r=>t({...e,ignore_nodes:r}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Age (sec)",value:e.max_age,onChange:r=>t({...e,max_age:r}),min:0,helper:"Ignore messages older than this"}),v.jsx(We,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})]})]})}function J0e({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(i=>i.toLowerCase())),n=i=>{const a=i.toLowerCase();r.has(a)?t({...e,disabled_commands:e.disabled_commands.filter(o=>o.toLowerCase()!==a)}):t({...e,disabled_commands:[...e.disabled_commands,i]})};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.commands}),v.jsx(or,{label:"Enable Commands",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Allow !commands on the mesh"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Command Prefix",value:e.prefix,onChange:i=>t({...e,prefix:i}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",v.jsx(eo,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),v.jsx("div",{className:"grid gap-1",children:G0e.map(i=>{const a=!r.has(i.name.toLowerCase());return v.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("code",{className:"text-accent text-sm",children:["!",i.name]}),v.jsx("span",{className:"text-xs text-slate-500",children:i.description})]}),v.jsx("button",{type:"button",onClick:()=>n(i.name),className:`relative w-9 h-5 rounded-full transition-colors ${a?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${a?"translate-x-4":""}`})})]},i.name)})})]})]})]})}function Q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.llm}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),v.jsx(ct,{label:"Model",value:e.model,onChange:r=>t({...e,model:r}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),v.jsx(ct,{label:"API Key",value:e.api_key,onChange:r=>t({...e,api_key:r}),type:"password",helper:"Supports ${ENV_VAR} syntax",info:"Your API key from the provider. You can also use ${ENV_VAR} syntax to read from an environment variable instead of storing the key in the config file."}),v.jsx(ct,{label:"Base URL",value:e.base_url,onChange:r=>t({...e,base_url:r}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Timeout (sec)",value:e.timeout,onChange:r=>t({...e,timeout:r}),min:5,max:120,helper:"Maximum seconds to wait for response"}),v.jsx(We,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:r=>t({...e,max_response_tokens:r}),min:100,helper:"Token limit for LLM responses"})]}),v.jsx(or,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:r=>t({...e,use_system_prompt:r}),helper:"Enable custom system instructions"}),e.use_system_prompt&&v.jsx(H0e,{label:"System Prompt",value:e.system_prompt,onChange:r=>t({...e,system_prompt:r}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),v.jsx(or,{label:"Web Search",checked:e.web_search,onChange:r=>t({...e,web_search:r}),helper:"Enable web search tool (Open WebUI feature)"}),v.jsx(or,{label:"Google Grounding",checked:e.google_grounding,onChange:r=>t({...e,google_grounding:r}),helper:"Ground responses in web search (Gemini only)"})]})}function exe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.weather}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),v.jsx(Ln,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),v.jsx(ct,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"})]})}function txe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.meshmonitor}),v.jsx(or,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),v.jsx(or,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function rxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.knowledge}),v.jsx(or,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),v.jsx(We,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),v.jsx(ct,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),v.jsx(We,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),v.jsx(or,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),v.jsx(ct,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),v.jsx(We,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function nxe({source:e,onChange:t,onDelete:r}){const[n,i]=G.useState(!1),a={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>i(!n),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[n?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),v.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),v.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),v.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),n&&v.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),v.jsx(Ln,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:a[e.type]||""})]}),e.type!=="mqtt"&&v.jsx(ct,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&v.jsx(ct,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),v.jsx(We,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),v.jsx(ct,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),v.jsx(ct,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),v.jsx(or,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),v.jsx(or,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function ixe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.mesh_sources}),e.map((n,i)=>v.jsx(nxe,{source:n,onChange:a=>{const o=[...e];o[i]=a,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((a,o)=>o!==i))}},i)),v.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Source"]})]})}function axe({data:e,onChange:t}){const[r,n]=G.useState(null);return v.jsxs("div",{className:"space-y-6",children:[v.jsx(Vn,{text:Fn.mesh_intelligence}),v.jsx(or,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Activate health scoring and alerting"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:i=>t({...e,locality_radius_miles:i}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),v.jsx(We,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:i=>t({...e,offline_threshold_hours:i}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Packet Threshold",value:e.packet_threshold,onChange:i=>t({...e,packet_threshold:i}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),v.jsx(We,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:i=>t({...e,battery_warning_percent:i}),min:1,max:100,helper:"Global battery warning level"})]}),v.jsx(kL,{label:"Critical Nodes",value:e.critical_nodes,onChange:i=>t({...e,critical_nodes:i}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(LL,{label:"Alert Channel",value:e.alert_channel,onChange:i=>t({...e,alert_channel:i}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),v.jsx(We,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:i=>t({...e,alert_cooldown_minutes:i}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",v.jsx(eo,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((i,a)=>v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===a?null:a),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[r===a?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("span",{className:"font-medium text-slate-200",children:i.name||"Unnamed Region"}),v.jsx("span",{className:"text-xs text-slate-500",children:i.local_name})]}),v.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${i.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==a);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),r===a&&v.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:i.name,onChange:o=>{const s=[...e.regions];s[a]={...i,name:o},t({...e,regions:s})}}),v.jsx(ct,{label:"Local Name",value:i.local_name,onChange:o=>{const s=[...e.regions];s[a]={...i,local_name:o},t({...e,regions:s})}})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Latitude",value:i.lat,onChange:o=>{const s=[...e.regions];s[a]={...i,lat:o},t({...e,regions:s})},step:1e-4}),v.jsx(We,{label:"Longitude",value:i.lon,onChange:o=>{const s=[...e.regions];s[a]={...i,lon:o},t({...e,regions:s})},step:1e-4})]}),v.jsx(ct,{label:"Description",value:i.description,onChange:o=>{const s=[...e.regions];s[a]={...i,description:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Aliases",value:i.aliases,onChange:o=>{const s=[...e.regions];s[a]={...i,aliases:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Cities",value:i.cities,onChange:o=>{const s=[...e.regions];s[a]={...i,cities:o},t({...e,regions:s})}})]})]},a)),v.jsxs("button",{onClick:()=>{const i={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,i]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Region"]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",v.jsx(eo,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),v.jsx(sn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_offline:i}})}),v.jsx(sn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:i}})}),v.jsx(sn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:i=>t({...e,alert_rules:{...e.alert_rules,new_router:i}})}),v.jsx(sn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:i}})}),v.jsx(sn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:i}})}),v.jsx(sn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),v.jsx(sn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning:i}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:i}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical:i}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:i}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:i}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:i}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:i}})}),v.jsx(sn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:i=>t({...e,alert_rules:{...e.alert_rules,power_source_change:i}})}),v.jsx(sn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:i=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),v.jsx(sn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:i=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:i}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:i}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),v.jsx(sn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood:i}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:i}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),v.jsx(sn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:i}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),v.jsx(sn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:i}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function oxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.dashboard}),v.jsx(or,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),v.jsx(We,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function sxe(){var I;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState("bot"),[o,s]=G.useState(!0),[l,u]=G.useState(!1),[c,h]=G.useState(null),[f,d]=G.useState(null),[g,m]=G.useState(!1),[y,x]=G.useState(!1),_=G.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error("Failed to fetch config");const D=await N.json();t(D),n(JSON.parse(JSON.stringify(D))),x(!1),h(null)}catch(N){h(N instanceof Error?N.message:"Unknown error")}finally{s(!1)}},[]);G.useEffect(()=>{document.title="Config — MeshAI",_()},[_]),G.useEffect(()=>{e&&r&&x(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const w=async()=>{if(e){u(!0),h(null),d(null);try{const N=e[i],D=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),O=await D.json();if(!D.ok)throw new Error(O.detail||"Save failed");d(`${i} saved successfully`),n(JSON.parse(JSON.stringify(e))),x(!1),O.restart_required&&(m(!0),hY(Array.isArray(O.changed_keys)?O.changed_keys:[])),setTimeout(()=>d(null),3e3)}catch(N){h(N instanceof Error?N.message:"Save failed")}finally{u(!1)}}},S=()=>{r&&(t(JSON.parse(JSON.stringify(r))),x(!1))},T=async()=>{try{await fetch("/api/restart",{method:"POST"}),m(!1),d("Restart initiated")}catch{h("Restart failed")}},M=(N,D)=>{e&&t({...e,[N]:D})};if(o)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const A=()=>{switch(i){case"bot":return v.jsx(Z0e,{data:e.bot,onChange:N=>M("bot",N)});case"connection":return v.jsx($0e,{data:e.connection,onChange:N=>M("connection",N)});case"response":return v.jsx(Y0e,{data:e.response,onChange:N=>M("response",N)});case"history":return v.jsx(X0e,{data:e.history,onChange:N=>M("history",N)});case"memory":return v.jsx(q0e,{data:e.memory,onChange:N=>M("memory",N)});case"context":return v.jsx(K0e,{data:e.context,onChange:N=>M("context",N)});case"commands":return v.jsx(J0e,{data:e.commands,onChange:N=>M("commands",N)});case"llm":return v.jsx(Q0e,{data:e.llm,onChange:N=>M("llm",N)});case"weather":return v.jsx(exe,{data:e.weather,onChange:N=>M("weather",N)});case"meshmonitor":return v.jsx(txe,{data:e.meshmonitor,onChange:N=>M("meshmonitor",N)});case"knowledge":return v.jsx(rxe,{data:e.knowledge,onChange:N=>M("knowledge",N)});case"mesh_sources":return v.jsx(ixe,{data:e.mesh_sources,onChange:N=>M("mesh_sources",N)});case"mesh_intelligence":return v.jsx(axe,{data:e.mesh_intelligence,onChange:N=>M("mesh_intelligence",N)});case"dashboard":return v.jsx(oxe,{data:e.dashboard,onChange:N=>M("dashboard",N)});default:return null}},P=((I=A3.find(N=>N.key===i))==null?void 0:I.label)||i;return v.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[v.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:A3.map(({key:N,label:D,icon:O})=>v.jsxs("button",{onClick:()=>a(N),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===N?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[v.jsx(O,{size:16}),v.jsx("span",{children:D}),y&&i===N&&v.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},N))}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center justify-between mb-6",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(vB,{size:20,className:"text-slate-500"}),v.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:P})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[y&&v.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[v.jsx(Jx,{size:14}),"Discard"]}),v.jsxs("button",{onClick:w,disabled:l||!y,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[l?v.jsx($v,{size:14,className:"animate-spin"}):v.jsx(zM,{size:14}),"Save"]})]})]}),g&&v.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[v.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[v.jsx($a,{size:16}),v.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),v.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),c&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 text-red-400",children:[v.jsx(ca,{size:16}),v.jsx("span",{className:"text-sm",children:c})]}),f&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 text-green-400",children:[v.jsx(Za,{size:16}),v.jsx("span",{className:"text-sm",children:f})]}),v.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:v.jsx("div",{className:"bg-bg-card border border-border p-6",children:A()})})]})]})}function lxe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return v.jsxs("div",{className:"bg-bg-hover p-4",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),v.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),v.jsx("span",{className:"text-xs text-[#777]",children:r})]}),v.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[v.jsxs("div",{children:["Events: ",e.event_count]}),v.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&v.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function uxe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Vo,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:$a,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:qx,color:"text-sky-400"},n=r.Icon;return v.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:16,className:r.color}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),v.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),v.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function J8({value:e,onChange:t,disabled:r,centralDisabled:n}){const i="px-2 py-1 text-xs transition-colors";return v.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[v.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${i} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),v.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${i} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function cxe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:i,onFeedSource:a,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h}){const f=s||!o;return v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&v.jsx("p",{className:"text-xs text-[#666]",children:t})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(J8,{value:i,onChange:a,disabled:!r,centralDisabled:f})]}),v.jsx(or,{label:"",checked:r,onChange:n})]})]}),!l&&v.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key not configured — contact admin"}),s&&v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),v.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&v.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[v.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?v.jsx(lxe,{feed:u}):v.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&v.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((d,g)=>v.jsx(uxe,{event:d},g))})]})]})}const hs={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0}},_S=[{key:"central",label:"Central",icon:K$,adapters:[]},{key:"weather",label:"Weather",icon:Du,adapters:["nws"]},{key:"fire",label:"Fire",icon:Xx,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:Di,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:$x,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:Kx,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:Qx,adapters:[]},{key:"mesh",label:"Mesh Health",icon:rf,adapters:[]}];function hxe(){var Lf,Nf;const[e,t]=G.useState(null),[r,n]=G.useState(""),[i,a]=G.useState(null),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(!1),[_,w]=G.useState("weather"),[S,T]=G.useState("nws"),[M,A]=G.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[P,I]=G.useState(""),[N,D]=G.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[O,R]=G.useState(""),[F,H]=G.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[W,V]=G.useState(""),[z,Z]=G.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[U,$]=G.useState(""),[Y,te]=G.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[ie,se]=G.useState(""),[le,Ee]=G.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[me,ye]=G.useState(""),[Me,pe]=G.useState({min_danger_level:3}),[Te,st]=G.useState(""),[ze,et]=G.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[lt,Et]=G.useState("");G.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var xe,Ut,Hn,ui,Gi,gl,ee,xt,pt,dt,ur,oo,rn,Be,Pf,If,Df,Ef,oc,jf,so,Rf,hg;try{const fg=await(await fetch("/api/config/environmental")).json();t(fg),n(JSON.stringify(fg));try{const Bt=await fetch("/api/adapter-config/wfigs");if(Bt.ok){const wt=await Bt.json(),Ft={allowed_incident_types:((xe=wt.allowed_incident_types)==null?void 0:xe.value)??["WF"],freshness_seconds:((Ut=wt.freshness_seconds)==null?void 0:Ut.value)??0,cooldown_seconds:((Hn=wt.cooldown_seconds)==null?void 0:Hn.value)??28800,broadcast_on_acres:((ui=wt.broadcast_on_acres)==null?void 0:ui.value)??!0,broadcast_on_contained:((Gi=wt.broadcast_on_contained)==null?void 0:Gi.value)??!0};A(Ft),I(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/fires");if(Bt.ok){const wt=await Bt.json(),Ft={digest_enabled:((gl=wt.digest_enabled)==null?void 0:gl.value)??!0,digest_schedule:((ee=wt.digest_schedule)==null?void 0:ee.value)??["06:00","18:00"],digest_timezone:((xt=wt.digest_timezone)==null?void 0:xt.value)??"America/Boise"};D(Ft),R(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/tomtom_incidents");if(Bt.ok){const wt=await Bt.json(),Ft={min_magnitude:((pt=wt.min_magnitude)==null?void 0:pt.value)??4,drop_non_present:((dt=wt.drop_non_present)==null?void 0:dt.value)??!0,drop_zero_magnitude:((ur=wt.drop_zero_magnitude)==null?void 0:ur.value)??!0};H(Ft),V(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/itd_511");if(Bt.ok){const wt=await Bt.json(),Ft={min_severity:((oo=wt.min_severity)==null?void 0:oo.value)??"None",enabled_categories:((rn=wt.enabled_categories)==null?void 0:rn.value)??["incident","closure"],enabled_sub_types:((Be=wt.enabled_sub_types)==null?void 0:Be.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ft),$(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/wzdx");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast:((Pf=wt.broadcast)==null?void 0:Pf.value)??!1,min_severity:((If=wt.min_severity)==null?void 0:If.value)??"Minor",sub_types:((Df=wt.sub_types)==null?void 0:Df.value)??["road_works","lane_closed","road_closed"]};te(Ft),se(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/nws");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast_severities:((Ef=wt.broadcast_severities)==null?void 0:Ef.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((oc=wt.duplicate_allowed_after_seconds)==null?void 0:oc.value)??3600};Ee(Ft),ye(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/avalanche");if(Bt.ok){const Ft={min_danger_level:((jf=(await Bt.json()).min_danger_level)==null?void 0:jf.value)??3};pe(Ft),st(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/swpc");if(Bt.ok){const wt=await Bt.json(),Ft={geomag_kp_floor:((so=wt.geomag_kp_floor)==null?void 0:so.value)??7,flare_class_floor:((Rf=wt.flare_class_floor)==null?void 0:Rf.value)??"X1",proton_pfu_floor:((hg=wt.proton_pfu_floor)==null?void 0:hg.value)??10};et(Ft),Et(JSON.stringify(Ft))}}catch{}}catch(Of){d(Of instanceof Error?Of.message:"Failed to load config")}finally{u(!1)}})()},[]),G.useEffect(()=>{const xe=async()=>{try{a(await xB()),s(await _B())}catch{}};xe();const Ut=setInterval(xe,3e4);return()=>clearInterval(Ut)},[]);const lr=e!==null&&JSON.stringify(e)!==r,Mr=JSON.stringify(M)!==P,Gn=JSON.stringify(N)!==O,Wn=JSON.stringify(F)!==W,io=JSON.stringify(z)!==U,Af=JSON.stringify(Y)!==ie,ng=JSON.stringify(le)!==me,ig=JSON.stringify(Me)!==Te,ac=JSON.stringify(ze)!==lt,ag=lr||Mr||Gn||Wn||io||Af||ng||ig||ac,jt=async(xe,Ut,Hn)=>{const ui=await fetch(`/api/adapter-config/${xe}/${Ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Hn})});if(!ui.ok){const Gi=await ui.json().catch(()=>({}));throw new Error(Gi.detail||`Failed to save ${xe}.${Ut}`)}},$_=async()=>{if(e){h(!0),d(null),m(null);try{if(lr){const xe=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Ut=await xe.json();if(!xe.ok)throw new Error(Ut.detail||"Save failed");n(JSON.stringify(e)),Ut.restart_required&&x(!0)}if(Mr){const xe=JSON.parse(P);M.freshness_seconds!==xe.freshness_seconds&&await jt("wfigs","freshness_seconds",M.freshness_seconds),JSON.stringify(M.allowed_incident_types)!==JSON.stringify(xe.allowed_incident_types)&&await jt("wfigs","allowed_incident_types",M.allowed_incident_types),M.cooldown_seconds!==xe.cooldown_seconds&&await jt("wfigs","cooldown_seconds",M.cooldown_seconds),M.broadcast_on_acres!==xe.broadcast_on_acres&&await jt("wfigs","broadcast_on_acres",M.broadcast_on_acres),M.broadcast_on_contained!==xe.broadcast_on_contained&&await jt("wfigs","broadcast_on_contained",M.broadcast_on_contained),I(JSON.stringify(M))}if(Gn){const xe=JSON.parse(O);N.digest_enabled!==xe.digest_enabled&&await jt("fires","digest_enabled",N.digest_enabled),JSON.stringify(N.digest_schedule)!==JSON.stringify(xe.digest_schedule)&&await jt("fires","digest_schedule",N.digest_schedule),N.digest_timezone!==xe.digest_timezone&&await jt("fires","digest_timezone",N.digest_timezone),R(JSON.stringify(N))}if(Wn){const xe=JSON.parse(W);F.min_magnitude!==xe.min_magnitude&&await jt("tomtom_incidents","min_magnitude",F.min_magnitude),F.drop_non_present!==xe.drop_non_present&&await jt("tomtom_incidents","drop_non_present",F.drop_non_present),F.drop_zero_magnitude!==xe.drop_zero_magnitude&&await jt("tomtom_incidents","drop_zero_magnitude",F.drop_zero_magnitude),V(JSON.stringify(F))}if(io){const xe=JSON.parse(U);z.min_severity!==xe.min_severity&&await jt("itd_511","min_severity",z.min_severity),JSON.stringify(z.enabled_categories)!==JSON.stringify(xe.enabled_categories)&&await jt("itd_511","enabled_categories",z.enabled_categories),JSON.stringify(z.enabled_sub_types)!==JSON.stringify(xe.enabled_sub_types)&&await jt("itd_511","enabled_sub_types",z.enabled_sub_types),$(JSON.stringify(z))}if(Af){const xe=JSON.parse(ie);Y.broadcast!==xe.broadcast&&await jt("wzdx","broadcast",Y.broadcast),Y.min_severity!==xe.min_severity&&await jt("wzdx","min_severity",Y.min_severity),JSON.stringify(Y.sub_types)!==JSON.stringify(xe.sub_types)&&await jt("wzdx","sub_types",Y.sub_types),se(JSON.stringify(Y))}if(ng){const xe=JSON.parse(me);JSON.stringify(le.broadcast_severities)!==JSON.stringify(xe.broadcast_severities)&&await jt("nws","broadcast_severities",le.broadcast_severities),le.duplicate_allowed_after_seconds!==xe.duplicate_allowed_after_seconds&&await jt("nws","duplicate_allowed_after_seconds",le.duplicate_allowed_after_seconds),ye(JSON.stringify(le))}if(ig){const xe=JSON.parse(Te);Me.min_danger_level!==xe.min_danger_level&&await jt("avalanche","min_danger_level",Me.min_danger_level),st(JSON.stringify(Me))}if(ac){const xe=JSON.parse(lt);ze.geomag_kp_floor!==xe.geomag_kp_floor&&await jt("swpc","geomag_kp_floor",ze.geomag_kp_floor),ze.flare_class_floor!==xe.flare_class_floor&&await jt("swpc","flare_class_floor",ze.flare_class_floor),ze.proton_pfu_floor!==xe.proton_pfu_floor&&await jt("swpc","proton_pfu_floor",ze.proton_pfu_floor),Et(JSON.stringify(ze))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(xe){d(xe instanceof Error?xe.message:"Save failed")}finally{h(!1)}}},og=()=>{e&&t(JSON.parse(r)),A(JSON.parse(P||JSON.stringify(M))),D(JSON.parse(O||JSON.stringify(N))),H(JSON.parse(W||JSON.stringify(F))),Z(JSON.parse(U||JSON.stringify(z))),te(JSON.parse(ie||JSON.stringify(Y))),Ee(JSON.parse(me||JSON.stringify(le))),pe(JSON.parse(Te||JSON.stringify(Me))),et(JSON.parse(lt||JSON.stringify(ze)))},sg=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{d("Restart failed")}},Ue=xe=>e&&t({...e,...xe});if(l)return v.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const lg=xe=>i==null?void 0:i.feeds.find(Ut=>Ut.source===hs[xe].health),kf=xe=>o.filter(Ut=>Ut.source===hs[xe].health),ao=_S.find(xe=>xe.key===_),tn=ao.adapters.length===0?null:S&&ao.adapters.includes(S)?S:ao.adapters[0],pl=xe=>{var Ut,Hn,ui,Gi,gl;switch(xe){case"nws":return v.jsxs(v.Fragment,{children:[v.jsx(ou,{label:"NWS Zones",value:e.nws_zones,onChange:ee=>Ue({nws_zones:ee}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),e.nws.feed_source!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"User Agent",value:e.nws.user_agent,onChange:ee=>Ue({nws:{...e.nws,user_agent:ee}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:ee=>Ue({nws:{...e.nws,tick_seconds:ee}}),min:30}),v.jsx(Ln,{label:"Min Severity",value:e.nws.severity_min,onChange:ee=>Ue({nws:{...e.nws,severity_min:ee}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsxs("div",{className:"mb-3",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),v.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:le.broadcast_severities.includes(ee),onChange:xt=>{const pt=le.broadcast_severities;Ee({...le,broadcast_severities:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:ee})]},ee))})]}),v.jsx(We,{label:"Re-broadcast Cooldown (seconds)",value:le.duplicate_allowed_after_seconds,onChange:ee=>Ee({...le,duplicate_allowed_after_seconds:ee}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return v.jsx("div",{className:"space-y-6",children:v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ln,{label:"Geomag Kp Floor",value:String(ze.geomag_kp_floor),onChange:ee=>et({...ze,geomag_kp_floor:Number(ee)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),v.jsx(Ln,{label:"Flare Class Floor",value:ze.flare_class_floor,onChange:ee=>et({...ze,flare_class_floor:ee}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),v.jsx(Ln,{label:"Proton pfu Floor",value:String(ze.proton_pfu_floor),onChange:ee=>et({...ze,proton_pfu_floor:Number(ee)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:ee=>Ue({ducting:{...e.ducting,tick_seconds:ee}}),min:60}),v.jsx(We,{label:"Latitude",value:e.ducting.latitude,onChange:ee=>Ue({ducting:{...e.ducting,latitude:ee}}),step:.01}),v.jsx(We,{label:"Longitude",value:e.ducting.longitude,onChange:ee=>Ue({ducting:{...e.ducting,longitude:ee}}),step:.01})]});case"fires":return v.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:ee=>Ue({fires:{...e.fires,tick_seconds:ee}}),min:60}),v.jsx(Ln,{label:"State",value:e.fires.state,onChange:ee=>Ue({fires:{...e.fires,state:ee}}),options:W0e})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),v.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([ee,xt])=>{var pt;return v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:((pt=M.allowed_incident_types)==null?void 0:pt.includes(ee))??ee==="WF",onChange:dt=>{const ur=M.allowed_incident_types??["WF"];A({...M,allowed_incident_types:dt.target.checked?[...ur,ee]:ur.filter(oo=>oo!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee)})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_acres,onChange:ee=>A({...M,broadcast_on_acres:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_contained,onChange:ee=>A({...M,broadcast_on_contained:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Update Cooldown (hours)",value:Math.round(M.cooldown_seconds/3600),onChange:ee=>A({...M,cooldown_seconds:ee*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),v.jsx(We,{label:"Freshness Window (hours)",value:Math.round(M.freshness_seconds/3600),onChange:ee=>A({...M,freshness_seconds:ee*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return v.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:ee=>Ue({avalanche:{...e.avalanche,tick_seconds:ee}}),min:60}),v.jsx(U0e,{label:"Season Months",value:e.avalanche.season_months,onChange:ee=>Ue({avalanche:{...e.avalanche,season_months:ee}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),v.jsx(ou,{label:"Center IDs",value:e.avalanche.center_ids,onChange:ee=>Ue({avalanche:{...e.avalanche,center_ids:ee}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Ln,{label:"Min Danger Level",value:String(Me.min_danger_level),onChange:ee=>pe({...Me,min_danger_level:Number(ee)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return v.jsxs(v.Fragment,{children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:ee=>Ue({usgs:{...e.usgs,tick_seconds:ee}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),v.jsx(ou,{label:"Site IDs",value:e.usgs.sites,onChange:ee=>Ue({usgs:{...e.usgs,sites:ee}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"})]});case"usgs_quake":return v.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,tick_seconds:ee}}),min:60}),v.jsx(ct,{label:"Region Tag",value:e.usgs_quake.region,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,region:ee}})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,global_mag_floor:ee}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),v.jsx(We,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_mag_floor:ee}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),v.jsx(We,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_radius_mi:ee}}),min:50,helper:"Radius around region centroid for reduced floor"}),v.jsx(We,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,escalate_mag_floor:ee}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),v.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),v.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(ee),onChange:xt=>{const pt=e.usgs_quake.broadcast_pager_alerts??[];Ue({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)}})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:ee})]},ee))})]})]});case"traffic":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"API Key",value:e.traffic.api_key,onChange:ee=>Ue({traffic:{...e.traffic,api_key:ee}}),type:"password",helper:"developer.tomtom.com"}),v.jsx(We,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:ee=>Ue({traffic:{...e.traffic,tick_seconds:ee}}),min:60}),v.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((ee,xt)=>v.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[v.jsx(ct,{label:"Name",value:ee.name,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,name:pt},Ue({traffic:{...e.traffic,corridors:dt}})}}),v.jsx(We,{label:"Lat",value:ee.lat,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lat:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx(We,{label:"Lon",value:ee.lon,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lon:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((pt,dt)=>dt!==xt)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},xt)),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),v.jsxs("select",{value:F.min_magnitude,onChange:ee=>H({...F,min_magnitude:parseInt(ee.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:1,children:"1 — Minor (all)"}),v.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),v.jsx("option",{value:3,children:"3 — Major (orange+)"}),v.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),v.jsxs("div",{className:"mt-3 space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),v.jsx("input",{type:"checkbox",checked:F.drop_non_present,onChange:ee=>H({...F,drop_non_present:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),v.jsx("input",{type:"checkbox",checked:F.drop_zero_magnitude,onChange:ee=>H({...F,drop_zero_magnitude:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:e.roads511.base_url,onChange:ee=>Ue({roads511:{...e.roads511,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:e.roads511.api_key,onChange:ee=>Ue({roads511:{...e.roads511,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:ee=>Ue({roads511:{...e.roads511,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:e.roads511.endpoints,onChange:ee=>Ue({roads511:{...e.roads511,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.roads511.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.roads511.bbox||[0,0,0,0]];ur[xt]=dt,Ue({roads511:{...e.roads511,bbox:ur}})},step:.01},ee)})}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),v.jsxs("select",{value:z.min_severity,onChange:ee=>Z({...z,min_severity:ee.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),v.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_categories.includes(ee),onChange:pt=>{const dt=z.enabled_categories;Z({...z,enabled_categories:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_sub_types.includes(ee),onChange:pt=>{const dt=z.enabled_sub_types;Z({...z,enabled_sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]})]})]});case"wzdx":return v.jsxs(v.Fragment,{children:[((Ut=e.wzdx)==null?void 0:Ut.feed_source)!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:((Hn=e.wzdx)==null?void 0:Hn.base_url)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:((ui=e.wzdx)==null?void 0:ui.api_key)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:((Gi=e.wzdx)==null?void 0:Gi.tick_seconds)??300,onChange:ee=>Ue({wzdx:{...e.wzdx,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:((gl=e.wzdx)==null?void 0:gl.endpoints)??["/get/event"],onChange:ee=>Ue({wzdx:{...e.wzdx,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt,dt;return v.jsx(We,{label:ee,value:((dt=(pt=e.wzdx)==null?void 0:pt.bbox)==null?void 0:dt[xt])??0,onChange:ur=>{var rn;const oo=[...((rn=e.wzdx)==null?void 0:rn.bbox)||[0,0,0,0]];oo[xt]=ur,Ue({wzdx:{...e.wzdx,bbox:oo}})},step:.01},ee)})}),v.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"})]}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),v.jsx("input",{type:"checkbox",checked:Y.broadcast,onChange:ee=>te({...Y,broadcast:ee.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),Y.broadcast?v.jsxs("div",{className:"space-y-3 mt-3",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),v.jsxs("select",{value:Y.min_severity,onChange:ee=>te({...Y,min_severity:ee.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:Y.sub_types.includes(ee),onChange:pt=>{const dt=Y.sub_types;te({...Y,sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:xt})]},ee))})]})]}):v.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"MAP Key",value:e.firms.map_key,onChange:ee=>Ue({firms:{...e.firms,map_key:ee}}),type:"password",helper:"firms.modaps.eosdis.nasa.gov/api/area/",infoLink:"https://firms.modaps.eosdis.nasa.gov/api/area/"}),v.jsx(We,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:ee=>Ue({firms:{...e.firms,tick_seconds:ee}}),min:300}),v.jsx(Ln,{label:"Satellite Source",value:e.firms.source,onChange:ee=>Ue({firms:{...e.firms,source:ee}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Day Range",value:e.firms.day_range,onChange:ee=>Ue({firms:{...e.firms,day_range:ee}}),min:1,max:10}),v.jsx(Ln,{label:"Min Confidence",value:e.firms.confidence_min,onChange:ee=>Ue({firms:{...e.firms,confidence_min:ee}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),v.jsx(We,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:ee=>Ue({firms:{...e.firms,proximity_km:ee}}),step:.5})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.firms.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.firms.bbox||[0,0,0,0]];ur[xt]=dt,Ue({firms:{...e.firms,bbox:ur}})},step:.01},ee)})})]})}},ug=e,cg=(xe,Ut)=>{const Hn=e[xe]||{};Ue({[xe]:{...Hn,...Ut}})};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h1",{className:"text-xl font-semibold text-white",children:"Environment"}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(or,{label:"Feeds Enabled",checked:e.enabled,onChange:xe=>Ue({enabled:xe})}),ag&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:og,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[v.jsx(Jx,{size:14})," Discard"]}),v.jsxs("button",{onClick:$_,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[v.jsx(zM,{size:14})," ",c?"Saving…":"Save"]})]})]})]}),f&&v.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&v.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&v.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx($v,{size:14})," A restart is required for some changes to take effect."]}),v.jsx("button",{onClick:sg,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),v.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:_S.map(({key:xe,label:Ut,icon:Hn})=>v.jsxs("button",{onClick:()=>{w(xe);const ui=_S.find(Gi=>Gi.key===xe);T(ui.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===xe?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[v.jsx(Hn,{size:15})," ",Ut]},xe))}),_==="central"&&e.central&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),v.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),v.jsx(or,{label:"",checked:!!e.central.enabled,onChange:xe=>Ue({central:{...e.central,enabled:xe}})})]}),v.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[v.jsx(ct,{label:"URL",value:e.central.url||"",onChange:xe=>Ue({central:{...e.central,url:xe}}),placeholder:"nats://central.echo6.mesh:4222"}),v.jsx(ct,{label:"Durable",value:e.central.durable||"",onChange:xe=>Ue({central:{...e.central,durable:xe}}),placeholder:"meshai-v04"}),v.jsx(ct,{label:"Region",value:e.central.region||"",onChange:xe=>Ue({central:{...e.central,region:xe}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="tracking"&&v.jsxs("div",{className:"flex flex-col items-center justify-center h-[40vh] text-center",children:[v.jsx(Qx,{size:32,className:"text-[#666] mb-4"}),v.jsx("p",{className:"text-[#666] max-w-md",children:"No adapters yet. ADS-B / AIS / satellite passes are planned for v0.5."})]}),_==="mesh"&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),v.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(J8,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),ao.adapters.length>0&&tn&&v.jsxs(v.Fragment,{children:[ao.adapters.length>1&&v.jsx("div",{className:"flex gap-1",children:ao.adapters.map(xe=>v.jsx("button",{onClick:()=>T(xe),className:`px-3 py-1.5 text-sm ${tn===xe?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:hs[xe].label},xe))}),v.jsx(cxe,{title:hs[tn].label,subtitle:hs[tn].subtitle,enabled:((Lf=ug[tn])==null?void 0:Lf.enabled)??!1,onEnabled:xe=>cg(tn,{enabled:xe}),feedSource:((Nf=ug[tn])==null?void 0:Nf.feed_source)??"native",onFeedSource:xe=>cg(tn,{feed_source:xe}),hasCentral:hs[tn].hasCentral,nativeOnly:hs[tn].nativeOnly,hasKey:hs[tn].hasKey,health:lg(tn),events:kf(tn),children:pl(tn)})]})]})}const k3={infra_offline:mB,infra_recovery:t_,battery_warning:Z1,battery_critical:Z1,battery_emergency:Z1,hf_blackout:Dh,uhf_ducting:Di,weather_warning:Du,weather_watch:Du,new_router:Di,packet_flood:$a,sustained_high_util:$a,region_blackout:Vo,default:Zv};function fxe(e){return k3[e]||k3.default}function Q8(e){switch(e==null?void 0:e.toLowerCase()){case"immediate":return{bg:"bg-red-500/10",border:"border-red-500",badge:"bg-red-500/20 text-red-400",iconColor:"text-red-500"};case"priority":return{bg:"bg-amber-500/10",border:"border-amber-500",badge:"bg-amber-500/20 text-amber-400",iconColor:"text-amber-500"};case"routine":default:return{bg:"bg-[#f59e0b]/10",border:"border-[#f59e0b]",badge:"bg-[#f59e0b]/20 text-[#f59e0b]",iconColor:"text-[#f59e0b]"}}}function dxe(e){const t=typeof e=="number"?new Date(e*1e3):new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24);return i<60?"Just now":a<60?`${a}m ago`:o<24?`${o}h ago`:`${s}d ago`}function vxe(e){return(typeof e=="number"?new Date(e*1e3):new Date(e)).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function pxe(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d`}function gxe({alert:e,onAcknowledge:t}){var i;const r=Q8(e.severity),n=fxe(e.type);return v.jsx("div",{className:`p-4 ${r.bg} border-l-4 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:20,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.badge}`,children:(i=e.severity)==null?void 0:i.toUpperCase()}),v.jsx("span",{className:"text-xs text-slate-500",children:e.type})]}),v.jsx("div",{className:"text-sm text-slate-200",children:e.message}),v.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(Iu,{size:12}),e.timestamp?dxe(e.timestamp):"Just now"]}),e.scope_value&&v.jsxs("span",{children:[e.scope_type,": ",e.scope_value]})]})]}),v.jsx("button",{onClick:()=>t(e),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200 border border-border rounded hover:bg-bg-hover transition-colors",children:"Acknowledge"})]})})}function mxe({history:e,typeFilter:t,severityFilter:r,onTypeFilterChange:n,onSeverityFilterChange:i,page:a,totalPages:o,onPageChange:s}){const l=["all","infra_offline","infra_recovery","battery_warning","battery_critical","hf_blackout","uhf_ducting","weather_warning","new_router","packet_flood"],u=["all","immediate","priority","routine"];return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(RM,{size:14,className:"text-slate-400"}),v.jsx("span",{className:"text-sm text-slate-400",children:"Filter:"})]}),v.jsx("select",{value:t,onChange:c=>n(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:l.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Types":c.replace(/_/g," ")},c))}),v.jsx("select",{value:r,onChange:c=>i(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:u.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Severities":c.charAt(0).toUpperCase()+c.slice(1)},c))})]}),v.jsx("div",{className:"overflow-x-auto",children:v.jsxs("table",{className:"w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"border-b border-border",children:[v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Time"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Type"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Severity"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Message"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Duration"})]})}),v.jsx("tbody",{children:e.length>0?e.map((c,h)=>{const f=Q8(c.severity);return v.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover",children:[v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono whitespace-nowrap",children:vxe(c.timestamp)}),v.jsx("td",{className:"p-4 text-sm text-slate-300",children:c.type.replace(/_/g," ")}),v.jsx("td",{className:"p-4",children:v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f.badge}`,children:c.severity})}),v.jsx("td",{className:"p-4 text-sm text-slate-200 max-w-md truncate",children:c.message}),v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono",children:c.duration?pxe(c.duration):"-"})]},c.id||h)}):v.jsx("tr",{children:v.jsx("td",{colSpan:5,className:"p-8 text-center text-slate-500",children:"No alert history available"})})})]})}),o>1&&v.jsxs("div",{className:"p-4 border-t border-border flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm text-slate-400",children:["Page ",a," of ",o]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:()=>s(a-1),disabled:a<=1,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(F$,{size:16})}),v.jsx("button",{onClick:()=>s(a+1),disabled:a>=o,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(Js,{size:16})})]})]})]})}function yxe({subscription:e,nodes:t}){const r=o=>{const s=t.find(l=>l.node_id_hex===o||String(l.node_num)===o||l.short_name===o);return s?s.long_name&&s.long_name!==s.short_name?`${s.short_name} (${s.long_name})`:s.short_name:o},n=()=>{if(e.sub_type==="alerts")return"Real-time";const o=e.schedule_time||"0000",s=parseInt(o.slice(0,2)),l=o.slice(2),u=s>=12?"PM":"AM";let h=`${s%12||12}:${l} ${u}`;return e.sub_type==="weekly"&&e.schedule_day&&(h+=` ${e.schedule_day.charAt(0).toUpperCase()}${e.schedule_day.slice(1)}`),h},a=(()=>{switch(e.sub_type){case"alerts":return Zv;case"daily":return Iu;case"weekly":return Iu;default:return Zv}})();return v.jsx("div",{className:"p-4 bg-bg-hover border border-border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 bg-[#f59e0b]/10 flex items-center justify-center",children:v.jsx(a,{size:18,className:"text-[#f59e0b]"})}),v.jsxs("div",{className:"flex-1",children:[v.jsxs("div",{className:"text-sm text-slate-200 font-medium",children:[e.sub_type.charAt(0).toUpperCase()+e.sub_type.slice(1),e.scope_type!=="mesh"&&e.scope_value&&v.jsxs("span",{className:"text-slate-400 font-normal ml-2",children:["(",e.scope_type,": ",e.scope_value,")"]})]}),v.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[n()," • ",r(e.user_id)]})]}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`})]})})}function xxe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(null),[f,d]=G.useState("all"),[g,m]=G.useState("all"),[y,x]=G.useState(1),[_,w]=G.useState(1),S=20,[T,M]=G.useState(new Set),{lastAlert:A}=FM();G.useEffect(()=>{document.title="Alerts — MeshAI"},[]),G.useEffect(()=>{Promise.all([yB().catch(()=>[]),OP(S,0).catch(()=>({items:[],total:0})),iY().catch(()=>[]),fetch("/api/nodes").then(N=>N.json()).catch(()=>[])]).then(([N,D,O,R])=>{t(N),Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S))),a(O),s(R),u(!1)}).catch(N=>{h(N.message),u(!1)})},[]),G.useEffect(()=>{A&&t(N=>N.some(O=>O.type===A.type&&O.message===A.message)?N:[A,...N])},[A]),G.useEffect(()=>{const N=(y-1)*S;OP(S,N,f,g).then(D=>{Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S)))}).catch(()=>{})},[y,f,g]);const P=G.useCallback(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;M(O=>new Set([...O,D]))},[]),I=e.filter(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;return!T.has(D)});return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading alerts..."})}):c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",c]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx($a,{size:14}),"Active Alerts (",I.length,")"]}),I.length>0?v.jsx("div",{className:"space-y-3",children:I.map((N,D)=>v.jsx(gxe,{alert:N,onAcknowledge:P},`${N.type}-${N.timestamp}-${D}`))}):v.jsxs("div",{className:"flex items-center gap-2 text-slate-500 py-8",children:[v.jsx(EM,{size:20,className:"text-green-500"}),v.jsx("span",{children:"No active alerts — all systems nominal"})]})]}),v.jsxs("div",{children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Iu,{size:14}),"Alert History"]}),v.jsx(mxe,{history:r,typeFilter:f,severityFilter:g,onTypeFilterChange:N=>{d(N),x(1)},onSeverityFilterChange:N=>{m(N),x(1)},page:y,totalPages:_,onPageChange:x})]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Q$,{size:14}),"Mesh Subscriptions (",i.length,")"]}),i.length>0?v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.map(N=>v.jsx(yxe,{subscription:N,nodes:o},N.id))}):v.jsxs("div",{className:"text-slate-500 py-4",children:[v.jsx("p",{children:"No active subscriptions."}),v.jsxs("p",{className:"text-xs mt-2",children:["Manage subscriptions via ",v.jsx("code",{className:"text-[#f59e0b]",children:"!subscribe"})," on mesh. Broadcasts arrive with one of three prefixes — ",v.jsx("strong",{children:"New:"})," (first sight), ",v.jsx("strong",{children:"Update:"})," (material change), or ",v.jsx("strong",{children:"Active:"})," (clock-driven reminder while the event is still live). See ",v.jsx("a",{href:"/reference#broadcast-types",className:"text-[#f59e0b] hover:underline",children:"Broadcast Types"})," and ",v.jsx("a",{href:"/reference#reminders",className:"text-[#f59e0b] hover:underline",children:"Reminder System"})," in Reference."]})]})]})]})}const Hy=[{value:"routine",label:"Routine",description:"Informational, no time pressure (ducting, new node, weather advisory, battery declining)"},{value:"priority",label:"Priority",description:"Needs attention soon (severe weather, fire nearby, node offline, HF blackout)"},{value:"immediate",label:"Immediate",description:"Act now, drop everything (fire at infrastructure, extreme weather, region blackout)"}],L3=[{id:"mesh_health",name:"Mesh Health Monitoring",description:"Infrastructure problems - offline nodes, low battery, channel congestion",rule:{name:"Mesh Health Monitoring",enabled:!0,trigger_type:"condition",categories:["infra_offline","critical_node_down","infra_recovery","battery_warning","battery_critical","battery_emergency","high_utilization","packet_flood","mesh_score_low"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"weather_fire",name:"Weather & Fire Alerts",description:"Environmental threats - severe weather, nearby wildfires, new ignitions, flooding",rule:{name:"Weather & Fire Alerts",enabled:!0,trigger_type:"condition",categories:["weather_warning","fire_proximity","new_ignition","stream_flood_warning"],min_severity:"priority",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:15,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"rf_conditions",name:"RF Conditions",description:"Propagation changes - solar events, HF blackouts, tropospheric ducting",rule:{name:"RF Conditions",enabled:!0,trigger_type:"condition",categories:["hf_blackout","tropospheric_ducting","geomagnetic_storm"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:60,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"road_traffic",name:"Road & Traffic",description:"Road closures and severe congestion",rule:{name:"Road & Traffic",enabled:!0,trigger_type:"condition",categories:["road_closure","traffic_congestion"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"everything_critical",name:"Everything Critical",description:"All emergency-level events regardless of type",rule:{name:"Everything Critical",enabled:!0,trigger_type:"condition",categories:[],min_severity:"immediate",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:5,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"morning_briefing",name:"Morning Briefing",description:"Daily health and conditions summary at 7am",rule:{name:"Morning Briefing",enabled:!0,trigger_type:"schedule",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"mesh_health_summary",custom_message:"",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}}];function uy(e){if(!e)return"Never";const r=Date.now()/1e3-e;return r<60?"Just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Ai({info:e}){const[t,r]=G.useState(!1);return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),v.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function xs({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o=""}){const[s,l]=G.useState(!1),u=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(Ai,{info:o})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&v.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Mp({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(Ai,{info:s})]}),v.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Lx({label:e,checked:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(Ai,{info:i})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Mv({label:e,value:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(Ai,{info:i})]}),v.jsx("input",{type:"time",value:t,onChange:a=>r(a.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Uy({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:i="",info:a=""}){const[o,s]=G.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(Ai,{info:a})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),v.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:v.jsx(af,{size:16})})]}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,v.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:v.jsx(ca,{size:14})})]},h))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function e7({value:e,onChange:t}){const[r,n]=G.useState(!1),i=Hy.find(a=>a.value===e)||Hy[0];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Severity Threshold",v.jsx(Ai,{info:"Only alerts at or above this severity trigger this rule. ROUTINE = informational, PRIORITY = needs attention, IMMEDIATE = act now."})]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{type:"button",onClick:()=>n(!r),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-left flex items-center justify-between hover:border-accent transition-colors",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-slate-200",children:i.label}),v.jsxs("span",{className:"text-slate-500 ml-2",children:["- ",i.description]})]}),v.jsx(ll,{size:16,className:`text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>n(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-[#0a0e17] border border-[#1e2a3a] shadow-xl overflow-hidden",children:Hy.map(a=>v.jsxs("button",{type:"button",onClick:()=>{t(a.value),n(!1)},className:`w-full px-3 py-2.5 text-left text-sm hover:bg-[#1e2a3a] transition-colors ${e===a.value?"bg-accent/10":""}`,children:[v.jsx("div",{className:"font-medium text-slate-200",children:a.label}),v.jsx("div",{className:"text-xs text-slate-500",children:a.description})]},a.value))})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:'Lower = more notifications. "Warning" recommended for most rules.'})]})}function cy({rule:e}){const[t,r]=G.useState(!1),[n,i]=G.useState(null),a=async()=>{r(!0),i(null);try{let s={type:e.delivery_type};e.delivery_type==="mesh_broadcast"?s.channel_index=e.broadcast_channel:e.delivery_type==="mesh_dm"?s.node_ids=e.node_ids:e.delivery_type==="email"?s={type:"email",smtp_host:e.smtp_host,smtp_port:e.smtp_port,smtp_user:e.smtp_user,smtp_password:e.smtp_password,smtp_tls:e.smtp_tls,from_address:e.from_address,recipients:e.recipients}:e.delivery_type==="webhook"&&(s={type:"webhook",url:e.webhook_url,headers:e.webhook_headers});const u=await(await fetch("/api/notifications/channels/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();i(u)}catch(s){i({success:!1,message:"Test failed",error:s instanceof Error?s.message:"Unknown error",details:{}})}finally{r(!1)}};if(!e.delivery_type)return null;const o={mesh_broadcast:v.jsx(Di,{size:14}),mesh_dm:v.jsx(OM,{size:14}),email:v.jsx(Y$,{size:14}),webhook:v.jsx(Z$,{size:14})}[e.delivery_type]||v.jsx(t_,{size:14});return v.jsxs("div",{className:"space-y-2",children:[v.jsx("button",{type:"button",onClick:a,disabled:t,className:"flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",children:t?v.jsxs(v.Fragment,{children:[v.jsx($v,{size:14,className:"animate-spin"}),"Testing..."]}):v.jsxs(v.Fragment,{children:[o,"Test Channel"]})}),n&&v.jsx("div",{className:`p-2 rounded text-xs ${n.success?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[n.success?v.jsx(Za,{size:14,className:"mt-0.5 flex-shrink-0"}):v.jsx(ca,{size:14,className:"mt-0.5 flex-shrink-0"}),v.jsxs("div",{children:[v.jsx("div",{className:"font-medium",children:n.message}),n.error&&v.jsx("div",{className:"mt-1 text-red-300",children:n.error})]})]})})]})}function _xe({rule:e,ruleIndex:t,categories:r,regions:n,onChange:i,onDelete:a,onDuplicate:o,onTest:s}){var O,R,F,H,W;const[l,u]=G.useState(!e.name),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null);G.useEffect(()=>{var V;e.name&&t>=0&&(fetch(`/api/notifications/rules/${t}/stats`).then(z=>z.json()).then(z=>d(z)).catch(()=>{}),(V=e.categories)!=null&&V.length&&fetch("/api/notifications/rules/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e.categories})}).then(z=>z.json()).then(z=>m(z)).catch(()=>{}))},[e.name,t,e.categories]);const y=[{value:"",label:"(None)",description:"Rule matches but does not deliver"},{value:"mesh_broadcast",label:"Mesh Broadcast",description:"Send to a mesh radio channel"},{value:"mesh_dm",label:"Mesh DM",description:"Direct message to specific nodes"},{value:"email",label:"Email",description:"Send via SMTP"},{value:"webhook",label:"Webhook",description:"POST to any URL"}],x=[{value:"daily",label:"Daily"},{value:"twice_daily",label:"Twice Daily"},{value:"weekly",label:"Weekly"}],_=[{value:"mesh_health_summary",label:"Mesh Health Summary",description:"Current health score, pillar breakdown, problem nodes"},{value:"rf_propagation_report",label:"RF Propagation Report",description:"Solar indices, Kp, ducting conditions"},{value:"alerts_digest",label:"Active Alerts Digest",description:"Summary of all active environmental alerts"},{value:"environmental_conditions",label:"Environmental Conditions",description:"Full conditions: weather, fire, streams, roads"},{value:"custom",label:"Custom Message",description:"Write your own with template tokens"}],w=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],S=V=>{const z=e.categories||[];z.includes(V)?i({...e,categories:z.filter(Z=>Z!==V)}):i({...e,categories:[...z,V]})},T=(V,z)=>{const Z=e.categories||[];if(z==="add"){const U=Array.from(new Set([...Z,...V]));i({...e,categories:U})}else{const U=new Set(V);i({...e,categories:Z.filter($=>!U.has($))})}},M=V=>{const z=e.region_scope||[];z.includes(V)?i({...e,region_scope:z.filter(Z=>Z!==V)}):i({...e,region_scope:[...z,V]})},A=V=>{const z=e.schedule_days||[];z.includes(V)?i({...e,schedule_days:z.filter(Z=>Z!==V)}):i({...e,schedule_days:[...z,V]})},P=async()=>{h(!0),await s(),h(!1)},I=()=>{if(e.trigger_type==="schedule")return"[Scheduled report preview would appear here]";const V=e.categories||[];if(V.length===0&&r.length>0)return r[0].example_message||"Alert notification";const z=r.find(Z=>V.includes(Z.id));return(z==null?void 0:z.example_message)||"Alert notification"},N=()=>{var z,Z,U,$,Y,te,ie,se;const V=[];if(e.trigger_type==="schedule"){const le=((z=x.find(me=>me.value===e.schedule_frequency))==null?void 0:z.label)||e.schedule_frequency,Ee=((Z=_.find(me=>me.value===e.message_type))==null?void 0:Z.label)||e.message_type;V.push(`${le} at ${e.schedule_time||"??:??"}`),V.push(Ee)}else{const le=((U=e.categories)==null?void 0:U.length)||0,Ee=le===0?"All":r.filter(ye=>{var Me;return(Me=e.categories)==null?void 0:Me.includes(ye.id)}).map(ye=>ye.name).slice(0,2).join(", ")+(le>2?` +${le-2}`:""),me=(($=Hy.find(ye=>ye.value===e.min_severity))==null?void 0:$.label)||e.min_severity;V.push(`${Ee} at ${me}+`)}if(!e.delivery_type)V.push("No delivery");else{const le=((Y=y.find(me=>me.value===e.delivery_type))==null?void 0:Y.label)||e.delivery_type;let Ee="";if(e.delivery_type==="mesh_broadcast")Ee=`Ch ${e.broadcast_channel}`;else if(e.delivery_type==="mesh_dm")Ee=`${((te=e.node_ids)==null?void 0:te.length)||0} nodes`;else if(e.delivery_type==="email")Ee=(ie=e.recipients)!=null&&ie.length?e.recipients[0]+(e.recipients.length>1?` +${e.recipients.length-1}`:""):"no recipients";else if(e.delivery_type==="webhook")try{Ee=new URL(e.webhook_url).hostname}catch{Ee=((se=e.webhook_url)==null?void 0:se.slice(0,20))||"no URL"}V.push(`${le}${Ee?` (${Ee})`:""}`)}return V.join(" -> ")},D=()=>{var z;if(!g||!((z=e.categories)!=null&&z.length))return null;const V=new Map;for(const[,Z]of Object.entries(g)){const U=V.get(Z.source);U?(U.events+=Z.active_events,U.enabled=U.enabled&&Z.enabled):V.set(Z.source,{enabled:Z.enabled,events:Z.active_events})}return Array.from(V.entries()).map(([Z,{enabled:U,events:$}])=>v.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ${U?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,title:U?`${$} active`:"Not enabled",children:[U?v.jsx(t_,{size:10}):v.jsx(mB,{size:10}),Z.toUpperCase(),U&&$>0&&` (${$})`]},Z))};return v.jsxs("div",{className:`border overflow-hidden ${e.enabled?"border-[#1e2a3a]":"border-slate-700 opacity-60"}`,children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>u(!l),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l?v.jsx(ll,{size:16,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:16,className:"text-slate-500 flex-shrink-0"}),v.jsx("button",{onClick:V=>{V.stopPropagation(),i({...e,enabled:!e.enabled})},className:`w-2 h-2 rounded-full flex-shrink-0 ${e.enabled?"bg-green-500":"bg-slate-500"}`,title:e.enabled?"Enabled":"Disabled"}),e.trigger_type==="schedule"?v.jsx(Iu,{size:14,className:"text-[#f59e0b] flex-shrink-0"}):v.jsx(Dh,{size:14,className:"text-yellow-400 flex-shrink-0"}),v.jsx("span",{className:"font-medium text-slate-200 truncate",title:e.name||void 0,children:e.name||"New Rule"}),!l&&v.jsx("span",{className:`text-xs truncate hidden sm:block ${e.delivery_type?"text-slate-500":"text-amber-400"}`,children:N()})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!l&&(()=>{const V="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs mr-2";if(!e.enabled)return v.jsx("span",{className:`${V} bg-slate-800 text-slate-500`,children:"Disabled"});if(!f)return null;const z=f.fire_count||0,Z=f.last_fired,U=Date.now()/1e3-7*86400;return z>0&&Z&&Z>=U?v.jsx("span",{className:`${V} bg-green-500/10 text-green-400`,title:`Last fired ${uy(Z)}`,children:"Active"}):z>0&&Z?v.jsx("span",{className:`${V} bg-yellow-500/10 text-yellow-400`,title:`Last fired ${uy(Z)}`,children:"Idle (no recent activity)"}):v.jsx("span",{className:`${V} bg-slate-800 text-slate-400`,children:"No activity yet"})})(),!l&&v.jsx("div",{className:"hidden md:flex items-center gap-1 mr-2",children:D()}),v.jsx("button",{onClick:V=>{V.stopPropagation(),P()},disabled:c||!e.name,className:"p-1.5 text-[#f59e0b] hover:text-[#d97706] hover:bg-[#f59e0b]/10 rounded disabled:opacity-50",title:"Test rule",children:v.jsx(_C,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),o()},className:"p-1.5 text-slate-400 hover:text-slate-200 hover:bg-slate-500/10 rounded",title:"Duplicate",children:v.jsx(H$,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),a()},className:"p-1.5 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",title:"Delete",children:v.jsx(Ep,{size:14})})]})]}),!l&&e.name&&v.jsxs("div",{className:"px-3 pb-2 pt-0 bg-[#0a0e17] flex items-center gap-2 flex-wrap text-xs",children:[!e.delivery_type&&v.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:[v.jsx(Vo,{size:10}),"No delivery method"]}),(f==null?void 0:f.fire_count)!==void 0&&f.fire_count>0&&v.jsxs("span",{className:"text-slate-500",children:["Fired ",f.fire_count,"x"]})]}),l&&v.jsxs("div",{className:"p-4 space-y-6 border-t border-[#1e2a3a]",children:[v.jsx(xs,{label:"Rule Name",value:e.name,onChange:V=>i({...e,name:V}),placeholder:"e.g., Emergency Broadcast, Daily Health Report",helper:"A descriptive name for this rule"}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Trigger Type"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"condition"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type!=="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Dh,{size:16}),v.jsx("span",{children:"Condition"})]}),v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"schedule"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type==="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Iu,{size:16}),v.jsx("span",{children:"Schedule"})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:e.trigger_type==="schedule"?"Send reports on a schedule (daily briefings, weekly digests)":"React to alert conditions (fires, outages, weather warnings)"})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx($a,{size:14}),"WHEN (Condition)"]}),v.jsx(e7,{value:e.min_severity,onChange:V=>i({...e,min_severity:V})}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Categories",v.jsx(Ai,{info:"Select which types of alerts trigger this rule. Leave all unchecked to match ALL categories. Categories are grouped by family — use the 'All' / 'Clear' buttons in each header to bulk-toggle."})]}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:(((O=e.categories)==null?void 0:O.length)||0)===0?"All categories (none selected)":`${(R=e.categories)==null?void 0:R.length} selected`}),v.jsx(bxe,{categories:r,selected:e.categories||[],onToggle:S,onSelectMany:T})]}),g&&Object.keys(g).length>0&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Data Sources"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:D()})]})]}),e.trigger_type==="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(B$,{size:14}),"WHEN (Schedule)"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Frequency"}),v.jsx("select",{value:e.schedule_frequency||"daily",onChange:V=>i({...e,schedule_frequency:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:x.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mv,{label:"Time",value:e.schedule_time||"07:00",onChange:V=>i({...e,schedule_time:V})}),e.schedule_frequency==="twice_daily"&&v.jsx(Mv,{label:"Second Time",value:e.schedule_time_2||"19:00",onChange:V=>i({...e,schedule_time_2:V})})]}),e.schedule_frequency==="weekly"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Days"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(V=>{var z;return v.jsx("button",{type:"button",onClick:()=>A(V),className:`px-3 py-1.5 rounded text-sm capitalize transition-colors ${(z=e.schedule_days)!=null&&z.includes(V)?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:V.slice(0,3)},V)})})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Report Type"}),v.jsx("select",{value:e.message_type||"mesh_health_summary",onChange:V=>i({...e,message_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:_.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(F=_.find(V=>V.value===e.message_type))==null?void 0:F.description})]}),e.message_type==="custom"&&v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Message",v.jsx(Ai,{info:"Available tokens: {MESH_SCORE}, {NODE_COUNT}, {NODES_ONLINE}, {ACTIVE_ALERTS}, {KP}, {SFI}, {DATE}, {TIME}"})]}),v.jsx("textarea",{value:e.custom_message||"",onChange:V=>i({...e,custom_message:V.target.value}),rows:4,placeholder:"Good morning! Mesh health: {MESH_SCORE}/100 with {NODE_COUNT} nodes online.",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"})]})]}),v.jsxs("div",{className:"space-y-2 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(nf,{size:14}),"REGIONS",v.jsx(Ai,{info:"Limit this rule to alerts from specific regions. Empty selection = all regions (backward compatible). Region names come from /api/regions."})]}),v.jsx("div",{className:"text-xs text-slate-500",children:(((H=e.region_scope)==null?void 0:H.length)||0)===0?"All regions (none selected)":`${e.region_scope.length} of ${n.length} selected`}),n.length===0?v.jsx("div",{className:"text-xs text-slate-600 italic",children:"No regions configured."}):v.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(V=>{const z=(e.region_scope||[]).includes(V.name);return v.jsx("button",{type:"button",onClick:()=>M(V.name),className:`px-3 py-1.5 rounded text-sm transition-colors ${z?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,title:V.local_name||V.name,children:V.local_name||V.name},V.name)})})]}),v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(_C,{size:14}),"SEND VIA"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Delivery Method",v.jsx(Ai,{info:"Where this notification gets delivered. Select (None) to save the rule without delivery - it will match conditions but won't send until you configure a delivery method."})]}),v.jsx("select",{value:e.delivery_type||"",onChange:V=>i({...e,delivery_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:y.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(W=y.find(V=>V.value===(e.delivery_type||"")))==null?void 0:W.description})]}),!e.delivery_type&&v.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[v.jsx(Vo,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),v.jsx("div",{className:"text-sm text-amber-300",children:"Rule will log matches but not deliver until a delivery method is configured."})]}),e.delivery_type==="mesh_broadcast"&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Broadcast Channel",value:e.broadcast_channel??0,onChange:V=>i({...e,broadcast_channel:V}),helper:"Select the mesh radio channel",mode:"single"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="mesh_dm"&&v.jsxs(v.Fragment,{children:[v.jsx(kL,{label:"Recipient Nodes",value:e.node_ids||[],onChange:V=>i({...e,node_ids:V}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="email"&&v.jsxs("div",{className:"space-y-4",children:[v.jsx(Uy,{label:"Recipients",value:e.recipients||[],onChange:V=>i({...e,recipients:V}),placeholder:"email@example.com",helper:"Email addresses to receive alerts"}),v.jsxs("details",{className:"group",children:[v.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[v.jsx(Js,{size:14,className:"group-open:rotate-90 transition-transform"}),"SMTP Configuration"]}),v.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"SMTP Host",value:e.smtp_host||"",onChange:V=>i({...e,smtp_host:V}),placeholder:"smtp.gmail.com"}),v.jsx(Mp,{label:"SMTP Port",value:e.smtp_port??587,onChange:V=>i({...e,smtp_port:V}),min:1,max:65535})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"Username",value:e.smtp_user||"",onChange:V=>i({...e,smtp_user:V})}),v.jsx(xs,{label:"Password",value:e.smtp_password||"",onChange:V=>i({...e,smtp_password:V}),type:"password",info:"Gmail users: use an App Password from myaccount.google.com/apppasswords"})]}),v.jsx(Lx,{label:"Use TLS",checked:e.smtp_tls??!0,onChange:V=>i({...e,smtp_tls:V})}),v.jsx(xs,{label:"From Address",value:e.from_address||"",onChange:V=>i({...e,from_address:V}),placeholder:"alerts@yourdomain.com"})]})]}),v.jsx(cy,{rule:e})]}),e.delivery_type==="webhook"&&v.jsxs(v.Fragment,{children:[v.jsx(xs,{label:"Webhook URL",value:e.webhook_url||"",onChange:V=>i({...e,webhook_url:V}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON",info:"Works with Discord webhooks, ntfy.sh, Slack, Home Assistant, Pushover, or any HTTP POST endpoint."}),v.jsx(cy,{rule:e})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mp,{label:"Cooldown (minutes)",value:e.cooldown_minutes??10,onChange:V=>i({...e,cooldown_minutes:V}),min:0,helper:"Min time between repeat sends",info:"Prevents alert spam. Same condition won't re-trigger this rule within this window."})," "]}),f&&v.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[v.jsxs("span",{children:["Last fired: ",uy(f.last_fired)]}),v.jsxs("span",{children:["Last tested: ",uy(f.last_test)]}),v.jsxs("span",{children:["Total fires: ",f.fire_count]})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Example Message"}),v.jsx("div",{className:"p-3 bg-[#1e2a3a]/50 border border-[#1e2a3a]",children:v.jsx("p",{className:"text-sm text-slate-300 font-mono",children:I()})}),v.jsx("p",{className:"text-xs text-slate-600",children:"This is an example of what this rule would send."})]})]})]})}const Zy=[{key:"mesh_health",label:"Mesh Health",Icon:rf},{key:"weather",label:"Weather",Icon:Du},{key:"fire",label:"Fire",Icon:Xx},{key:"rf_propagation",label:"RF Propagation",Icon:Di},{key:"roads",label:"Roads",Icon:$x},{key:"avalanche",label:"Avalanche",Icon:J$},{key:"seismic",label:"Seismic",Icon:Kx},{key:"tracking",label:"Tracking",Icon:nf}];function bxe({categories:e,selected:t,onToggle:r,onSelectMany:n}){const i=new Set(Zy.map(f=>f.key)),a=new Map;Zy.forEach(f=>a.set(f.key,[]));const o=[];for(const f of e){const d=f.toggle;d&&i.has(d)?a.get(d).push(f):o.push(f)}const s=new Set;for(const[f,d]of a)d.some(g=>t.includes(g.id))&&s.add(f);o.some(f=>t.includes(f.id))&&s.add("other");const[l,u]=G.useState(s),c=f=>{u(d=>{const g=new Set(d);return g.has(f)?g.delete(f):g.add(f),g})},h=(f,d,g,m)=>{if(!m.length)return null;const y=l.has(f),x=m.map(w=>w.id),_=x.filter(w=>t.includes(w)).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded",children:[v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-[#0d1420]",children:[v.jsxs("button",{type:"button",onClick:()=>c(f),className:"flex items-center gap-2 text-sm text-slate-200 flex-1 min-w-0",children:[y?v.jsx(ll,{size:14,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:14,className:"text-slate-500 flex-shrink-0"}),g&&v.jsx(g,{size:14,className:"text-slate-400 flex-shrink-0"}),v.jsxs("span",{className:"truncate",children:[d," (",m.length,")"]}),_>0&&v.jsxs("span",{className:"ml-1 text-xs text-accent",children:[_," selected"]})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"add")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-accent hover:bg-accent/10",title:"Select all in family",children:"All"}),v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"remove")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-red-400 hover:bg-red-500/10",title:"Clear family",children:"Clear"})]})]}),y&&v.jsx("div",{className:"p-1 space-y-1",children:m.map(w=>v.jsxs("label",{onClick:()=>r(w.id),className:"flex items-start gap-2 p-2 rounded hover:bg-[#1e2a3a]/50 cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 mt-0.5 rounded border flex items-center justify-center flex-shrink-0 ${t.includes(w.id)?"bg-accent border-accent":"border-slate-600"}`,children:t.includes(w.id)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200",children:w.name}),v.jsx("div",{className:"text-xs text-slate-500",children:w.description})]})]},w.id))})]},f)};return v.jsxs("div",{className:"max-h-96 overflow-y-auto border border-[#1e2a3a] p-2 space-y-2",children:[Zy.map(f=>h(f.key,f.label,f.Icon,a.get(f.key)||[])),h("other","Other",null,o)]})}const N3=["digest","mesh_broadcast","mesh_dm","email","webhook"],wxe=["routine","priority","immediate"];function Sxe({toggles:e,onChange:t}){const[r,n]=G.useState(null),i=(a,o)=>t({...e,[a]:{...e[a]||{},name:a,...o}});return v.jsxs("div",{className:"space-y-3 mb-8",children:[v.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Master Toggles",v.jsx(Ai,{info:"Per-family notification policy: enable a family, set its severity threshold, choose which channels fire at each severity, and scope to regions (PagerDuty/Grafana-style)."})]}),v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Zy.map(({key:a,label:o,Icon:s})=>{const l=e[a]||{},u=r===a,c=Object.values(l.severity_channels||{}).reduce((f,d)=>f+((d==null?void 0:d.length)||0),0),h=(l.regions||[]).length;return v.jsxs("div",{className:"border border-[#1e2a3a] p-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("button",{type:"button",onClick:()=>n(u?null:a),className:"flex items-center gap-2 text-sm text-slate-200",children:[v.jsx(s,{size:15})," ",o,u?v.jsx(ll,{size:14}):v.jsx(Js,{size:14})]}),v.jsx(Lx,{label:"",checked:!!l.enabled,onChange:f=>i(a,{enabled:f})})]}),!u&&v.jsx("div",{className:"text-xs text-slate-600 mt-1",children:l.enabled?`${h||"all"} region${h===1?"":"s"}, ${c} channel${c===1?"":"s"} at ${l.min_severity||"priority"}+`:"OFF"}),u&&v.jsxs("div",{className:`mt-3 space-y-3 ${l.enabled?"":"opacity-40 pointer-events-none select-none"}`,children:[v.jsx(e7,{value:l.min_severity||"priority",onChange:f=>i(a,{min_severity:f})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Severity → channels"}),v.jsxs("table",{className:"text-xs w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{}),N3.map(f=>v.jsx("th",{className:"text-slate-500 font-normal px-1",children:f.replace("_"," ")},f))]})}),v.jsx("tbody",{children:wxe.map(f=>v.jsxs("tr",{children:[v.jsx("td",{className:"text-slate-400 pr-2",children:f}),N3.map(d=>{var m;const g=(((m=l.severity_channels)==null?void 0:m[f])||[]).includes(d);return v.jsx("td",{className:"text-center",children:v.jsx("input",{type:"checkbox",checked:g,onChange:y=>{const x={...l.severity_channels||{}},_=new Set(x[f]||[]);y.target.checked?_.add(d):_.delete(d),x[f]=Array.from(_),i(a,{severity_channels:x})}})},d)})]},f))})]}),v.jsx(Uy,{label:"Regions (empty = all)",value:l.regions||[],onChange:f=>i(a,{regions:f}),placeholder:"Add region..."})," ",v.jsx("div",{className:"text-xs text-slate-500 pt-1",children:"Channel config"}),v.jsx(Mp,{label:"Broadcast channel",value:l.broadcast_channel??0,onChange:f=>i(a,{broadcast_channel:f})}),v.jsx(Uy,{label:"DM node IDs",value:l.node_ids||[],onChange:f=>i(a,{node_ids:f}),placeholder:"!nodeid"}),v.jsx(Uy,{label:"Email recipients",value:l.recipients||[],onChange:f=>i(a,{recipients:f}),placeholder:"ops@example.com"}),v.jsx(xs,{label:"SMTP host",value:l.smtp_host||"",onChange:f=>i(a,{smtp_host:f}),placeholder:"smtp.example.com"}),v.jsx(Mp,{label:"SMTP port",value:l.smtp_port??587,onChange:f=>i(a,{smtp_port:f})}),v.jsx(xs,{label:"Webhook URL",value:l.webhook_url||"",onChange:f=>i(a,{webhook_url:f}),placeholder:"https://..."})]})]},a)})})]})}function Cxe(){var z,Z,U;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(null),[_,w]=G.useState({open:!1,ruleIndex:-1,loading:!1,action:""}),[S,T]=G.useState(!1),[M,A]=G.useState(!1),P=G.useCallback(async()=>{try{const[$,Y,te]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/categories"),fetch("/api/regions")]);if(!$.ok)throw new Error("Failed to fetch notifications config");const ie=await $.json(),se=await Y.json(),le=te.ok?await te.json():[];t(ie),n(JSON.parse(JSON.stringify(ie))),a(se),s(Array.isArray(le)?le:[]),A(!1),d(null)}catch($){d($ instanceof Error?$.message:"Unknown error")}finally{u(!1)}},[]);G.useEffect(()=>{document.title="Notifications - MeshAI",P()},[P]),G.useEffect(()=>{e&&r&&A(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const I=async()=>{if(e){h(!0),d(null),m(null);try{const $=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Y=await $.json();if(!$.ok)throw new Error(Y.detail||"Save failed");m("Notifications config saved successfully"),n(JSON.parse(JSON.stringify(e))),A(!1),setTimeout(()=>m(null),3e3)}catch($){d($ instanceof Error?$.message:"Save failed")}finally{h(!1)}}},N=()=>{r&&(t(JSON.parse(JSON.stringify(r))),A(!1))},D=()=>({name:"",enabled:!0,trigger_type:"condition",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"19:00",schedule_days:["monday"],message_type:"mesh_health_summary",custom_message:"",delivery_type:"",broadcast_channel:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{},cooldown_minutes:10,region_scope:[]}),O=()=>{e&&t({...e,rules:[...e.rules||[],D()]})},R=$=>{if(!e)return;const Y=L3.find(te=>te.id===$);Y&&(t({...e,rules:[...e.rules||[],{...D(),...Y.rule}]}),T(!1))},F=$=>{if(!e)return;const Y=e.rules[$],te={...JSON.parse(JSON.stringify(Y)),name:`${Y.name} (copy)`},ie=[...e.rules];ie.splice($+1,0,te),t({...e,rules:ie})},H=async $=>{w({open:!0,ruleIndex:$,loading:!0,action:""});try{const te=await(await fetch(`/api/notifications/rules/${$}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})})).json();x(te),w(ie=>({...ie,loading:!1}))}catch{x({success:!1,message:"Failed to get preview"}),w(Y=>({...Y,loading:!1}))}},W=async $=>{const Y=_.ruleIndex;w(te=>({...te,loading:!0,action:$}));try{const ie=await(await fetch(`/api/notifications/rules/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:$})})).json();x(ie),w(se=>({...se,loading:!1}))}catch{x({success:!1,message:`Failed to ${$}`}),w(te=>({...te,loading:!1}))}},V=()=>{w({open:!1,ruleIndex:-1,loading:!1,action:""}),x(null)};return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):e?v.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[_.open&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:v.jsxs("div",{className:"bg-[#1a2332] border border-[#2a3a4a] shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] overflow-auto",children:[v.jsxs("div",{className:"p-4 border-b border-[#2a3a4a] flex items-center justify-between sticky top-0 bg-[#1a2332]",children:[v.jsx("h3",{className:"text-lg font-semibold",children:"Test Notification Rule"}),v.jsx("button",{onClick:V,className:"text-slate-500 hover:text-slate-300",children:v.jsx(ca,{size:20})})]}),v.jsx("div",{className:"p-4 space-y-4",children:_.loading?v.jsxs("div",{className:"flex items-center justify-center py-8",children:[v.jsx($v,{size:20,className:"animate-spin text-slate-400 mr-2"}),v.jsx("div",{className:"text-slate-400",children:_.action?`${_.action.replace("_"," ").replace("send ","Sending ")}...`:"Loading current data..."})]}):y?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Current Data"}),y.live_data_summary&&y.live_data_summary.length>0?v.jsx("div",{className:"p-3 bg-slate-800/50 rounded space-y-1",children:y.live_data_summary.map(($,Y)=>v.jsx("div",{className:`text-sm font-mono ${$.startsWith("[!]")?"text-amber-400":""}`,children:$},Y))}):v.jsx("div",{className:"p-3 bg-slate-800/50 rounded text-sm text-slate-500",children:"No live data available for this rule's categories"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Rule Matching"}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.conditions_matched&&y.conditions_matched>0?v.jsxs("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 rounded text-sm",children:[y.conditions_matched," condition",y.conditions_matched!==1?"s":""," match - this rule WOULD fire"]}):v.jsx("span",{className:"px-2 py-1 bg-slate-700 text-slate-400 rounded text-sm",children:"No conditions trigger this rule right now"}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded text-sm",children:[y.conditions_below_threshold," below threshold"]})]}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-sm space-y-2",children:[v.jsx("div",{className:"text-yellow-300",children:y.below_threshold_summary}),y.below_threshold_events&&y.below_threshold_events.length>0&&v.jsx("div",{className:"space-y-1 text-yellow-200/80",children:y.below_threshold_events.slice(0,3).map(($,Y)=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 rounded",children:$.severity}),v.jsx("span",{children:$.headline})]},Y))}),y.suggestion&&v.jsxs("div",{className:"text-yellow-400 text-xs mt-2",children:["Tip: ",y.suggestion]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:y.is_example?"Example Messages":"Messages That Would Fire"}),(z=y.preview_messages)==null?void 0:z.map(($,Y)=>v.jsx("div",{className:"p-3 bg-slate-800 rounded text-sm font-mono break-words",children:$},Y))]}),y.delivered!==void 0&&y.delivery_result&&v.jsx("div",{className:`p-3 rounded text-sm ${y.delivered?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[y.delivered?v.jsx(Za,{size:16,className:"mt-0.5"}):v.jsx(ca,{size:16,className:"mt-0.5"}),v.jsxs("div",{children:[v.jsx("div",{children:y.delivery_result}),y.delivery_error&&v.jsx("div",{className:"mt-1 text-red-300",children:y.delivery_error})]})]})}),y.message&&!y.preview_messages&&v.jsx("div",{className:`p-3 rounded text-sm ${y.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:y.message})]}):null}),v.jsxs("div",{className:"p-4 border-t border-[#2a3a4a] flex justify-between sticky bottom-0 bg-[#1a2332]",children:[v.jsx("button",{onClick:V,className:"px-4 py-2 text-slate-400 hover:text-slate-200",children:"Close"}),y&&!y.delivered&&v.jsx("div",{className:"flex gap-2",children:y.delivery_method?v.jsxs(v.Fragment,{children:[y.live_data_summary&&y.live_data_summary.length>0&&v.jsx("button",{onClick:()=>W("send_status"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send current conditions summary",children:"Send Current Conditions"}),v.jsx("button",{onClick:()=>W("send_test"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send example alert message",children:"Send Example Alert"}),y.can_send_live&&v.jsx("button",{onClick:()=>W("send_live"),disabled:_.loading,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm disabled:opacity-50",title:"Send actual live alert",children:"Send Live Alert"})]}):v.jsx("span",{className:"px-3 py-2 text-amber-400 text-sm",children:"Configure a delivery method to send test messages"})})]})]})}),v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{children:v.jsx("p",{className:"text-sm text-slate-500",children:"Alert delivery and scheduled reports. Rules define what triggers a notification and where it gets sent."})}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:P,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:v.jsx($v,{size:18})}),v.jsxs("button",{onClick:N,disabled:!M,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[v.jsx(Jx,{size:16}),"Discard"]}),v.jsxs("button",{onClick:I,disabled:c||!M,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[v.jsx(zM,{size:16}),c?"Saving...":"Save"]})]})]}),f&&v.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&v.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[v.jsx(Za,{size:14,className:"inline mr-2"}),g]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-6",children:[v.jsx(Lx,{label:"Enable Notifications",checked:e.enabled,onChange:$=>t({...e,enabled:$}),helper:"Master switch for all notification delivery",info:"When disabled, no alerts or scheduled messages will be delivered. Alerts still get recorded to history."}),e.enabled&&v.jsxs(v.Fragment,{children:[" ",v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),v.jsx(Mp,{label:"Grace period (seconds)",value:e.cold_start_grace_seconds??60,onChange:$=>t({...e,cold_start_grace_seconds:$}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),v.jsx(Lx,{label:"Enable scheduled band-conditions broadcasts",checked:e.band_conditions_enabled??!0,onChange:$=>t({...e,band_conditions_enabled:$}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(e.band_conditions_enabled??!0)&&v.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[v.jsx(Mv,{label:"Slot 1",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[0]=$,t({...e,band_conditions_schedule:Y})},helper:"Morning (default 06:00 MT)"}),v.jsx(Mv,{label:"Slot 2",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[1]=$,t({...e,band_conditions_schedule:Y})},helper:"Afternoon (default 14:00 MT)"}),v.jsx(Mv,{label:"Slot 3",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[2]=$,t({...e,band_conditions_schedule:Y})},helper:"Night (default 22:00 MT)"})]}),v.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),e.toggles&&v.jsx(Sxe,{toggles:e.toggles,onChange:$=>t({...e,toggles:$})}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Notification Rules",v.jsx(Ai,{info:"Each rule is self-contained: define what triggers it (condition or schedule), where to send it (mesh, email, webhook), and behavior settings."})]}),v.jsxs("span",{className:"text-xs text-slate-500",children:[((Z=e.rules)==null?void 0:Z.length)||0," rule",(((U=e.rules)==null?void 0:U.length)||0)!==1?"s":""]})]}),(e.rules||[]).map(($,Y)=>v.jsx(_xe,{rule:$,ruleIndex:Y,categories:i,regions:o,onChange:te=>{const ie=[...e.rules||[]];ie[Y]=te,t({...e,rules:ie})},onDelete:()=>{confirm(`Delete rule "${$.name||"New Rule"}"?`)&&t({...e,rules:(e.rules||[]).filter((te,ie)=>ie!==Y)})},onDuplicate:()=>F(Y),onTest:()=>H(Y)},Y)),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{onClick:O,className:"flex-1 py-3 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Rule"]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>T(!S),className:"py-3 px-4 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center gap-2 transition-colors",children:[v.jsx(hB,{size:16})," Add from Template"]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(!1)}),v.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-80 bg-[#1a2332] border border-[#2a3a4a] shadow-xl overflow-hidden",children:[v.jsx("div",{className:"p-2 border-b border-[#2a3a4a] text-xs text-slate-500 uppercase",children:"Rule Templates"}),L3.map($=>v.jsxs("button",{onClick:()=>R($.id),className:"w-full p-3 text-left hover:bg-[#2a3a4a] transition-colors",children:[v.jsx("div",{className:"font-medium text-slate-200",children:$.name}),v.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:$.description})]},$.id))]})]})]})]})]})]})]})]}):v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const P3=[{id:"stream-gauges",label:"Stream Gauges",icon:Yx},{id:"wildfire",label:"Wildfire",icon:Xx},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:Qx},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:U$},{id:"weather-alerts",label:"Weather Alerts",icon:G$},{id:"solar",label:"Solar & Geomagnetic",icon:pB},{id:"ducting",label:"Tropospheric Ducting",icon:Di},{id:"avalanche",label:"Avalanche Danger",icon:Kx},{id:"traffic",label:"Traffic Flow",icon:$x},{id:"roads-511",label:"Road Conditions (511)",icon:sB},{id:"mesh-health",label:"Mesh Health",icon:rf},{id:"broadcast-types",label:"Broadcast Types",icon:_C},{id:"reminders",label:"Reminder System",icon:Iu},{id:"notifications",label:"Notifications",icon:Zv},{id:"commands",label:"Commands",icon:gB},{id:"llm-dm",label:"LLM DM Queries",icon:OM},{id:"or-not-and",label:"OR-not-AND Architecture",icon:dB},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:BM},{id:"curation",label:"Curation: Gauges & Towns",icon:uB},{id:"schema",label:"Schema Migrations",icon:$$},{id:"api",label:"API Reference",icon:W$}];function $t({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return v.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function yt({headers:e,rows:t}){return v.jsx("div",{className:"overflow-x-auto my-4",children:v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>v.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),v.jsx("tbody",{children:t.map((r,n)=>v.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((i,a)=>v.jsx("td",{className:"px-4 py-2 text-slate-300",children:i},a))},n))})]})})}function Pt({href:e,children:t}){return v.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",v.jsx(Ih,{size:12})]})}function de({children:e}){return v.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function fs({children:e}){return v.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function oe({children:e}){return v.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function hr({id:e,title:t,children:r}){return v.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[v.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),v.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function Txe(){const e=tf(),[t,r]=G.useState(""),[n,i]=G.useState("stream-gauges"),a=G.useRef(null);G.useEffect(()=>{const l=e.hash.replace("#","");if(l&&P3.find(u=>u.id===l)){i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=P3.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return v.jsxs("div",{className:"flex h-full -m-6",children:[v.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[v.jsx("div",{className:"p-4 border-b border-border",children:v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),v.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return v.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[v.jsx(u,{size:16}),l.label]},l.id)})})]}),v.jsx("div",{ref:a,className:"flex-1 overflow-y-auto p-6",children:v.jsxs("div",{className:"max-w-4xl",children:[v.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),v.jsxs(hr,{id:"stream-gauges",title:"Stream Gauges",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"A small creek: 50-200 CFS"}),v.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),v.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),v.jsx(de,{children:"When Does It Flood?"}),v.jsxs("p",{children:["Flood levels are set by the ",v.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),v.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),v.jsx(de,{children:"Low Water / Drought"}),v.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Find your gauge at ",v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),v.jsxs("li",{children:["Copy the site number (like ",v.jsx(oe,{children:"13090500"}),")"]}),v.jsx("li",{children:"Add it in Config → Environmental → USGS"}),v.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),v.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),v.jsxs(hr,{id:"wildfire",title:"Wildfire",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),v.jsx(de,{children:"Fire Size — How Big Is It?"}),v.jsx(yt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),v.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),v.jsx(de,{children:"Containment — Is It Under Control?"}),v.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),v.jsx(de,{children:"How Far Away Should I Worry?"}),v.jsx(yt,{headers:["Distance","What To Do"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Under 5 km (3 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 5-15 km (3-10 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 15-30 km (10-20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Over 30 km (20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),v.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),v.jsx(de,{children:"Which Matters More — Size or Distance?"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("p",{children:["Just configure your state code (like ",v.jsx(oe,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),v.jsxs(hr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),v.jsxs("p",{children:[v.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",v.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),v.jsx(de,{children:"Confidence — Is It Really a Fire?"}),v.jsx("p",{children:"Each detection gets a confidence rating:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),v.jsx(de,{children:"FRP — How Intense Is It?"}),v.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),v.jsx(yt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),v.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),v.jsx(de,{children:"New Ignition Detection"}),v.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",v.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),v.jsx(de,{children:"Timing"}),v.jsxs("p",{children:["Satellite data arrives ",v.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",v.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),v.jsx("li",{children:'Click "Get MAP_KEY"'}),v.jsx("li",{children:"Register for a free Earthdata account"}),v.jsx("li",{children:"Your key arrives by email"}),v.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),v.jsxs(hr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[v.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),v.jsx(de,{children:"What you'll see on the mesh"}),v.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),v.jsx(yt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[v.jsx(oe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[v.jsx(oe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",v.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[v.jsx(oe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[v.jsx(oe,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[v.jsx(oe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",v.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[v.jsx(oe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),v.jsx(de,{children:"Daily LLM digest"}),v.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",v.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",v.jsx(oe,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),v.jsx(de,{children:"How attribution works"}),v.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",v.jsx(oe,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),v.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",v.jsx(oe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",v.jsx(oe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",v.jsx(oe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",v.jsx(oe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),v.jsx(de,{children:"How movement is computed"}),v.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",v.jsx(oe,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",v.jsx(oe,{children:"growth_drift_threshold_mi"})," the"," ",v.jsx(oe,{children:"wildfire_growth"})," broadcast fires."]}),v.jsx(de,{children:"How spotting is detected"}),v.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",v.jsx(oe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",v.jsx(oe,{children:"wildfire_spotting"})," broadcast at ",v.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",v.jsx(oe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),v.jsx(de,{children:"Tunable knobs (Adapter Config → fires)"}),v.jsx(yt,{headers:["Key","Default","What it does"],rows:[[v.jsx(oe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[v.jsx(oe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[v.jsx(oe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[v.jsx(oe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[v.jsx(oe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[v.jsx(oe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[v.jsx(oe,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[v.jsx(oe,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[v.jsx(oe,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[v.jsx(oe,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),v.jsxs(hr,{id:"weather-alerts",title:"Weather Alerts",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),v.jsx(de,{children:"Alert Severity — How Serious Is It?"}),v.jsx(yt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),v.jsx(de,{children:"When Should I Act? (Urgency)"}),v.jsx(yt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),v.jsx(de,{children:"How Sure Are They? (Certainty)"}),v.jsx(yt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),v.jsx(de,{children:"These Are Separate Scales"}),v.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),v.jsx(de,{children:"What Minimum Severity Should I Set?"}),v.jsx(yt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),v.jsx(de,{children:"Finding Your NWS Zone"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://www.weather.gov",children:"weather.gov"})]}),v.jsx("li",{children:"Enter your location"}),v.jsxs("li",{children:["Find your zone code at ",v.jsx(Pt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),v.jsxs("li",{children:["Zone codes look like: ",v.jsx(oe,{children:"IDZ016"}),", ",v.jsx(oe,{children:"UTZ040"}),", etc."]})]}),v.jsx(de,{children:"The User-Agent Field"}),v.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),v.jsx("p",{children:v.jsx(oe,{children:"(meshai, you@email.com)"})}),v.jsx("p",{children:"No registration. No waiting. Just type it in."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),v.jsxs(hr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),v.jsx(de,{children:"Solar Flux Index (SFI)"}),v.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),v.jsx(yt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),v.jsx(de,{children:"Kp Index"}),v.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),v.jsx(yt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[v.jsx("strong",{children:"5"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[v.jsx("strong",{children:"6"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[v.jsx("strong",{children:"7"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[v.jsx("strong",{children:"8-9"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),v.jsx(de,{children:"R / S / G Scales"}),v.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),v.jsx(fs,{children:"R (Radio Blackouts) — from solar flares:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),v.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),v.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),v.jsx(fs,{children:"S (Solar Radiation Storms) — from energetic particles:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Mostly affects polar regions and satellites"}),v.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),v.jsx(fs,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),v.jsx(de,{children:"Bz — The Storm Predictor"}),v.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),v.jsx(yt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),v.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),v.jsxs(hr,{id:"ducting",title:"Tropospheric Ducting",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),v.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),v.jsx(de,{children:"How Do I Know If Ducting Is Happening?"}),v.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),v.jsx(yt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),v.jsx(de,{children:"What You'll Actually Notice"}),v.jsx("p",{children:"When ducting happens on your mesh:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),v.jsx("li",{children:"Nodes appear from far outside your normal range"}),v.jsx("li",{children:"You hear FM radio stations from other cities"}),v.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),v.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),v.jsx(de,{children:"The dM/dz Number"}),v.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),v.jsx(de,{children:"When Does Ducting Happen?"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),v.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),v.jsx("li",{children:"Most common in late summer and early fall"}),v.jsx("li",{children:"Strongest along coastlines and over water"}),v.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),v.jsxs(hr,{id:"avalanche",title:"Avalanche Danger",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),v.jsx(de,{children:"The Danger Scale"}),v.jsx(yt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",v.jsx($t,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",v.jsx($t,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",v.jsx($t,{color:"orange"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",v.jsx($t,{color:"red"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",v.jsx($t,{color:"black"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),v.jsx(de,{children:"The Most Important Thing to Know"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),v.jsx(de,{children:"Seasonal"}),v.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),v.jsx(de,{children:"Finding Your Avalanche Center"}),v.jsxs("p",{children:["Go to ",v.jsx(Pt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"UAC"})," — Utah"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"CAIC"})," — Colorado"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"SAC"})," — Sierra Nevada (CA)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),v.jsxs(hr,{id:"traffic",title:"Traffic Flow",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),v.jsx(de,{children:"Speed Ratio — The Key Number"}),v.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),v.jsx(yt,{headers:["Ratio","What It Means"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),v.jsx(de,{children:"Confidence — Can You Trust the Data?"}),v.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),v.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),v.jsx(de,{children:"Setting Up Corridors"}),v.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Go to Google Maps, find the road"}),v.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),v.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),v.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Sign up at ",v.jsx(Pt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),v.jsx("li",{children:"Create an app → get your API key"}),v.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),v.jsxs(hr,{id:"roads-511",title:"Road Conditions (511)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),v.jsx("p",{children:"Configure in Config → Environmental → 511:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"API Key"})," — if required by your state"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),v.jsxs(hr,{id:"mesh-health",title:"Mesh Health",children:[v.jsx(de,{children:"Health Score"}),v.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),v.jsx(yt,{headers:["Pillar","Weight","What It Measures"],rows:[[v.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[v.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[v.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[v.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[v.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),v.jsx("p",{children:"The overall score is the weighted sum:"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),v.jsx(de,{children:"How Each Pillar Is Calculated"}),v.jsx(fs,{children:"Infrastructure (30%)"}),v.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),v.jsxs("p",{children:["Only nodes with the ",v.jsx(oe,{children:"ROUTER"}),", ",v.jsx(oe,{children:"ROUTER_LATE"}),", or ",v.jsx(oe,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),v.jsx(fs,{children:"Utilization (25%)"}),v.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",v.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),v.jsx("p",{children:v.jsx("strong",{children:"How it works:"})}),v.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[v.jsxs("li",{children:["Collect ",v.jsx(oe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),v.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),v.jsxs("li",{children:["Use the ",v.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),v.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),v.jsxs("p",{className:"mt-4",children:[v.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),v.jsx(yt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),v.jsx(fs,{children:"Coverage (20%)"}),v.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),v.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",v.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),v.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),v.jsx(yt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),v.jsx(fs,{children:"Behavior (15%)"}),v.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),v.jsxs("p",{children:[v.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),v.jsx(yt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),v.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),v.jsx(fs,{children:"Power (10%)"}),v.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),v.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),v.jsxs("p",{children:[v.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),v.jsx(de,{children:"Health Tiers"}),v.jsx(yt,{headers:["Score","Tier","What It Means"],rows:[["90-100",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),v.jsx(de,{children:"Channel Utilization — Is the Radio Channel Full?"}),v.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),v.jsx(yt,{headers:["Utilization","What's Happening"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),v.jsx(de,{children:"Packet Flooding"}),v.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:v.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),v.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),v.jsx(yt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),v.jsx(de,{children:"Battery Levels"}),v.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),v.jsx(yt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[v.jsx("strong",{children:"3.60V"}),v.jsx("strong",{children:"~30%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[v.jsx("strong",{children:"3.50V"}),v.jsx("strong",{children:"~15%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"🔴 Low — charge it now"})})],[v.jsx("strong",{children:"3.40V"}),v.jsx("strong",{children:"~7%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),v.jsx(de,{children:"Node Offline Detection"}),v.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),v.jsx(yt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",v.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),v.jsxs(hr,{id:"broadcast-types",title:"Broadcast Types",children:[v.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),v.jsx(yt,{headers:["Prefix","What it means","When you see it"],rows:[[v.jsx(oe,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[v.jsx(oe,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[v.jsx(oe,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),v.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),v.jsxs(hr,{id:"reminders",title:"Reminder System",children:[v.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",v.jsx(oe,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),v.jsx(de,{children:"Cadences"}),v.jsx(yt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[v.jsx(oe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),v.jsx(de,{children:"The tombstone"}),v.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",v.jsx(oe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",v.jsx(oe,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),v.jsx(de,{children:"Turning reminders off"}),v.jsxs("p",{children:["Per-adapter on/off lives in ",v.jsx(oe,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),v.jsxs(hr,{id:"notifications",title:"Notifications",children:[v.jsx(de,{children:"How It Works"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),v.jsx(de,{children:"Building Rules"}),v.jsx("p",{children:"Each rule answers three questions:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),v.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),v.jsx(de,{children:"Severity Levels — What Should I Set?"}),v.jsx(yt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),v.jsx(de,{children:"Webhook — The Swiss Army Knife"}),v.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"ntfy.sh"})," — POST to ",v.jsx(oe,{children:"https://ntfy.sh/your-topic"})]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),v.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),v.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),v.jsxs(hr,{id:"commands",title:"Commands",children:[v.jsxs("p",{children:["All commands use the ",v.jsx(oe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),v.jsx(de,{children:"Basic Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!help"}),"Shows all available commands"],[v.jsx(oe,{children:"!ping"}),"Tests if the bot is alive"],[v.jsx(oe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[v.jsx(oe,{children:"!health"}),"Detailed health report with pillar scores"],[v.jsx(oe,{children:"!weather"}),"Current weather for your area"]]}),v.jsx(de,{children:"Environmental Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!solar"})," (or ",v.jsx(oe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[v.jsx(oe,{children:"!fire"}),"Active wildfires near your mesh"],[v.jsx(oe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!streams"})," (or ",v.jsx(oe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!roads"})," (or ",v.jsx(oe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[v.jsx(oe,{children:"!hotspots"}),"Satellite fire detections"]]}),v.jsx(de,{children:"Subscription Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!subscribe"}),"Lists all alert categories you can subscribe to"],[v.jsx(oe,{children:"!subscribe fire_proximity"}),"Subscribe to a specific category"],[v.jsx(oe,{children:"!subscribe all"}),"Subscribe to everything"],[v.jsx(oe,{children:"!unsubscribe fire_proximity"}),"Unsubscribe from a category"],[v.jsx(oe,{children:"!subscriptions"}),"Shows what you're currently subscribed to"]]}),v.jsx(de,{children:"Conversational"}),v.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",v.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),v.jsxs(hr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[v.jsxs("p",{children:["Bang commands like ",v.jsx(oe,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),v.jsx(de,{children:"What it can answer"}),v.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),v.jsx(yt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[v.jsx(oe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[v.jsx(oe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[v.jsx(oe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[v.jsx(oe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[v.jsx(oe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[v.jsx(oe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[v.jsx(oe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),v.jsx(de,{children:"The grounding rule"}),v.jsxs("p",{children:["The bot is told to answer ",v.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),v.jsx(de,{children:"Excluding an adapter from LLM context"}),v.jsxs("p",{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",v.jsx(oe,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),v.jsx(de,{children:"What it can't answer"}),v.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),v.jsxs(hr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[v.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),v.jsx(de,{children:"Why mutually exclusive"}),v.jsxs("p",{children:["An adapter is set to ",v.jsx("strong",{children:"either"})," Central ",v.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",v.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),v.jsx(de,{children:"The per-adapter source toggle"}),v.jsxs("p",{children:["Set ",v.jsx(oe,{children:"feed_source"})," on each adapter's row in Environment:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),v.jsxs("li",{children:[v.jsx(oe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),v.jsxs("p",{children:["On the GUI, adapters with ",v.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),v.jsx(de,{children:"Where this surfaces in tooltips"}),v.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",v.jsxs(oe,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),v.jsxs(hr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[v.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),v.jsx(de,{children:"The CONFIG-vs-CODE rule"}),v.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),v.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),v.jsx(de,{children:"Restart-required vs live"}),v.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Anything under the ",v.jsx(oe,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),v.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),v.jsx("li",{children:"The dispatcher cold-start grace window."})]}),v.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),v.jsxs(de,{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle"]}),v.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,v.jsx(oe,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),v.jsxs(hr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[v.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),v.jsx(de,{children:"Gauge Sites"}),v.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),v.jsxs("p",{children:[v.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",v.jsx(oe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),v.jsx(de,{children:"Town Anchors"}),v.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),v.jsx("li",{children:"Town Anchors table (your curated list)"}),v.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),v.jsx("li",{children:"County + state fallback"}),v.jsx("li",{children:"Bare lat/lon coords"})]}),v.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),v.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",v.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),v.jsxs(hr,{id:"schema",title:"Schema Migrations",children:[v.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",v.jsx(oe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",v.jsx(oe,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",v.jsx(oe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),v.jsx(de,{children:"v0.6 + v0.7 additions"}),v.jsx(yt,{headers:["Migration","What it added"],rows:[[v.jsx(oe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[v.jsx(oe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[v.jsx(oe,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[v.jsx(oe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[v.jsx(oe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[v.jsx(oe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),v.jsx(de,{children:"When migrations fail"}),v.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",v.jsx(oe,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),v.jsxs(hr,{id:"api",title:"API Reference",children:[v.jsxs("p",{children:["MeshAI's REST API is available at ",v.jsx(oe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),v.jsx(de,{children:"System"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/status"})," — version, uptime, node count"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/channels"})," — radio channel list"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"POST /api/restart"})," — restart the bot"]})]}),v.jsx(de,{children:"Mesh Data"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/health"})," — health score and pillars"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/regions"})," — region summaries"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/sources"})," — data source health"]})]}),v.jsx(de,{children:"Configuration"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/config"})," — full config"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["GET /api/config/","{section}"]})," — one section"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),v.jsx(de,{children:"Environmental"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/status"})," — per-feed health"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/active"})," — all active events"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),v.jsx(de,{children:"Alerts"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/active"})," — current alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/history"})," — past alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),v.jsx(de,{children:"Real-time"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(oe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const Mxe=1500;function Axe(){const[e,t]=G.useState({}),[r,n]=G.useState({}),[i,a]=G.useState(!0),[o,s]=G.useState(null),[l,u]=G.useState({}),[c,h]=G.useState({}),[f,d]=G.useState({}),g=G.useCallback(async()=>{a(!0),s(null);try{const[S,T]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!S.ok)throw new Error(`GET /adapter-config: ${S.status}`);if(!T.ok)throw new Error(`GET /adapter-meta: ${T.status}`);t(await S.json()),n(await T.json())}catch(S){s(String(S))}finally{a(!1)}},[]);G.useEffect(()=>{g()},[g]);const m=G.useCallback((S,T,M)=>{h(A=>({...A,[S]:T})),M&&d(A=>({...A,[S]:M})),T==="saved"&&setTimeout(()=>{h(A=>A[S]==="saved"?{...A,[S]:"idle"}:A)},Mxe)},[]),y=G.useCallback(async(S,T,M)=>{const A=`${S}.${T}`;m(A,"saving");try{const P=await fetch(`/api/adapter-config/${S}/${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:M})});if(!P.ok){const D=(await P.json().catch(()=>({}))).detail||P.statusText;m(A,"error",String(D));return}const I=await P.json();t(N=>({...N,[S]:(N[S]||[]).map(D=>D.key===T?I:D)})),m(A,"saved")}catch(P){m(A,"error",String(P))}},[m]),x=G.useCallback(async(S,T)=>{const M=`${S}.${T}`;m(M,"saving");try{const A=await fetch(`/api/adapter-config/${S}/${T}/reset`,{method:"POST"});if(!A.ok){m(M,"error",`reset failed (${A.status})`);return}const P=await A.json();t(I=>({...I,[S]:(I[S]||[]).map(N=>N.key===T?P:N)})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]),_=G.useCallback(async(S,T)=>{const M=`meta:${S}`;m(M,"saving");try{const A=await fetch(`/api/adapter-meta/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const I=await A.json().catch(()=>({}));m(M,"error",String(I.detail||A.statusText));return}const P=await A.json();n(I=>({...I,[S]:P})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]);if(i)return v.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(o)return v.jsxs("div",{className:"p-6 text-red-400",children:[v.jsx(Vo,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",o]});const w=Array.from(new Set([...Object.keys(r),...Object.keys(e)])).sort();return v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 text-white",children:[v.jsx(BM,{className:"w-5 h-5"}),v.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),v.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.values(e).reduce((S,T)=>S+T.length,0)," settings across ",w.length," adapters"]})]}),v.jsxs("p",{className:"text-xs text-[#777] max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",v.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",v.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),w.map(S=>{const T=r[S]||{display_name:S,include_in_llm_context:!0,description:""},M=e[S]||[],A=l[S]??!1,P=`meta:${S}`,I=c[P]||"idle";return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 flex items-start gap-4",children:[v.jsx("button",{onClick:()=>u(N=>({...N,[S]:!N[S]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:A?v.jsx(ll,{className:"w-5 h-5"}):v.jsx(Js,{className:"w-5 h-5"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"text-base font-semibold text-white",children:T.display_name}),v.jsx("code",{className:"text-xs text-[#666]",children:S}),M.length>0&&v.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",M.length," settings)"]}),M.length===0&&v.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:"(meta only)"})]}),T.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:T.description})]}),v.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[v.jsx("input",{type:"checkbox",checked:T.include_in_llm_context,onChange:N=>_(S,{include_in_llm_context:N.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",v.jsx(t7,{status:I,error:f[P]})]})]}),A&&M.length>0&&v.jsx("div",{className:"border-t border-border divide-y divide-border",children:M.map(N=>v.jsx(kxe,{row:N,status:c[`${S}.${N.key}`]||"idle",error:f[`${S}.${N.key}`],onCommit:D=>y(S,N.key,D),onReset:()=>x(S,N.key)},N.key))})]},S)})]})}function kxe({row:e,status:t,error:r,onCommit:n,onReset:i}){const[a,o]=G.useState(bS(e));G.useEffect(()=>{o(bS(e))},[e.value,e.type]);const s=a!==bS(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=Lxe(a,e.type);c.error||c.changed(e.value)&&n(c.value)};return v.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),v.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&v.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),v.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?v.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?v.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:a,onChange:c=>o(c.target.value),onBlur:u}):v.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-[#0d0d0d] border border-border px-2 py-1 text-sm text-white",value:a,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),v.jsx(t7,{status:t,error:r,dirty:s}),v.jsx("button",{onClick:i,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:v.jsx(Jx,{className:"w-4 h-4"})})]})]})}function t7({status:e,error:t,dirty:r}){return e==="saving"?v.jsx(Dp,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?v.jsx(Za,{className:"w-4 h-4 text-green-500"}):e==="error"?v.jsx("span",{title:t,className:"text-red-400 cursor-help",children:v.jsx(Vo,{className:"w-4 h-4"})}):r?v.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):v.jsx("span",{className:"w-4 h-4"})}function bS(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function Lxe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const wS={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function Nxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(wS),[c,h]=G.useState(!1),[f,d]=G.useState("unknown"),g=G.useCallback(async()=>{n(!0),a(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){a(String(S))}finally{n(!1)}},[]);G.useEffect(()=>{g()},[g]),G.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var T;return d(((T=S==null?void 0:S.usgs)==null?void 0:T.feed_source)||"unknown")}).catch(()=>d("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...wS})},x=()=>{s(null),h(!1),u(wS)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const T=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!T.ok){alert(`delete failed: ${T.status}`);return}g()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Yx,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),v.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add site"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),v.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:9,className:"px-3 py-2",children:v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):v.jsxs("tr",{className:"hover:bg-bg-hover",children:[v.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),v.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),v.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function I3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i,feedSource:a}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=G.useState(!1),[u,c]=G.useState(null),h=a!=="native"||!e.site_id.trim(),f=a!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",d=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",v.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[v.jsx("input",{className:"flex-1 bg-bg border border-border px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!i}),v.jsxs("button",{type:"button",onClick:d,disabled:h||s,title:f,className:"px-2 py-1 bg-bg-hover hover:bg-[#333] disabled:opacity-30 disabled:cursor-not-allowed text-xs text-slate-100 flex items-center gap-1",children:[s?v.jsx(Dp,{className:"w-3 h-3 animate-spin"}):v.jsx(e_,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&v.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}const SS={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function Pxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(!1),[c,h]=G.useState(SS),f=G.useCallback(async()=>{n(!0),a(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){a(String(_))}finally{n(!1)}},[]);G.useEffect(()=>{f()},[f]);const d=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...SS})},m=()=>{s(null),u(!1),h(SS)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const T=await S.json().catch(()=>({}));alert(`save failed: ${T.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nf,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),v.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add town"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),v.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:e.map(_=>o===_.anchor_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:6,className:"px-3 py-2",children:v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):v.jsxs("tr",{className:"hover:bg-bg-hover",children:[v.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>d(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function D3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i}){const a=(o,s)=>t({...e,[o]:s});return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.name,onChange:o=>a("name",o.target.value),disabled:!i})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["State",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>a("state",o.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>a("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:o=>a("lat",parseFloat(o.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:o=>a("lon",parseFloat(o.target.value))})]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}function Ixe(){return v.jsx(cY,{children:v.jsx(pY,{children:v.jsxs(b$,{children:[v.jsx($i,{path:"/",element:v.jsx(CY,{})}),v.jsx($i,{path:"/mesh",element:v.jsx(V0e,{})}),v.jsx($i,{path:"/environment",element:v.jsx(hxe,{})}),v.jsx($i,{path:"/config",element:v.jsx(sxe,{})}),v.jsx($i,{path:"/alerts",element:v.jsx(xxe,{})}),v.jsx($i,{path:"/notifications",element:v.jsx(Cxe,{})}),v.jsx($i,{path:"/reference",element:v.jsx(Txe,{})}),v.jsx($i,{path:"/adapter-config",element:v.jsx(Axe,{})}),v.jsx($i,{path:"/gauge-sites",element:v.jsx(Nxe,{})}),v.jsx($i,{path:"/town-anchors",element:v.jsx(Pxe,{})})]})})})}CS.createRoot(document.getElementById("root")).render(v.jsx(Ch.StrictMode,{children:v.jsx(k$,{children:v.jsx(Ixe,{})})})); diff --git a/meshai/dashboard/static/index.html b/meshai/dashboard/static/index.html index b28d39d..ec194d0 100644 --- a/meshai/dashboard/static/index.html +++ b/meshai/dashboard/static/index.html @@ -8,8 +8,8 @@ - - + +
{r.name} {r.lat.toFixed(4)} {r.lon.toFixed(4)}