var _LKMapUserVersion='2.7.0'; 
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).LKMap=e()}(this,(function(){"use strict";var t,e,i;function r(r,o){if(t)if(e){var n="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://lbs.luokuang.com/doc.html#/doc/jsapi/devGuide/intro/quickUse'); }; var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk); self.onerror = null;",a={};t(a),i=o(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"})))}else e=o;else t=o}return function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}('a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;outline:0}body,html{height:100%;width:100%}a,button,input,select{font-family:Microsoft YaHei,arial,helvetica,sans-serif}.lkmap-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0)}.lkmap-canvas{position:absolute;left:0;top:0}.lkmap-map:-webkit-full-screen{width:100%;height:100%}.lkmap-canary{background-color:salmon}.lkmap-canvas-container.lkmap-interactive{cursor:grab}.lkmap-canvas-container.lkmap-interactive,.lkmap-ctrl-group>button.lkmap-ctrl-compass{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.lkmap-canvas-container.lkmap-interactive:active{cursor:grabbing}.lkmap-canvas-container.lkmap-touch-zoom-rotate,.lkmap-canvas-container.lkmap-touch-zoom-rotate .lkmap-canvas{touch-action:pan-x pan-y}.lkmap-canvas-container.lkmap-touch-drag-pan,.lkmap-canvas-container.lkmap-touch-drag-pan .lkmap-canvas{touch-action:pinch-zoom}.lkmap-canvas-container.lkmap-touch-zoom-rotate.lkmap-touch-drag-pan,.lkmap-canvas-container.lkmap-touch-zoom-rotate.lkmap-touch-drag-pan .lkmap-canvas{touch-action:none}.lkmap-ctrl-bottom-left,.lkmap-ctrl-bottom-right,.lkmap-ctrl-left-center,.lkmap-ctrl-right-center,.lkmap-ctrl-top-left,.lkmap-ctrl-top-right{position:absolute;pointer-events:none;z-index:99999}.lkmap-ctrl-top-left{top:0;left:0}.lkmap-ctrl-top-right{top:0;right:0}.lkmap-ctrl-bottom-left{bottom:20px;left:0}.lkmap-ctrl-bottom-right{right:0;bottom:20px}.lkmap-ctrl-left-center{left:0;top:50%}.lkmap-ctrl-right-center{right:0;top:50%}.lkmap-ctrl{clear:both;pointer-events:auto}.lkmap-ctrl-top-left .lkmap-ctrl{margin:10px 0 0 10px;float:left}.lkmap-ctrl-top-right .lkmap-ctrl{margin:10px 10px 0 0;float:right}.lkmap-ctrl-bottom-left .lkmap-ctrl{margin:0 0 10px 10px;float:left}.lkmap-ctrl-bottom-right .lkmap-ctrl{margin:0 10px 10px 0;float:right}.lkmap-ctrl-left-center .lkmap-ctrl{margin:0 0 10px 10px;float:right}.lkmap-ctrl-right-center .lkmap-ctrl{margin:0 10px 10px 0;float:right}.lkmap-ctrl-group button{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.lkmap-ctrl-group button+button{border-top:1px solid #ddd}.lkmap-ctrl button .lkmap-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@media (-ms-high-contrast:active){.lkmap-ctrl-icon{background-color:transparent}.lkmap-ctrl-group button+button{border-top:1px solid ButtonText}}.lkmap-ctrl button:disabled{cursor:not-allowed}.lkmap-ctrl button:disabled .lkmap-ctrl-icon{opacity:.25}.lkmap-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}.lkmap-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.lkmap-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.lkmap-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.lkmap-ctrl-group button:focus:only-child{border-radius:inherit}.LK-map-logo{position:absolute;bottom:5px;left:10px;z-index:1;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.LK-map-logo,.LK-map-logo .LK-map-logo-img{width:78px;height:20px}.LK-map-logo-right{position:absolute;bottom:2px;right:10px;width:fit-content;height:20px;background:hsla(0,0%,100%,.6);padding-left:2px;line-height:20px;z-index:1;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.LK-map-logo-right>p{font-family:Noto Sans,Noto Sans CJK SC,sans-serif;font-size:12px;color:#676767;margin:0;padding:0}.lkmap-ctrl.lkmap-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.lkmap-ctrl-attrib.lkmap-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;border-radius:12px}.lkmap-ctrl-attrib.lkmap-compact-show{padding:2px 28px 2px 8px;visibility:visible}.lkmap-ctrl-bottom-left>.lkmap-ctrl-attrib.lkmap-compact-show,.lkmap-ctrl-top-left>.lkmap-ctrl-attrib.lkmap-compact-show{padding:2px 8px 2px 28px;border-radius:12px}.lkmap-ctrl-attrib.lkmap-compact .lkmap-ctrl-attrib-inner{display:none}.lkmap-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.lkmap-ctrl-bottom-left .lkmap-ctrl-attrib-button,.lkmap-ctrl-top-left .lkmap-ctrl-attrib-button{left:0}.lkmap-ctrl-attrib.lkmap-compact-show .lkmap-ctrl-attrib-inner,.lkmap-ctrl-attrib.lkmap-compact .lkmap-ctrl-attrib-button{display:block}.lkmap-ctrl-attrib.lkmap-compact-show .lkmap-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.lkmap-ctrl-bottom-right>.lkmap-ctrl-attrib.lkmap-compact:after{bottom:0;right:0}.lkmap-ctrl-top-right>.lkmap-ctrl-attrib.lkmap-compact:after{top:0;right:0}.lkmap-ctrl-top-left>.lkmap-ctrl-attrib.lkmap-compact:after{top:0;left:0}.lkmap-ctrl-bottom-left>.lkmap-ctrl-attrib.lkmap-compact:after{bottom:0;left:0}}.lkmap-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.lkmap-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.lkmap-ctrl-attrib .lkmap-improve-map{font-weight:700;margin-left:2px}.lkmap-attrib-empty{display:none}.lkmap-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;border-width:medium 2px 2px;border-style:none solid solid;border-color:#333;padding:0 5px;color:#333;box-sizing:border-box;height:10px;background-color:transparent;line-height:10%;text-align:center}.lkmap-popup{position:absolute;top:0;left:0;display:flex;z-index:200}.lkmap-popup-anchor-top,.lkmap-popup-anchor-top-center,.lkmap-popup-anchor-top-left,.lkmap-popup-anchor-top-right{flex-direction:column}.lkmap-popup-anchor-bottom,.lkmap-popup-anchor-bottom-center,.lkmap-popup-anchor-bottom-left,.lkmap-popup-anchor-bottom-right{flex-direction:column-reverse}.lkmap-popup-anchor-left,.lkmap-popup-anchor-middle-left{flex-direction:row}.lkmap-popup-anchor-middle-right,.lkmap-popup-anchor-right{flex-direction:row-reverse}.lkmap-popup-tip{width:0;height:0;border:10px solid transparent;z-index:110}.lkmap-popup-anchor-top-center .lkmap-popup-tip,.lkmap-popup-anchor-top .lkmap-popup-tip{align-self:center;border-top:none;border-bottom-color:#fff}.lkmap-popup-anchor-top-left .lkmap-popup-tip{align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.lkmap-popup-anchor-top-right .lkmap-popup-tip{align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.lkmap-popup-anchor-bottom-center .lkmap-popup-tip,.lkmap-popup-anchor-bottom .lkmap-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.lkmap-popup-anchor-bottom-left .lkmap-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.lkmap-popup-anchor-bottom-right .lkmap-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.lkmap-popup-anchor-left .lkmap-popup-tip,.lkmap-popup-anchor-middle-left .lkmap-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.lkmap-popup-anchor-middle-right .lkmap-popup-tip,.lkmap-popup-anchor-right .lkmap-popup-tip{align-self:center;border-right:none;border-left-color:#fff}.lkmap-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent;width:18px;height:18px;text-align:center;line-height:18px}.lkmap-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.lkmap-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;z-index:100}.lkmap-popup-anchor-top-left .lkmap-popup-content{border-top-left-radius:0}.lkmap-popup-anchor-top-right .lkmap-popup-content{border-top-right-radius:0}.lkmap-popup-anchor-bottom-left .lkmap-popup-content{border-bottom-left-radius:0}.lkmap-popup-anchor-bottom-right .lkmap-popup-content{border-bottom-right-radius:0}.lkmap-popup-track-pointer{display:none}.lkmap-popup-track-pointer *{pointer-events:none;user-select:none}.lkmap-map:hover .lkmap-popup-track-pointer{display:flex}.lkmap-map:active .lkmap-popup-track-pointer{display:none}.lkmap-popup .lkmap-popup-content{z-index:100}.lkmap-popup .lkmap-popup-showShadow{position:absolute;bottom:0;left:0;z-index:-1}.lkmap-popup .lkmap-popup-showShadow>div{position:absolute;background-position:0 0;background-repeat:no-repeat;background-size:100% 100%;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598236280888.png)}.lkmap-popup .lkmap-popup-showShadow .topLeft{top:0;left:0;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598240025105.png)}.lkmap-popup .lkmap-popup-showShadow .topRight{top:0;left:0;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598253720190.png)}.lkmap-popup .lkmap-popup-showShadow .bottomRight{top:0;left:0;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598240026449.png)}.lkmap-popup .lkmap-popup-showShadow .bottomLeft{top:0;left:0;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598240026089.png)}.lkmap-popup .lkmap-popup-showShadow-one{background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598087045017.png)}.lkmap-popup .lkmap-popup-showShadow-two{background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598087044309.png)}.lkmap-popup .lkmap-popup-showShadow-three{background-image:url(http://file.bjjxsk.com/file_sdk_icon/1598087044798.png)}.lkmap-marker{position:absolute;top:0;left:0;opacity:1;transition:opacity .2s;cursor:pointer}.lkmap-marker .LKmap-label-content{position:absolute;top:50%;left:50%;height:0}.lkmap-marker .LKmap-label-content .label-content-container{display:block;width:auto;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#fff;padding:0 5px;transform:translate(-50%,-50%);box-shadow:0 2px 6px 0 rgba(97,113,166,.2);border-radius:2px;color:#333}.lkmap-marker-occluded{opacity:.2}.marker-img-box{background:#ccc;opacity:0;z-index:1}.lkmapMarker .lkmap-marker-icon,.lkmapMarker .marker-img,.marker-img-box{position:absolute;top:0;left:0;width:100%;height:100%}.markerKeyframesImgAnimation{-webkit-animation:a 1s infinite ease-out;-moz-animation:a 1s infinite ease-out;-ms-animation:a 1s infinite ease-out}.markerKeyframesAnimationDrop{-webkit-animation:b .6s 1;-moz-animation:b .6s 1;-ms-animation:b .6s 1}@keyframes a{0%{-webkit-transform:translate(0);-moz-transform:translate(0);-ms-transform:translate(0);-o-transform:translate(0)}25%{-webkit-transform:translateY(-15px);-moz-transform:translateY(-15px);-ms-transform:translateY(-15px);-o-transform:translateY(-15px)}50%{-webkit-transform:translateY(-20px);-moz-transform:translateY(-20px);-ms-transform:translateY(-20px);-o-transform:translateY(-20px)}75%{-webkit-transform:translateY(-15px);-moz-transform:translateY(-15px);-ms-transform:translateY(-15px);-o-transform:translateY(-15px)}to{-webkit-transform:translate(0);-moz-transform:translate(0);-ms-transform:translate(0);-o-transform:translate(0)}}@keyframes b{0%{-webkit-transform:translateY(-70px);-moz-transform:translateY(-70px);-ms-transform:translateY(-70px);-o-transform:translateY(-70px)}50%{-webkit-transform:translate(0);-moz-transform:translate(0);-ms-transform:translate(0);-o-transform:translate(0)}90%{-webkit-transform:translateY(-15px);-moz-transform:translateY(-15px);-ms-transform:translateY(-15px);-o-transform:translateY(-15px)}to{-webkit-transform:translate(0);-moz-transform:translate(0);-ms-transform:translate(0);-o-transform:translate(0)}}.lkmap-user-location-dot,.lkmap-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.lkmap-user-location-dot:before{content:"";position:absolute;animation:c 2s infinite}.lkmap-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@keyframes c{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.lkmap-user-location-dot-stale{background-color:#aaa}.lkmap-user-location-dot-stale:after{display:none}.lkmap-user-location-accuracy-circle{background-color:#1da1f233;width:1px;height:1px;border-radius:100%}.lkmap-crosshair,.lkmap-crosshair .lkmap-interactive,.lkmap-crosshair .lkmap-interactive:active{cursor:crosshair}.lkmap-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}@media print{.lkmap-improve-map{display:none}}.animated{animation-duration:.5s;animation-fill-mode:both}@keyframes d{0%{opacity:0;transform:translate3d(0,-30%,0)}to{opacity:1;transform:translateZ(0)}}.fadeInDown{animation-name:d}@keyframes e{0%{top:0}25%{top:-15px}50%{top:-20px}75%{top:-15px}to{top:0}}@keyframes f{0%{top:-70px}80%{top:0}90%{top:-15px}to{top:0}}.textKeyframesAnimation{-webkit-animation:e 1s infinite ease-out;-moz-animation:e 1s infinite ease-out;-ms-animation:e 1s infinite ease-out}.textKeyframesAnimationDrop{-webkit-animation:f .6s 1;-moz-animation:f .6s 1;-ms-animation:f .6s 1}.LKmap-text .LKmap-text-content{position:relative;left:0;top:0}.LKmap-text .LKmap-text-content .text-content-container{display:block;width:auto;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#fff;padding:0 5px;box-shadow:0 2px 6px 0 rgba(97,113,166,.2);border-radius:2px;color:#333}.lkMsgTost{min-width:380px;box-sizing:border-box;border-radius:4px;border:1px solid #e1f3d8;position:fixed;left:50%;top:70px;margin-left:-190px;background-color:#edf2fc;transition:opacity .3s,transform .4s,top .4s;overflow:hidden;padding:15px 15px 15px 20px;display:flex;align-items:center;z-index:100}.lkMsgTost.success{background-color:#f0f9eb;border-color:#bbe4a7;color:#67c23a}.lkMsgTost.warning{background-color:#fdf6ec;border-color:#f1d9b6;color:#e6a23c}.lkMsgTost.error{background-color:#fef0f0;border-color:#f56c6c}#lkMapOperation{position:fixed;bottom:30px;right:30px;background-color:#fff;min-width:200px;border-radius:6px;box-shadow:0 2px 6px 0 rgba(114,124,245,.5);padding:20px 10px}#lkMapOperation h4{font-family:inherit;font-size:14px;line-height:20px;margin:0 0 15px;font-weight:300}#lkMapOperation .btns{margin-bottom:10px}#lkMapOperation .btns>button{padding:0 10px;height:30px;line-height:30px;border-radius:4px;text-align:center;background:#fff;box-sizing:border-box;border:1px solid #0037e4;color:#0037e4;margin-right:10px;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in}#lkMapOperation .btns>button:hover{cursor:pointer;background:#0037e4;color:#fff}#lkMapOperation .btns>button:last-child{margin-bottom:0}#lkMapOperation .btns>button.right{float:right}#lkMapOperation .btns.flex{display:flex;flex-flow:column;align-items:flex-start}#lkMapOperation .btns.flex>button{margin-bottom:15px}#lkMapOperation .btns:last-child{margin-bottom:0}#lkMapOperation .custorm_value{display:flex;margin-bottom:10px}#lkMapOperation .custorm_value .name{line-height:28px;display:inline-block;flex-shrink:0}.lkmap-map .lkmap-overlays{position:absolute;left:0;top:0}.lkmap-map .lkmap-overlays .lkmap-menu{position:absolute;width:max-content}.lkmap-map .lkmap-overlays .lkmap-menu .lkmap-menu-outer{margin:0;list-style-type:none;box-shadow:0 1px 2px rgba(0,0,0,.1);background:none repeat scroll 0 0 #fff;border-radius:2px;padding:0;text-align:left}.lkmap-map .lkmap-overlays .lkmap-menu .lkmap-menu-outer:hover{box-shadow:0 1px 2px rgba(0,0,0,.3)}.lkmap-map .lkmap-overlays .lkmap-menu .lkmap-menu-outer li{cursor:pointer;height:30px;line-height:30px;word-break:break-all;padding:0 10px;font-size:12px;white-space:nowrap}.lkmap-map .lkmap-overlays .lkmap-menu .lkmap-menu-outer li:hover{background-color:#f3f3ee}#lkmap-minimap{border:2px solid #a1a1a1;box-shadow:0 4px 8px 0 hsla(0,0%,9%,.3);border-radius:2px;border:2px solid #fff;background:#fff;position:relative}#lkmap-minimap .LK-map-logo,#lkmap-minimap .LK-map-logo-right{display:none}#lkmap-minimap .lkmap-minimap-box,#lkmap-minimap .lkmap-minimap-win{position:absolute;box-sizing:border-box}#lkmap-minimap .lkmap-minimap-win{cursor:all-scroll}#lkMapInfo{position:fixed;top:30px;right:30px;background-color:#fff;width:360px;border-radius:4px;box-shadow:0 2px 6px 0 rgba(114,124,245,.5);padding:20px 10px}#lkMapInfo h4{font-family:inherit;font-size:14px;line-height:20px;margin:0 0 15px;font-weight:300}#lkMapInfo>p{font-size:12px;line-height:20px;margin:0;padding:0}.lkmap-indoor-floor{position:relative;width:47px;text-align:center;line-height:1.3em;border-radius:24px;box-shadow:0 0 3px 3px rgba(0,0,0,.1);background-color:#fff}.lkmap-indoor-floor .floor-minus,.lkmap-indoor-floor .floor-plus{margin:0 auto;position:relative;display:block;width:47px;height:25px;background:#f3f6fe}.lkmap-indoor-floor .floor-minus:after,.lkmap-indoor-floor .floor-plus:after{content:"";position:absolute;margin:auto;bottom:4px;left:0;right:0;width:0;height:0;border:7px solid transparent;border-top-color:#0037e4}.lkmap-indoor-floor .floor-minus:hover:after,.lkmap-indoor-floor .floor-plus:hover:after{opacity:.8}.lkmap-indoor-floor .floor-plus{border-radius:100px 100px 0 0}.lkmap-indoor-floor .floor-plus:after{border-bottom-color:#0037e4;border-top-color:transparent;bottom:9px}.lkmap-indoor-floor .floor-plus.forbid:after{opacity:1!important;border-bottom-color:#ccc}.lkmap-indoor-floor .floor-minus{border-radius:0 0 100px 100px}.lkmap-indoor-floor .floor-minus.forbid:after{opacity:1!important;border-top-color:#ccc}.lkmap-indoor-floor .floor-list-box{max-height:185px;overflow:scroll;-ms-overflow-style:none;overflow:-moz-scrollbars-none;-webkit-user-select:none;-moz-user-select:none;scrollbar-width:none}.lkmap-indoor-floor .floor-list-box::-webkit-scrollbar{width:0!important;height:0!important}.lkmap-indoor-floor .floor-list-box ul{list-style:none;margin:0;padding:0 5px;width:40px;box-sizing:border-box}.lkmap-indoor-floor .floor-list-box ul li{height:37px;width:37px;border-radius:19px}.lkmap-indoor-floor .floor-list-box ul li div{height:37px;text-align:center;line-height:37px;font-size:12px}.lkmap-indoor-floor .floor-list-box ul li:hover{background-color:#f2f2f2}.lkmap-indoor-floor .floor-list-box ul li.selected{color:#fff;background-color:#0037e4!important}.bgImage{background-image:url(http://file.bjjxsk.com/file_sdk_icon/1663062132907.png);background-size:160px 160px;background-repeat:no-repeat}.lkmap-measure-tool-box{background:#2c2f32;pointer-events:auto;display:flex;padding:4px 12px;border-radius:6px}.lkmap-measure-tool-box .lkmap-measure-tool-items{width:40px;height:40px;border:2px solid rgba(44,47,50,0);box-sizing:border-box;margin-right:10px;-webkit-transition:background-color .15s ease-in;-moz-transition:background-color .15s ease-in;-ms-transition:background-color .15s ease-in;-o-transition:background-color .15s ease-in;font-size:14px;font-family:PingFangSC-Regular,PingFang SC;color:#0037e4;line-height:38px;text-align:center;border-radius:4px;position:relative;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1663062132907.png);background-size:160px 160px;background-repeat:no-repeat}.lkmap-measure-tool-box .lkmap-measure-tool-items:last-child{margin-right:0}.lkmap-measure-tool-box .lkmap-measure-tool-items.lkmap-measure-tool-distance{background-position:-2px -2px}.lkmap-measure-tool-box .lkmap-measure-tool-items.lkmap-measure-tool-triangulation{background-position:-42px -2px}.lkmap-measure-tool-box .lkmap-measure-tool-items.lkmap-measure-tool-measureArea{background-position:-82px -2px}.lkmap-measure-tool-box .lkmap-measure-tool-items.lkmap-measure-tool-clear{background-position:-122px -2px}.lkmap-measure-tool-box .lkmap-measure-tool-items.lkmap-measure-tool-active{background-color:#006eff}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip{position:absolute;top:40px;left:18px;width:80px;margin-left:-40px;padding:12px 0 0;display:none;z-index:2}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip .tooltip-text{font-size:12px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#fff;line-height:14px;background:#000;position:relative;height:20px;line-height:20px;border-radius:4px;width:100%}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip .tooltip-text:after{content:"";width:0;height:0;border-width:6px;border-style:solid;border-color:transparent transparent #000;position:absolute;top:-12px;left:50%;margin-left:-6px}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip.position-right{position:absolute;top:10px;right:40px;left:unset;width:80px;margin-left:-40px;padding:0 12px 0 0}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip.position-right .tooltip-text:after{border-color:transparent transparent transparent #000;position:absolute;top:4px;right:-12px;left:unset}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip.position-left{position:absolute;top:10px;right:unset;left:70px;width:80px;margin-left:-30px!important;padding:0 0 0 12px}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip.position-left .tooltip-text:after{border-color:transparent #000 transparent transparent;position:absolute;top:4px;right:unset;left:-6px}.lkmap-measure-tool-box .lkmap-measure-tool-items .measure-tooltip.minTip{margin-left:-30px!important;width:60px!important}.lkmap-measure-tool-box .lkmap-measure-tool-items:hover{cursor:pointer;background-color:#006eff}.lkmap-measure-tool-box .lkmap-measure-tool-items:hover .measure-tooltip{display:block}.lkmap-measure-tool-box.tool-flex-flow{flex-flow:column;padding:12px 4px}.lkmap-measure-tool-box.tool-flex-flow .lkmap-measure-tool-items{margin:0 0 14px}.lkmap-measure-tool-box.tool-flex-flow .lkmap-measure-tool-items:last-child{margin-bottom:0}.measure-tools-wrap{padding:3px;display:flex;display:-ms-flexbox;-moz-align-items:center;-ms-align-items:center;align-items:center}.measure-tools-wrap .mt-distance-unit{padding-left:4px}.measure-tools-wrap .mt-distance-text-blue{color:#0037e4}.measure-tools-wrap .mt-del-icon{display:inline-block;width:12px;height:12px;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1663062132907.png);background-size:160px 160px;background-repeat:no-repeat;background-position:-133px -134px;margin:0 0 0 10px}.measure-tools-wrap .mt-del-icon:hover{cursor:pointer}.measure-tools-wrap .mt-del-segmentation{display:inline-block;width:1px;height:16px;background-color:#979797;margin:0 7px;opacity:.3}.measure-tools-wrap .mt-del-line-icon,.measure-tools-wrap .mt-del-polygon-icon{display:inline-block;width:18px;height:17px;background-image:url(http://file.bjjxsk.com/file_sdk_icon/1663062132907.png);background-size:160px 160px;background-repeat:no-repeat;background-position:-131px -109px}.measure-tools-wrap .mt-del-line-icon:hover,.measure-tools-wrap .mt-del-polygon-icon:hover{cursor:pointer}'),r(0,(function(t){var e=i;function i(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=i,this.p2y=r}i.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},i.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},i.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},i.prototype.solveCurveX=function(t,e){var i,r,o,n,a;for(void 0===e&&(e=1e-6),o=t,a=0;a<8;a++){if(n=this.sampleCurveX(o)-t,Math.abs(n)<e)return o;var s=this.sampleCurveDerivativeX(o);if(Math.abs(s)<1e-6)break;o-=n/s}if((o=t)<(i=0))return i;if(o>(r=1))return r;for(;i<r;){if(n=this.sampleCurveX(o),Math.abs(n-t)<e)return o;t>n?i=o:r=o,o=.5*(r-i)+i}return o},i.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),o=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var n="undefined"!=typeof self?self:{},a={API_URL:"http://map.bjjxsk.com",WEB_API:"http://webapi.bjjxsk.com",FILE_API:"http://file.bjjxsk.com",get API_URL_REGEX(){},get EVENTS_URL(){return null},SESSION_PATH:!1,TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:"ACCESS_TOKEN",MAX_PARALLEL_IMAGE_REQUESTS:16,USER_AK:"",key:"",accessToken:"",version:"2.7.0",pluginVersion:"230620",userVersion:"",stamp:"",httpsStatus:!0};function s(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(!s(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!s(t[r],e[r]))return!1;return!0}return t===e}var l=Math.pow(2,53)-1,u=Math.PI/180,h=180/Math.PI,p=a.FILE_API;function c(t){return t*u}var f=[[0,0],[1,0],[1,1],[0,1]];function d(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function m(t,i,r,o){var n=new e(t,i,r,o);return function(t){return n.solve(t)}}var y=m(.25,.1,.25,1);function g(t,e,i){return Math.min(i,Math.max(e,t))}function _(t,e,i){var r=i-e,o=((t-e)%r+r)%r+e;return o===e?i:o}function v(t,e,i){if(!t.length)return i(null,[]);var r=t.length,o=new Array(t.length),n=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(n=t),o[a]=e,0==--r&&i(n,o)}))}))}function x(t){var e=[];for(var i in t)e.push(t[i]);return e}function b(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,o=e;r<o.length;r+=1){var n=o[r];for(var a in n)t[a]=n[a]}return t}var w=1;function k(){return w++}function T(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function I(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function S(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function E(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function A(t,e){return-1!==t.indexOf(e,t.length-e.length)}function P(t,e,i){var r={};for(var o in t)r[o]=e.call(i||this,t[o],o,t);return r}function M(t,e,i){var r={};for(var o in t)e.call(i||this,t[o],o,t)&&(r[o]=t[o]);return r}function L(t){return Array.isArray(t)?t.map(L):"object"==typeof t&&t?P(t,L):t}var C={};function D(t){C[t]||(C[t]=!0)}function z(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function O(t){for(var e=0,i=0,r=t.length,o=r-1,n=void 0,a=void 0;i<r;o=i++)e+=((a=t[o]).x-(n=t[i]).x)*(n.y+a.y);return e}function R(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function B(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,i,r,o){var n=r||o;return e[i]=!n||n.toLowerCase(),""})),e["max-age"]){var i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}var F,U,j,N=null;function V(t){if(null==N){var e=t.navigator?t.navigator.userAgent:null;N=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return N}function G(t){try{var e=n[t];return e.setItem("_lkmap_test_",1),e.removeItem("_lkmap_test_"),!0}catch(t){return!1}}var Z,q,X={now:function(){return void 0!==j?j:n.performance.now()},setNow:function(t){j=t},restoreNow:function(){j=void 0},frame:function(t){var e=n.requestAnimationFrame(t);return{cancel:function(){return n.cancelAnimationFrame(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var i=n.document.createElement("canvas"),r=i.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,r.drawImage(t,0,0,t.width,t.height),r.getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImagePartData:function(t,e,i,r,o,n,a,s){if(void 0===s&&(s=0),!e)throw new Error("failed to create canvas 2d context");return t.width=n,t.height=a,e.clearRect(0,0,n,a),e.drawImage(i,r,o,n,a,0,0,n,a),e.getImageData(-s,-s,n+2*s,a+2*s)},resolveURL:function(t){return F||(F=n.document.createElement("a")),F.href=t,F.href},get devicePixelRatio(){return n.devicePixelRatio},get prefersReducedMotion(){return!!n.matchMedia&&(null==U&&(U=n.matchMedia("(prefers-reduced-motion: reduce)")),U.matches)}},W={supported:!1,testSupport:function(t){!H&&q&&(Y?K(t):Z=t)}},H=!1,Y=!1;function K(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,q),t.isContextLost())return;W.supported=!0}catch(t){}t.deleteTexture(e),H=!0}n.document&&((q=n.document.createElement("img")).onload=function(){Z&&K(Z),Z=null,Y=!0},q.onerror=function(){H=!0,Z=null},q.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var J="01",Q="NO_ACCESS_TOKEN",$=function(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken(),this._config=a,a.USER_AK=a.key=this.getKey(),a.userVersion=n._LKMapUserVersion||this.getKey("v")||this.getKey("version")||""};function tt(t){return 0===t.indexOf("luokuang:")}$.prototype.getKey=function(t){void 0===t&&(t="ak");try{var e=function(t){for(var e=t.length,i=null,r=0;r<e&&!((i=document.querySelector?t[r].src:t[r].getAttribute("src",4)).indexOf("ak=")>-1&&(i.indexOf(a.WEB_API+"/maps")>-1||i.indexOf("lkmap-dev.js")>-1||i.indexOf("lkmap.js")>-1||i.indexOf("LKmap.js")>-1)||i.indexOf("nightLKmap.js")>-1);r++);return i?i.split("?")[1]:null}(document.getElementsByTagName("script"));return function(i){if(e&&e.indexOf("&")>0){var r,o=0,n=(a=e.split("&")).length;for(o=0;o<n;o++)if(i==(r=a[o].split("="))[0])return r[1]}else if(e.indexOf(t+"=")>-1){var a;return(a=e.split("="))[1]}return null}(t)}catch(t){alert("引入sdk方式错误，请检查")}},$.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",J,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},$.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},$.prototype.transformRequest=function(t,e){if(this._transformRequestFn)return this._transformRequestFn(t,e)||{url:t};var i="?";return t.indexOf("?")>-1&&(i="&"),{url:t=t+i+"ak="+a.USER_AK}},$.prototype.normalizeStyleURL=function(t,e){if(!tt(t))return t;var i=it(t);return i.path="/styles/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},$.prototype.normalizeImageLibURL=function(t,e){if(!tt(t))return t;var i=it(t);return this._makeAPIURL(i,this._customAccessToken||e)},$.prototype.normalizeGlyphsURL=function(t,e){if(!tt(t))return t;var i=it(t);return i.path="/fonts/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},$.prototype.normalizeSourceURL=function(t,e){if(!tt(t))return t;var i=it(t);return i.path="/v4/"+i.authority+".json",i.params.push("secure"),this._makeAPIURL(i,this._customAccessToken||e)},$.prototype.normalizeSpriteURL=function(t,e,i,r){var o=it(t);return tt(t)?(o.path="/styles/v1"+o.path+"/sprite"+e+i,this._makeAPIURL(o,this._customAccessToken||r)):(o.path+=""+e+i,rt(o))},$.prototype.normalizeTileURL=function(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!tt(t))return t;var r=it(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(e||i&&"raster"!==r.authority&&512===i?"@2x":"")+(W.supported?".webp":"$1")),"raster"===r.authority?r.path="/"+a.RASTER_URL_PREFIX+r.path:(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/"+a.TILE_URL_VERSION+r.path);var o=this._customAccessToken||function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e].match(/^access_token=(.*)$/);if(r)return r[1]}return null}(r.params)||a.ACCESS_TOKEN;return a.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&r.params.push("sku="+this._skuToken),this._makeAPIURL(r,o)},$.prototype.canonicalizeTileURL=function(t,e){var i=it(t);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;var r="lkmap://";i.path.match(/^\/raster\/v1\//)?r+="raster/"+i.path.replace("/"+a.RASTER_URL_PREFIX+"/",""):r+="tiles/"+i.path.replace("/"+a.TILE_URL_VERSION+"/","");var o=i.params;return e&&(o=o.filter((function(t){return!t.match(/^access_token=/)}))),o.length&&(r+="?"+o.join("&")),r},$.prototype.canonicalizeTileset=function(t,e){e&&tt(e);for(var i=[],r=0,o=t.tiles||[];r<o.length;r+=1)i.push(o[r]);return i},$.prototype._makeAPIURL=function(t,e){var i=it(a.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,"http"===t.protocol){var r=t.params.indexOf("secure");r>=0&&t.params.splice(r,1)}if("/"!==i.path&&(t.path=""+i.path+t.path),!a.REQUIRE_ACCESS_TOKEN)return rt(t);if(e=e||a.ACCESS_TOKEN,!this._silenceAuthErrors&&!e)throw new Error("An ak access token is required to use LKMap. See 查看帮助");return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+(e||"")),rt(t)};var et=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function it(t){var e=t.match(et);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function rt(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}var ot="LKMap.eventData";function nt(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(n.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var at=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};at.prototype.getStorageKey=function(t){var e,i=nt(a.ACCESS_TOKEN);return e=i&&i.u?n.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):a.ACCESS_TOKEN||"",t?ot+"."+t+":"+e:ot+":"+e},at.prototype.fetchEventData=function(){var t=G("localStorage"),e=this.getStorageKey(),i=this.getStorageKey("uuid");if(t)try{var r=n.localStorage.getItem(e);r&&(this.eventData=JSON.parse(r));var o=n.localStorage.getItem(i);o&&(this.anonId=o)}catch(t){D("Unable to read from LocalStorage")}},at.prototype.saveEventData=function(){var t=G("localStorage"),e=this.getStorageKey(),i=this.getStorageKey("uuid");if(t)try{n.localStorage.setItem(i,this.anonId),Object.keys(this.eventData).length>=1&&n.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){D("Unable to write to LocalStorage")}},at.prototype.processRequests=function(t){},at.prototype.postEvent=function(t,e,i,r){var o=this;if(a.EVENTS_URL){var n=it(a.EVENTS_URL);n.params.push("access_token="+(r||a.ACCESS_TOKEN||""));var s={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"lkmap",sdkVersion:"2.3.0-dev",skuId:J,userId:this.anonId},l=e?b(s,e):s,u={url:rt(n),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=Ct(u,(function(t){o.pendingRequest=null,i(t),o.saveEventData(),o.processRequests(r)}))}},at.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var st,lt,ut=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,i,r){this.skuToken=e,this.errorCb=r,a.EVENTS_URL&&(i||a.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Q)))},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id,o=i.timestamp;r&&this.success[r]||(this.anonId||this.fetchEventData(),S(this.anonId)||(this.anonId=T()),this.postEvent(o,{skuToken:this.skuToken},(function(t){t?e.errorCb(t):r&&(e.success[r]=!0)}),t))}},e}(at),ht=function(t){function e(){t.call(this,"map.auth"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getSession=function(t,e,i,r){var o=this;if(a.API_URL&&a.SESSION_PATH){var n=it(a.API_URL+a.SESSION_PATH);n.params.push("sku="+(e||"")),n.params.push("access_token="+(r||a.ACCESS_TOKEN||""));var s={url:rt(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=Dt(s,(function(t){o.pendingRequest=null,i(t),o.saveEventData(),o.processRequests(r)}))}},e.prototype.getSessionAPI=function(t,e,i,r){this.skuToken=e,this.errorCb=r,a.SESSION_PATH&&a.API_URL&&(i||a.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Q)))},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id;r&&this.success[r]||this.getSession(i.timestamp,this.skuToken,(function(t){t?e.errorCb(t):r&&(e.success[r]=!0)}),t)}},e}(at),pt=function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){a.EVENTS_URL&&a.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return tt(t)||!1}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var i=nt(a.ACCESS_TOKEN),r=i?i.u:a.ACCESS_TOKEN,o=r!==this.eventData.tokenU;S(this.anonId)||(this.anonId=T(),o=!0);var n=this.queue.shift();if(this.eventData.lastSuccess){var s=new Date(this.eventData.lastSuccess),l=new Date(n),u=(n-this.eventData.lastSuccess)/864e5;o=o||u>=1||u<-1||s.getDate()!==l.getDate()}else o=!0;if(!o)return this.processRequests();this.postEvent(n,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=n,e.eventData.tokenU=r)}),t)}},e}(at),ct=new pt,ft=ct.postTurnstileEvent.bind(ct),dt=new ut,mt=dt.postMapLoadEvent.bind(dt),yt=new ht,gt=yt.getSessionAPI.bind(yt),_t=new Set,vt="lkmap-tiles",xt=500,bt=50;function wt(){n.caches&&!st&&(st=n.caches.open(vt))}function kt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var Tt=1/0,It={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(It);var St,Et,At=function(t){function e(e,i,r){t.call(this,e),this.status=i,this.url=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),Pt=R()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===n.location.protocol?n.parent:n).location.href},Mt=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Pt())&&!/^\w+:/.test(i))){if(n.fetch&&n.Request&&n.AbortController&&n.Request.prototype.hasOwnProperty("signal"))return function(t,e){var i=new n.AbortController,r=new n.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Pt(),signal:i.signal}),o=!1,a=!1,s=r.url.indexOf("sku=")>0&&!1;"json"===t.type&&r.headers.set("Accept","application/json");var l=function(i,o,l){if(!a){if(i&&"SecurityError"!==i.message&&D(i),o&&l)return u(o);var h=Date.now();n.fetch(r).then((function(i){if(i.ok){var r=s?i.clone():null;return u(i,r,h)}return e(new At(i.statusText,i.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},u=function(i,s,l){("arrayBuffer"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((function(t){a||(s&&l&&function(t,e,i){if(wt(),st){var r={status:e.status,statusText:e.statusText,headers:new n.Headers};e.headers.forEach((function(t,e){return r.headers.set(e,t)}));var o=B(e.headers.get("Cache-Control")||"");o["no-store"]||(o["max-age"]&&r.headers.set("Expires",new Date(i+1e3*o["max-age"]).toUTCString()),new Date(r.headers.get("Expires")).getTime()-i<42e4||function(t,e){if(void 0===lt)try{new Response(new ReadableStream),lt=!0}catch(t){lt=!1}lt?e(t.body):t.blob().then(e)}(e,(function(e){var i=new n.Response(e,r);wt(),st&&st.then((function(e){return e.put(kt(t.url),i)})).catch((function(t){return D(t.message)}))})))}}(r,s,l),o=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((function(t){a||e(new Error(t.message))}))};return s?function(t,e){if(wt(),!st)return e(null);var i=kt(t.url);st.then((function(t){t.match(i).then((function(r){var o=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),i=B(t.headers.get("Cache-Control")||"");return e>Date.now()&&!i["no-cache"]}(r);t.delete(i),o&&t.put(i,r.clone()),e(null,r,o)})).catch(e)})).catch(e)}(r,l):l(null,null),{cancel:function(){a=!0,o||i.abort()}}}(t,e);if(R()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){var i=new n.XMLHttpRequest;for(var r in i.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(i.responseType="arraybuffer"),t.headers)i.setRequestHeader(r,t.headers[r]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=function(){e(new Error(i.statusText))},i.onload=function(){if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){var r=i.response;if("json"===t.type)try{r=JSON.parse(i.response)}catch(t){return e(t)}e(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else e(new At(i.statusText,i.status,t.url))},i.send(t.body),{cancel:function(){return i.abort()}}}(t,e)},Lt=function(t,e){return Mt(b(t,{type:"arrayBuffer"}),e)},Ct=function(t,e){return Mt(b(t,{method:"POST"}),e)},Dt=function(t,e){return Mt(b(t,{method:"GET"}),e)},zt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";St=[],Et=0;var Ot=function(t,e){if(W.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Et>=a.MAX_PARALLEL_IMAGE_REQUESTS){var i={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return St.push(i),i}Et++;var r=!1,o=function(){if(!r)for(r=!0,Et--;St.length&&Et<a.MAX_PARALLEL_IMAGE_REQUESTS;){var t=St.shift();t.cancelled||(t.cancel=Ot(t.requestParameters,t.callback).cancel)}},s=Lt(t,(function(t,i,r,a){o(),t?e(t):i&&(n.createImageBitmap?function(t,e){var i=new n.Blob([new Uint8Array(t)],{type:"image/png"});n.createImageBitmap(i).then((function(t){e(null,t)})).catch((function(t){e(new Error("Could not load image because of "+t.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}))}(i,(function(t,i){return e(t,i,r,a)})):function(t,e){var i=new n.Image,r=n.URL;i.onload=function(){e(null,i),r.revokeObjectURL(i.src),i.onload=null,n.requestAnimationFrame((function(){i.src=zt}))},i.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var o=new n.Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?r.createObjectURL(o):zt}(i,(function(t,i){return e(t,i,r,a)})))}));return{cancel:function(){s.cancel(),o()}}};function Rt(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function Bt(t,e,i){if(i&&i[t]){var r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}var Ft=function(t,e){void 0===e&&(e={}),b(this,e),this.type=t},Ut=function(t){function e(e,i){void 0===i&&(i={}),t.call(this,"error",b({error:e},i))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ft),jt=function(){};jt.prototype.on=function(t,e){return this._listeners=this._listeners||{},Rt(t,e,this._listeners),this},jt.prototype.onBack=function(t,e){return this._listeners=this._listeners||{},Rt(t,e,this._listeners),this},jt.prototype.off=function(t,e){return Bt(t,e,this._listeners),Bt(t,e,this._oneTimeListeners),this},jt.prototype.offBack=function(t,e){return Bt(t,e,this._listeners),Bt(t,e,this._oneTimeListeners),this},jt.prototype.once=function(t,e){var i=this;return e?(this._oneTimeListeners=this._oneTimeListeners||{},Rt(t,e,this._oneTimeListeners),this):new Promise((function(e){return i.once(t,e)}))},jt.prototype.fire=function(t,e){"string"==typeof t&&(t=new Ft(t,e||{}));var i=t.type;if(this.listens(i)){t.target=this;for(var r=0,o=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];r<o.length;r+=1)o[r].call(this,t);for(var n=0,a=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];n<a.length;n+=1){var s=a[n];Bt(i,s,this._oneTimeListeners),s.call(this,t)}var l=this._eventedParent;l&&(b(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),l.fire(t))}else t instanceof Ut&&t.error.status&&t.error.status;return this},jt.prototype.listens=function(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))},jt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Nt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image","source_model"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},lkmap:{}},default:"lkmap"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_model:{type:{required:!0,type:"enum",default:"model",values:{model:{}}},url:{required:!0,type:"string"},modelType:{type:"string",value:"string",default:"glb"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},model:{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{},"middle-left":{},"middle-right":{},"top-center":{},"bottom-center":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{},"middle-left":{},"middle-right":{},"top-center":{},"bottom-center":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.1,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky","paint_model"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-animate-enable":{type:"boolean",default:!1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-water-enable":{type:"boolean",default:!1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-exclude":{type:"string",default:"none",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-direction":{type:"string",default:"up",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-isGradient":{type:"boolean",default:!1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-isTile":{type:"boolean",default:!1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-roofcolor":{type:"color",default:"#bcd4e6",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_model:{"model-default-color":{type:"color",default:"#999999",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"model-blend-light":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-height":{type:"number",default:0,minimum:-1e3,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-animate-enable":{type:"boolean",default:!1,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-animate-interval":{type:"number",default:1,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-animate-duration":{type:"number",default:4,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-animate-trailLength":{type:"number",default:.2,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},Vt=function(t,e,i,r){this.message=(t?t+": ":"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__),this.value=e,this.layer=[],this.paint=[],this.layout=[];var o=t.split(".");if(o.length>0)if(this.layerIndex=parseInt(o[0].substring(7,o[0].length-1)),1==o.length&&0==o[0].indexOf("layers["))this.duplicate=(i.indexOf("duplicate layer id"),!0),this.duplicateId=e;else if(2==o.length)this.layer.push(o[1]);else if(o.length>=3)switch(o[1]){case"paint":this.paint.push(o[2]),o[3]&&this.paint.push(o[3]);break;case"layout":this.layout.push(o[2]),o[3]&&this.layout.push(o[3])}};function Gt(t){var e=t.value;return e?[new Vt(t.key,e,"constants have been deprecated as of v8")]:[]}function Zt(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,o=e;r<o.length;r+=1){var n=o[r];for(var a in n)t[a]=n[a]}return t}function qt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Xt(t){if(Array.isArray(t))return t.map(Xt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var i in t)e[i]=Xt(t[i]);return e}return qt(t)}var Wt=function(t){function e(e,i){t.call(this,i),this.message=i,this.key=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),Ht=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var i=0,r=e;i<r.length;i+=1){var o=r[i];this.bindings[o[0]]=o[1]}};Ht.prototype.concat=function(t){return new Ht(this,t)},Ht.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Ht.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Yt=Ht,Kt={kind:"null"},Jt={kind:"number"},Qt={kind:"string"},$t={kind:"boolean"},te={kind:"color"},ee={kind:"object"},ie={kind:"value"},re={kind:"collator"},oe={kind:"formatted"},ne={kind:"resolvedImage"};function ae(t,e){return{kind:"array",itemType:t,N:e}}function se(t){if("array"===t.kind){var e=se(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var le=[Kt,Jt,Qt,$t,te,oe,ee,ae(ie),ne];function ue(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ue(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var i=0,r=le;i<r.length;i+=1)if(!ue(r[i],e))return null}return"Expected "+se(t)+" but found "+se(e)+" instead."}function he(t,e){return e.some((function(e){return e.kind===t.kind}))}function pe(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}function ce(t){var e={exports:{}};return t(e,e.exports),e.exports}var fe=ce((function(t,e){var i={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function r(t){return(t=Math.round(t))<0?0:t>255?255:t}function o(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function n(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in i)return i[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var h=s.substr(0,l),p=s.substr(l+1,u-(l+1)).split(","),c=1;switch(h){case"rgba":if(4!==p.length)return null;c=n(p.pop());case"rgb":return 3!==p.length?null:[o(p[0]),o(p[1]),o(p[2]),c];case"hsla":if(4!==p.length)return null;c=n(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=n(p[1]),m=n(p[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[r(255*a(g,y,f+1/3)),r(255*a(g,y,f)),r(255*a(g,y,f-1/3)),c];default:return null}}return null}}catch(t){}})),de=function(t,e,i,r){void 0===r&&(r=1),this.r=t,this.g=e,this.b=i,this.a=r};de.parse=function(t){if(t){if(t instanceof de)return t;if("string"==typeof t){var e=fe.parseCSSColor(t);if(e)return new de(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},de.prototype.toString=function(){var t=this.toArray(),e=t[1],i=t[2],r=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(i)+","+r+")"},de.prototype.toArray=function(){var t=this,e=t.a;return 0===e?[0,0,0,0]:[255*t.r/e,255*t.g/e,255*t.b/e,e]},de.black=new de(0,0,0,1),de.white=new de(1,1,1,1),de.transparent=new de(0,0,0,0),de.red=new de(1,0,0,1),de.blue=new de(0,0,1,1);var me=de,ye=function(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};ye.prototype.compare=function(t,e){return this.collator.compare(t,e)},ye.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ge=ye,_e=function(t,e,i,r,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=o},ve=function(t){this.sections=t};ve.fromString=function(t){return new ve([new _e(t,null,null,null,null)])},ve.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},ve.factory=function(t){return t instanceof ve?t:ve.fromString(t)},ve.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ve.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var r=i[e];if(r.image)t.push(["image",r.image.name]);else{t.push(r.text);var o={};r.fontStack&&(o["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(o["font-scale"]=r.scale),r.textColor&&(o["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(o)}}return t};var xe=ve,be=function(t){this.name=t.name,this.available=t.available};be.prototype.toString=function(){return this.name},be.fromString=function(t){return t?new be({name:t,available:!1}):null},be.prototype.serialize=function(){return["image",this.name]};var we=be;function ke(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value ["+[t,e,i,r].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function Te(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof me)return!0;if(t instanceof ge)return!0;if(t instanceof xe)return!0;if(t instanceof we)return!0;if(Array.isArray(t)){for(var e=0,i=t;e<i.length;e+=1)if(!Te(i[e]))return!1;return!0}if("object"==typeof t){for(var r in t)if(!Te(t[r]))return!1;return!0}return!1}function Ie(t){if(null===t)return Kt;if("string"==typeof t)return Qt;if("boolean"==typeof t)return $t;if("number"==typeof t)return Jt;if(t instanceof me)return te;if(t instanceof ge)return re;if(t instanceof xe)return oe;if(t instanceof we)return ne;if(Array.isArray(t)){for(var e,i=t.length,r=0,o=t;r<o.length;r+=1){var n=Ie(o[r]);if(e){if(e===n)continue;e=ie;break}e=n}return ae(e||ie,i)}return ee}function Se(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof me||t instanceof xe||t instanceof we?t.toString():JSON.stringify(t)}var Ee=function(t,e){this.type=t,this.value=e};Ee.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!Te(t[1]))return e.error("invalid value");var i=t[1],r=Ie(i),o=e.expectedType;return"array"!==r.kind||0!==r.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(r=o),new Ee(r,i)},Ee.prototype.evaluate=function(){return this.value},Ee.prototype.eachChild=function(){},Ee.prototype.outputDefined=function(){return!0},Ee.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof me?["rgba"].concat(this.value.toArray()):this.value instanceof xe?this.value.serialize():this.value};var Ae=Ee,Pe=function(t){this.name="ExpressionEvaluationError",this.message=t};Pe.prototype.toJSON=function(){return this.message};var Me=Pe,Le={string:Qt,number:Jt,boolean:$t,object:ee},Ce=function(t,e){this.type=t,this.args=e};Ce.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i,r=1,o=t[0];if("array"===o){var n,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in Le)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=Le[s],r++}else n=ie;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=ae(n,a)}else i=Le[o];for(var l=[];r<t.length;r++){var u=e.parse(t[r],r,ie);if(!u)return null;l.push(u)}return new Ce(i,l)},Ce.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var i=this.args[e].evaluate(t);if(!ue(this.type,Ie(i)))return i;if(e===this.args.length-1)throw new Me("Expected value to be of type "+se(this.type)+", but found "+se(Ie(i))+" instead.")}return null},Ce.prototype.eachChild=function(t){this.args.forEach(t)},Ce.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},Ce.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);var r=t.N;("number"==typeof r||this.args.length>1)&&e.push(r)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var De=Ce,ze=function(t){this.type=oe,this.sections=t};ze.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");for(var r=[],o=!1,n=1;n<=t.length-1;++n){var a=t[n];if(o&&"object"==typeof a&&!Array.isArray(a)){o=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Jt)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,ae(Qt))))return null;var u=null;if(a["text-color"]&&!(u=e.parse(a["text-color"],1,te)))return null;var h=r[r.length-1];h.scale=s,h.font=l,h.textColor=u}else{var p=e.parse(t[n],1,ie);if(!p)return null;var c=p.type.kind;if("string"!==c&&"value"!==c&&"null"!==c&&"resolvedImage"!==c)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,r.push({content:p,scale:null,font:null,textColor:null})}}return new ze(r)},ze.prototype.evaluate=function(t){return new xe(this.sections.map((function(e){var i=e.content.evaluate(t);return Ie(i)===ne?new _e("",i,null,null,null):new _e(Se(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ze.prototype.eachChild=function(t){for(var e=0,i=this.sections;e<i.length;e+=1){var r=i[e];t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}},ze.prototype.outputDefined=function(){return!1},ze.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var r=i[e];t.push(r.content.serialize());var o={};r.scale&&(o["font-scale"]=r.scale.serialize()),r.font&&(o["text-font"]=r.font.serialize()),r.textColor&&(o["text-color"]=r.textColor.serialize()),t.push(o)}return t};var Oe=ze,Re=function(t){this.type=ne,this.input=t};Re.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Qt);return i?new Re(i):e.error("No image name provided.")},Re.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=we.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i},Re.prototype.eachChild=function(t){t(this.input)},Re.prototype.outputDefined=function(){return!1},Re.prototype.serialize=function(){return["image",this.input.serialize()]};var Be=Re,Fe={"to-boolean":$t,"to-color":te,"to-number":Jt,"to-string":Qt},Ue=function(t,e){this.type=t,this.args=e};Ue.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");for(var r=Fe[i],o=[],n=1;n<t.length;n++){var a=e.parse(t[n],n,ie);if(!a)return null;o.push(a)}return new Ue(r,o)},Ue.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,i,r=0,o=this.args;r<o.length;r+=1){if(i=null,(e=o[r].evaluate(t))instanceof me)return e;if("string"==typeof e){var n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&!(i=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ke(e[0],e[1],e[2],e[3])))return new me(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Me(i||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,l=this.args;s<l.length;s+=1){if(null===(a=l[s].evaluate(t)))return 0;var u=Number(a);if(!isNaN(u))return u}throw new Me("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?xe.fromString(Se(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?we.fromString(Se(this.args[0].evaluate(t))):Se(this.args[0].evaluate(t))},Ue.prototype.eachChild=function(t){this.args.forEach(t)},Ue.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},Ue.prototype.serialize=function(){if("formatted"===this.type.kind)return new Oe([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Be(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var je=Ue,Ne=["Unknown","Point","LineString","Polygon"],Ve=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};Ve.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},Ve.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?Ne[this.feature.type]:this.feature.type:null},Ve.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},Ve.prototype.canonicalID=function(){return this.canonical},Ve.prototype.properties=function(){return this.feature&&this.feature.properties||{}},Ve.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=me.parse(t)),e};var Ge=Ve,Ze=function(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r};Ze.prototype.evaluate=function(t){return this._evaluate(t,this.args)},Ze.prototype.eachChild=function(t){this.args.forEach(t)},Ze.prototype.outputDefined=function(){return!1},Ze.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},Ze.parse=function(t,e){var i,r=t[0],o=Ze.definitions[r];if(!o)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var n=Array.isArray(o)?o[0]:o.type,a=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,s=a.filter((function(e){var i=e[0];return!Array.isArray(i)||i.length===t.length-1})),l=null,u=0,h=s;u<h.length;u+=1){var p=h[u],c=p[0],f=p[1];l=new _i(e.registry,e.path,null,e.scope);for(var d=[],m=!1,y=1;y<t.length;y++){var g=t[y],_=Array.isArray(c)?c[y-1]:c.type,v=l.parse(g,1+d.length,_);if(!v){m=!0;break}d.push(v)}if(!m)if(Array.isArray(c)&&c.length!==d.length)l.error("Expected "+c.length+" arguments, but found "+d.length+" instead.");else{for(var x=0;x<d.length;x++){var b=Array.isArray(c)?c[x]:c.type,w=d[x];l.concat(x+1).checkSubtype(b,w.type)}if(0===l.errors.length)return new Ze(r,n,f,d)}}if(1===s.length)(i=e.errors).push.apply(i,l.errors);else{for(var k=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(se).join(", ")+")":"("+se(e.type)+"...)"})).join(" | "),T=[],I=1;I<t.length;I++){var S=e.parse(t[I],1+T.length);if(!S)return null;T.push(se(S.type))}e.error("Expected arguments of type "+k+", but found ("+T.join(", ")+") instead.")}return null},Ze.register=function(t,e){for(var i in Ze.definitions=e,e)t[i]=Ze};var qe=Ze,Xe=function(t,e,i){this.type=re,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e};Xe.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");var r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,$t);if(!r)return null;var o=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,$t);if(!o)return null;var n=null;return i.locale&&!(n=e.parse(i.locale,1,Qt))?null:new Xe(r,o,n)},Xe.prototype.evaluate=function(t){return new ge(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},Xe.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},Xe.prototype.outputDefined=function(){return!1},Xe.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var We=Xe,He=8192;function Ye(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ke(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Je(t,e){var i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*He),Math.round(r*o*He)]}function Qe(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function $e(t,e){for(var i,r,o,n,a,s,l,u=!1,h=0,p=e.length;h<p;h++)for(var c=e[h],f=0,d=c.length;f<d-1;f++){if((n=(i=t)[0]-(r=c[f])[0])*(l=i[1]-(o=c[f+1])[1])-(s=i[0]-o[0])*(a=i[1]-r[1])==0&&n*s<=0&&a*l<=0)return!1;Qe(t,c[f],c[f+1])&&(u=!u)}return u}function ti(t,e){for(var i=0;i<e.length;i++)if($e(t,e[i]))return!0;return!1}function ei(t,e,i,r){var o=r[0]-i[0],n=r[1]-i[1],a=(t[0]-i[0])*n-o*(t[1]-i[1]),s=(e[0]-i[0])*n-o*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function ii(t,e,i){for(var r=0,o=i;r<o.length;r+=1)for(var n=o[r],a=0;a<n.length-1;++a)if(0!=(p=[(h=n[a+1])[0]-(u=n[a])[0],h[1]-u[1]])[0]*(c=[(l=e)[0]-(s=t)[0],l[1]-s[1]])[1]-p[1]*c[0]&&ei(s,l,u,h)&&ei(u,h,s,l))return!0;var s,l,u,h,p,c;return!1}function ri(t,e){for(var i=0;i<t.length;++i)if(!$e(t[i],e))return!1;for(var r=0;r<t.length-1;++r)if(ii(t[r],t[r+1],e))return!1;return!0}function oi(t,e){for(var i=0;i<e.length;i++)if(ri(t,e[i]))return!0;return!1}function ni(t,e,i){for(var r=[],o=0;o<t.length;o++){for(var n=[],a=0;a<t[o].length;a++){var s=Je(t[o][a],i);Ye(e,s),n.push(s)}r.push(n)}return r}function ai(t,e,i){for(var r=[],o=0;o<t.length;o++){var n=ni(t[o],e,i);r.push(n)}return r}function si(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){var o=.5*r,n=t[0]-i[0]>o?-r:i[0]-t[0]>o?r:0;0===n&&(n=t[0]-i[2]>o?-r:i[2]-t[0]>o?r:0),t[0]+=n}Ye(e,t)}function li(t,e,i,r){for(var o=Math.pow(2,r.z)*He,n=[r.x*He,r.y*He],a=[],s=0,l=t;s<l.length;s+=1)for(var u=0,h=l[s];u<h.length;u+=1){var p=h[u],c=[p.x+n[0],p.y+n[1]];si(c,e,i,o),a.push(c)}return a}function ui(t,e,i,r){for(var o=Math.pow(2,r.z)*He,n=[r.x*He,r.y*He],a=[],s=0,l=t;s<l.length;s+=1){for(var u=[],h=0,p=l[s];h<p.length;h+=1){var c=p[h],f=[c.x+n[0],c.y+n[1]];Ye(e,f),u.push(f)}a.push(u)}if(e[2]-e[0]<=o/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(var d=0,m=a;d<m.length;d+=1)for(var y=0,g=m[d];y<g.length;y+=1)si(g[y],e,i,o)}return a}var hi=function(t,e){this.type=$t,this.geojson=t,this.geometries=e};hi.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(Te(t[1])){var i=t[1];if("FeatureCollection"===i.type)for(var r=0;r<i.features.length;++r){var o=i.features[r].geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new hi(i,i.features[r].geometry)}else if("Feature"===i.type){var n=i.geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new hi(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new hi(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},hi.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],o=t.canonicalID();if("Polygon"===e.type){var n=ni(e.coordinates,r,o),a=li(t.geometry(),i,r,o);if(!Ke(i,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!$e(l[s],n))return!1}if("MultiPolygon"===e.type){var u=ai(e.coordinates,r,o),h=li(t.geometry(),i,r,o);if(!Ke(i,r))return!1;for(var p=0,c=h;p<c.length;p+=1)if(!ti(c[p],u))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],o=t.canonicalID();if("Polygon"===e.type){var n=ni(e.coordinates,r,o),a=ui(t.geometry(),i,r,o);if(!Ke(i,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!ri(l[s],n))return!1}if("MultiPolygon"===e.type){var u=ai(e.coordinates,r,o),h=ui(t.geometry(),i,r,o);if(!Ke(i,r))return!1;for(var p=0,c=h;p<c.length;p+=1)if(!oi(c[p],u))return!1}return!0}(t,this.geometries)}return!1},hi.prototype.eachChild=function(){},hi.prototype.outputDefined=function(){return!0},hi.prototype.serialize=function(){return["within",this.geojson]};var pi=hi;function ci(t){if(t instanceof qe){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof pi)return!1;var e=!0;return t.eachChild((function(t){e&&!ci(t)&&(e=!1)})),e}function fi(t){if(t instanceof qe&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!fi(t)&&(e=!1)})),e}function di(t,e){if(t instanceof qe&&e.indexOf(t.name)>=0)return!1;var i=!0;return t.eachChild((function(t){i&&!di(t,e)&&(i=!1)})),i}var mi=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};mi.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var i=t[1];return e.scope.has(i)?new mi(i,e.scope.get(i)):e.error('Unknown variable "'+i+'". Make sure "'+i+'" has been bound in an enclosing "let" expression before using it.',1)},mi.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},mi.prototype.eachChild=function(){},mi.prototype.outputDefined=function(){return!1},mi.prototype.serialize=function(){return["var",this.name]};var yi=mi,gi=function(t,e,i,r,o){void 0===e&&(e=[]),void 0===r&&(r=new Yt),void 0===o&&(o=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=r,this.errors=o,this.expectedType=i};gi.prototype.parse=function(t,e,i,r,o){return void 0===o&&(o={}),e?this.concat(e,i,r)._parse(t,o):this._parse(t,o)},gi.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new De(e,[t]):"coerce"===i?new je(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var o=this.registry[r];if(o){var n=o.parse(t,this);if(!n)return null;if(this.expectedType){var a=this.expectedType,s=n.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else n=i(n,a,e.typeAnnotation||"coerce");else n=i(n,a,e.typeAnnotation||"assert")}if(!(n instanceof Ae)&&"resolvedImage"!==n.type.kind&&vi(n)){var l=new Ge;try{n=new Ae(n.type,n.evaluate(l))}catch(t){return this.error(t.message),null}}return n}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},gi.prototype.concat=function(t,e,i){var r="number"==typeof t?this.path.concat(t):this.path,o=i?this.scope.concat(i):this.scope;return new gi(this.registry,r,e||null,o,this.errors)},gi.prototype.error=function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var r=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Wt(r,t))},gi.prototype.checkSubtype=function(t,e){var i=ue(t,e);return i&&this.error(i),i};var _i=gi;function vi(t){if(t instanceof yi)return vi(t.boundExpression);if(t instanceof qe&&"error"===t.name)return!1;if(t instanceof We)return!1;if(t instanceof pi)return!1;var e=t instanceof je||t instanceof De,i=!0;return t.eachChild((function(t){i=e?i&&vi(t):i&&t instanceof Ae})),!!i&&ci(t)&&di(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script"])}function xi(t,e){for(var i,r=t.length-1,o=0,n=r,a=0;o<=n;)if((i=t[a=Math.floor((o+n)/2)])<=e){if(a===r||e<t[a+1])return a;o=a+1}else{if(!(i>e))throw new Me("Input is not a number.");n=a-1}return 0}var bi=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var r=0,o=i;r<o.length;r+=1){var n=o[r],a=n[1];this.labels.push(n[0]),this.outputs.push(a)}};bi.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var i=e.parse(t[1],1,Jt);if(!i)return null;var r=[],o=null;e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(var n=1;n<t.length;n+=2){var a=1===n?-1/0:t[n],s=t[n+1],l=n,u=n+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(r.length&&r[r.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var h=e.parse(s,u,o);if(!h)return null;o=o||h.type,r.push([a,h])}return new bi(o,i,r)},bi.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);var o=e.length;return r>=e[o-1]?i[o-1].evaluate(t):i[xi(e,r)].evaluate(t)},bi.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1)t(i[e])},bi.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},bi.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var wi=bi;function ki(t,e,i){return t*(1-i)+e*i}var Ti=Object.freeze({__proto__:null,number:ki,color:function(t,e,i){return new me(ki(t.r,e.r,i),ki(t.g,e.g,i),ki(t.b,e.b,i),ki(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,r){return ki(t,e[r],i)}))}}),Ii=.95047,Si=1.08883,Ei=4/29,Ai=6/29,Pi=3*Ai*Ai,Mi=Ai*Ai*Ai,Li=Math.PI/180,Ci=180/Math.PI;function Di(t){return t>Mi?Math.pow(t,1/3):t/Pi+Ei}function zi(t){return t>Ai?t*t*t:Pi*(t-Ei)}function Oi(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ri(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Bi(t){var e=Ri(t.r),i=Ri(t.g),r=Ri(t.b),o=Di((.4124564*e+.3575761*i+.1804375*r)/Ii),n=Di((.2126729*e+.7151522*i+.072175*r)/1);return{l:116*n-16,a:500*(o-n),b:200*(n-Di((.0193339*e+.119192*i+.9503041*r)/Si)),alpha:t.a}}function Fi(t){var e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,r=isNaN(t.b)?e:e-t.b/200;return e=1*zi(e),i=Ii*zi(i),r=Si*zi(r),new me(Oi(3.2404542*i-1.5371385*e-.4985314*r),Oi(-.969266*i+1.8760108*e+.041556*r),Oi(.0556434*i-.2040259*e+1.0572252*r),t.alpha)}function Ui(t,e,i){var r=e-t;return t+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var ji={forward:Bi,reverse:Fi,interpolate:function(t,e,i){return{l:ki(t.l,e.l,i),a:ki(t.a,e.a,i),b:ki(t.b,e.b,i),alpha:ki(t.alpha,e.alpha,i)}}},Ni={forward:function(t){var e=Bi(t),i=e.l,r=e.a,o=e.b,n=Math.atan2(o,r)*Ci;return{h:n<0?n+360:n,c:Math.sqrt(r*r+o*o),l:i,alpha:t.a}},reverse:function(t){var e=t.h*Li,i=t.c;return Fi({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Ui(t.h,e.h,i),c:ki(t.c,e.c,i),l:ki(t.l,e.l,i),alpha:ki(t.alpha,e.alpha,i)}}},Vi=Object.freeze({__proto__:null,lab:ji,hcl:Ni}),Gi=function(t,e,i,r,o){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(var n=0,a=o;n<a.length;n+=1){var s=a[n],l=s[1];this.labels.push(s[0]),this.outputs.push(l)}};function Zi(t,e,i,r){var o=r-i,n=t-i;return 0===o?0:1===e?n/o:(Math.pow(e,n)-1)/(Math.pow(e,o)-1)}Gi.interpolationFactor=function(t,i,r,o){var n=0;if("exponential"===t.name)n=Zi(i,t.base,r,o);else if("linear"===t.name)n=Zi(i,1,r,o);else if("cubic-bezier"===t.name){var a=t.controlPoints;n=new e(a[0],a[1],a[2],a[3]).solve(Zi(i,1,r,o))}return n},Gi.parse=function(t,e){var i=t[0],r=t[1],o=t[2],n=t.slice(3);if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){var a=r[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:a}}else{if("cubic-bezier"!==r[0])return e.error("Unknown interpolation type "+String(r[0]),1,0);var s=r.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(o=e.parse(o,2,Jt)))return null;var l=[],u=null;"interpolate-hcl"===i||"interpolate-lab"===i?u=te:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var h=0;h<n.length;h+=2){var p=n[h],c=n[h+1],f=h+3,d=h+4;if("number"!=typeof p)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',f);if(l.length&&l[l.length-1][0]>=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(c,d,u);if(!m)return null;u=u||m.type,l.push([p,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new Gi(u,i,r,o,l):e.error("Type "+se(u)+" is not interpolatable.")},Gi.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);var o=e.length;if(r>=e[o-1])return i[o-1].evaluate(t);var n=xi(e,r),a=Gi.interpolationFactor(this.interpolation,r,e[n],e[n+1]),s=i[n].evaluate(t),l=i[n+1].evaluate(t);return"interpolate"===this.operator?Ti[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Ni.reverse(Ni.interpolate(Ni.forward(s),Ni.forward(l),a)):ji.reverse(ji.interpolate(ji.forward(s),ji.forward(l),a))},Gi.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1)t(i[e])},Gi.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},Gi.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],i=0;i<this.labels.length;i++)e.push(this.labels[i],this.outputs[i].serialize());return e};var qi=Gi,Xi=function(t,e){this.type=t,this.args=e};Xi.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var i=null,r=e.expectedType;r&&"value"!==r.kind&&(i=r);for(var o=[],n=0,a=t.slice(1);n<a.length;n+=1){var s=e.parse(a[n],1+o.length,i,void 0,{typeAnnotation:"omit"});if(!s)return null;i=i||s.type,o.push(s)}var l=r&&o.some((function(t){return ue(r,t.type)}));return new Xi(l?ie:i,o)},Xi.prototype.evaluate=function(t){for(var e,i=null,r=0,o=0,n=this.args;o<n.length&&(r++,(i=n[o].evaluate(t))&&i instanceof we&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null===i);o+=1);return i},Xi.prototype.eachChild=function(t){this.args.forEach(t)},Xi.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},Xi.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Wi=Xi,Hi=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};Hi.prototype.evaluate=function(t){return this.result.evaluate(t)},Hi.prototype.eachChild=function(t){for(var e=0,i=this.bindings;e<i.length;e+=1)t(i[e][1]);t(this.result)},Hi.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var i=[],r=1;r<t.length-1;r+=2){var o=t[r];if("string"!=typeof o)return e.error("Expected string, but found "+typeof o+" instead.",r);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);var n=e.parse(t[r+1],r+1);if(!n)return null;i.push([o,n])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return a?new Hi(i,a):null},Hi.prototype.outputDefined=function(){return this.result.outputDefined()},Hi.prototype.serialize=function(){for(var t=["let"],e=0,i=this.bindings;e<i.length;e+=1){var r=i[e];t.push(r[0],r[1].serialize())}return t.push(this.result.serialize()),t};var Yi=Hi,Ki=function(t,e,i){this.type=t,this.index=e,this.input=i};Ki.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Jt),r=e.parse(t[2],2,ae(e.expectedType||ie));return i&&r?new Ki(r.type.itemType,i,r):null},Ki.prototype.evaluate=function(t){var e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Me("Array index out of bounds: "+e+" < 0.");if(e>=i.length)throw new Me("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new Me("Array index must be an integer, but found "+e+" instead.");return i[e]},Ki.prototype.eachChild=function(t){t(this.index),t(this.input)},Ki.prototype.outputDefined=function(){return!1},Ki.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ji=Ki,Qi=function(t,e){this.type=$t,this.needle=t,this.haystack=e};Qi.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,ie),r=e.parse(t[2],2,ie);return i&&r?he(i.type,[$t,Qt,Jt,Kt,ie])?new Qi(i,r):e.error("Expected first argument to be of type boolean, string, number or null, but found "+se(i.type)+" instead"):null},Qi.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!pe(e,["boolean","string","number","null"]))throw new Me("Expected first argument to be of type boolean, string, number or null, but found "+se(Ie(e))+" instead.");if(!pe(i,["string","array"]))throw new Me("Expected second argument to be of type array or string, but found "+se(Ie(i))+" instead.");return i.indexOf(e)>=0},Qi.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},Qi.prototype.outputDefined=function(){return!0},Qi.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var $i=Qi,tr=function(t,e,i){this.type=Jt,this.needle=t,this.haystack=e,this.fromIndex=i};tr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,ie),r=e.parse(t[2],2,ie);if(!i||!r)return null;if(!he(i.type,[$t,Qt,Jt,Kt,ie]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+se(i.type)+" instead");if(4===t.length){var o=e.parse(t[3],3,Jt);return o?new tr(i,r,o):null}return new tr(i,r)},tr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!pe(e,["boolean","string","number","null"]))throw new Me("Expected first argument to be of type boolean, string, number or null, but found "+se(Ie(e))+" instead.");if(!pe(i,["string","array"]))throw new Me("Expected second argument to be of type array or string, but found "+se(Ie(i))+" instead.");if(this.fromIndex){var r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)},tr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},tr.prototype.outputDefined=function(){return!1},tr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var er=tr,ir=function(t,e,i,r,o,n){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=o,this.otherwise=n};ir.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var o={},n=[],a=2;a<t.length-1;a+=2){var s=t[a],l=t[a+1];Array.isArray(s)||(s=[s]);var u=e.concat(a);if(0===s.length)return u.error("Expected at least one branch label.");for(var h=0,p=s;h<p.length;h+=1){var c=p[h];if("number"!=typeof c&&"string"!=typeof c)return u.error("Branch labels must be numbers or strings.");if("number"==typeof c&&Math.abs(c)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof c&&Math.floor(c)!==c)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,Ie(c)))return null}else i=Ie(c);if(void 0!==o[String(c)])return u.error("Branch labels must be unique.");o[String(c)]=n.length}var f=e.parse(l,a,r);if(!f)return null;r=r||f.type,n.push(f)}var d=e.parse(t[1],1,ie);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,r);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(i,d.type)?null:new ir(i,r,d,o,n,m):null},ir.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(Ie(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},ir.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},ir.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},ir.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],r={},o=0,n=Object.keys(this.cases).sort();o<n.length;o+=1){var a=n[o];void 0===(p=r[this.cases[a]])?(r[this.cases[a]]=i.length,i.push([this.cases[a],[a]])):i[p][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},l=0,u=i;l<u.length;l+=1){var h=u[l],p=h[0],c=h[1];e.push(1===c.length?s(c[0]):c.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var rr=ir,or=function(t,e,i){this.type=t,this.branches=e,this.otherwise=i};or.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var r=[],o=1;o<t.length-1;o+=2){var n=e.parse(t[o],o,$t);if(!n)return null;var a=e.parse(t[o+1],o+1,i);if(!a)return null;r.push([n,a]),i=i||a.type}var s=e.parse(t[t.length-1],t.length-1,i);return s?new or(i,r,s):null},or.prototype.evaluate=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var r=i[e],o=r[1];if(r[0].evaluate(t))return o.evaluate(t)}return this.otherwise.evaluate(t)},or.prototype.eachChild=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var r=i[e],o=r[1];t(r[0]),t(o)}t(this.otherwise)},or.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},or.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var nr=or,ar=function(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r};ar.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,ie),r=e.parse(t[2],2,Jt);if(!i||!r)return null;if(!he(i.type,[ae(ie),Qt,ie]))return e.error("Expected first argument to be of type array or string, but found "+se(i.type)+" instead");if(4===t.length){var o=e.parse(t[3],3,Jt);return o?new ar(i.type,i,r,o):null}return new ar(i.type,i,r)},ar.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!pe(e,["string","array"]))throw new Me("Expected first argument to be of type array or string, but found "+se(Ie(e))+" instead.");if(this.endIndex){var r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)},ar.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},ar.prototype.outputDefined=function(){return!1},ar.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var sr=ar;function lr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function ur(t,e,i,r){return 0===r.compare(e,i)}function hr(t,e,i){var r="=="!==t&&"!="!==t;return function(){function o(t,e,i){this.type=$t,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return o.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var i=t[0],n=e.parse(t[1],1,ie);if(!n)return null;if(!lr(i,n.type))return e.concat(1).error('"'+i+"\" comparisons are not supported for type '"+se(n.type)+"'.");var a=e.parse(t[2],2,ie);if(!a)return null;if(!lr(i,a.type))return e.concat(2).error('"'+i+"\" comparisons are not supported for type '"+se(a.type)+"'.");if(n.type.kind!==a.type.kind&&"value"!==n.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+se(n.type)+"' and '"+se(a.type)+"'.");r&&("value"===n.type.kind&&"value"!==a.type.kind?n=new De(a.type,[n]):"value"!==n.type.kind&&"value"===a.type.kind&&(a=new De(n.type,[a])));var s=null;if(4===t.length){if("string"!==n.type.kind&&"string"!==a.type.kind&&"value"!==n.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,re)))return null}return new o(n,a,s)},o.prototype.evaluate=function(o){var n=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(r&&this.hasUntypedArgument){var s=Ie(n),l=Ie(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new Me('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+l.kind+") instead.")}if(this.collator&&!r&&this.hasUntypedArgument){var u=Ie(n),h=Ie(a);if("string"!==u.kind||"string"!==h.kind)return e(o,n,a)}return this.collator?i(o,n,a,this.collator.evaluate(o)):e(o,n,a)},o.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},o.prototype.outputDefined=function(){return!0},o.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},o}()}var pr=hr("==",(function(t,e,i){return e===i}),ur),cr=hr("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!ur(0,e,i,r)})),fr=hr("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),dr=hr(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),mr=hr("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),yr=hr(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0})),gr=function(t,e,i,r,o){this.type=Qt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=o};gr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Jt);if(!i)return null;var r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");var o=null;if(r.locale&&!(o=e.parse(r.locale,1,Qt)))return null;var n=null;if(r.currency&&!(n=e.parse(r.currency,1,Qt)))return null;var a=null;if(r["min-fraction-digits"]&&!(a=e.parse(r["min-fraction-digits"],1,Jt)))return null;var s=null;return r["max-fraction-digits"]&&!(s=e.parse(r["max-fraction-digits"],1,Jt))?null:new gr(i,o,n,a,s)},gr.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},gr.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},gr.prototype.outputDefined=function(){return!1},gr.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var _r=gr,vr=function(t){this.type=Jt,this.input=t};vr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error("Expected argument of type string or array, but found "+se(i.type)+" instead."):new vr(i):null},vr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Me("Expected value to be of type string or array, but found "+se(Ie(e))+" instead.")},vr.prototype.eachChild=function(t){t(this.input)},vr.prototype.outputDefined=function(){return!1},vr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var xr={"==":pr,"!=":cr,">":dr,"<":fr,">=":yr,"<=":mr,array:De,at:Ji,boolean:De,case:nr,coalesce:Wi,collator:We,format:Oe,image:Be,in:$i,"index-of":er,interpolate:qi,"interpolate-hcl":qi,"interpolate-lab":qi,length:vr,let:Yi,literal:Ae,match:rr,number:De,"number-format":_r,object:De,slice:sr,step:wi,string:De,"to-boolean":je,"to-color":je,"to-number":je,"to-string":je,var:yi,within:pi};function br(t,e){var i=e[0],r=e[1],o=e[2],n=e[3];i=i.evaluate(t),r=r.evaluate(t),o=o.evaluate(t);var a=n?n.evaluate(t):1,s=ke(i,r,o,a);if(s)throw new Me(s);return new me(i/255*a,r/255*a,o/255*a,a)}function wr(t,e){return t in e}function kr(t,e){var i=e[t];return void 0===i?null:i}function Tr(t){return{type:t}}qe.register(xr,{error:[{kind:"error"},[Qt],function(t,e){throw new Me(e[0].evaluate(t))}],typeof:[Qt,[ie],function(t,e){return se(Ie(e[0].evaluate(t)))}],"to-rgba":[ae(Jt,4),[te],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[te,[Jt,Jt,Jt],br],rgba:[te,[Jt,Jt,Jt,Jt],br],has:{type:$t,overloads:[[[Qt],function(t,e){return wr(e[0].evaluate(t),t.properties())}],[[Qt,ee],function(t,e){var i=e[1];return wr(e[0].evaluate(t),i.evaluate(t))}]]},get:{type:ie,overloads:[[[Qt],function(t,e){return kr(e[0].evaluate(t),t.properties())}],[[Qt,ee],function(t,e){var i=e[1];return kr(e[0].evaluate(t),i.evaluate(t))}]]},"feature-state":[ie,[Qt],function(t,e){return kr(e[0].evaluate(t),t.featureState||{})}],properties:[ee,[],function(t){return t.properties()}],"geometry-type":[Qt,[],function(t){return t.geometryType()}],id:[ie,[],function(t){return t.id()}],zoom:[Jt,[],function(t){return t.globals.zoom}],"heatmap-density":[Jt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Jt,[],function(t){return t.globals.lineProgress||0}],"sky-radial-progress":[Jt,[],function(t){return t.globals.skyRadialProgress||0}],accumulated:[ie,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Jt,Tr(Jt),function(t,e){for(var i=0,r=0,o=e;r<o.length;r+=1)i+=o[r].evaluate(t);return i}],"*":[Jt,Tr(Jt),function(t,e){for(var i=1,r=0,o=e;r<o.length;r+=1)i*=o[r].evaluate(t);return i}],"-":{type:Jt,overloads:[[[Jt,Jt],function(t,e){var i=e[1];return e[0].evaluate(t)-i.evaluate(t)}],[[Jt],function(t,e){return-e[0].evaluate(t)}]]},"/":[Jt,[Jt,Jt],function(t,e){var i=e[1];return e[0].evaluate(t)/i.evaluate(t)}],"%":[Jt,[Jt,Jt],function(t,e){var i=e[1];return e[0].evaluate(t)%i.evaluate(t)}],ln2:[Jt,[],function(){return Math.LN2}],pi:[Jt,[],function(){return Math.PI}],e:[Jt,[],function(){return Math.E}],"^":[Jt,[Jt,Jt],function(t,e){var i=e[1];return Math.pow(e[0].evaluate(t),i.evaluate(t))}],sqrt:[Jt,[Jt],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Jt,[Jt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Jt,[Jt],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Jt,[Jt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Jt,[Jt],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Jt,[Jt],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Jt,[Jt],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Jt,[Jt],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Jt,[Jt],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Jt,[Jt],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Jt,Tr(Jt),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Jt,Tr(Jt),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Jt,[Jt],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Jt,[Jt],function(t,e){var i=e[0].evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Jt,[Jt],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Jt,[Jt],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[$t,[Qt,ie],function(t,e){var i=e[0],r=e[1];return t.properties()[i.value]===r.value}],"filter-id-==":[$t,[ie],function(t,e){var i=e[0];return t.id()===i.value}],"filter-type-==":[$t,[Qt],function(t,e){var i=e[0];return t.geometryType()===i.value}],"filter-<":[$t,[Qt,ie],function(t,e){var i=e[0],r=e[1],o=t.properties()[i.value],n=r.value;return typeof o==typeof n&&o<n}],"filter-id-<":[$t,[ie],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r<o}],"filter->":[$t,[Qt,ie],function(t,e){var i=e[0],r=e[1],o=t.properties()[i.value],n=r.value;return typeof o==typeof n&&o>n}],"filter-id->":[$t,[ie],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r>o}],"filter-<=":[$t,[Qt,ie],function(t,e){var i=e[0],r=e[1],o=t.properties()[i.value],n=r.value;return typeof o==typeof n&&o<=n}],"filter-id-<=":[$t,[ie],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r<=o}],"filter->=":[$t,[Qt,ie],function(t,e){var i=e[0],r=e[1],o=t.properties()[i.value],n=r.value;return typeof o==typeof n&&o>=n}],"filter-id->=":[$t,[ie],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r>=o}],"filter-has":[$t,[ie],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[$t,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[$t,[ae(Qt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[$t,[ae(ie)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[$t,[Qt,ae(ie)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[$t,[Qt,ae(ie)],function(t,e){var i=e[0],r=e[1];return function(t,e,i,r){for(;i<=r;){var o=i+r>>1;if(e[o]===t)return!0;e[o]>t?r=o-1:i=o+1}return!1}(t.properties()[i.value],r.value,0,r.value.length-1)}],all:{type:$t,overloads:[[[$t,$t],function(t,e){var i=e[1];return e[0].evaluate(t)&&i.evaluate(t)}],[Tr($t),function(t,e){for(var i=0,r=e;i<r.length;i+=1)if(!r[i].evaluate(t))return!1;return!0}]]},any:{type:$t,overloads:[[[$t,$t],function(t,e){var i=e[1];return e[0].evaluate(t)||i.evaluate(t)}],[Tr($t),function(t,e){for(var i=0,r=e;i<r.length;i+=1)if(r[i].evaluate(t))return!0;return!1}]]},"!":[$t,[$t],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[$t,[Qt],function(t,e){var i=t.globals&&t.globals.isSupportedScript;return!i||i(e[0].evaluate(t))}],upcase:[Qt,[Qt],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Qt,[Qt],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Qt,Tr(ie),function(t,e){return e.map((function(e){return Se(e.evaluate(t))})).join("")}],"resolved-locale":[Qt,[re],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var Ir=xr;function Sr(t){return{result:"success",value:t}}function Er(t){return{result:"error",value:t}}function Ar(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Pr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Mr(t){return!!t.expression&&t.expression.interpolated}function Lr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Cr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Dr(t){return t}function zr(t,e){var i,r,o,n="color"===e.type,a=t.stops&&"object"==typeof t.stops[0][0],s=a||!(a||void 0!==t.property),l=t.type||(Mr(e)?"exponential":"interval");if(n&&((t=Zt({},t)).stops&&(t.stops=t.stops.map((function(t){return[t[0],me.parse(t[1])]}))),t.default=me.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Vi[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);if("exponential"===l)i=Fr;else if("interval"===l)i=Br;else if("categorical"===l){i=Rr,r=Object.create(null);for(var u=0,h=t.stops;u<h.length;u+=1){var p=h[u];r[p[0]]=p[1]}o=typeof t.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'+l+'"');i=Ur}if(a){for(var c={},f=[],d=0;d<t.stops.length;d++){var m=t.stops[d],y=m[0].zoom;void 0===c[y]&&(c[y]={zoom:y,type:t.type,property:t.property,default:t.default,stops:[]},f.push(y)),c[y].stops.push([m[0].value,m[1]])}for(var g=[],_=0,v=f;_<v.length;_+=1){var x=v[_];g.push([c[x].zoom,zr(c[x],e)])}var b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:qi.interpolationFactor.bind(void 0,b),zoomStops:g.map((function(t){return t[0]})),evaluate:function(i,r){var o=i.zoom;return Fr({stops:g,base:t.base},e,o).evaluate(o,r)}}}if(s){var w="exponential"===l?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:qi.interpolationFactor.bind(void 0,w),zoomStops:t.stops.map((function(t){return t[0]})),evaluate:function(n){return i(t,e,n.zoom,r,o)}}}return{kind:"source",evaluate:function(n,a){var s=a&&a.properties?a.properties[t.property]:void 0;return void 0===s?Or(t.default,e.default):i(t,e,s,r,o)}}}function Or(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Rr(t,e,i,r,o){return Or(typeof i===o?r[i]:void 0,t.default,e.default)}function Br(t,e,i){if("number"!==Lr(i))return Or(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];var o=xi(t.stops.map((function(t){return t[0]})),i);return t.stops[o][1]}function Fr(t,e,i){var r=void 0!==t.base?t.base:1;if("number"!==Lr(i))return Or(t.default,e.default);var o=t.stops.length;if(1===o)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[o-1][0])return t.stops[o-1][1];var n=xi(t.stops.map((function(t){return t[0]})),i),a=function(t,e,i,r){var o=r-i,n=t-i;return 0===o?0:1===e?n/o:(Math.pow(e,n)-1)/(Math.pow(e,o)-1)}(i,r,t.stops[n][0],t.stops[n+1][0]),s=t.stops[n][1],l=t.stops[n+1][1],u=Ti[e.type]||Dr;if(t.colorSpace&&"rgb"!==t.colorSpace){var h=Vi[t.colorSpace];u=function(t,e){return h.reverse(h.interpolate(h.forward(t),h.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var i=s.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return u(i,r,a)}}:u(s,l,a)}function Ur(t,e,i){return"color"===e.type?i=me.parse(i):"formatted"===e.type?i=xe.fromString(i.toString()):"resolvedImage"===e.type?i=we.fromString(i.toString()):Lr(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),Or(i,t.default,e.default)}var jr=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ge,this._defaultValue=e?function(t){return"color"===t.type&&Cr(t.default)?new me(0,0,0,0):"color"===t.type?me.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Nr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ir}function Vr(t,e){var i=new _i(Ir,[],e?function(t){var e={color:te,string:Qt,number:Jt,enum:Qt,boolean:$t,formatted:oe,resolvedImage:ne};return"array"===t.type?ae(e[t.value]||ie,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?Sr(new jr(r,e)):Er(i.errors)}jr.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,o,n){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)},jr.prototype.evaluate=function(t,e,i,r,o,n){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=n||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new Me("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0),this._defaultValue}};var Gr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!fi(e.expression)};Gr.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,o,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,o,n)},Gr.prototype.evaluate=function(t,e,i,r,o,n){return this._styleExpression.evaluate(t,e,i,r,o,n)};var Zr=function(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!fi(e.expression),this.interpolationType=r};function qr(t,e){if("error"===(t=Vr(t,e)).result)return t;var i=t.value.expression,r=ci(i);if(!r&&!Ar(e))return Er([new Wt("","data expressions not supported")]);var o=di(i,["zoom"]);if(!o&&!Pr(e))return Er([new Wt("","zoom expressions not supported")]);var n=Wr(i);return n||o?n instanceof Wt?Er([n]):n instanceof qi&&!Mr(e)?Er([new Wt("",'"interpolate" expressions cannot be used with this property')]):Sr(n?new Zr(r?"camera":"composite",t.value,n.labels,n instanceof qi?n.interpolation:void 0):new Gr(r?"constant":"source",t.value)):Er([new Wt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Zr.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,o,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,o,n)},Zr.prototype.evaluate=function(t,e,i,r,o,n){return this._styleExpression.evaluate(t,e,i,r,o,n)},Zr.prototype.interpolationFactor=function(t,e,i){return this.interpolationType?qi.interpolationFactor(this.interpolationType,t,e,i):0};var Xr=function(t,e){this._parameters=t,this._specification=e,Zt(this,zr(this._parameters,this._specification))};function Wr(t){var e=null;if(t instanceof Yi)e=Wr(t.result);else if(t instanceof Wi)for(var i=0,r=t.args;i<r.length&&!(e=Wr(r[i]));i+=1);else(t instanceof wi||t instanceof qi)&&t.input instanceof qe&&"zoom"===t.input.name&&(e=t);return e instanceof Wt||t.eachChild((function(t){var i=Wr(t);i instanceof Wt?e=i:!e&&i?e=new Wt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Wt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Hr(t){var e=t.key,i=t.value,r=t.valueSpec||{},o=t.objectElementValidators||{},n=t.style,a=t.styleSpec,s=[],l=Lr(i);if("object"!==l)return[new Vt(e,i,"object expected, "+l+" found")];for(var u in i){var h=u.split(".")[0],p=r[h]||r["*"],c=void 0;if(o[h])c=o[h];else if(r[h])c=To;else if(o["*"])c=o["*"];else{if(!r["*"]){s.push(new Vt(e,i[u],'unknown property "'+u+'"'));continue}c=To}s=s.concat(c({key:(e?e+".":e)+u,value:i[u],valueSpec:p,style:n,styleSpec:a,object:i,objectKey:u},i))}for(var f in r)o[f]||r[f].required&&void 0===r[f].default&&void 0===i[f]&&s.push(new Vt(e,i,'missing required property "'+f+'"'));return s}function Yr(t){var e=t.value,i=t.valueSpec,r=t.style,o=t.styleSpec,n=t.key,a=t.arrayElementValidator||To;if("array"!==Lr(e))return[new Vt(n,e,"array expected, "+Lr(e)+" found")];if(i.length&&e.length!==i.length)return[new Vt(n,e,"array length "+i.length+" expected, length "+e.length+" found")];if(i["min-length"]&&e.length<i["min-length"])return[new Vt(n,e,"array length at least "+i["min-length"]+" expected, length "+e.length+" found")];var s={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum};o.$version<7&&(s.function=i.function),"object"===Lr(i.value)&&(s=i.value);for(var l=[],u=0;u<e.length;u++)l=l.concat(a({array:e,arrayIndex:u,value:e[u],valueSpec:s,style:r,styleSpec:o,key:n+"["+u+"]"}));return l}function Kr(t){var e=t.key,i=t.value,r=t.valueSpec,o=Lr(i);if("number"===o&&i!=i&&(o="NaN"),"number"!==o)return[new Vt(e,i,"number expected, "+o+" found")];if("minimum"in r){var n=r.minimum;if("array"===Lr(r.minimum)&&(n=r.minimum[t.arrayIndex]),i<n)return[new Vt(e,i,i+" is less than the minimum value "+n)]}if("maximum"in r){var a=r.maximum;if("array"===Lr(r.maximum)&&(a=r.maximum[t.arrayIndex]),i>a)return[new Vt(e,i,i+" is greater than the maximum value "+a)]}return[]}function Jr(t){var e,i,r,o=t.valueSpec,n=qt(t.value.type),a={},s="categorical"!==n&&void 0===t.value.property,l=!s,u="array"===Lr(t.value.stops)&&"array"===Lr(t.value.stops[0])&&"object"===Lr(t.value.stops[0][0]),h=Hr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return[new Vt(t.key,t.value,'identity function may not have a "stops" property')];var e=[],i=t.value;return e=e.concat(Yr({key:t.key,value:i,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Lr(i)&&0===i.length&&e.push(new Vt(t.key,i,"array must have at least one stop")),e},default:function(t){return To({key:t.key,value:t.value,valueSpec:o,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&s&&h.push(new Vt(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||h.push(new Vt(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!Mr(t.valueSpec)&&h.push(new Vt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ar(t.valueSpec)?h.push(new Vt(t.key,t.value,"property functions not supported")):s&&!Pr(t.valueSpec)&&h.push(new Vt(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!u||void 0!==t.value.property||h.push(new Vt(t.key,t.value,'"property" property is required')),h;function p(t){var e=[],n=t.value,s=t.key;if("array"!==Lr(n))return[new Vt(s,n,"array expected, "+Lr(n)+" found")];if(2!==n.length)return[new Vt(s,n,"array length 2 expected, length "+n.length+" found")];if(u){if("object"!==Lr(n[0]))return[new Vt(s,n,"object expected, "+Lr(n[0])+" found")];if(void 0===n[0].zoom)return[new Vt(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new Vt(s,n,"object stop key must have value")];if(r&&r>qt(n[0].zoom))return[new Vt(s,n[0].zoom,"stop zoom values must appear in ascending order")];qt(n[0].zoom)!==r&&(r=qt(n[0].zoom),i=void 0,a={}),e=e.concat(Hr({key:s+"[0]",value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Kr,value:c}}))}else e=e.concat(c({key:s+"[0]",value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Nr(Xt(n[1]))?e.concat([new Vt(s+"[1]",n[1],"expressions are not allowed in function stops.")]):e.concat(To({key:s+"[1]",value:n[1],valueSpec:o,style:t.style,styleSpec:t.styleSpec}))}function c(t,r){var s=Lr(t.value),l=qt(t.value),u=null!==t.value?t.value:r;if(e){if(s!==e)return[new Vt(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Vt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){var h="number expected, "+s+" found";return Ar(o)&&void 0===n&&(h+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Vt(t.key,u,h)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==i&&l<i?[new Vt(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===n&&l in a?[new Vt(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new Vt(t.key,u,"integer expected, found "+l)]}}function Qr(t){var e=("property"===t.expressionContext?qr:Vr)(Xt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new Vt(""+t.key+e.key,t.value,e.message)}));var i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new Vt(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!fi(i))return[new Vt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!fi(i))return[new Vt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!di(i,["zoom","feature-state"]))return[new Vt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ci(i))return[new Vt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function $r(t){var e=t.key,i=t.value,r=t.valueSpec,o=[];return Array.isArray(r.values)?-1===r.values.indexOf(qt(i))&&o.push(new Vt(e,i,"expected one of ["+r.values.join(", ")+"], "+JSON.stringify(i)+" found")):-1===Object.keys(r.values).indexOf(qt(i))&&o.push(new Vt(e,i,"expected one of ["+Object.keys(r.values).join(", ")+"], "+JSON.stringify(i)+" found")),o}function to(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,i=t.slice(1);e<i.length;e+=1){var r=i[e];if(!to(r)&&"boolean"!=typeof r)return!1}return!0;default:return!0}}Xr.deserialize=function(t){return new Xr(t._parameters,t._specification)},Xr.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var eo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function io(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};to(t)||(t=no(t));var e=Vr(t,eo);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,i,r){return e.value.evaluate(t,i,{},r)},needGeometry:oo(t)}}function ro(t,e){return t<e?-1:t>e?1:0}function oo(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(var e=1;e<t.length;e++)if(oo(t[e]))return!0;return!1}function no(t){if(!t)return!0;var e,i=t[0];return t.length<=1?"any"!==i:"=="===i?ao(t[1],t[2],"=="):"!="===i?uo(ao(t[1],t[2],"==")):"<"===i||">"===i||"<="===i||">="===i?ao(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(no))):"all"===i?["all"].concat(t.slice(1).map(no)):"none"===i?["all"].concat(t.slice(1).map(no).map(uo)):"in"===i?so(t[1],t.slice(2)):"!in"===i?uo(so(t[1],t.slice(2))):"has"===i?lo(t[1]):"!has"===i?uo(lo(t[1])):"within"!==i||t}function ao(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function so(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(ro)]]:["filter-in-small",t,["literal",e]]}}function lo(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function uo(t){return["!",t]}function ho(t){return to(Xt(t.value))?Qr(Zt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):po(t)}function po(t){var e=t.value,i=t.key;if("array"!==Lr(e))return[new Vt(i,e,"array expected, "+Lr(e)+" found")];var r,o=t.styleSpec,n=[];if(e.length<1)return[new Vt(i,e,"filter array must have at least 1 element")];switch(n=n.concat($r({key:i+"[0]",value:e[0],valueSpec:o.filter_operator,style:t.style,styleSpec:t.styleSpec})),qt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===qt(e[1])&&n.push(new Vt(i,e,'"$type" cannot be use with operator "'+e[0]+'"'));case"==":case"!=":3!==e.length&&n.push(new Vt(i,e,'filter array for operator "'+e[0]+'" must have 3 elements'));case"in":case"!in":e.length>=2&&"string"!==(r=Lr(e[1]))&&n.push(new Vt(i+"[1]",e[1],"string expected, "+r+" found"));for(var a=2;a<e.length;a++)r=Lr(e[a]),"$type"===qt(e[1])?n=n.concat($r({key:i+"["+a+"]",value:e[a],valueSpec:o.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&n.push(new Vt(i+"["+a+"]",e[a],"string, number, or boolean expected, "+r+" found"));break;case"any":case"all":case"none":for(var s=1;s<e.length;s++)n=n.concat(po({key:i+"["+s+"]",value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=Lr(e[1]),2!==e.length?n.push(new Vt(i,e,'filter array for "'+e[0]+'" operator must have 2 elements')):"string"!==r&&n.push(new Vt(i+"[1]",e[1],"string expected, "+r+" found"));break;case"within":r=Lr(e[1]),2!==e.length?n.push(new Vt(i,e,'filter array for "'+e[0]+'" operator must have 2 elements')):"object"!==r&&n.push(new Vt(i+"[1]",e[1],"object expected, "+r+" found"))}return n}function co(t,e){var i=t.key,r=t.style,o=t.styleSpec,n=t.value,a=t.objectKey,s=o[e+"_"+t.layerType];if(!s)return[];var l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return To({key:i,value:n,valueSpec:o.transition,style:r,styleSpec:o});var u,h=t.valueSpec||s[a];if(!h)return[new Vt(i,n,'unknown property "'+a+'"')];if("string"===Lr(n)&&Ar(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(n)))return[new Vt(i,n,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(u[1])+" }`.")];var p=[];return"symbol"===t.layerType&&("text-field"===a&&r&&!r.glyphs&&p.push(new Vt(i,n,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Cr(Xt(n))&&"identity"===qt(n.type)&&p.push(new Vt(i,n,'"text-font" does not support identity functions'))),p.concat(To({key:t.key,value:n,valueSpec:h,style:r,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:a}))}function fo(t){return co(t,"paint")}function mo(t){return co(t,"layout")}function yo(t){var e=[],i=t.value,r=t.key,o=t.style,n=t.styleSpec;i.type||i.ref||e.push(new Vt(r,i,'either "type" or "ref" is required'));var a,s=qt(i.type),l=qt(i.ref);if(i.id)for(var u=qt(i.id),h=0;h<t.arrayIndex;h++){var p=o.layers[h];qt(p.id)===u&&e.push(new Vt(r,i.id,'duplicate layer id "'+i.id+'", previously used at line '+p.id.__line__))}if("ref"in i)["type","source","source-layer","filter","layout"].forEach((function(t){t in i&&e.push(new Vt(r,i[t],'"'+t+'" is prohibited for ref layers'))})),o.layers.forEach((function(t){qt(t.id)===l&&(a=t)})),a?a.ref?e.push(new Vt(r,i.ref,"ref cannot reference another ref layer")):s=qt(a.type):e.push(new Vt(r,i.ref,'ref layer "'+l+'" not found'));else if("background"!==s&&"sky"!==s)if(i.source){var c=o.sources&&o.sources[i.source],f=c&&qt(c.type);c?"vector"===f&&"raster"===s?e.push(new Vt(r,i.source,'layer "'+i.id+'" requires a raster source')):"raster"===f&&"raster"!==s?e.push(new Vt(r,i.source,'layer "'+i.id+'" requires a vector source')):"vector"!==f||i["source-layer"]?"raster-dem"===f&&"hillshade"!==s?e.push(new Vt(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===f&&c.lineMetrics||e.push(new Vt(r,i,'layer "'+i.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new Vt(r,i,'layer "'+i.id+'" must specify a "source-layer"')):e.push(new Vt(r,i.source,'source "'+i.source+'" not found'))}else e.push(new Vt(r,i,'missing required property "source"'));return e=e.concat(Hr({key:r,value:i,valueSpec:n.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return To({key:r+".type",value:i.type,valueSpec:n.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"})},filter:ho,layout:function(t){return Hr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return mo(Zt({layerType:s},t))}}})},paint:function(t){return Hr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return fo(Zt({layerType:s},t))}}})}}})),e}function go(t){var e=t.value,i=t.key,r=Lr(e);return"string"!==r?[new Vt(i,e,"string expected, "+r+" found")]:[]}var _o={promoteId:function(t){var e=t.key,i=t.value;if("string"===Lr(i))return go({key:e,value:i});var r=[];for(var o in i)r.push.apply(r,go({key:e+"."+o,value:i[o]}));return r}};function vo(t){var e=t.value,i=t.key,r=t.styleSpec,o=t.style;if(!e.type)return[new Vt(i,e,'"type" is required')];var n,a=qt(e.type);switch(a){case"vector":case"raster":case"model":case"raster-dem":return Hr({key:i,value:e,valueSpec:r["source_"+a.replace("-","_")],style:t.style,styleSpec:r,objectElementValidators:_o});case"geojson":if(n=Hr({key:i,value:e,valueSpec:r.source_geojson,style:o,styleSpec:r,objectElementValidators:_o}),e.cluster)for(var s in e.clusterProperties){var l=e.clusterProperties[s],u=l[0],h="string"==typeof u?[u,["accumulated"],["get",s]]:u;n.push.apply(n,Qr({key:i+"."+s+".map",value:l[1],expressionContext:"cluster-map"})),n.push.apply(n,Qr({key:i+"."+s+".reduce",value:h,expressionContext:"cluster-reduce"}))}return n;case"video":return Hr({key:i,value:e,valueSpec:r.source_video,style:o,styleSpec:r});case"image":return Hr({key:i,value:e,valueSpec:r.source_image,style:o,styleSpec:r});case"canvas":return[new Vt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $r({key:i+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image","model"]},style:o,styleSpec:r})}}function xo(t){var e=t.value,i=t.styleSpec,r=i.light,o=t.style,n=[],a=Lr(e);if(void 0===e)return n;if("object"!==a)return n.concat([new Vt("light",e,"object expected, "+a+" found")]);for(var s in e){var l=s.match(/^(.*)-transition$/);n=n.concat(l&&r[l[1]]&&r[l[1]].transition?To({key:s,value:e[s],valueSpec:i.transition,style:o,styleSpec:i}):r[s]?To({key:s,value:e[s],valueSpec:r[s],style:o,styleSpec:i}):[new Vt(s,e[s],'unknown property "'+s+'"')])}return n}function bo(t){var e=t.value,i=t.key,r=t.style,o=t.styleSpec,n=o.terrain,a=[],s=Lr(e);if(void 0===e)return a;if("object"!==s)return a.concat([new Vt("terrain",e,"object expected, "+s+" found")]);for(var l in e){var u=l.match(/^(.*)-transition$/);a=a.concat(u&&n[u[1]]&&n[u[1]].transition?To({key:l,value:e[l],valueSpec:o.transition,style:r,styleSpec:o}):n[l]?To({key:l,value:e[l],valueSpec:n[l],style:r,styleSpec:o}):[new Vt(l,e[l],'unknown property "'+l+'"')])}if(e.source){var h=r.sources&&r.sources[e.source],p=h&&qt(h.type);h?"raster-dem"!==p&&a.push(new Vt(i,e.source,"terrain cannot be used with a source of type "+p+', it only be used with a "raster-dem" source type')):a.push(new Vt(i,e.source,'source "'+e.source+'" not found'))}else a.push(new Vt(i,e,'terrain is missing required property "source"'));return a}function wo(t){var e=t.value,i=t.style,r=t.styleSpec,o=r.fog,n=[],a=Lr(e);if(void 0===e)return n;if("object"!==a)return n.concat([new Vt("fog",e,"object expected, "+a+" found")]);for(var s in e.range&&!Nr(Xt(e.range))&&e.range[0]>=e.range[1]&&(n=n.concat([new Vt("fog",e,"fog.range[0] can't be greater than or equal to fog.range[1]")])),e){var l=s.match(/^(.*)-transition$/);n=n.concat(l&&o[l[1]]&&o[l[1]].transition?To({key:s,value:e[s],valueSpec:r.transition,style:i,styleSpec:r}):o[s]?To({key:s,value:e[s],valueSpec:o[s],style:i,styleSpec:r}):[new Vt(s,e[s],'unknown property "'+s+'"')])}return n}var ko={"*":function(){return[]},array:Yr,boolean:function(t){var e=t.value,i=t.key,r=Lr(e);return"boolean"!==r?[new Vt(i,e,"boolean expected, "+r+" found")]:[]},number:Kr,color:function(t){var e=t.key,i=t.value,r=Lr(i);return"string"!==r?[new Vt(e,i,"color expected, "+r+" found")]:null===fe.parseCSSColor(i)?[new Vt(e,i,'color expected, "'+i+'" found')]:[]},constants:Gt,enum:$r,filter:ho,function:Jr,layer:yo,object:Hr,source:vo,light:xo,terrain:bo,fog:wo,string:go,formatted:function(t){return 0===go(t).length?[]:Qr(t)},resolvedImage:function(t){return 0===go(t).length?[]:Qr(t)}};function To(t){var e=t.value,i=t.valueSpec,r=t.styleSpec;return i.expression&&Cr(qt(e))?Jr(t):i.expression&&Nr(Xt(e))?Qr(t):i.type&&ko[i.type]?ko[i.type](t):Hr(Zt({},t,{valueSpec:i.type?r[i.type]:i}))}function Io(t){var e=t.value,i=t.key,r=go(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new Vt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new Vt(i,e,'"glyphs" url must include a "{range}" token'))),r}function So(t,e){void 0===e&&(e=Nt);var i=[];return i=i.concat(To({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Io,"*":function(){return[]}}})),t.constants&&(i=i.concat(Gt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Eo(i)}function Eo(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Ao(t){return function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];return Eo(t.apply(this,e))}}So.source=Ao(vo),So.light=Ao(xo),So.terrain=Ao(bo),So.fog=Ao(wo),So.layer=Ao(yo),So.filter=Ao(ho),So.paintProperty=Ao(fo),So.layoutProperty=Ao(mo);var Po=So,Mo=Po.light,Lo=Po.fog,Co=Po.paintProperty,Do=Po.layoutProperty;function zo(t,e){var i=!1;if(e&&e.length){t.map&&t.map._errorFun&&t.map._errorFun.length>0&&t.map._errorFun.forEach((function(t){t(e)}));for(var r=0,o=e;r<o.length;r+=1)t.fire(new Ut(new Error(o[r].message))),i=!0}return i}var Oo=Bo,Ro=3;function Bo(t,e,i){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(var n=0;n<this.d*this.d;n++){var a=o[Ro+n],s=o[Ro+n+1];r.push(a===s?null:o.subarray(a,s))}var l=o[Ro+r.length+1];this.keys=o.subarray(o[Ro+r.length],l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var u=0;u<this.d*this.d;u++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var h=i/e*t;this.min=-h,this.max=t+h}Bo.prototype.insert=function(t,e,i,r,o){this._forEachCell(e,i,r,o,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(o)},Bo.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Bo.prototype._insertCell=function(t,e,i,r,o,n){this.cells[o].push(n)},Bo.prototype.query=function(t,e,i,r,o){var n=this.min,a=this.max;if(t<=n&&e<=n&&a<=i&&a<=r&&!o)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,i,r,this._queryCell,s,{},o),s},Bo.prototype._queryCell=function(t,e,i,r,o,n,a,s){var l=this.cells[o];if(null!==l)for(var u=this.keys,h=this.bboxes,p=0;p<l.length;p++){var c=l[p];if(void 0===a[c]){var f=4*c;(s?s(h[f+0],h[f+1],h[f+2],h[f+3]):t<=h[f+2]&&e<=h[f+3]&&i>=h[f+0]&&r>=h[f+1])?(a[c]=!0,n.push(u[c])):a[c]=!1}}},Bo.prototype._forEachCell=function(t,e,i,r,o,n,a,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),h=this._convertToCellCoord(i),p=this._convertToCellCoord(r),c=l;c<=h;c++)for(var f=u;f<=p;f++){var d=this.d*f+c;if((!s||s(this._convertFromCellCoord(c),this._convertFromCellCoord(f),this._convertFromCellCoord(c+1),this._convertFromCellCoord(f+1)))&&o.call(this,t,e,i,r,d,n,a,s))return}},Bo.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Bo.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Bo.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=Ro+this.cells.length+1+1,i=0,r=0;r<this.cells.length;r++)i+=this.cells[r].length;var o=new Int32Array(e+i+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var n=e,a=0;a<t.length;a++){var s=t[a];o[Ro+a]=n,o.set(s,n),n+=s.length}return o[Ro+t.length]=n,o.set(this.keys,n),o[Ro+t.length+1]=n+=this.keys.length,o.set(this.bboxes,n),n+=this.bboxes.length,o.buffer};var Fo=ce((function(t){function e(i){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(i)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Uo=ce((function(t){var e=Fo.default;function i(){t.exports=i=function(){return o},t.exports.__esModule=!0,t.exports.default=t.exports;var r,o={},n=Object.prototype,a=n.hasOwnProperty,s=Object.defineProperty||function(t,e,i){t[e]=i.value},l="function"==typeof Symbol?Symbol:{},u=l.iterator||"@@iterator",h=l.asyncIterator||"@@asyncIterator",p=l.toStringTag||"@@toStringTag";function c(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,i){return t[e]=i}}function f(t,e,i,r){var o=Object.create((e&&e.prototype instanceof x?e:x).prototype),n=new D(r||[]);return s(o,"_invoke",{value:P(t,i,n)}),o}function d(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}o.wrap=f;var m="suspendedStart",y="suspendedYield",g="executing",_="completed",v={};function x(){}function b(){}function w(){}var k={};c(k,u,(function(){return this}));var T=Object.getPrototypeOf,I=T&&T(T(z([])));I&&I!==n&&a.call(I,u)&&(k=I);var S=w.prototype=x.prototype=Object.create(k);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,i){function r(o,n,s,l){var u=d(t[o],t,n);if("throw"!==u.type){var h=u.arg,p=h.value;return p&&"object"==e(p)&&a.call(p,"__await")?i.resolve(p.__await).then((function(t){r("next",t,s,l)}),(function(t){r("throw",t,s,l)})):i.resolve(p).then((function(t){h.value=t,s(h)}),(function(t){return r("throw",t,s,l)}))}l(u.arg)}var o;s(this,"_invoke",{value:function(t,e){function n(){return new i((function(i,o){r(t,e,i,o)}))}return o=o?o.then(n,n):n()}})}function P(t,e,i){var o=m;return function(n,a){if(o===g)throw Error("Generator is already running");if(o===_){if("throw"===n)throw a;return{value:r,done:!0}}for(i.method=n,i.arg=a;;){var s=i.delegate;if(s){var l=M(s,i);if(l){if(l===v)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===m)throw o=_,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=g;var u=d(t,e,i);if("normal"===u.type){if(o=i.done?_:y,u.arg===v)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(o=_,i.method="throw",i.arg=u.arg)}}}function M(t,e){var i=e.method,o=t.iterator[i];if(o===r)return e.delegate=null,"throw"===i&&t.iterator.return&&(e.method="return",e.arg=r,M(t,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),v;var n=d(o,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,v;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function z(t){if(t||""===t){var i=t[u];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,n=function e(){for(;++o<t.length;)if(a.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return n.next=n}}throw new TypeError(e(t)+" is not iterable")}return b.prototype=w,s(S,"constructor",{value:w,configurable:!0}),s(w,"constructor",{value:b,configurable:!0}),b.displayName=c(w,p,"GeneratorFunction"),o.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,c(t,p,"GeneratorFunction")),t.prototype=Object.create(S),t},o.awrap=function(t){return{__await:t}},E(A.prototype),c(A.prototype,h,(function(){return this})),o.AsyncIterator=A,o.async=function(t,e,i,r,n){void 0===n&&(n=Promise);var a=new A(f(t,e,i,r),n);return o.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(S),c(S,p,"Generator"),c(S,u,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),o.keys=function(t){var e=Object(t),i=[];for(var r in e)i.push(r);return i.reverse(),function t(){for(;i.length;){var r=i.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},o.values=z,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(i,o){return s.type="throw",s.arg=t,e.next=i,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var n=this.tryEntries[o],s=n.completion;if("root"===n.tryLoc)return i("end");if(n.tryLoc<=this.prev){var l=a.call(n,"catchLoc"),u=a.call(n,"finallyLoc");if(l&&u){if(this.prev<n.catchLoc)return i(n.catchLoc,!0);if(this.prev<n.finallyLoc)return i(n.finallyLoc)}else if(l){if(this.prev<n.catchLoc)return i(n.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return i(n.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var n=o?o.completion:{};return n.type=t,n.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(n)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),C(i),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var r=i.completion;if("throw"===r.type){var o=r.arg;C(i)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:z(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=r),v}},o}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),jo=Uo(),No=jo;try{regeneratorRuntime=jo}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=jo:Function("r","regeneratorRuntime = r")(jo)}function Vo(t){return Vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vo(t)}function Go(t){var e=function(t){if("object"!=Vo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Vo(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Vo(e)?e:e+""}function Zo(t,e,i){return(e=Go(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function qo(t,e,i,r,o,n,a){try{var s=t[n](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(r,o)}function Xo(t){return function(){var e=this,i=arguments;return new Promise((function(r,o){var n=t.apply(e,i);function a(t){qo(n,r,o,a,s,"next",t)}function s(t){qo(n,r,o,a,s,"throw",t)}a(void 0)}))}}var Wo={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},Ho=Wo.global||Wo.self||Wo.window,Yo="object"!==("undefined"==typeof process?"undefined":Vo(process))||"[object process]"!==String(process)||process.browser,Ko="undefined"!=typeof process&&process.version&&process.version.match(/v([0-9]*)/);Ko&&parseFloat(Ko[1]);var Jo="undefined"!=typeof Image,Qo="undefined"!=typeof ImageBitmap,$o=Boolean(Ho._parseImageNode),tn=!!Yo||$o;function en(t){switch(function(t){var e=function(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"===Vo(t)&&t.data&&t.width&&t.height?"data":null}(t);if(!e)throw new Error("Not an image");return e}(t)){case"data":return t;case"image":case"imagebitmap":var e=document.createElement("canvas"),i=e.getContext("2d");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0),i.getImageData(0,0,t.width,t.height);default:return function(){throw new Error(void 0)}()}}var rn=/^data:image\/svg\+xml/,on=/\.svg((\?|#).*)?$/;function nn(t){return t&&(rn.test(t)||on.test(t))}function an(t,e){if(nn(e)){var i=(new TextDecoder).decode(t);return"data:image/svg+xml;base64,".concat(btoa(i))}return sn(t,e)}function sn(t,e){if(nn(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}function ln(t,e,i){return un.apply(this,arguments)}function un(){return(un=Xo(No.mark((function t(e,i,r){var o,n,a;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=an(e,r),n=self.URL||self.webkitURL,a="string"!=typeof o&&n.createObjectURL(o),t.prev=3,t.next=6,hn(a||o,i);case 6:return t.abrupt("return",t.sent);case 7:return t.prev=7,a&&n.revokeObjectURL(a),t.finish(7);case 10:case"end":return t.stop()}}),t,null,[[3,,7,10]])})))).apply(this,arguments)}function hn(t,e){return pn.apply(this,arguments)}function pn(){return pn=Xo(No.mark((function t(e,i){var r;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((r=new Image).src=e,!(i.image&&i.image.decode&&r.decode)){t.next=6;break}return t.next=5,r.decode();case 5:return t.abrupt("return",r);case 6:return t.next=8,new Promise((function(t,i){try{r.onload=function(){return t(r)},r.onerror=function(t){return i(new Error("Could not load image ".concat(e,": ").concat(t)))}}catch(t){i(t)}}));case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t)}))),pn.apply(this,arguments)}var cn={},fn=!0;function dn(t,e,i){return mn.apply(this,arguments)}function mn(){return(mn=Xo(No.mark((function t(e,i,r){var o,n;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!nn(r)){t.next=7;break}return t.next=3,ln(e,i,r);case 3:o=t.sent,t.next=8;break;case 7:o=sn(e,r);case 8:return n=i&&i.imagebitmap,t.next=11,yn(o,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function yn(t){return gn.apply(this,arguments)}function gn(){return gn=Xo(No.mark((function t(e){var i,r=arguments;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!_n(i=r.length>1&&void 0!==r[1]?r[1]:null)&&fn||(i=null),!i){t.next=13;break}return t.prev=3,t.next=6,createImageBitmap(e,i);case 6:return t.abrupt("return",t.sent);case 9:t.prev=9,t.t0=t.catch(3),fn=!1;case 13:return t.next=15,createImageBitmap(e);case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,null,[[3,9]])}))),gn.apply(this,arguments)}function _n(t){for(var e in t||cn)return!0;return!1}var vn=!1,xn=!0;function bn(t){var e=wn(t);return function(t){var e=wn(t);return e.byteLength>=24&&2303741511===e.getUint32(0,vn)?{mimeType:"image/png",width:e.getUint32(16,vn),height:e.getUint32(20,vn)}:null}(e)||function(t){var e=wn(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,vn)&&255===e.getUint8(2)))return null;for(var i=function(){for(var t=new Set([65499,65476,65484,65501,65534]),e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}(),r=i.tableMarkers,o=i.sofMarkers,n=2;n+9<e.byteLength;){var a=e.getUint16(n,vn);if(o.has(a))return{mimeType:"image/jpeg",height:e.getUint16(n+5,vn),width:e.getUint16(n+7,vn)};if(!r.has(a))return null;n+=2,n+=e.getUint16(n,vn)}return null}(e)||function(t){var e=wn(t);return e.byteLength>=10&&1195984440===e.getUint32(0,vn)?{mimeType:"image/gif",width:e.getUint16(6,xn),height:e.getUint16(8,xn)}:null}(e)||function(t){var e=wn(t);return e.byteLength>=14&&16973===e.getUint16(0,vn)&&e.getUint32(2,xn)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,xn),height:e.getUint32(22,xn)}:null}(e)}function wn(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}function kn(t,e){var i=bn(t)||{};return(0,Ho._parseImageNode)(t,i.mimeType,e)}function Tn(){return(Tn=Xo(No.mark((function t(e,i,r){var o,n,a,s;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=(r||{}).url,a=In(o=((i=i||{}).image||{}).type||"auto"),t.t0=a,t.next="imagebitmap"===t.t0?8:"image"===t.t0?12:"data"===t.t0?16:20;break;case 8:return t.next=10,dn(e,i,n);case 10:case 14:case 18:return s=t.sent,t.abrupt("break",21);case 12:return t.next=14,ln(e,i,n);case 16:return t.next=18,kn(e,i);case 20:case 21:return"data"===o&&(s=en(s)),t.abrupt("return",s);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function In(t){switch(t){case"auto":case"data":return function(){if(Qo)return"imagebitmap";if(Jo)return"image";if(tn)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return Qo||Jo||tn;case"imagebitmap":return Qo;case"image":case"html":return Jo;case"data":case"ndarray":return tn;default:throw new Error("@loaders.gl/images: image ".concat(t," not supported in this environment"))}}(t),t}}var Sn={id:"image",name:"Images",version:"2.2.8",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vndmicrosofticon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:function(t,e,i){return Tn.apply(this,arguments)},test:function(t){return Boolean(bn(new DataView(t)))},options:{image:{type:"auto",decode:!0}}},En=Sn;function An(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=i||new Set;if(t)if(Pn(t))r.add(t);else if(Pn(t.buffer))r.add(t.buffer);else if(ArrayBuffer.isView(t));else if(e&&"object"===Vo(t))for(var o in t)An(t[o],e,r);return void 0===i?Array.from(r):null}function Pn(t){return!!t&&(t instanceof ArrayBuffer||"undefined"!=typeof MessagePort&&t instanceof MessagePort||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)}function Mn(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function Ln(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2.2.8",i=t.version;e&&i&&(e=Cn(e),i=Cn(i))}function Cn(t){var e=t.split(".").map(Number);return{major:e[0],minor:e[1]}}var Dn={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},zn=Dn.global||Dn.self||Dn.window,On="object"!==("undefined"==typeof process?"undefined":Vo(process))||"[object process]"!==String(process)||process.browser,Rn="undefined"!=typeof process&&process.version&&process.version.match(/v([0-9]*)/),Bn=Rn&&parseFloat(Rn[1])||0,Fn={};function Un(t){return t+3&-4}var jn={};function Nn(t){for(var e in jn)t.startsWith(e)&&(t=t.replace(e,jn[e]));return t.startsWith("http://")||t.startsWith("https://")||(t="".concat("").concat(t)),t}function Vn(t,e){this.v=t,this.k=e}function Gn(t){return new Vn(t,0)}function Zn(t){return function(){return new qn(t.apply(this,arguments))}}function qn(t){var e,i;function r(e,i){try{var n=t[e](i),a=n.value,s=a instanceof Vn;Promise.resolve(s?a.v:a).then((function(i){if(s){var l="return"===e?"return":"next";if(!a.k||i.done)return r(l,i);i=t[l](i).value}o(n.done?"return":"normal",i)}),(function(t){r("throw",t)}))}catch(t){o("throw",t)}}function o(t,o){switch(t){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?r(e.key,e.arg):i=null}this._invoke=function(t,o){return new Promise((function(n,a){var s={key:t,arg:o,resolve:n,reject:a,next:null};i?i=i.next=s:(e=i=s,r(t,o))}))},"function"!=typeof t.return&&(this.return=void 0)}function Xn(t){var e,i,r,o=2;for("undefined"!=typeof Symbol&&(i=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(i&&null!=(e=t[i]))return e.call(t);if(r&&null!=(e=t[r]))return new Wn(e.call(t));i="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Wn(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return Wn=function(t){this.s=t,this.n=t.next},Wn.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var i=this.s.return;return void 0===i?Promise.resolve({value:t,done:!0}):e(i.apply(this.s,arguments))},throw:function(t){var i=this.s.return;return void 0===i?Promise.reject(t):e(i.apply(this.s,arguments))}},new Wn(t)}function Hn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yn(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Go(r.key),r)}}function Kn(t,e,i){return e&&Yn(t.prototype,e),i&&Yn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function Qn(t){return function(t){if(Array.isArray(t))return Jn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Jn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Jn(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}qn.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},qn.prototype.next=function(t){return this._invoke("next",t)},qn.prototype.throw=function(t){return this._invoke("throw",t)},qn.prototype.return=function(t){return this._invoke("return",t)};var $n=["SCALAR","VEC2","VEC3","VEC4"],ta=new Map([[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126]]),ea={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ia={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ra={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function oa(t){var e=ta.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}var na=function(){function t(e){if(Hn(this,t),e instanceof t)return e;e||(e={json:{version:2,buffers:[]},buffers:[]}),this.gltf=e}return Kn(t,[{key:"getApplicationData",value:function(t){return this.json[t]}},{key:"getExtraData",value:function(t){return(this.json.extras||{})[t]}},{key:"getExtension",value:function(t){return this.getUsedExtensions().find((function(e){return e===t}))?(this.json.extensions||{})[t]||!0:null}},{key:"getRequiredExtension",value:function(t){return this.getRequiredExtensions().find((function(e){return e===t}))?this.getExtension(t):null}},{key:"getRequiredExtensions",value:function(){return this.json.extensionsRequired||[]}},{key:"getUsedExtensions",value:function(){return this.json.extensionsUsed||[]}},{key:"getObjectExtension",value:function(t,e){return(t.extensions||{})[e]}},{key:"getScene",value:function(t){return this.getObject("scenes",t)}},{key:"getNode",value:function(t){return this.getObject("nodes",t)}},{key:"getSkin",value:function(t){return this.getObject("skins",t)}},{key:"getMesh",value:function(t){return this.getObject("meshes",t)}},{key:"getMaterial",value:function(t){return this.getObject("materials",t)}},{key:"getAccessor",value:function(t){return this.getObject("accessors",t)}},{key:"getCamera",value:function(t){return null}},{key:"getTexture",value:function(t){return this.getObject("textures",t)}},{key:"getSampler",value:function(t){return this.getObject("samplers",t)}},{key:"getImage",value:function(t){return this.getObject("images",t)}},{key:"getBufferView",value:function(t){return this.getObject("bufferViews",t)}},{key:"getBuffer",value:function(t){return this.getObject("buffers",t)}},{key:"getObject",value:function(t,e){if("object"===Vo(e))return e;var i=this.json[t]&&this.json[t][e];if(!i)throw new Error("glTF file error: Could not find ".concat(t,"[").concat(e,"]"));return i}},{key:"getTypedArrayForBufferView",value:function(t){t=this.getBufferView(t);var e=this.gltf.buffers[t.buffer];return new Uint8Array(e.arrayBuffer,(t.byteOffset||0)+e.byteOffset,t.byteLength)}},{key:"getTypedArrayForAccessor",value:function(t){t=this.getAccessor(t);var e=this.getBufferView(t.bufferView),i=this.getBuffer(e.buffer).data,r=function(t){var e=ea[t.type];return{ArrayType:ra[t.componentType],length:t.count*e,byteLength:t.count*e*ia[t.componentType]}}(t);return new(0,r.ArrayType)(i,e.byteOffset+t.byteOffset,r.length)}},{key:"getTypedArrayForImageData",value:function(t){t=this.getAccessor(t);var e=this.getBufferView(t.bufferView),i=this.getBuffer(e.buffer);return new Uint8Array(i.data,e.byteOffset||0,e.byteLength)}},{key:"addApplicationData",value:function(t,e){return this.json[t]=e,this}},{key:"addExtraData",value:function(t,e){return this.json.extras=this.json.extras||{},this.json.extras[t]=e,this}},{key:"addObjectExtension",value:function(t,e,i){return t.extensions=t.extensions||{},t.extensions[e]=i,this.registerUsedExtension(e),this}},{key:"removeObjectExtension",value:function(t,e){return delete(t.extensions||{})[e],this}},{key:"addExtension",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}},{key:"addRequiredExtension",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.addExtension(t,e),this.registerRequiredExtension(t),e}},{key:"registerUsedExtension",value:function(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((function(e){return e===t}))||this.json.extensionsUsed.push(t)}},{key:"registerRequiredExtension",value:function(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((function(e){return e===t}))||this.json.extensionsRequired.push(t)}},{key:"removeExtension",value:function(t){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t),this.json.extensions&&delete this.json.extensions[t]}},{key:"setObjectExtension",value:function(t,e,i){(t.extensions||{})[e]=i}},{key:"addMesh",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,r={primitives:[{attributes:this._addAttributes(t),indices:e,mode:i}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}},{key:"addPointCloud",value:function(t){var e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}},{key:"addImage",value:function(t,e){var i;e=e||((i=bn(t))?i.mimeType:null);var r={bufferView:this.addBufferView(t),mimeType:e};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}},{key:"addBufferView",value:function(t){var e=t.byteLength;this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);var i={buffer:0,byteOffset:this.byteLength,byteLength:e};return this.byteLength+=Un(e),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}},{key:"addAccessor",value:function(t,e){var i,r={bufferView:t,type:(i=e.size,$n[i-1]||$n[0]),componentType:e.componentType,count:e.count};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}},{key:"addBinaryBuffer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3},i=this.addBufferView(t),r={size:e.size,componentType:oa(t),count:Math.round(t.length/e.size)};return this.addAccessor(i,Object.assign(r,e))}},{key:"createBinaryChunk",value:function(){if(!this.arrayBuffer){for(var t=this.byteLength,e=new ArrayBuffer(t),i=new Uint8Array(e),r=0,o=0;o<this.sourceBuffers.length;o++)a=i,s=r,l=(n=this.sourceBuffers[o])instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength),a.set(l,s),r=s+Un(l.byteLength);this.json.buffers[0].byteLength=t,this.arrayBuffer=e,this.sourceBuffers=[]}var n,a,s,l}},{key:"_removeStringFromArray",value:function(t,e){for(var i=!0;i;){var r=t.indexOf(e);r>-1?t.splice(r,1):i=!1}}},{key:"json",get:function(){return this.gltf.json}}]),t}(),aa=!0;function sa(t,e,i,r,o){var n=new Uint8Array(e.buffer,i,r),a=new TextDecoder("utf8").decode(n);t.json=JSON.parse(a)}function la(t,e,i,r,o){t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:i,byteLength:r,arrayBuffer:e.buffer})}var ua={id:"glb",name:"GLB",version:"2.2.8",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,parse:function(){var t=Xo(No.mark((function t(e,i){return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ha(e,i));case 1:case"end":return t.stop()}}),t)})));return function(e,i){return t.apply(this,arguments)}}(),parseSync:ha,options:{glb:{strict:!1}}};function ha(t,e){var i=e.byteOffset,r={};return function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=new DataView(e);t.type=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"".concat(String.fromCharCode(t.getUint8(e+0))).concat(String.fromCharCode(t.getUint8(e+1))).concat(String.fromCharCode(t.getUint8(e+2))).concat(String.fromCharCode(t.getUint8(e+3)))}(o,i+0),t.version=o.getUint32(i+4,aa);var n=o.getUint32(i+8,aa);t.header={byteOffset:i,byteLength:n},t.json={},t.binChunks=[],function(t,e,i,r){for(;i+8<=t.header.byteLength;){var o=e.getUint32(i+0,aa),n=e.getUint32(i+4,aa);switch(i+=8,n){case 1313821514:sa(t,e,i,o);break;case 5130562:la(t,e,i,o);break;case 0:r.glb.strict||sa(t,e,i,o);break;case 1:r.glb.strict||la(t,e,i,o)}i+=Un(o)}}(t,o,i+12,r)}(r,t,void 0===i?0:i,e),r}var pa=n.ImageData,ca=n.ImageBitmap,fa={};function da(t,e,i){void 0===i&&(i={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),fa[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}for(var ma in da("Object",Object),Oo.serialize=function(t,e){var i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}},Oo.deserialize=function(t){return new Oo(t.buffer)},da("Grid",Oo),da("Color",me),da("Error",Error),da("ResolvedImage",we),da("Model",na),da("StylePropertyFunction",Xr),da("StyleExpression",jr,{omit:["_evaluator"]}),da("ZoomDependentExpression",Zr),da("ZoomConstantExpression",Gr),da("CompoundExpression",qe,{omit:["_evaluate"]}),Ir)Ir[ma]._classRegistryKey||da("Expression_"+ma,Ir[ma]);function ya(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function ga(t){return ca&&t instanceof ca}function _a(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(ya(t)||ga(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var i=t;return e&&e.push(i.buffer),i}if(t instanceof pa)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var r=[],o=0,n=t;o<n.length;o+=1)r.push(_a(n[o],e));return r}if("object"==typeof t){var a=t.constructor,s=a._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");var l=a.serialize?a.serialize(t,e):{};if(!a.serialize){for(var u in t)if(t.hasOwnProperty(u)&&!(fa[s].omit.indexOf(u)>=0)){var h=t[u];l[u]=fa[s].shallow.indexOf(u)>=0?h:_a(h,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function va(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||ya(t)||ga(t)||ArrayBuffer.isView(t)||t instanceof pa)return t;if(Array.isArray(t))return t.map(va);if("object"==typeof t){var e=t.$name||"Object",i=fa[e].klass;if(!i)throw new Error("can't deserialize unregistered class "+e);if(i.deserialize)return i.deserialize(t);for(var r=Object.create(i.prototype),o=0,n=Object.keys(t);o<n.length;o+=1){var a=n[o];if("$name"!==a){var s=t[a];r[a]=fa[e].shallow.indexOf(a)>=0?s:va(s)}}return r}throw new Error("can't deserialize object of type "+typeof t)}var xa=function(){this.first=!0};xa.prototype.update=function(t,e){var i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))};var ba=function(t){return t>=1536&&t<=1791},wa=function(t){return t>=1872&&t<=1919},ka=function(t){return t>=2208&&t<=2303},Ta=function(t){return t>=11904&&t<=12031},Ia=function(t){return t>=12032&&t<=12255},Sa=function(t){return t>=12272&&t<=12287},Ea=function(t){return t>=12288&&t<=12351},Aa=function(t){return t>=12352&&t<=12447},Pa=function(t){return t>=12448&&t<=12543},Ma=function(t){return t>=12544&&t<=12591},La=function(t){return t>=12704&&t<=12735},Ca=function(t){return t>=12736&&t<=12783},Da=function(t){return t>=12784&&t<=12799},za=function(t){return t>=12800&&t<=13055},Oa=function(t){return t>=13056&&t<=13311},Ra=function(t){return t>=13312&&t<=19903},Ba=function(t){return t>=19968&&t<=40959},Fa=function(t){return t>=40960&&t<=42127},Ua=function(t){return t>=42128&&t<=42191},ja=function(t){return t>=44032&&t<=55215},Na=function(t){return t>=63744&&t<=64255},Va=function(t){return t>=64336&&t<=65023},Ga=function(t){return t>=65040&&t<=65055},Za=function(t){return t>=65072&&t<=65103},qa=function(t){return t>=65104&&t<=65135},Xa=function(t){return t>=65136&&t<=65279},Wa=function(t){return t>=65280&&t<=65519};function Ha(t){for(var e=0,i=t;e<i.length;e+=1)if(Ya(i[e].charCodeAt(0)))return!0;return!1}function Ya(t){return!(746!==t&&747!==t&&(t<4352||!(La(t)||Ma(t)||Za(t)&&!(t>=65097&&t<=65103)||Na(t)||Oa(t)||Ta(t)||Ca(t)||!(!Ea(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Ra(t)||Ba(t)||za(t)||function(t){return t>=12592&&t<=12687}(t)||function(t){return t>=43360&&t<=43391}(t)||function(t){return t>=55216&&t<=55295}(t)||function(t){return t>=4352&&t<=4607}(t)||ja(t)||Aa(t)||Sa(t)||function(t){return t>=12688&&t<=12703}(t)||Ia(t)||Da(t)||Pa(t)&&12540!==t||!(!Wa(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!qa(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||function(t){return t>=5120&&t<=5759}(t)||function(t){return t>=6320&&t<=6399}(t)||Ga(t)||function(t){return t>=19904&&t<=19967}(t)||Fa(t)||Ua(t))))}function Ka(t){return!(Ya(t)||function(t){return!!(function(t){return t>=128&&t<=255}(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||function(t){return t>=8192&&t<=8303}(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||function(t){return t>=8448&&t<=8527}(t)||function(t){return t>=8528&&t<=8591}(t)||function(t){return t>=8960&&t<=9215}(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||function(t){return t>=9216&&t<=9279}(t)&&9251!==t||function(t){return t>=9280&&t<=9311}(t)||function(t){return t>=9312&&t<=9471}(t)||function(t){return t>=9632&&t<=9727}(t)||function(t){return t>=9728&&t<=9983}(t)&&!(t>=9754&&t<=9759)||function(t){return t>=11008&&t<=11263}(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Ea(t)||Pa(t)||function(t){return t>=57344&&t<=63743}(t)||Za(t)||qa(t)||Wa(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ja(t){return t>=1424&&t<=2303||Va(t)||Xa(t)}function Qa(t,e){return!(!e&&Ja(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||function(t){return t>=6016&&t<=6143}(t))}function $a(t){for(var e=0,i=t;e<i.length;e+=1)if(Ja(i[e].charCodeAt(0)))return!0;return!1}var ts="deferred",es="loading",is="loaded",rs=null,os="unavailable",ns=null,as=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(os="error"),rs&&rs(t)};function ss(){ls.fire(new Ft("pluginStateChange",{pluginStatus:os,pluginURL:ns}))}var ls=new jt,us=function(){return os},hs=function(){if(os!==ts||!ns)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");os=es,ss(),ns&&Lt({url:ns},(function(t){t?as(t):(os=is,ss())}))},ps={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return os===is||null!=ps.applyArabicShaping},isLoading:function(){return os===es},setState:function(t){os=t.pluginStatus,ns=t.pluginURL},isParsed:function(){return null!=ps.applyArabicShaping&&null!=ps.processBidirectionalText&&null!=ps.processStyledBidirectionalText},getPluginURL:function(){return ns}},cs=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xa,this.transition={})};cs.prototype.isSupportedScript=function(t){return function(t,e){for(var i=0,r=t;i<r.length;i+=1)if(!Qa(r[i].charCodeAt(0),e))return!1;return!0}(t,ps.isLoaded())},cs.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},cs.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}};var fs=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Cr(t))return new Xr(t,e);if(Nr(t)){var i=qr(t,e);if("error"===i.result)throw new Error(i.value.map((function(t){return t.key+": "+t.message})).join(", "));return i.value}var r=t;return"string"==typeof t&&"color"===e.type&&(r=me.parse(t)),{kind:"constant",evaluate:function(){return r}}}(void 0===e?t.specification.default:e,t.specification)};fs.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},fs.prototype.possiblyEvaluate=function(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)};var ds=function(t){this.property=t,this.value=new fs(t,void 0)};ds.prototype.transitioned=function(t,e){return new ys(this.property,this.value,e,b({},t.transition,this.transition),t.now)},ds.prototype.untransitioned=function(){return new ys(this.property,this.value,null,{},0)};var ms=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};ms.prototype.getValue=function(t){return L(this._values[t].value.value)},ms.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ds(this._values[t].property)),this._values[t].value=new fs(this._values[t].property,null===e?void 0:L(e))},ms.prototype.getTransition=function(t){return L(this._values[t].transition)},ms.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ds(this._values[t].property)),this._values[t].transition=L(e)||void 0},ms.prototype.serialize=function(){for(var t={},e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e],o=this.getValue(r);void 0!==o&&(t[r]=o);var n=this.getTransition(r);void 0!==n&&(t[r+"-transition"]=n)}return t},ms.prototype.transitioned=function(t,e){for(var i=new gs(this._properties),r=0,o=Object.keys(this._values);r<o.length;r+=1){var n=o[r];i._values[n]=this._values[n].transitioned(t,e._values[n])}return i},ms.prototype.untransitioned=function(){for(var t=new gs(this._properties),e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e];t._values[r]=this._values[r].untransitioned()}return t};var ys=function(t,e,i,r,o){var n=r.delay||0,a=r.duration||0;o=o||0,this.property=t,this.value=e,this.begin=o+n,this.end=this.begin+a,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)};ys.prototype.possiblyEvaluate=function(t,e,i){var r=t.now||0,o=this.value.possiblyEvaluate(t,e,i),n=this.prior;if(n){if(r>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(r<this.begin)return n.possiblyEvaluate(t,e,i);var a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(t,e,i),o,d(a))}return o};var gs=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};gs.prototype.possiblyEvaluate=function(t,e,i){for(var r=new xs(this._properties),o=0,n=Object.keys(this._values);o<n.length;o+=1){var a=n[o];r._values[a]=this._values[a].possiblyEvaluate(t,e,i)}return r},gs.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var _s=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};_s.prototype.getValue=function(t){return L(this._values[t].value)},_s.prototype.setValue=function(t,e){this._values[t]=new fs(this._values[t].property,null===e?void 0:L(e))},_s.prototype.serialize=function(){for(var t={},e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e],o=this.getValue(r);void 0!==o&&(t[r]=o)}return t},_s.prototype.possiblyEvaluate=function(t,e,i){for(var r=new xs(this._properties),o=0,n=Object.keys(this._values);o<n.length;o+=1){var a=n[o];r._values[a]=this._values[a].possiblyEvaluate(t,e,i)}return r};var vs=function(t,e,i){this.property=t,this.value=e,this.parameters=i};vs.prototype.isConstant=function(){return"constant"===this.value.kind},vs.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},vs.prototype.evaluate=function(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)};var xs=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};xs.prototype.get=function(t){return this._values[t]};var bs=function(t){this.specification=t};bs.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},bs.prototype.interpolate=function(t,e,i){var r=Ti[this.specification.type];return r?r(t,e,i):t};var ws=function(t,e){this.specification=t,this.overrides=e};ws.prototype.possiblyEvaluate=function(t,e,i,r){return new vs(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)},ws.prototype.interpolate=function(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new vs(this,{kind:"constant",value:void 0},t.parameters);var r=Ti[this.specification.type];return r?new vs(this,{kind:"constant",value:r(t.value.value,e.value.value,i)},t.parameters):t},ws.prototype.evaluate=function(t,e,i,r,o,n){return"constant"===t.kind?t.value:t.evaluate(e,i,r,o,n)};var ks=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(t,e,i,r){if(void 0===t.value)return new vs(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var o=t.expression.evaluate(e,null,{},i,r),n="resolvedImage"===t.property.specification.type&&"string"!=typeof o?o.name:o,a=this._calculate(n,n,n,e);return new vs(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){var s=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new vs(this,{kind:"constant",value:s},e)}return new vs(this,t.expression,e)},e.prototype.evaluate=function(t,e,i,r,o,n){if("source"===t.kind){var a=t.evaluate(e,i,r,o,n);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value},e.prototype._calculate=function(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e,other:i}:{from:i,to:e,other:t}},e.prototype.interpolate=function(t){return t},e}(ws),Ts=function(t){this.specification=t};Ts.prototype.possiblyEvaluate=function(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){var o=t.expression.evaluate(e,null,{},i,r);return this._calculate(o,o,o,e)}return this._calculate(t.expression.evaluate(new cs(Math.floor(e.zoom-1),e)),t.expression.evaluate(new cs(Math.floor(e.zoom),e)),t.expression.evaluate(new cs(Math.floor(e.zoom+1),e)),e)}},Ts.prototype._calculate=function(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}},Ts.prototype.interpolate=function(t){return t};var Is=function(t){this.specification=t};Is.prototype.possiblyEvaluate=function(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)},Is.prototype.interpolate=function(){return!1};var Ss=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var i=t[e];i.specification.overridable&&this.overridableProperties.push(e);var r=this.defaultPropertyValues[e]=new fs(i,void 0),o=this.defaultTransitionablePropertyValues[e]=new ds(i);this.defaultTransitioningPropertyValues[e]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}};function Es(t,e){return 256*(t=g(Math.floor(t),0,255))+g(Math.floor(e),0,255)}da("DataDrivenProperty",ws),da("DataConstantProperty",bs),da("CrossFadedDataDrivenProperty",ks),da("CrossFadedProperty",Ts),da("ColorRampProperty",Is);var As={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ps=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Ms=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ls(t,e){void 0===e&&(e=1);var i=0,r=0;return{members:t.map((function(t){var o=As[t.type].BYTES_PER_ELEMENT,n=i=Cs(i,Math.max(e,o)),a=t.components||1;return r=Math.max(r,o),i+=o*a,{name:t.name,type:t.type,components:a,offset:n}})),size:Cs(i,Math.max(r,e)),alignment:e}}function Cs(t,e){return Math.ceil(t/e)*e}Ms.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ms.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ms.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ms.prototype.clear=function(){this.length=0},Ms.prototype.resize=function(t){this.reserve(t),this.length=t},Ms.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(2*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Ms.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ds=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t},e}(Ms);Ds.prototype.bytesPerElement=4,da("StructArrayLayout2i4",Ds);var zs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,o){var n=4*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,this.int16[n+3]=o,t},e}(Ms);zs.prototype.bytesPerElement=8,da("StructArrayLayout4i8",zs);var Os=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r,o)},e.prototype.emplace=function(t,e,i,r,o,n){var a=5*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=o,this.int16[a+4]=n,t},e}(Ms);Os.prototype.bytesPerElement=10,da("StructArrayLayout5i8",Os);var Rs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a){var s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,o,n,a)},e.prototype.emplace=function(t,e,i,r,o,n,a,s){var l=6*t,u=12*t,h=3*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.uint8[u+4]=r,this.uint8[u+5]=o,this.uint8[u+6]=n,this.uint8[u+7]=a,this.float32[h+2]=s,t},e}(Ms);Rs.prototype.bytesPerElement=12,da("StructArrayLayout2i4ub1f12",Rs);var Bs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,o,n,a,s)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l){var u=8*t,h=16*t,p=4*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.uint8[h+4]=r,this.uint8[h+5]=o,this.uint8[h+6]=n,this.uint8[h+7]=a,this.float32[p+2]=s,this.float32[p+3]=l,t},e}(Ms);Bs.prototype.bytesPerElement=16,da("StructArrayLayout2i4ub2f16",Bs);var Fs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t},e}(Ms);Fs.prototype.bytesPerElement=8,da("StructArrayLayout2f8",Fs);var Us=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,o,n,a,s,l,u)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,h){var p=10*t;return this.uint16[p+0]=e,this.uint16[p+1]=i,this.uint16[p+2]=r,this.uint16[p+3]=o,this.uint16[p+4]=n,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.uint16[p+8]=u,this.uint16[p+9]=h,t},e}(Ms);Us.prototype.bytesPerElement=20,da("StructArrayLayout10ui20",Us);var js=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,o,n,a,s)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l){var u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=o,this.uint16[u+4]=n,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(Ms);js.prototype.bytesPerElement=16,da("StructArrayLayout8ui16",js);var Ns=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,o,n,a,s)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l){var u=8*t;return this.float32[u+0]=e,this.float32[u+1]=i,this.float32[u+2]=r,this.float32[u+3]=o,this.float32[u+4]=n,this.float32[u+5]=a,this.float32[u+6]=s,this.float32[u+7]=l,t},e}(Ms);Ns.prototype.bytesPerElement=32,da("StructArrayLayout8f32",Ns);var Vs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u,h,p){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,o,n,a,s,l,u,h,p)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,h,p,c){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=o,this.uint16[f+4]=n,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=h,this.int16[f+10]=p,this.int16[f+11]=c,t},e}(Ms);Vs.prototype.bytesPerElement=24,da("StructArrayLayout4i4ui4i24",Vs);var Gs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var o=3*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,t},e}(Ms);Gs.prototype.bytesPerElement=12,da("StructArrayLayout3f12",Gs);var Zs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ms);Zs.prototype.bytesPerElement=4,da("StructArrayLayout1ul4",Zs);var qs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,o,n,a,s,l,u)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,h){var p=16*t,c=8*t;return this.int16[p+0]=e,this.int16[p+1]=i,this.float32[c+1]=r,this.float32[c+2]=o,this.float32[c+3]=n,this.float32[c+4]=a,this.int16[p+10]=s,this.uint32[c+6]=l,this.uint16[p+14]=u,this.uint16[p+15]=h,t},e}(Ms);qs.prototype.bytesPerElement=32,da("StructArrayLayout2i4f1i1ul2ui32",qs);var Xs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,o,n)},e.prototype.emplace=function(t,e,i,r,o,n,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=o,this.int16[s+4]=n,this.int16[s+5]=a,t},e}(Ms);Xs.prototype.bytesPerElement=12,da("StructArrayLayout2i2i2i12",Xs);var Ws=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r,o)},e.prototype.emplace=function(t,e,i,r,o,n){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=o,this.int16[s+7]=n,t},e}(Ms);Ws.prototype.bytesPerElement=16,da("StructArrayLayout2f1f2i16",Ws);var Hs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,o){var n=12*t,a=3*t;return this.uint8[n+0]=e,this.uint8[n+1]=i,this.float32[a+1]=r,this.float32[a+2]=o,t},e}(Ms);Hs.prototype.bytesPerElement=12,da("StructArrayLayout2ub2f12",Hs);var Ys=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var o=3*t;return this.uint16[o+0]=e,this.uint16[o+1]=i,this.uint16[o+2]=r,t},e}(Ms);Ys.prototype.bytesPerElement=6,da("StructArrayLayout3ui6",Ys);var Ks=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g){var _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g,_){var v=24*t,x=12*t,b=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=o,this.uint32[x+2]=n,this.uint32[x+3]=a,this.uint32[x+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[x+7]=p,this.float32[x+8]=c,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=m,this.uint32[x+10]=y,this.int16[v+22]=g,this.uint8[b+46]=_,t},e}(Ms);Ks.prototype.bytesPerElement=48,da("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1ub48",Ks);var Js=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,k,T,I,S){var E=this.length;return this.resize(E+1),this.emplace(E,t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,k,T,I,S)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,k,T,I,S,E){var A=32*t,P=16*t;return this.int16[A+0]=e,this.int16[A+1]=i,this.int16[A+2]=r,this.int16[A+3]=o,this.int16[A+4]=n,this.int16[A+5]=a,this.int16[A+6]=s,this.int16[A+7]=l,this.uint16[A+8]=u,this.uint16[A+9]=h,this.uint16[A+10]=p,this.uint16[A+11]=c,this.uint16[A+12]=f,this.uint16[A+13]=d,this.uint16[A+14]=m,this.uint16[A+15]=y,this.uint16[A+16]=g,this.uint16[A+17]=_,this.uint16[A+18]=v,this.uint16[A+19]=x,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=k,this.uint32[P+12]=T,this.float32[P+13]=I,this.float32[P+14]=S,this.float32[P+15]=E,t},e}(Ms);Js.prototype.bytesPerElement=64,da("StructArrayLayout8i15ui1ul3f64",Js);var Qs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ms);Qs.prototype.bytesPerElement=4,da("StructArrayLayout1f4",Qs);var $s=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var o=3*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,t},e}(Ms);$s.prototype.bytesPerElement=6,da("StructArrayLayout3i6",$s);var tl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,o){var n=6*t;return this.uint32[3*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,this.uint16[n+4]=o,t},e}(Ms);tl.prototype.bytesPerElement=12,da("StructArrayLayout1ul3ui12",tl);var el=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t},e}(Ms);el.prototype.bytesPerElement=4,da("StructArrayLayout2ui4",el);var il=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ms);il.prototype.bytesPerElement=2,da("StructArrayLayout1ui2",il);var rl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,o){var n=4*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,this.float32[n+3]=o,t},e}(Ms);rl.prototype.bytesPerElement=16,da("StructArrayLayout4f16",rl);var ol=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},padding:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return i.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},i.x1.get=function(){return this._structArray.float32[this._pos4+1]},i.y1.get=function(){return this._structArray.float32[this._pos4+2]},i.x2.get=function(){return this._structArray.float32[this._pos4+3]},i.y2.get=function(){return this._structArray.float32[this._pos4+4]},i.padding.get=function(){return this._structArray.int16[this._pos2+10]},i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+6]},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+14]},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+15]},i.anchorPoint.get=function(){return new r(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,i),e}(Ps);ol.prototype.size=32;var nl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ol(this,t)},e}(qs);da("CollisionBoxArray",nl);var al=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0},flipState:{configurable:!0}};return i.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},i.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},i.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},i.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},i.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},i.segment.get=function(){return this._structArray.uint16[this._pos2+10]},i.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},i.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},i.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},i.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},i.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},i.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},i.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},i.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},i.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},i.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},i.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},i.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},i.flipState.get=function(){return this._structArray.uint8[this._pos1+46]},i.flipState.set=function(t){this._structArray.uint8[this._pos1+46]=t},Object.defineProperties(e.prototype,i),e}(Ps);al.prototype.size=48;var sl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new al(this,t)},e}(Ks);da("PlacedSymbolArray",sl);var ll=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return i.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},i.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},i.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},i.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},i.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},i.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},i.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},i.key.get=function(){return this._structArray.uint16[this._pos2+8]},i.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},i.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},i.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},i.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},i.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},i.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},i.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},i.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},i.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},i.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},i.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},i.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},i.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},i.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},i.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},i.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},i.textOffset0.get=function(){return this._structArray.float32[this._pos4+13]},i.textOffset1.get=function(){return this._structArray.float32[this._pos4+14]},i.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+15]},Object.defineProperties(e.prototype,i),e}(Ps);ll.prototype.size=64;var ul=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ll(this,t)},e}(Js);da("SymbolInstanceArray",ul);var hl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Qs);da("GlyphOffsetArray",hl);var pl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}($s);da("SymbolLineVertexArray",pl);var cl=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},layoutVertexArrayOffset:{configurable:!0}};return i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},i.layoutVertexArrayOffset.get=function(){return this._structArray.uint16[this._pos2+4]},Object.defineProperties(e.prototype,i),e}(Ps);cl.prototype.size=12;var fl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new cl(this,t)},e}(tl);da("FeatureIndexArray",fl);var dl=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={a_centroid_pos0:{configurable:!0},a_centroid_pos1:{configurable:!0}};return i.a_centroid_pos0.get=function(){return this._structArray.uint16[this._pos2+0]},i.a_centroid_pos1.get=function(){return this._structArray.uint16[this._pos2+1]},Object.defineProperties(e.prototype,i),e}(Ps);dl.prototype.size=4;var ml=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new dl(this,t)},e}(el);da("FillExtrusionCentroidArray",ml);var yl=Ls([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),gl=Ls([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]),_l=ce((function(t){t.exports=function(t,e){var i,r,o,n,a,s,l,u;for(r=t.length-(i=3&t.length),o=e,a=3432918353,s=461845907,u=0;u<r;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,o=27492+(65535&(n=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}})),vl=ce((function(t){t.exports=function(t,e){for(var i,r=t.length,o=e^r,n=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(n)|(255&t.charCodeAt(++n))<<8|(255&t.charCodeAt(++n))<<16|(255&t.charCodeAt(++n))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++n;switch(r){case 3:o^=(255&t.charCodeAt(n+2))<<16;case 2:o^=(255&t.charCodeAt(n+1))<<8;case 1:o=1540483477*(65535&(o^=255&t.charCodeAt(n)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}})),xl=_l,bl=vl;xl.murmur3=_l,xl.murmur2=bl;var wl=function(){this.ids=[],this.positions=[],this.indexed=!1};function kl(t){var e=+t;return!isNaN(e)&&e<=l?e:xl(String(t))}function Tl(t,e,i,r){for(;i<r;){for(var o=t[i+r>>1],n=i-1,a=r+1;;){do{n++}while(t[n]<o);do{a--}while(t[a]>o);if(n>=a)break;Il(t,n,a),Il(e,3*n,3*a),Il(e,3*n+1,3*a+1),Il(e,3*n+2,3*a+2)}a-i<r-a?(Tl(t,e,i,a),i=a+1):(Tl(t,e,a+1,r),r=a)}}function Il(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}wl.prototype.add=function(t,e,i,r){this.ids.push(kl(t)),this.positions.push(e,i,r)},wl.prototype.getPositions=function(t){for(var e=kl(t),i=0,r=this.ids.length-1;i<r;){var o=i+r>>1;this.ids[o]>=e?r=o:i=o+1}for(var n=[];this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n},wl.serialize=function(t,e){var i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Tl(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}},wl.deserialize=function(t){var e=new wl;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e},da("FeaturePositionMap",wl);var Sl=function(t,e){this.gl=t.gl,this.location=e},El=function(t){function e(e,i){t.call(this,e,i),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(Sl),Al=function(t){function e(e,i){t.call(this,e,i),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(Sl),Pl=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(Sl),Ml=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(Sl),Ll=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(Sl),Cl=function(t){function e(e,i){t.call(this,e,i),this.current=me.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(Sl),Dl=new Float32Array(16),zl=function(t){function e(e,i){t.call(this,e,i),this.current=Dl}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(Sl),Ol=new Float32Array(9),Rl=function(t){function e(e,i){t.call(this,e,i),this.current=Ol}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){for(var e=0;e<9;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix3fv(this.location,!1,t);break}},e}(Sl);function Bl(t){return[Es(255*t.r,255*t.g),Es(255*t.b,255*t.a)]}var Fl=function(t,e,i){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=i};Fl.prototype.setUniform=function(t,e,i){t.set(i.constantOr(this.value))},Fl.prototype.getBinding=function(t,e,i){return"color"===this.type?new Cl(t,e):new Al(t,e)};var Ul=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Ul.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)},Ul.prototype.setUniform=function(t,e,i,r){var o="u_pattern_to"===r||"u_dash_to"===r?this.patternTo:"u_pattern_from"===r||"u_dash_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;o&&t.set(o)},Ul.prototype.getBinding=function(t,e,i){return"u_pattern_from"===i||"u_pattern_to"===i||"u_dash_from"===i||"u_dash_to"===i?new Ll(t,e):new Al(t,e)};var jl=function(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===i?2:1,offset:0}})),this.paintVertexArray=new r};jl.prototype.populatePaintArray=function(t,e,i,r,o){var n=this.paintVertexArray.length,a=this.expression.evaluate(new cs(0),e,{},r,[],o);this.paintVertexArray.resize(t),this._setPaintValue(n,t,a)},jl.prototype.updatePaintArray=function(t,e,i,r){var o=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,o)},jl.prototype._setPaintValue=function(t,e,i){if("color"===this.type)for(var r=Bl(i),o=t;o<e;o++)this.paintVertexArray.emplace(o,r[0],r[1]);else{for(var n=t;n<e;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}},jl.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},jl.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var Nl=function(t,e,i,r,o,n){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=i,this.useIntegerZoom=r,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===i?4:2,offset:0}})),this.paintVertexArray=new n};Nl.prototype.populatePaintArray=function(t,e,i,r,o){var n=this.expression.evaluate(new cs(this.zoom),e,{},r,[],o),a=this.expression.evaluate(new cs(this.zoom+1),e,{},r,[],o),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,n,a)},Nl.prototype.updatePaintArray=function(t,e,i,r){var o=this.expression.evaluate({zoom:this.zoom},i,r),n=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,o,n)},Nl.prototype._setPaintValue=function(t,e,i,r){if("color"===this.type)for(var o=Bl(i),n=Bl(r),a=t;a<e;a++)this.paintVertexArray.emplace(a,o[0],o[1],n[0],n[1]);else{for(var s=t;s<e;s++)this.paintVertexArray.emplace(s,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}},Nl.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Nl.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Nl.prototype.setUniform=function(t,e){var i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=g(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)},Nl.prototype.getBinding=function(t,e,i){return new Al(t,e)};var Vl=function(t,e,i,r,o,n,a){this.expression=t,this.type=i,this.useIntegerZoom=r,this.zoom=o,this.layerId=a,this.paintVertexAttributes=("array"===i?gl:yl).members;for(var s=0;s<e.length;++s);this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n};Vl.prototype.populatePaintArray=function(t,e,i){var r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)},Vl.prototype.updatePaintArray=function(t,e,i,r,o){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],o)},Vl.prototype._setPaintValues=function(t,e,i,r){if(r&&i){var o=r[i.min],n=r[i.mid],a=r[i.max];if(o&&n&&a)for(var s=t;s<e;s++)this._setPaintValue(this.zoomInPaintVertexArray,s,n,o),this._setPaintValue(this.zoomOutPaintVertexArray,s,n,a)}},Vl.prototype._setPaintValue=function(t,e,i,r){t.emplace(e,i.tl[0],i.tl[1],i.br[0],i.br[1],r.tl[0],r.tl[1],r.br[0],r.br[1],i.pixelRatio,r.pixelRatio)},Vl.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Vl.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Gl=function(t,e,i){void 0===i&&(i=function(){return!0}),this.binders={},this._buffers=[];var r=[];for(var o in t.paint._values)if(i(o)){var n=t.paint.get(o);if(n instanceof vs&&Ar(n.property.specification)){var a=Xl(o,t.type),s=n.value,l=n.property.specification.type,u=n.property.useIntegerZoom,h=n.property.specification["property-type"],p="cross-faded"===h||"cross-faded-data-driven"===h,c="line-dasharray"===String(o)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==s.kind||c)if("source"===s.kind||c||p){var f=Yl(o,l,"source");this.binders[o]=p?new Vl(s,a,l,u,e,f,t.id):new jl(s,a,l,f),r.push("/a_"+o)}else{var d=Yl(o,l,"composite");this.binders[o]=new Nl(s,a,l,u,e,d),r.push("/z_"+o)}else this.binders[o]=p?new Ul(s.value,a):new Fl(s.value,a,l),r.push("/u_"+o)}}this.cacheKey=r.sort().join("")};Gl.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof jl||e instanceof Nl?e.maxValue:0},Gl.prototype.populatePaintArrays=function(t,e,i,r,o){for(var n in this.binders){var a=this.binders[n];(a instanceof jl||a instanceof Nl||a instanceof Vl)&&a.populatePaintArray(t,e,i,r,o)}},Gl.prototype.setConstantPatternPositions=function(t,e){for(var i in this.binders){var r=this.binders[i];r instanceof Ul&&r.setConstantPatternPositions(t,e)}},Gl.prototype.updatePaintArrays=function(t,e,i,r,o){var n=!1;for(var a in t)for(var s=0,l=e.getPositions(a);s<l.length;s+=1){var u=l[s],h=i.feature(u.index);for(var p in this.binders){var c=this.binders[p];if((c instanceof jl||c instanceof Nl||c instanceof Vl)&&!0===c.expression.isStateDependent){var f=r.paint.get(p);c.expression=f.value,c.updatePaintArray(u.start,u.end,h,t[a],o),n=!0}}}return n},Gl.prototype.defines=function(){var t=[];for(var e in this.binders){var i=this.binders[e];(i instanceof Fl||i instanceof Ul)&&t.push.apply(t,i.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},Gl.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var i=this.binders[e];if(i instanceof jl||i instanceof Nl||i instanceof Vl)for(var r=0;r<i.paintVertexAttributes.length;r++)t.push(i.paintVertexAttributes[r].name)}return t},Gl.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var i=this.binders[e];if(i instanceof Fl||i instanceof Ul||i instanceof Nl)for(var r=0,o=i.uniformNames;r<o.length;r+=1)t.push(o[r])}return t},Gl.prototype.getPaintVertexBuffers=function(){return this._buffers},Gl.prototype.getUniforms=function(t,e){var i=[];for(var r in this.binders){var o=this.binders[r];if(o instanceof Fl||o instanceof Ul||o instanceof Nl)for(var n=0,a=o.uniformNames;n<a.length;n+=1){var s=a[n];if(e[s]){var l=o.getBinding(t,e[s],s);i.push({name:s,property:r,binding:l})}}}return i},Gl.prototype.setUniforms=function(t,e,i,r){for(var o=0,n=e;o<n.length;o+=1){var a=n[o],s=a.name,l=a.property;this.binders[l].setUniform(a.binding,r,i.get(l),s)}},Gl.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var i=this.binders[e];if(t&&i instanceof Vl){var r=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof jl||i instanceof Nl)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}},Gl.prototype.upload=function(t){for(var e in this.binders){var i=this.binders[e];(i instanceof jl||i instanceof Nl||i instanceof Vl)&&i.upload(t)}this.updatePaintBuffers()},Gl.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof jl||e instanceof Nl||e instanceof Vl)&&e.destroy()}};var Zl=function(t,e,i){void 0===i&&(i=function(){return!0}),this.programConfigurations={};for(var r=0,o=t;r<o.length;r+=1){var n=o[r];this.programConfigurations[n.id]=new Gl(n,e,i)}this.needsUpload=!1,this._featureMap=new wl,this._bufferOffset=0};Zl.prototype.populatePaintArrays=function(t,e,i,r,o,n){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,r,o,n);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},Zl.prototype.updatePaintArrays=function(t,e,i,r){for(var o=0,n=i;o<n.length;o+=1){var a=n[o];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,r)||this.needsUpload}},Zl.prototype.get=function(t){return this.programConfigurations[t]},Zl.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Zl.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()};var ql={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-height":["height"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"line-dasharray":["dash_to","dash_from"]};function Xl(t,e){return ql[t]||[t.replace(e+"-","").replace(/-/g,"_")]}var Wl={"line-pattern":{source:Us,composite:Us},"fill-pattern":{source:Us,composite:Us},"fill-extrusion-pattern":{source:Us,composite:Us},"line-dasharray":{source:js,composite:js}},Hl={color:{source:Fs,composite:rl},number:{source:Qs,composite:Fs}};function Yl(t,e,i){var r=Wl[t];return r&&r[i]||Hl[e][i]}da("ConstantBinder",Fl),da("CrossFadedConstantBinder",Ul),da("SourceExpressionBinder",jl),da("CrossFadedCompositeBinder",Vl),da("CompositeExpressionBinder",Nl),da("ProgramConfiguration",Gl,{omit:["_buffers"]}),da("ProgramConfigurationSet",Zl);var Kl="-transition",Jl=function(t){function e(e,i){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),i.layout&&(this._unevaluatedLayout=new _s(i.layout)),i.paint)){for(var r in this._transitionablePaint=new ms(i.paint),e.paint)this.setPaintProperty(r,e.paint[r],{validate:!1});for(var o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new xs(i.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,i){void 0===i&&(i={}),null!=e&&this._validate(Do,"layers."+this.id+".layout."+t,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return A(t,Kl)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,i){if(void 0===i&&(i={}),null!=e&&this._validate(Co,"layers."+this.id+".paint."+t,t,e,i))return!1;if(A(t,Kl))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;var r=this._transitionablePaint._values[t],o="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||n||o||this._handleOverridablePaintPropertyUpdate(t,a,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype.getProgramIds=function(){return null},e.prototype.getProgramConfiguration=function(t){return null},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,i){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),M(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,i,r,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&zo(this,t.call(Po,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:Nt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isModel=function(){return!1},e.prototype.isSky=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isContinuousDraw=function(){return!1},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof vs&&Ar(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(jt),Ql=Ls([{name:"a_pos",components:2,type:"Int16"}],4).members,$l=function(t){void 0===t&&(t=[]),this.segments=t};$l.prototype.prepareSegment=function(t,e,i,r){var o=this.segments[this.segments.length-1];return t>$l.MAX_VERTEX_ARRAY_LENGTH&&D("Max vertices per segment is "+$l.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!o||o.vertexLength+t>$l.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==r)&&(o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(o.sortKey=r),this.segments.push(o)),o},$l.prototype.newSegment=function(t,e,i,r){var o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0};return void 0!==r&&(o.sortKey=r),this.segments.push(o),o},$l.prototype.get=function(){return this.segments},$l.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var i=e[t];for(var r in i.vaos)i.vaos[r].destroy()}},$l.simpleSegment=function(t,e,i,r){return new $l([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])},$l.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,da("SegmentVector",$l);var tu=8192,eu=Math.pow(2,14)-1,iu=-eu-1;function ru(t){for(var e=tu/t.extent,i=t.loadGeometry(),r=0;r<i.length;r++)for(var o=i[r],n=0;n<o.length;n++){var a=o[n],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=g(s,iu,eu),a.y=g(l,iu,eu),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&D("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function ou(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ru(t):[]}}function nu(t,e,i,r,o){t.emplaceBack(2*e+(r+1)/2,2*i+(o+1)/2)}var au=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ds,this.indexArray=new Ys,this.segments=new $l,this.programConfigurations=new Zl(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function su(t,e){for(var i=0;i<t.length;i++)if(yu(e,t[i]))return!0;for(var r=0;r<e.length;r++)if(yu(t,e[r]))return!0;return!!pu(t,e)}function lu(t,e,i){return!!yu(t,e)||!!fu(e,t,i)}function uu(t,e){if(1===t.length)return mu(e,t[0]);for(var i=0;i<e.length;i++)for(var r=e[i],o=0;o<r.length;o++)if(yu(t,r[o]))return!0;for(var n=0;n<t.length;n++)if(mu(e,t[n]))return!0;for(var a=0;a<e.length;a++)if(pu(t,e[a]))return!0;return!1}function hu(t,e,i){if(t.length>1){if(pu(t,e))return!0;for(var r=0;r<e.length;r++)if(fu(e[r],t,i))return!0}for(var o=0;o<t.length;o++)if(fu(t[o],e,i))return!0;return!1}function pu(t,e){if(0===t.length||0===e.length)return!1;for(var i=0;i<t.length-1;i++)for(var r=t[i],o=t[i+1],n=0;n<e.length-1;n++)if(cu(r,o,e[n],e[n+1]))return!0;return!1}function cu(t,e,i,r){return z(t,i,r)!==z(e,i,r)&&z(t,e,i)!==z(t,e,r)}function fu(t,e,i){var r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(var o=1;o<e.length;o++)if(du(t,e[o-1],e[o])<r)return!0;return!1}function du(t,e,i){var r=e.distSqr(i);if(0===r)return t.distSqr(e);var o=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function mu(t,e){for(var i,r,o,n=!1,a=0;a<t.length;a++)for(var s=0,l=(i=t[a]).length-1;s<i.length;l=s++)(r=i[s]).y>e.y!=(o=i[l]).y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(n=!n);return n}function yu(t,e){for(var i=!1,r=0,o=t.length-1;r<t.length;o=r++){var n=t[r],a=t[o];n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}function gu(t,e,i,o,n){for(var a=0,s=t;a<s.length;a+=1){var l=s[a];if(e<=l.x&&i<=l.y&&o>=l.x&&n>=l.y)return!0}var u=[new r(e,i),new r(e,n),new r(o,n),new r(o,i)];if(t.length>2)for(var h=0,p=u;h<p.length;h+=1)if(yu(t,p[h]))return!0;for(var c=0;c<t.length-1;c++)if(_u(t[c],t[c+1],u))return!0;return!1}function _u(t,e,i){var r=i[0],o=i[2];if(t.x<r.x&&e.x<r.x||t.x>o.x&&e.x>o.x||t.y<r.y&&e.y<r.y||t.y>o.y&&e.y>o.y)return!1;var n=z(t,e,i[0]);return n!==z(t,e,i[1])||n!==z(t,e,i[2])||n!==z(t,e,i[3])}function vu(t,e,i){var r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function xu(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function bu(t,e,i,o,n){if(!e[0]&&!e[1])return t;var a=r.convert(e)._mult(n);"viewport"===i&&a._rotate(-o);for(var s=[],l=0;l<t.length;l++)s.push(t[l].sub(a));return s}function wu(t,e,i,o){var n=r.convert(t)._mult(o);return"viewport"===e&&n._rotate(-i),n}au.prototype.populate=function(t,e,i){var r=this.layers[0],o=[],n=null;"circle"===r.type&&(n=r.layout.get("circle-sort-key"));for(var a=0,s=t;a<s.length;a+=1){var l=s[a],u=l.feature,h=l.id,p=l.index,c=l.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=ou(u,f);if(this.layers[0]._featureFilter.filter(new cs(this.zoom),d,i)){var m=n?n.evaluate(d,{},i):void 0,y={id:h,properties:u.properties,type:u.type,sourceLayerIndex:c,index:p,geometry:f?d.geometry:ru(u),patterns:{},sortKey:m};o.push(y)}}n&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var g=0,_=o;g<_.length;g+=1){var v=_[g],x=v.geometry,b=v.index,w=v.sourceLayerIndex,k=t[b].feature;this.addFeature(v,x,b,i),e.featureIndex.insert(k,x,b,w,this.index)}},au.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},au.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},au.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},au.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ql),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},au.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},au.prototype.addFeature=function(t,e,i,r){for(var o=0,n=e;o<n.length;o+=1)for(var a=0,s=n[o];a<s.length;a+=1){var l=s[a],u=l.x,h=l.y;if(!(u<0||u>=tu||h<0||h>=tu)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=p.vertexLength;nu(this.layoutVertexArray,u,h,-1,-1),nu(this.layoutVertexArray,u,h,1,-1),nu(this.layoutVertexArray,u,h,1,1),nu(this.layoutVertexArray,u,h,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)},da("CircleBucket",au,{omit:["layers"]});var ku=new Ss({"circle-sort-key":new ws(Nt.layout_circle["circle-sort-key"])}),Tu={paint:new Ss({"circle-radius":new ws(Nt.paint_circle["circle-radius"]),"circle-color":new ws(Nt.paint_circle["circle-color"]),"circle-blur":new ws(Nt.paint_circle["circle-blur"]),"circle-opacity":new ws(Nt.paint_circle["circle-opacity"]),"circle-translate":new bs(Nt.paint_circle["circle-translate"]),"circle-translate-anchor":new bs(Nt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new bs(Nt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new bs(Nt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ws(Nt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ws(Nt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ws(Nt.paint_circle["circle-stroke-opacity"])}),layout:ku},Iu="undefined"!=typeof Float32Array?Float32Array:Array;function Su(){var t=new Iu(9);return Iu!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Eu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Au(t,e,i){var r=e[0],o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],p=e[8],c=e[9],f=e[10],d=e[11],m=e[12],y=e[13],g=e[14],_=e[15],v=i[0],x=i[1],b=i[2],w=i[3];return t[0]=v*r+x*s+b*p+w*m,t[1]=v*o+x*l+b*c+w*y,t[2]=v*n+x*u+b*f+w*g,t[3]=v*a+x*h+b*d+w*_,t[4]=(v=i[4])*r+(x=i[5])*s+(b=i[6])*p+(w=i[7])*m,t[5]=v*o+x*l+b*c+w*y,t[6]=v*n+x*u+b*f+w*g,t[7]=v*a+x*h+b*d+w*_,t[8]=(v=i[8])*r+(x=i[9])*s+(b=i[10])*p+(w=i[11])*m,t[9]=v*o+x*l+b*c+w*y,t[10]=v*n+x*u+b*f+w*g,t[11]=v*a+x*h+b*d+w*_,t[12]=(v=i[12])*r+(x=i[13])*s+(b=i[14])*p+(w=i[15])*m,t[13]=v*o+x*l+b*c+w*y,t[14]=v*n+x*u+b*f+w*g,t[15]=v*a+x*h+b*d+w*_,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,i=arguments.length;i--;)e+=t[i]*t[i];return Math.sqrt(e)});var Pu=Au;function Mu(){var t=new Iu(3);return Iu!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Lu(t){var e=new Iu(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Cu(t){return Math.hypot(t[0],t[1],t[2])}function Du(t,e,i){var r=new Iu(3);return r[0]=t,r[1]=e,r[2]=i,r}function zu(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Ou(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Ru(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function Bu(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Fu(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t}function Uu(t,e){var i=e[0],r=e[1],o=e[2],n=i*i+r*r+o*o;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function ju(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Nu(t,e,i){var r=e[0],o=e[1],n=e[2],a=i[0],s=i[1],l=i[2];return t[0]=o*l-n*s,t[1]=n*a-r*l,t[2]=r*s-o*a,t}function Vu(t,e,i){var r=i[0],o=i[1],n=i[2],a=e[0],s=e[1],l=e[2],u=o*l-n*s,h=n*a-r*l,p=r*s-o*a,c=o*p-n*h,f=n*u-r*p,d=r*h-o*u,m=2*i[3];return h*=m,p*=m,f*=2,d*=2,t[0]=a+(u*=m)+(c*=2),t[1]=s+h+f,t[2]=l+p+d,t}var Gu,Zu=Ou,qu=Ru,Xu=Cu;function Wu(t,e,i){var r=e[0],o=e[1],n=e[2],a=e[3];return t[0]=i[0]*r+i[4]*o+i[8]*n+i[12]*a,t[1]=i[1]*r+i[5]*o+i[9]*n+i[13]*a,t[2]=i[2]*r+i[6]*o+i[10]*n+i[14]*a,t[3]=i[3]*r+i[7]*o+i[11]*n+i[15]*a,t}function Hu(){var t=new Iu(4);return Iu!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Yu(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Ku(t,e,i){i*=.5;var r=e[0],o=e[1],n=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=r*l+a*s,t[1]=o*l+n*s,t[2]=n*l-o*s,t[3]=a*l-r*s,t}Mu(),Gu=new Iu(4),Iu!=Float32Array&&(Gu[0]=0,Gu[1]=0,Gu[2]=0,Gu[3]=0),Mu(),Du(1,0,0),Du(0,1,0),Hu(),Hu(),Su();var Ju=function(t,e){this.pos=t,this.dir=e};Ju.prototype.intersectsPlane=function(t,e,i){var r=ju(e,this.dir);if(Math.abs(r)<1e-6)return!1;var o=ju(Zu(Mu(),t,this.pos),e)/r;return function(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2]}(i,Fu(Mu(),this.pos,this.dir,o)),!0};var Qu=function(t,e){this.points=t,this.planes=e};Qu.fromInvProjectionMatrix=function(t,e,i){var r=Math.pow(2,i),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(i){var o=Wu([],i,t),n=1/o[3]/e*r;return function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}(o,o,[n,n,1/o[3],n])})),n=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(t){var e=Uu([],Nu([],Zu([],o[t[0]],o[t[1]]),Zu([],o[t[2]],o[t[1]]))),i=-ju(e,o[t[1]]);return e.concat(i)}));return new Qu(o,n)};var $u=function(t,e){this.min=t,this.max=e,this.center=Bu([],zu([],this.min,this.max),.5)};$u.prototype.quadrant=function(t){for(var e=[t%2==0,t<2],i=Lu(this.min),r=Lu(this.max),o=0;o<e.length;o++)i[o]=e[o]?this.min[o]:this.center[o],r[o]=e[o]?this.center[o]:this.max[o];return r[2]=this.max[2],new $u(i,r)},$u.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},$u.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},$u.prototype.distanceZ=function(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]},$u.prototype.intersects=function(t){for(var e,i,r=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],o=!0,n=0;n<t.planes.length;n++){for(var a=t.planes[n],s=0,l=0;l<r.length;l++)s+=(e=a)[0]*(i=r[l])[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]>=0;if(0===s)return 0;s!==r.length&&(o=!1)}if(o)return 2;for(var u=0;u<3;u++){for(var h=Number.MAX_VALUE,p=-Number.MAX_VALUE,c=0;c<t.points.length;c++){var f=t.points[c][u]-this.min[u];h=Math.min(h,f),p=Math.max(p,f)}if(p<0||h>this.max[u]-this.min[u])return 0}return 1};var th=function(t){function e(e){t.call(this,e,Tu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new au(t)},e.prototype.queryRadius=function(t){var e=t;return vu("circle-radius",this,e)+vu("circle-stroke-width",this,e)+xu(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,r,o,n,a,s){var l=this,u="map"===this.paint.get("circle-pitch-alignment");if(u&&t.queryGeometry.isAboveHorizon)return!1;for(var h=wu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),n.angle,t.pixelToTileUnitsFactor),p=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c=u?p*t.pixelToTileUnitsFactor:p,f=0,d=r;f<d.length;f+=1)for(var m=function(){var e=g[y],i=e.add(h),r=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(i.x,i.y,!0):0,o=u?i:eh(i,r,a),p=u?t.tilespaceRays.map((function(t){return oh(t,r)})):t.queryGeometry.screenGeometry,f=c,d=Wu([],[e.x,e.y,r,1],a);if("viewport"===l.paint.get("circle-pitch-scale")&&"map"===l.paint.get("circle-pitch-alignment")?f*=d[3]/n.cameraToCenterDistance:"map"===l.paint.get("circle-pitch-scale")&&"viewport"===l.paint.get("circle-pitch-alignment")&&(f*=n.cameraToCenterDistance/d[3]),lu(p,o,f))return{v:!0}},y=0,g=d[f];y<g.length;y+=1){var _=m();if(_)return _.v}return!1},e.prototype.getProgramIds=function(){return["circle"]},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e}(Jl);function eh(t,e,i){var o=Wu([],[t.x,t.y,e,1],i);return new r(o[0]/o[3],o[1]/o[3])}var ih=Du(0,0,0),rh=Du(0,0,1);function oh(t,e){var i=Mu();return ih[2]=e,t.intersectsPlane(ih,rh,i),new r(i[0],i[1])}var nh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(au);function ah(t,e,i,r){var o=e.width,n=e.height;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==o*n*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(o*n*i);return t.width=o,t.height=n,t.data=r,t}function sh(t,e,i){var r=e.width,o=e.height;if(r!==t.width||o!==t.height){var n=ah({},{width:r,height:o},i);lh(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,r),height:Math.min(t.height,o)},i),t.width=r,t.height=o,t.data=n.data}}function lh(t,e,i,r,o,n){if(0===o.width||0===o.height)return e;if(o.width>t.width||o.height>t.height||i.x>t.width-o.width||i.y>t.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||r.x>e.width-o.width||r.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<o.height;l++)for(var u=((i.y+l)*t.width+i.x)*n,h=((r.y+l)*e.width+r.x)*n,p=0;p<o.width*n;p++)s[h+p]=a[u+p];return e}da("HeatmapBucket",nh,{omit:["layers"]});var uh=function(t,e){ah(this,t,1,e)};uh.prototype.resize=function(t){sh(this,t,1)},uh.prototype.clone=function(){return new uh({width:this.width,height:this.height},new Uint8Array(this.data))},uh.copy=function(t,e,i,r,o){lh(t,e,i,r,o,1)};var hh=function(t,e){ah(this,t,4,e)};hh.prototype.resize=function(t){sh(this,t,4)},hh.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},hh.prototype.clone=function(){return new hh({width:this.width,height:this.height},new Uint8Array(this.data))},hh.copy=function(t,e,i,r,o){lh(t,e,i,r,o,4)},da("AlphaImage",uh),da("RGBAImage",hh);var ph={paint:new Ss({"heatmap-radius":new ws(Nt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ws(Nt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new bs(Nt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Is(Nt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new bs(Nt.paint_heatmap["heatmap-opacity"])})};function ch(t){var e={},i=t.resolution||256,r=t.clips?t.clips.length:1,o=t.image||new hh({width:i,height:r}),n=function(i,r,n){e[t.evaluationKey]=n;var a=t.expression.evaluate(e);o.data[i+r+0]=Math.floor(255*a.r/a.a),o.data[i+r+1]=Math.floor(255*a.g/a.a),o.data[i+r+2]=Math.floor(255*a.b/a.a),o.data[i+r+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<r;++a,s+=4*i)for(var l=0,u=0;l<i;l++,u+=4){var h=l/(i-1),p=t.clips[a];n(s,u,p.start*(1-h)+p.end*h)}else for(var c=0,f=0;c<i;c++,f+=4)n(0,f,c/(i-1));return o}var fh=function(t){function e(e){t.call(this,e,ph),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new nh(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=ch({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e.prototype.getProgramIds=function(){return["heatmap","heatmapTexture"]},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e}(Jl),dh={paint:new Ss({"hillshade-illumination-direction":new bs(Nt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new bs(Nt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new bs(Nt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new bs(Nt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new bs(Nt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new bs(Nt.paint_hillshade["hillshade-accent-color"])})},mh=function(t){function e(e){t.call(this,e,dh)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e.prototype.getProgramIds=function(){return["hillshade","hillshadePrepare"]},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e}(Jl),yh=Ls([{name:"a_pos",components:2,type:"Int16"}],4).members,gh=vh,_h=vh;function vh(t,e,i){i=i||2;var r,o,n,a,s,l,u,h=e&&e.length,p=h?e[0]*i:t.length,c=xh(t,0,p,i,!0),f=[];if(!c||c.next===c.prev)return f;if(h&&(c=function(t,e,i,r){var o,n,a,s=[];for(o=0,n=e.length;o<n;o++)(a=xh(t,e[o]*r,o<n-1?e[o+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),s.push(Lh(a));for(s.sort(Eh),o=0;o<s.length;o++)i=Ah(s[o],i);return i}(t,e,c,i)),t.length>80*i){r=n=t[0],o=a=t[1];for(var d=i;d<p;d+=i)(s=t[d])<r&&(r=s),(l=t[d+1])<o&&(o=l),s>n&&(n=s),l>a&&(a=l);u=0!==(u=Math.max(n-r,a-o))?32767/u:0}return wh(c,f,i,r,o,u,0),f}function xh(t,e,i,r,o){var n,a;if(o===Zh(t,e,i,r)>0)for(n=e;n<i;n+=r)a=Nh(n,t[n],t[n+1],a);else for(n=i-r;n>=e;n-=r)a=Nh(n,t[n],t[n+1],a);return a&&Oh(a,a.next)&&(Vh(a),a=a.next),a}function bh(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Oh(r,r.next)&&0!==zh(r.prev,r,r.next))r=r.next;else{if(Vh(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function wh(t,e,i,r,o,n,a){if(t){!a&&n&&function(t,e,i,r){var o=t;do{0===o.z&&(o.z=Mh(o.x,o.y,e,i,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==t);o.prevZ.nextZ=null,o.prevZ=null,function(t){var e,i,r,o,n,a,s,l,u=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,r=i,s=0,e=0;e<u&&(s++,r=r.nextZ);e++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(o=i,i=i.nextZ,s--):(o=r,r=r.nextZ,l--),n?n.nextZ=o:t=o,o.prevZ=n,n=o;i=r}n.nextZ=null,u*=2}while(a>1)}(o)}(t,r,o,n);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,n?Th(t,r,o,n):kh(t))e.push(s.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),Vh(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?wh(t=Ih(bh(t),e,i),e,i,r,o,n,2):2===a&&Sh(t,e,i,r,o,n):wh(bh(t),e,i,r,o,n,1);break}}}function kh(t){var e=t.prev,i=t,r=t.next;if(zh(e,i,r)>=0)return!1;for(var o=e.x,n=i.x,a=r.x,s=e.y,l=i.y,u=r.y,h=o<n?o<a?o:a:n<a?n:a,p=s<l?s<u?s:u:l<u?l:u,c=o>n?o>a?o:a:n>a?n:a,f=s>l?s>u?s:u:l>u?l:u,d=r.next;d!==e;){if(d.x>=h&&d.x<=c&&d.y>=p&&d.y<=f&&Ch(o,s,n,l,a,u,d.x,d.y)&&zh(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Th(t,e,i,r){var o=t.prev,n=t,a=t.next;if(zh(o,n,a)>=0)return!1;for(var s=o.x,l=n.x,u=a.x,h=o.y,p=n.y,c=a.y,f=s<l?s<u?s:u:l<u?l:u,d=h<p?h<c?h:c:p<c?p:c,m=s>l?s>u?s:u:l>u?l:u,y=h>p?h>c?h:c:p>c?p:c,g=Mh(f,d,e,i,r),_=Mh(m,y,e,i,r),v=t.prevZ,x=t.nextZ;v&&v.z>=g&&x&&x.z<=_;){if(v.x>=f&&v.x<=m&&v.y>=d&&v.y<=y&&v!==o&&v!==a&&Ch(s,h,l,p,u,c,v.x,v.y)&&zh(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=f&&x.x<=m&&x.y>=d&&x.y<=y&&x!==o&&x!==a&&Ch(s,h,l,p,u,c,x.x,x.y)&&zh(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=m&&v.y>=d&&v.y<=y&&v!==o&&v!==a&&Ch(s,h,l,p,u,c,v.x,v.y)&&zh(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=f&&x.x<=m&&x.y>=d&&x.y<=y&&x!==o&&x!==a&&Ch(s,h,l,p,u,c,x.x,x.y)&&zh(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ih(t,e,i){var r=t;do{var o=r.prev,n=r.next.next;!Oh(o,n)&&Rh(o,r,r.next,n)&&Uh(o,n)&&Uh(n,o)&&(e.push(o.i/i|0),e.push(r.i/i|0),e.push(n.i/i|0),Vh(r),Vh(r.next),r=t=n),r=r.next}while(r!==t);return bh(r)}function Sh(t,e,i,r,o,n){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Dh(a,s)){var l=jh(a,s);return a=bh(a,a.next),l=bh(l,l.next),wh(a,e,i,r,o,n,0),void wh(l,e,i,r,o,n,0)}s=s.next}a=a.next}while(a!==t)}function Eh(t,e){return t.x-e.x}function Ah(t,e){var i=function(t,e){var i,r=e,o=t.x,n=t.y,a=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var s=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,i=r.x<r.next.x?r:r.next,s===o))return i}r=r.next}while(r!==e);if(!i)return null;var l,u=i,h=i.x,p=i.y,c=1/0;r=i;do{o>=r.x&&r.x>=h&&o!==r.x&&Ch(n<p?o:a,n,h,p,n<p?a:o,n,r.x,r.y)&&(l=Math.abs(n-r.y)/(o-r.x),Uh(r,t)&&(l<c||l===c&&(r.x>i.x||r.x===i.x&&Ph(i,r)))&&(i=r,c=l)),r=r.next}while(r!==u);return i}(t,e);if(!i)return e;var r=jh(i,t);return bh(r,r.next),bh(i,i.next)}function Ph(t,e){return zh(t.prev,t,e.prev)<0&&zh(e.next,t,t.next)<0}function Mh(t,e,i,r,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Lh(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Ch(t,e,i,r,o,n,a,s){return(o-a)*(e-s)>=(t-a)*(n-s)&&(t-a)*(r-s)>=(i-a)*(e-s)&&(i-a)*(n-s)>=(o-a)*(r-s)}function Dh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Rh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Uh(t,e)&&Uh(e,t)&&function(t,e){var i=t,r=!1,o=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&o<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(zh(t.prev,t,e.prev)||zh(t,e.prev,e))||Oh(t,e)&&zh(t.prev,t,t.next)>0&&zh(e.prev,e,e.next)>0)}function zh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Oh(t,e){return t.x===e.x&&t.y===e.y}function Rh(t,e,i,r){var o=Fh(zh(t,e,i)),n=Fh(zh(t,e,r)),a=Fh(zh(i,r,t)),s=Fh(zh(i,r,e));return o!==n&&a!==s||!(0!==o||!Bh(t,i,e))||!(0!==n||!Bh(t,r,e))||!(0!==a||!Bh(i,t,r))||!(0!==s||!Bh(i,e,r))}function Bh(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Fh(t){return t>0?1:t<0?-1:0}function Uh(t,e){return zh(t.prev,t,t.next)<0?zh(t,e,t.next)>=0&&zh(t,t.prev,e)>=0:zh(t,e,t.prev)<0||zh(t,t.next,e)<0}function jh(t,e){var i=new Gh(t.i,t.x,t.y),r=new Gh(e.i,e.x,e.y),o=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function Nh(t,e,i,r){var o=new Gh(t,e,i);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function Vh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Gh(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Zh(t,e,i,r){for(var o=0,n=e,a=i-r;n<i;n+=r)o+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return o}function qh(t,e,i,r,o){Xh(t,e,i||0,r||t.length-1,o||Hh)}function Xh(t,e,i,r,o){for(;r>i;){if(r-i>600){var n=r-i+1,a=e-i+1,s=Math.log(n),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(n-l)/n)*(a-n/2<0?-1:1);Xh(t,e,Math.max(i,Math.floor(e-a*l/n+u)),Math.min(r,Math.floor(e+(n-a)*l/n+u)),o)}var h=t[e],p=i,c=r;for(Wh(t,i,e),o(t[r],h)>0&&Wh(t,i,r);p<c;){for(Wh(t,p,c),p++,c--;o(t[p],h)<0;)p++;for(;o(t[c],h)>0;)c--}0===o(t[i],h)?Wh(t,i,c):Wh(t,++c,r),c<=e&&(i=c+1),e<=c&&(r=c-1)}}function Wh(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function Hh(t,e){return t<e?-1:t>e?1:0}function Yh(t,e){var i=t.length;if(i<=1)return[t];for(var r,o,n=[],a=0;a<i;a++){var s=O(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===o&&(o=s<0),o===s<0?(r&&n.push(r),r=[t[a]]):r.push(t[a]))}if(r&&n.push(r),e>1)for(var l=0;l<n.length;l++)n[l].length<=e||(qh(n[l],e,1,n[l].length-1,Kh),n[l]=n[l].slice(0,e));return n}function Kh(t,e){return e.area-t.area}function Jh(t,e,i){for(var r=i.patternDependencies,o=!1,n=0,a=e;n<a.length;n+=1){var s=a[n].paint.get(t+"-pattern");s.isConstant()||(o=!0);var l=s.constantOr(null);l&&(o=!0,r[l.to]=!0,r[l.from]=!0)}return o}function Qh(t,e,i,r,o){for(var n=o.patternDependencies,a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.paint.get(t+"-pattern").value;if("constant"!==u.kind){var h=u.evaluate({zoom:r-1},i,{},o.availableImages),p=u.evaluate({zoom:r},i,{},o.availableImages),c=u.evaluate({zoom:r+1},i,{},o.availableImages);p=p&&p.name?p.name:p,c=c&&c.name?c.name:c,n[h=h&&h.name?h.name:h]=!0,n[p]=!0,n[c]=!0,i.patterns[l.id]={min:h,mid:p,max:c}}}return i}vh.deviation=function(t,e,i,r){var o=e&&e.length,n=Math.abs(Zh(t,0,o?e[0]*i:t.length,i));if(o)for(var a=0,s=e.length;a<s;a++)n-=Math.abs(Zh(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<r.length;a+=3){var u=r[a]*i,h=r[a+1]*i,p=r[a+2]*i;l+=Math.abs((t[u]-t[p])*(t[h+1]-t[u+1])-(t[u]-t[h])*(t[p+1]-t[u+1]))}return 0===n&&0===l?0:Math.abs((l-n)/n)},vh.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,o=0;o<t.length;o++){for(var n=0;n<t[o].length;n++)for(var a=0;a<e;a++)i.vertices.push(t[o][n][a]);o>0&&i.holes.push(r+=t[o-1].length)}return i},gh.default=_h;var $h=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ds,this.indexArray=new Ys,this.indexArray2=new el,this.programConfigurations=new Zl(t.layers,t.zoom),this.segments=new $l,this.segments2=new $l,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};$h.prototype.populate=function(t,e,i){this.hasPattern=Jh("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),o=[],n=0,a=t;n<a.length;n+=1){var s=a[n],l=s.feature,u=s.id,h=s.index,p=s.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,f=ou(l,c);if(this.layers[0]._featureFilter.filter(new cs(this.zoom),f,i)){var d=r?r.evaluate(f,{},i,e.availableImages):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:c?f.geometry:ru(l),patterns:{},sortKey:d};o.push(m)}}r&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,g=o;y<g.length;y+=1){var _=g[y],v=_.geometry,x=_.index,b=_.sourceLayerIndex;if(this.hasPattern){var w=Qh("fill",this.layers,_,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(_,v,x,i,{});e.featureIndex.insert(t[x].feature,v,x,b,this.index)}},$h.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},$h.prototype.addFeatures=function(t,e,i){for(var r=0,o=this.patternFeatures;r<o.length;r+=1){var n=o[r];this.addFeature(n,n.geometry,n.index,e,i)}},$h.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},$h.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},$h.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,yh),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},$h.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},$h.prototype.addFeature=function(t,e,i,r,o){for(var n=0,a=Yh(e,500);n<a.length;n+=1){for(var s=a[n],l=0,u=0,h=s;u<h.length;u+=1)l+=h[u].length;for(var p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray),c=p.vertexLength,f=[],d=[],m=0,y=s;m<y.length;m+=1){var g=y[m];if(0!==g.length){g!==s[0]&&d.push(f.length/2);var _=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),v=_.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(v+g.length-1,v),f.push(g[0].x),f.push(g[0].y);for(var x=1;x<g.length;x++)this.layoutVertexArray.emplaceBack(g[x].x,g[x].y),this.indexArray2.emplaceBack(v+x-1,v+x),f.push(g[x].x),f.push(g[x].y);_.vertexLength+=g.length,_.primitiveLength+=g.length}}for(var b=gh(f,d),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(c+b[w],c+b[w+1],c+b[w+2]);p.vertexLength+=l,p.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,r)},da("FillBucket",$h,{omit:["layers","patternFeatures"]});var tp=new Ss({"fill-sort-key":new ws(Nt.layout_fill["fill-sort-key"])}),ep={paint:new Ss({"fill-antialias":new bs(Nt.paint_fill["fill-antialias"]),"fill-opacity":new ws(Nt.paint_fill["fill-opacity"]),"fill-color":new ws(Nt.paint_fill["fill-color"]),"fill-outline-color":new ws(Nt.paint_fill["fill-outline-color"]),"fill-translate":new bs(Nt.paint_fill["fill-translate"]),"fill-translate-anchor":new bs(Nt.paint_fill["fill-translate-anchor"]),"fill-pattern":new ks(Nt.paint_fill["fill-pattern"]),"fill-animate-enable":new bs(Nt.paint_fill["fill-animate-enable"]),"fill-water-enable":new bs(Nt.paint_fill["fill-water-enable"])}),layout:tp},ip=function(t){function e(e){t.call(this,e,ep)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getProgramIds=function(){var t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e.prototype.recalculate=function(e,i){t.prototype.recalculate.call(this,e,i);var r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new $h(t)},e.prototype.queryRadius=function(){return xu(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,r,o,n){return!t.queryGeometry.isAboveHorizon&&uu(bu(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),n.angle,t.pixelToTileUnitsFactor),r)},e.prototype.isTileClipped=function(){return!0},e.prototype.isContinuousDraw=function(){return this.paint.get("fill-animate-enable")>0},e}(Jl),rp=Ls([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),op=Ls([{name:"a_centroid_pos",components:2,type:"Uint16"}]),np=rp.members,ap=sp;function sp(t,e,i,r,o){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=o,t.readFields(lp,this,e)}function lp(t,e,i){1==t?e.id=i.readVarint():7==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],o=e._values[t.readVarint()];e.properties[r]=o}}(i,e):6==t?e.type=i.readVarint():2==t&&(e._geometry=i.pos)}function up(t){for(var e,i,r=0,o=0,n=t.length,a=n-1;o<n;a=o++)r+=((i=t[a]).x-(e=t[o]).x)*(e.y+i.y);return r}sp.types=["Unknown","Point","LineString","Polygon"],sp.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,o=1,n=0,a=0,s=0,l=[];t.pos<i;){if(n<=0){var u=t.readVarint();o=7&u,n=u>>3}if(n--,1===o||2===o)a+=t.readSVarint(),s+=t.readSVarint(),1===o&&(e&&l.push(e),e=[]),e.push(new r(a,s));else{if(7!==o)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&l.push(e),l},sp.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,o=0,n=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(o+=t.readSVarint())<a&&(a=o),o>s&&(s=o),(n+=t.readSVarint())<l&&(l=n),n>u&&(u=n);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},sp.prototype.toGeoJSON=function(t,e,i){var r,o,n=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=sp.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/n)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(r=0;r<l.length;r++)p[r]=l[r][0];h(l=p);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,o=[],n=0;n<e;n++){var a=up(t[n]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&o.push(i),i=[t[n]]):i.push(t[n]))}return i&&o.push(i),o}(l),r=0;r<l.length;r++)for(o=0;o<l[r].length;o++)h(l[r][o])}1===l.length?l=l[0]:u="Multi"+u;var c={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(c.id=this.id),c};var hp=pp;function pp(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(cp,this,e),this.length=this._features.length}function cp(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():6===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):4===t?e._keys.push(i.readString()):5===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}pp.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ap(this._pbf,e,this.extent,this._keys,this._values)};var fp=dp;function dp(t,e,i,r,o){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=o,t.readFields(mp,this,e)}function mp(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],o=e._values[t.readVarint()];e.properties[r]=o}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function yp(t){for(var e,i,r=0,o=0,n=t.length,a=n-1;o<n;a=o++)r+=((i=t[a]).x-(e=t[o]).x)*(e.y+i.y);return r}dp.types=["Unknown","Point","LineString","Polygon"],dp.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,o=1,n=0,a=0,s=0,l=[];t.pos<i;){if(n<=0){var u=t.readVarint();o=7&u,n=u>>3}if(n--,1===o||2===o)a+=t.readSVarint(),s+=t.readSVarint(),1===o&&(e&&l.push(e),e=[]),e.push(new r(a,s));else{if(7!==o)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&l.push(e),l},dp.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,o=0,n=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(o+=t.readSVarint())<a&&(a=o),o>s&&(s=o),(n+=t.readSVarint())<l&&(l=n),n>u&&(u=n);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},dp.prototype.toGeoJSON=function(t,e,i){var r,o,n=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=dp.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/n)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(r=0;r<l.length;r++)p[r]=l[r][0];h(l=p);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,o=[],n=0;n<e;n++){var a=yp(t[n]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&o.push(i),i=[t[n]]):i.push(t[n]))}return i&&o.push(i),o}(l),r=0;r<l.length;r++)for(o=0;o<l[r].length;o++)h(l[r][o])}1===l.length?l=l[0]:u="Multi"+u;var c={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(c.id=this.id),c};var gp=_p;function _p(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(vp,this,e),this.length=this._features.length}function vp(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}function xp(t,e,i){var r;2===t&&(r=new hp(i,i.readVarint()+i.pos)).length&&(e[r.name]=r),3===t&&(r=new gp(i,i.readVarint()+i.pos)).length&&(e[r.name]=r)}_p.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new fp(this._pbf,e,this.extent,this._keys,this._values)};var bp={VectorTile:function(t,e){this.layers=t.readFields(xp,{},e)},VectorTileFeature:ap,VectorTileLayer:hp},wp=bp.VectorTileFeature.types,kp=Math.pow(2,13);function Tp(t,e,i,r,o,n,a,s){t.emplaceBack((e<<1)+a,(i<<1)+n,(Math.floor(r*kp)<<1)+o,Math.round(s))}function Ip(t,e,i,r,o,n,a,s,l){void 0===l&&(l=0),t.emplaceBack((e<<1)+a,(i<<1)+n,(Math.floor(r*kp)<<1)+o,Math.round(s),l)}var Sp=function(){this.acc=new r(0,0),this.polyCount=[]};Sp.prototype.startRing=function(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new r(t.x,t.y),this.max=new r(t.x,t.y))},Sp.prototype.append=function(t,e){this.currentPolyCount.edges++,this.acc._add(t);var i=!!this.borders,r=this.min,o=this.max;t.x<r.x?(r.x=t.x,i=!0):t.x>o.x&&(o.x=t.x,i=!0),t.y<r.y?(r.y=t.y,i=!0):t.y>o.y&&(o.y=t.y,i=!0),((0===t.x||t.x===tu)&&t.x===e.x)!=((0===t.y||t.y===tu)&&t.y===e.y)&&this.processBorderOverlap(t,e),i&&this.checkBorderIntersection(t,e)},Sp.prototype.checkBorderIntersection=function(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,ki(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>tu!=t.x>tu&&this.addBorderIntersection(1,ki(e.y,t.y,(tu-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,ki(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>tu!=t.y>tu&&this.addBorderIntersection(3,ki(e.x,t.x,(tu-e.y)/(t.y-e.y)))},Sp.prototype.addBorderIntersection=function(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);var i=this.borders[t];e<i[0]&&(i[0]=e),e>i[1]&&(i[1]=e)},Sp.prototype.processBorderOverlap=function(t,e){if(t.x===e.x){if(t.y===e.y)return;var i=0===t.x?0:1;this.addBorderIntersection(i,e.y),this.addBorderIntersection(i,t.y)}else{var r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x)}},Sp.prototype.centroid=function(){var t=this.polyCount.reduce((function(t,e){return t+e.edges}),0);return 0!==t?this.acc.div(t)._round():new r(0,0)},Sp.prototype.span=function(){return new r(this.max.x-this.min.x,this.max.y-this.min.y)},Sp.prototype.intersectsCount=function(){return this.borders.reduce((function(t,e){return t+ +(e[0]!==Number.MAX_VALUE)}),0)};var Ep=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new zs,this.VSArray=new Os,this.centroidVertexArray=new ml,this.indexArray=new Ys,this.programConfigurations=new Zl(t.layers,t.zoom),this.segments=new $l,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.enableTerrain=t.enableTerrain};function Ap(t,e){return t.x===e.x&&(t.x<0||t.x>tu)||t.y===e.y&&(t.y<0||t.y>tu)}function Pp(t){return t.every((function(t){return t.x<=0}))||t.every((function(t){return t.x>=tu}))||t.every((function(t){return t.y<=0}))||t.every((function(t){return t.y>=tu}))}Ep.prototype.populate=function(t,e,i){this.features=[],this.hasPattern=Jh("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(t){var e=Math.exp(Math.PI*(1-t.y/(1<<t.z)*2));return 80150034*e/(e*e+1)/tu/(1<<t.z)}(i);for(var r=0,o=t;r<o.length;r+=1){var n=o[r],a=n.feature,s=n.id,l=n.index,u=n.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,p=ou(a,h);if(this.layers[0]._featureFilter.filter(new cs(this.zoom),p,i)){var c={id:s,sourceLayerIndex:u,index:l,geometry:h?p.geometry:ru(a),properties:a.properties,type:a.type,patterns:{}},f=this.layoutVertexArray.length;this.hasPattern?this.features.push(Qh("fill-extrusion",this.layers,c,this.zoom,e)):this.addFeature(c,c.geometry,l,i,{}),e.featureIndex.insert(a,c.geometry,l,u,this.index,f)}}this.sortBorders()},Ep.prototype.addFeatures=function(t,e,i){for(var r=0,o=this.features;r<o.length;r+=1){var n=o[r];this.addFeature(n,n.geometry,n.index,e,i)}this.sortBorders()},Ep.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},Ep.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ep.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ep.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,np),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ep.prototype.uploadCentroid=function(t){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,op.members,!0),this.needsCentroidUpdate=!1)},Ep.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ep.prototype.addFeature=function(t,e,i,r,o){for(var n=this.enableTerrain&&t.properties&&"Polygon"===wp[t.type]?new Sp:null,a=0,s=Yh(e,500);a<s.length;a+=1){var l=s[a],u=0,h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);if(0!==l.length&&!Pp(l[0])){for(var p=0;p<l.length;p++){var c=l[p];if(0!==c.length){u+=c.length;var f=0;n&&n.startRing(c[0]);for(var d=0;d<c.length;d++){var m=c[d];if(d>=1){var y=c[d-1];if(!Ap(m,y)){n&&n.append(m,y),h.vertexLength+4>$l.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=m.sub(y)._perp(),_=g.x/(Math.abs(g.x)+Math.abs(g.y)),v=g.y>0?1:0,x=y.dist(m);f+x>32768&&(f=0),Tp(this.layoutVertexArray,m.x,m.y,_,v,0,0,f),Tp(this.layoutVertexArray,m.x,m.y,_,v,0,1,f),Ip(this.VSArray,m.x,m.y,_,v,0,0,f,t.properties.height),Ip(this.VSArray,m.x,m.y,_,v,0,1,f,t.properties.height),Tp(this.layoutVertexArray,y.x,y.y,_,v,0,2,f+=x),Tp(this.layoutVertexArray,y.x,y.y,_,v,0,3,f),Ip(this.VSArray,y.x,y.y,_,v,0,2,f,t.properties.height),Ip(this.VSArray,y.x,y.y,_,v,0,3,f,t.properties.height);var b=h.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),h.vertexLength+=4,h.primitiveLength+=2}}}}}if(h.vertexLength+u>$l.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===wp[t.type]){for(var w=[],k=[],T=h.vertexLength,I=0;I<l.length;I++){var S=l[I];if(0!==S.length){S!==l[0]&&k.push(w.length/2);for(var E=0;E<S.length;E++){var A=S[E];Tp(this.layoutVertexArray,A.x,A.y,0,0,1,1,0),Ip(this.VSArray,A.x,A.y,0,0,1,1,0,t.properties.height),w.push(A.x),w.push(A.y),n&&n.currentPolyCount.top++}}}for(var P=gh(w,k),M=0;M<P.length;M+=3)this.indexArray.emplaceBack(T+P[M],T+P[M+2],T+P[M+1]);h.primitiveLength+=P.length/3,h.vertexLength+=u}}}if(n&&n.polyCount.length>0){if(n.borders){n.vertexArrayOffset=this.centroidVertexArray.length;for(var L=n.borders,C=this.featuresOnBorder.push(n)-1,D=0;D<4;D++)L[D][0]!==Number.MAX_VALUE&&this.borders[D].push(C)}this.encodeCentroid(n.borders?void 0:n.centroid(),n)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,r)},Ep.prototype.sortBorders=function(){for(var t=this,e=function(e){t.borders[e].sort((function(i,r){return t.featuresOnBorder[i].borders[e][0]-t.featuresOnBorder[r].borders[e][0]}))},i=0;i<4;i++)e(i)},Ep.prototype.encodeCentroid=function(t,e,i){var r,o;if(void 0===i&&(i=!0),t)if(0!==t.y){var n=e.span()._mult(this.tileToMeter);r=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(n.x/10)),o=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else r=Math.ceil(7*(t.x+450)),o=0;else r=0,o=+i;for(var a=i?this.centroidVertexArray.length:e.vertexArrayOffset,s=0,l=e.polyCount;s<l.length;s+=1){var u=l[s];i&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*u.edges+u.top);for(var h=0;h<2*u.edges;h++)this.centroidVertexArray.emplace(a++,0,o),this.centroidVertexArray.emplace(a++,r,o);for(var p=0;p<u.top;p++)this.centroidVertexArray.emplace(a++,r,o)}},da("FillExtrusionBucket",Ep,{omit:["layers","features"]}),da("PartMetadata",Sp);var Mp={paint:new Ss({"fill-extrusion-opacity":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-exclude":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-exclude"]),"fill-extrusion-direction":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-direction"]),"fill-extrusion-isTile":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-isTile"]),"fill-extrusion-isGradient":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-isGradient"]),"fill-extrusion-color":new ws(Nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-roofcolor":new ws(Nt["paint_fill-extrusion"]["fill-extrusion-roofcolor"]),"fill-extrusion-translate":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ks(Nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ws(Nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ws(Nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new bs(Nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Lp=function(t){function e(e){t.call(this,e,Mp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ep(t)},e.prototype.queryRadius=function(){return xu(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.getProgramIds=function(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e.prototype.queryIntersectsFeature=function(t,e,i,o,n,a,s,l,u){var h=wu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),p=this.paint.get("fill-extrusion-height").evaluate(e,i),c=this.paint.get("fill-extrusion-base").evaluate(e,i),f=[0,0],d=l&&a.elevation,m=a.elevation?a.elevation.exaggeration():1;if(d){var y=t.tile.getBucket(this).centroidVertexArray,g=u+1;if(g<y.length){var _=y.get(g);f[0]=_.a_centroid_pos0,f[1]=_.a_centroid_pos1}}if(0===f[0]&&1===f[1])return!1;var v=function(t,e,i,o,n,a,s,l,u){return a?function(t,e,i,r,o,n,a,s,l){for(var u=[],h=[],p=[0,0,0,1],c=0,f=t;c<f.length;c+=1){for(var d=[],m=[],y=0,g=f[c];y<g.length;y+=1){var _=g[y],v=_.x+r.x,x=_.y+r.y,b=Op(v,x,e,i,n,a,s,l);p[0]=v,p[1]=x,p[2]=b.base,p[3]=1,Wu(p,p,o),p[3]=Math.max(p[3],1e-5);var w=zp([p[0]/p[3],p[1]/p[3],p[2]/p[3]]);p[0]=v,p[1]=x,p[2]=b.top,p[3]=1,Wu(p,p,o),p[3]=Math.max(p[3],1e-5);var k=zp([p[0]/p[3],p[1]/p[3],p[2]/p[3]]);d.push(w),m.push(k)}u.push(d),h.push(m)}return[u,h]}(t,e,i,o,n,a,s,l,u):function(t,e,i,o,n){for(var a=[],s=[],l=n[8]*e,u=n[9]*e,h=n[10]*e,p=n[11]*e,c=n[8]*i,f=n[9]*i,d=n[10]*i,m=n[11]*i,y=0,g=t;y<g.length;y+=1){for(var _=[],v=[],x=0,b=g[y];x<b.length;x+=1){var w=b[x],k=w.x+o.x,T=w.y+o.y,I=n[0]*k+n[4]*T+n[12],S=n[1]*k+n[5]*T+n[13],E=n[2]*k+n[6]*T+n[14],A=n[3]*k+n[7]*T+n[15],P=I+l,M=S+u,L=E+h,C=Math.max(A+p,1e-5),D=I+c,z=S+f,O=E+d,R=Math.max(A+m,1e-5),B=new r(P/C,M/C);B.z=L/C,_.push(B);var F=new r(D/R,z/R);F.z=O/R,v.push(F)}a.push(_),s.push(v)}return[a,s]}(t,e,i,o,n)}(o,c,p,h,s,d?l:null,f,m,a.center.lat),x=t.queryGeometry;return function(t,e,i){var r=1/0;uu(i,e)&&(r=Dp(i,e[0]));for(var o=0;o<e.length;o++)for(var n=e[o],a=t[o],s=0;s<n.length-1;s++){var l=n[s],u=[l,n[s+1],a[s+1],a[s],l];su(i,u)&&(r=Math.min(r,Dp(i,u)))}return r!==1/0&&r}(v[0],v[1],x.isPointQuery()?x.screenBounds:x.screenGeometry)},e}(Jl);function Cp(t,e){return t.x*e.x+t.y*e.y}function Dp(t,e){if(1===t.length){for(var i,r=0,o=e[r++];!i||o.equals(i);)if(!(i=e[r++]))return 1/0;for(;r<e.length;r++){var n=e[r],a=t[0],s=i.sub(o),l=n.sub(o),u=a.sub(o),h=Cp(s,s),p=Cp(s,l),c=Cp(l,l),f=Cp(u,s),d=Cp(u,l),m=h*c-p*p,y=(c*f-p*d)/m,g=(h*d-p*f)/m,_=o.z*(1-y-g)+i.z*y+n.z*g;if(isFinite(_))return _}return 1/0}for(var v=1/0,x=0,b=e;x<b.length;x+=1)v=Math.min(v,b[x].z);return v}function zp(t){var e=new r(t[0],t[1]);return e.z=t[2],e}function Op(t,e,i,r,o,n,a,s){var l=a*o.getElevationAt(t,e,!0,!0),u=0!==n[0],h=u?0===n[1]?a*(n[0]/7-450):a*function(t,e,i){var r=Math.floor(e[0]/8),o=Math.floor(e[1]/8),n=10*(e[0]-8*r),a=10*(e[1]-8*o),s=t.getElevationAt(r,o,!0,!0),l=t.getMeterToDEM(i),u=Math.floor(.5*(n*l-1)),h=Math.floor(.5*(a*l-1)),p=t.tileCoordToPixel(r,o),c=2*u+1,f=2*h+1,d=function(t,e,i,r,o){return[t.getElevationAtPixel(e,i,!0),t.getElevationAtPixel(e+o,i,!0),t.getElevationAtPixel(e,i+o,!0),t.getElevationAtPixel(e+r,i+o,!0)]}(t,p.x-u,p.y-h,c,f),m=Math.abs(d[0]-d[1]),y=Math.abs(d[2]-d[3]),g=Math.abs(d[0]-d[2])+Math.abs(d[1]-d[3]),_=Math.min(.25,.5*l*(m+y)/c),v=Math.min(.25,.5*l*g/f);return s+Math.max(_*n,v*a)}(o,n,s):l;return{base:l+(0===i)?-1:i,top:u?Math.max(h+r,l+i+2):l+r}}var Rp=Ls([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"},{name:"a_total_distance",components:1,type:"Float32"}],4).members,Bp=Ls([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,Fp=bp.VectorTileFeature.types,Up=Math.cos(Math.PI/180*37.5),jp=function(t){var e=this;this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((function(t){e.gradients[t.id]={}})),this.layoutVertexArray=new Bs,this.layoutVertexArray2=new Fs,this.indexArray=new Ys,this.programConfigurations=new Zl(t.layers,t.zoom),this.segments=new $l,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.isLastSegmentHasHeight=!1};jp.prototype.populate=function(t,e,i){this.hasPattern=Jh("line",this.layers,e);for(var r=this.layers[0].layout.get("line-sort-key"),o=[],n=0,a=t;n<a.length;n+=1){var s=a[n],l=s.feature,u=s.id,h=s.index,p=s.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,f=ou(l,c);if(this.layers[0]._featureFilter.filter(new cs(this.zoom),f,i)){var d=r?r.evaluate(f,{},i):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:c?f.geometry:ru(l),patterns:{},sortKey:d};o.push(m)}}r&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=e.lineAtlas,g=e.featureIndex,_=this.addConstantDashes(y),v=0,x=o;v<x.length;v+=1){var b=x[v],w=b.geometry,k=b.index,T=b.sourceLayerIndex;if(_&&this.addFeatureDashes(b,y),this.hasPattern){var I=Qh("line",this.layers,b,this.zoom,e);this.patternFeatures.push(I)}else this.addFeature(b,w,k,i,y.positions);g.insert(t[k].feature,w,k,T,this.index)}},jp.prototype.addConstantDashes=function(t){for(var e=!1,i=0,r=this.layers;i<r.length;i+=1){var o=r[i],n=o.paint.get("line-dasharray").value,a=o.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==a.kind)e=!0;else{var s=a.value,l=n.value;if(!l)continue;t.addDash(l.from,s),t.addDash(l.to,s),l.other&&t.addDash(l.other,s)}}return e},jp.prototype.addFeatureDashes=function(t,e){for(var i=this.zoom,r=0,o=this.layers;r<o.length;r+=1){var n=o[r],a=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==s.kind){var l=void 0,u=void 0,h=void 0,p=void 0,c=void 0,f=void 0;if("constant"===a.kind){var d=a.value;if(!d)continue;l=d.other||d.to,u=d.to,h=d.from}else l=a.evaluate({zoom:i-1},t),u=a.evaluate({zoom:i},t),h=a.evaluate({zoom:i+1},t);"constant"===s.kind?p=c=f=s.value:(p=s.evaluate({zoom:i-1},t),c=s.evaluate({zoom:i},t),f=s.evaluate({zoom:i+1},t)),e.addDash(l,p),e.addDash(u,c),e.addDash(h,f);var m=e.getKey(l,p),y=e.getKey(u,c),g=e.getKey(h,f);t.patterns[n.id]={min:m,mid:y,max:g}}}},jp.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},jp.prototype.addFeatures=function(t,e,i){for(var r=0,o=this.patternFeatures;r<o.length;r+=1){var n=o[r];this.addFeature(n,n.geometry,n.index,e,i)}},jp.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},jp.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},jp.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Bp)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rp),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},jp.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},jp.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("lkmap_clip_start")&&t.properties.hasOwnProperty("lkmap_clip_end"))return{start:+t.properties.lkmap_clip_start,end:+t.properties.lkmap_clip_end}},jp.prototype.addFeature=function(t,e,i,r,o){var n=this.layers[0].layout,a=n.get("line-join").evaluate(t,{}),s=n.get("line-cap").evaluate(t,{}),l=n.get("line-miter-limit"),u=n.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var h=0,p=e;h<p.length;h+=1)this.addLine(p[h],t,a,s,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,r)},jp.prototype.addLine=function(t,e,i,r,o,n){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0;for(var a=0;a<t.length-1;a++)this.totalDistance+=t[a].dist(t[a+1]);this.lineClips&&(this.lineClipsArray.push(this.lineClips),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance));for(var s="Polygon"===Fp[e.type],l=t.length;l>=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;u<l-1&&t[u].equals(t[u+1]);)u++;if(!(l<(s?3:2))){"bevel"===i&&(o=1.05);var h=this.overscaling<=16?122880/(512*this.overscaling):0,p=void 0,c=!1;this.isLastSegmentHasHeight?(p=this.segments.newSegment(10*l,this.layoutVertexArray,this.indexArray),c=!0,this.isLastSegmentHasHeight=!1):p=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray);var f,d=this.layers[0].paint;if(void 0!==d){var m=d.get("line-height");if(void 0!==m){var y=m.evaluate(e,{});0!==y&&(c||(p=this.segments.newSegment(10*l,this.layoutVertexArray,this.indexArray)),this.isLastSegmentHasHeight=!0),p.lineHeight=y}else p.lineHeight=0}var g=void 0,_=void 0,v=void 0,x=void 0;this.e1=this.e2=-1,s&&(x=t[u].sub(f=t[l-2])._unit()._perp());for(var b=u;b<l;b++)if(!(_=b===l-1?s?t[u+1]:void 0:t[b+1])||!t[b].equals(_)){x&&(v=x),f&&(g=f),f=t[b],x=_?_.sub(f)._unit()._perp():v;var w=(v=v||x).add(x);0===w.x&&0===w.y||w._unit();var k=v.x*x.x+v.y*x.y,T=w.x*x.x+w.y*x.y,I=0!==T?1/T:1/0,S=2*Math.sqrt(2-2*T),E=T<Up&&g&&_,A=v.x*x.y-v.y*x.x>0;if(E&&b>u){var P=f.dist(g);if(P>2*h){var M=f.sub(f.sub(g)._mult(h/P)._round());this.updateDistance(g,M),this.addCurrentVertex(M,v,0,0,p),g=M}}var L=g&&_,C=L?i:s?"butt":r;if(L&&"round"===C&&(I<n?C="miter":I<=2&&(C="fakeround")),"miter"===C&&I>o&&(C="bevel"),"bevel"===C&&(I>2&&(C="flipbevel"),I<o&&(C="miter")),g&&this.updateDistance(g,f),"miter"===C)w._mult(I),this.addCurrentVertex(f,w,0,0,p);else if("flipbevel"===C){if(I>100)w=x.mult(-1);else{var D=I*v.add(x).mag()/v.sub(x).mag();w._perp()._mult(D*(A?-1:1))}this.addCurrentVertex(f,w,0,0,p),this.addCurrentVertex(f,w.mult(-1),0,0,p)}else if("bevel"===C||"fakeround"===C){var z=-Math.sqrt(I*I-1),O=A?z:0,R=A?0:z;if(g&&this.addCurrentVertex(f,v,O,R,p),"fakeround"===C)for(var B=Math.round(180*S/Math.PI/20),F=1;F<B;F++){var U=F/B;if(.5!==U){var j=U-.5;U+=U*j*(U-1)*((1.0904+k*(k*(3.55645-1.43519*k)-3.2452))*j*j+(.848013+k*(.215638*k-1.06021)))}var N=x.sub(v)._mult(U)._add(v)._unit()._mult(A?-1:1);this.addHalfVertex(f,N.x,N.y,!1,A,0,p)}_&&this.addCurrentVertex(f,x,-O,-R,p)}else if("butt"===C)this.addCurrentVertex(f,w,0,0,p);else if("square"===C){var V=g?1:-1;g||this.addCurrentVertex(f,w,V,V,p),this.addCurrentVertex(f,w,0,0,p),g&&this.addCurrentVertex(f,w,V,V,p)}else"round"===C&&(g&&(this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v,1,1,p,!0)),_&&(this.addCurrentVertex(f,x,-1,-1,p,!0),this.addCurrentVertex(f,x,0,0,p)));if(E&&b<l-1){var G=f.dist(_);if(G>2*h){var Z=f.add(_.sub(f)._mult(h/G)._round());this.updateDistance(f,Z),this.addCurrentVertex(Z,x,0,0,p),f=Z}}}}},jp.prototype.addCurrentVertex=function(t,e,i,r,o,n){void 0===n&&(n=!1);var a=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,n,!1,i,o),this.addHalfVertex(t,a,s,n,!0,-r,o)},jp.prototype.addHalfVertex=function(t,e,i,r,o,n,a){this.layoutVertexArray.emplaceBack((t.x<<1)+(r?1:0),(t.y<<1)+(o?1:0),Math.round(63*e)+128,Math.round(63*i)+128,1+(0===n?0:n<0?-1:1),0,this.lineSoFar,this.totalDistance),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length);var s=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,s),a.primitiveLength++),o?this.e2=s:this.e1=s},jp.prototype.updateScaledDistance=function(){if(this.lineClips){var t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance},jp.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},da("LineBucket",jp,{omit:["layers","patternFeatures"]});var Np=new Ss({"line-cap":new ws(Nt.layout_line["line-cap"]),"line-join":new ws(Nt.layout_line["line-join"]),"line-miter-limit":new bs(Nt.layout_line["line-miter-limit"]),"line-round-limit":new bs(Nt.layout_line["line-round-limit"]),"line-sort-key":new ws(Nt.layout_line["line-sort-key"])}),Vp={paint:new Ss({"line-opacity":new ws(Nt.paint_line["line-opacity"]),"line-animate-enable":new bs(Nt.paint_line["line-animate-enable"]),"line-animate-duration":new bs(Nt.paint_line["line-animate-duration"]),"line-animate-interval":new bs(Nt.paint_line["line-animate-interval"]),"line-animate-trailLength":new bs(Nt.paint_line["line-animate-trailLength"]),"line-color":new ws(Nt.paint_line["line-color"]),"line-translate":new bs(Nt.paint_line["line-translate"]),"line-translate-anchor":new bs(Nt.paint_line["line-translate-anchor"]),"line-width":new ws(Nt.paint_line["line-width"]),"line-height":new ws(Nt.paint_line["line-height"]),"line-gap-width":new ws(Nt.paint_line["line-gap-width"]),"line-offset":new ws(Nt.paint_line["line-offset"]),"line-blur":new ws(Nt.paint_line["line-blur"]),"line-dasharray":new ks(Nt.paint_line["line-dasharray"]),"line-pattern":new ks(Nt.paint_line["line-pattern"]),"line-gradient":new Is(Nt.paint_line["line-gradient"])}),layout:Np},Gp=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,i){return i=new cs(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),t.prototype.possiblyEvaluate.call(this,e,i)},e.prototype.evaluate=function(e,i,r,o){return i=b({},i,{zoom:Math.floor(i.zoom)}),t.prototype.evaluate.call(this,e,i,r,o)},e}(ws),Zp=new Gp(Vp.paint.properties["line-width"].specification);Zp.useIntegerZoom=!0;var qp=function(t){function e(e){t.call(this,e,Vp),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){if("line-gradient"===t){var e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof wi,this.gradientVersion=(this.gradientVersion+1)%l}},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,i){t.prototype.recalculate.call(this,e,i),this.paint._values["line-floorwidth"]=Zp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new jp(t)},e.prototype.getProgramIds=function(){var t=this.paint.get("line-dasharray"),e=this.paint.get("line-pattern").constantOr(1),i=this.paint.get("line-gradient");return[e?"linePattern":t?"lineSDF":i?"lineGradient":"line"]},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e.prototype.queryRadius=function(t){var e=t,i=Xp(vu("line-width",this,e),vu("line-gap-width",this,e)),r=vu("line-offset",this,e);return i/2+Math.abs(r)+xu(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,o,n,a){if(t.queryGeometry.isAboveHorizon)return!1;var s=bu(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Xp(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),u=this.paint.get("line-offset").evaluate(e,i);return u&&(o=function(t,e){for(var i=[],o=new r(0,0),n=0;n<t.length;n++){for(var a=t[n],s=[],l=0;l<a.length;l++){var u=a[l],h=a[l+1],p=0===l?o:u.sub(a[l-1])._unit()._perp(),c=l===a.length-1?o:h.sub(u)._unit()._perp(),f=p._add(c)._unit();f._mult(1/(f.x*c.x+f.y*c.y)),s.push(f._mult(e)._add(u))}i.push(s)}return i}(o,u*t.pixelToTileUnitsFactor)),function(t,e,i){for(var r=0;r<e.length;r++){var o=e[r];if(t.length>=3)for(var n=0;n<o.length;n++)if(yu(t,o[n]))return!0;if(hu(t,o,i))return!0}return!1}(s,o,l)},e.prototype.isTileClipped=function(){return!0},e.prototype.isContinuousDraw=function(){return this.paint.get("line-animate-enable")>0},e}(Jl);function Xp(t,e){return e>0?e+2*t:t}var Wp=Ls([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Hp=Ls([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ls([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Yp=Ls([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Kp=Ls([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ls([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var Jp=Ls([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Qp=Ls([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ls([{name:"triangle",components:3,type:"Uint16"}]),Ls([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Ls([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ls([{type:"Float32",name:"offsetX"}]),Ls([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var $p=24,tc=128;function ec(t,e){var i=e.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new cs(t+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,o=i.interpolationType,n=0;n<r.length&&r[n]<=t;)n++;for(var a=n=Math.max(0,n-1);a<r.length&&r[a]<t+1;)a++;a=Math.min(r.length-1,a);var s=r[n],l=r[a];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:o}:{kind:"camera",minZoom:s,maxZoom:l,minSize:i.evaluate(new cs(s)),maxSize:i.evaluate(new cs(l)),interpolationType:o}}function ic(t,e,i){var r=e.uSize,o=i.lowerSize;return"source"===t.kind?o/tc:"composite"===t.kind?ki(o/tc,i.upperSize/tc,e.uSizeT):r}function rc(t,e){var i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){var o=t.interpolationType,n=o?g(qi.interpolationFactor(o,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?r=ki(t.minSize,t.maxSize,n):i=n}return{uSizeT:i,uSize:r}}var oc=Object.freeze({__proto__:null,getSizeData:ec,evaluateSizeForFeature:ic,evaluateSizeForZoom:rc,SIZE_PACK_FACTOR:tc});function nc(t,e,i){return t.sections.forEach((function(t){t.text=function(t,e,i){var r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),ps.applyArabicShaping&&(t=ps.applyArabicShaping(t)),t}(t.text,e,i)})),t}var ac={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"};function sc(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"｀"===t||"￣"===t||"︑"===t||"︒"===t}function lc(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var uc=function(t,e,i,r,o){var n,a,s=8*o-r-1,l=(1<<s)-1,u=l>>1,h=-7,p=i?o-1:0,c=i?-1:1,f=t[e+p];for(p+=c,n=f&(1<<-h)-1,f>>=-h,h+=s;h>0;n=256*n+t[e+p],p+=c,h-=8);for(a=n&(1<<-h)-1,n>>=-h,h+=r;h>0;a=256*a+t[e+p],p+=c,h-=8);if(0===n)n=1-u;else{if(n===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),n-=u}return(f?-1:1)*a*Math.pow(2,n-r)},hc=function(t,e,i,r,o,n){var a,s,l,u=8*n-o-1,h=(1<<u)-1,p=h>>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:n-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+p>=1?c/l:c*Math.pow(2,1-p))*l>=2&&(a++,l/=2),a+p>=h?(s=0,a=h):a+p>=1?(s=(e*l-1)*Math.pow(2,o),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,o),a=0));o>=8;t[i+f]=255&s,f+=d,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;t[i+f]=255&a,f+=d,a/=256,u-=8);t[i+f-d]|=128*m},pc=cc;function cc(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}cc.Varint=0,cc.Fixed64=1,cc.Bytes=2,cc.Fixed32=5;var fc=4294967296,dc=1/fc,mc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function yc(t){return t.type===cc.Bytes?t.readVarint()+t.pos:t.pos+1}function gc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function _c(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var o=i.pos-1;o>=t;o--)i.buf[o+r]=i.buf[o]}function vc(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function xc(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function bc(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function wc(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function kc(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Tc(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Ic(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Sc(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Ec(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Ac(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Pc(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Mc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Lc(t,e,i){e.glyphs=[],1===t&&i.readMessage(Cc,e)}function Cc(t,e,i){if(3===t){var r=i.readMessage(Dc,{}),o=r.width,n=r.height,a=r.left,s=r.top,l=r.advance;e.glyphs.push({id:r.id,bitmap:new uh({width:o+6,height:n+6},r.bitmap),metrics:{width:o,height:n,left:a,top:s,advance:l}})}else 4===t?e.ascender=i.readSVarint():5===t&&(e.descender=i.readSVarint())}function Dc(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function zc(t){for(var e=0,i=0,r=0,o=t;r<o.length;r+=1){var n=o[r];e+=n.w*n.h,i=Math.max(i,n.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}],s=0,l=0,u=0,h=t;u<h.length;u+=1)for(var p=h[u],c=a.length-1;c>=0;c--){var f=a[c];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=a.pop();c<a.length&&(a[c]=d)}else p.h===f.h?(f.x+=p.w,f.w-=p.w):p.w===f.w?(f.y+=p.h,f.h-=p.h):(a.push({x:f.x+p.w,y:f.y,w:f.w-p.w,h:p.h}),f.y+=p.h,f.h-=p.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}cc.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),o=r>>3,n=this.pos;this.type=7&r,t(o,e,this),this.pos===n&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ac(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Mc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ac(this.buf,this.pos)+Ac(this.buf,this.pos+4)*fc;return this.pos+=8,t},readSFixed64:function(){var t=Ac(this.buf,this.pos)+Mc(this.buf,this.pos+4)*fc;return this.pos+=8,t},readFloat:function(){var t=uc(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=uc(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,o,n=i.buf;if(r=(112&(o=n[i.pos++]))>>4,o<128)return gc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<3,o<128)return gc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<10,o<128)return gc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<17,o<128)return gc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<24,o<128)return gc(t,r,e);if(r|=(1&(o=n[i.pos++]))<<31,o<128)return gc(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&mc?function(t,e,i){return mc.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",o=e;o<i;){var n,a,s,l=t[o],u=null,h=l>239?4:l>223?3:l>191?2:1;if(o+h>i)break;1===h?l<128&&(u=l):2===h?128==(192&(n=t[o+1]))&&(u=(31&l)<<6|63&n)<=127&&(u=null):3===h?(a=t[o+2],128==(192&(n=t[o+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&n)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(a=t[o+2],s=t[o+3],128==(192&(n=t[o+1]))&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&n)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),o+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==cc.Bytes)return t.push(this.readVarint(e));var i=yc(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==cc.Bytes)return t.push(this.readSVarint());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==cc.Bytes)return t.push(this.readBoolean());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==cc.Bytes)return t.push(this.readFloat());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==cc.Bytes)return t.push(this.readDouble());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==cc.Bytes)return t.push(this.readFixed32());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==cc.Bytes)return t.push(this.readSFixed32());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==cc.Bytes)return t.push(this.readFixed64());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==cc.Bytes)return t.push(this.readSFixed64());var e=yc(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===cc.Varint)for(;this.buf[this.pos++]>127;);else if(e===cc.Bytes)this.pos=this.readVarint()+this.pos;else if(e===cc.Fixed32)this.pos+=4;else{if(e!==cc.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Pc(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Pc(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Pc(this.buf,-1&t,this.pos),Pc(this.buf,Math.floor(t*dc),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Pc(this.buf,-1&t,this.pos),Pc(this.buf,Math.floor(t*dc),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,o,n=0;n<e.length;n++){if((r=e.charCodeAt(n))>55295&&r<57344){if(!o){r>56319||n+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):o=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,o=r;continue}r=o-55296<<10|r-56320|65536,o=null}else o&&(t[i++]=239,t[i++]=191,t[i++]=189,o=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&_c(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),hc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),hc(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&_c(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,cc.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,vc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,xc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,kc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,bc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,wc,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Tc,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ic,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Sc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ec,e)},writeBytesField:function(t,e){this.writeTag(t,cc.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,cc.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,cc.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,cc.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,cc.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,cc.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,cc.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,cc.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,cc.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,cc.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Oc=function(t,e){var i=e.pixelRatio,r=e.version,o=e.stretchX,n=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=i,this.stretchX=o,this.stretchY=n,this.content=a,this.version=r},Rc={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};Rc.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Rc.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Rc.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Oc.prototype,Rc);var Bc=function(t,e){var i={},r={};this.haveRenderCallbacks=[];var o=[];this.addImages(t,i,o),this.addImages(e,r,o);var n=zc(o),a=new hh({width:n.w||1,height:n.h||1});for(var s in t){var l=t[s],u=i[s].paddedRect;hh.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var h in e){var p=e[h],c=r[h].paddedRect,f=c.x+1,d=c.y+1,m=p.data.width,y=p.data.height;hh.copy(p.data,a,{x:0,y:0},{x:f,y:d},p.data),hh.copy(p.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:m,height:1}),hh.copy(p.data,a,{x:0,y:0},{x:f,y:d+y},{width:m,height:1}),hh.copy(p.data,a,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:y}),hh.copy(p.data,a,{x:0,y:0},{x:f+m,y:d},{width:1,height:y})}this.image=a,this.iconPositions=i,this.patternPositions=r};Bc.prototype.addImages=function(t,e,i){for(var r in t){var o=t[r],n={x:0,y:0,w:o.data.width+2,h:o.data.height+2};i.push(n),e[r]=new Oc(n,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(r)}},Bc.prototype.patchUpdatedImages=function(t,e){for(var i in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)},Bc.prototype.patchUpdatedImage=function(t,e,i){if(t&&e&&t.version!==e.version){t.version=e.version;var r=t.tl;i.update(e.data,void 0,{x:r[0],y:r[1]})}},da("ImagePosition",Oc),da("ImageAtlas",Bc);var Fc={horizontal:1,vertical:2,horizontalOnly:3},Uc=function(){this.scale=1,this.fontStack="",this.imageName=null};Uc.forText=function(t,e){var i=new Uc;return i.scale=t||1,i.fontStack=e,i},Uc.forImage=function(t){var e=new Uc;return e.imageName=t,e};var jc=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Nc(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m){var y,g=jc.fromFeature(t,o);p===Fc.vertical&&g.verticalizePunctuation(c&&"point"===f);var _=ps.processBidirectionalText,v=ps.processStyledBidirectionalText;if(_&&1===g.sections.length){y=[];for(var x=0,b=_(g.toString(),Yc(g,u,n,e,r,f,d));x<b.length;x+=1){var w=b[x],k=new jc;k.text=w,k.sections=g.sections;for(var T=0;T<w.length;T++)k.sectionIndex.push(0);y.push(k)}}else if(v){y=[];for(var I=0,S=v(g.text,g.sectionIndex,Yc(g,u,n,e,r,f,d));I<S.length;I+=1){var E=S[I],A=new jc;A.text=E[0],A.sectionIndex=E[1],A.sections=g.sections,y.push(A)}}else y=function(t,e){for(var i=[],r=t.text,o=0,n=0,a=e;n<a.length;n+=1){var s=a[n];i.push(t.substring(o,s)),o=s}return o<r.length&&i.push(t.substring(o,r.length)),i}(g,Yc(g,u,n,e,r,f,d));var P=[],M={positionedLines:P,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(t,e,i,r,o,n,a,s,l,u,h,p){for(var c=0,f=0,d=0,m="right"===s?1:"left"===s?0:.5,y=!1,g=0,_=o;g<_.length;g+=1){for(var v=0,x=_[g].getSections();v<x.length;v+=1){var b=x[v];if(!b.imageName){var w=e[b.fontStack];if(w&&!(y=void 0!==w.ascender&&void 0!==w.descender))break}}if(!y)break}for(var k=0,T=0,I=o;T<I.length;T+=1){var S=I[T];S.trim();var E=S.getMaxScale(),A=(E-1)*$p,P={positionedGlyphs:[],lineOffset:0};t.positionedLines[k]=P;var M=P.positionedGlyphs,L=0;if(S.length()){for(var C=0,D=0,z=0;z<S.length();z++){var O=S.getSection(z),R=S.getSectionIndex(z),B=S.getCharCode(z),F=O.scale,U=null,j=null,N=null,V=$p,G=0,Z=!(l===Fc.horizontal||!h&&!Ya(B)||h&&(Vc[B]||(et=B,ba(et)||wa(et)||ka(et)||Va(et)||Xa(et))));if(O.imageName){var q=r[O.imageName];if(!q)continue;N=O.imageName,t.iconsInText=t.iconsInText||!0,j=q.paddedRect;var X=q.displaySize;F=F*$p/p,U={width:X[0],height:X[1],left:1,top:-3,advance:Z?X[1]:X[0],localGlyph:!1},G=y?-U.height*F:E*$p-17-X[1]*F,V=U.advance;var W=(Z?X[0]:X[1])*F-$p*E;W>0&&W>L&&(L=W)}else{var H=i[O.fontStack];if(!H)continue;H[B]&&(j=H[B]);var Y=e[O.fontStack];if(!Y)continue;var K=Y.glyphs[B];if(!K)continue;if(U=K.metrics,V=8203!==B?$p:0,y){var J=void 0!==Y.ascender?Math.abs(Y.ascender):0,Q=void 0!==Y.descender?Math.abs(Y.descender):0,$=(J+Q)*F;C<$&&(C=$,D=(J-Q)/2*F),G=-J*F}else G=(E-F)*$p-17}Z?(t.verticalizable=!0,M.push({glyph:B,imageName:N,x:c,y:f+G,vertical:Z,scale:F,localGlyph:U.localGlyph,fontStack:O.fontStack,sectionIndex:R,metrics:U,rect:j}),c+=V*F+u):(M.push({glyph:B,imageName:N,x:c,y:f+G,vertical:Z,scale:F,localGlyph:U.localGlyph,fontStack:O.fontStack,sectionIndex:R,metrics:U,rect:j}),c+=U.advance*F+u)}0!==M.length&&(d=Math.max(c-u,d),y?Jc(M,m,L,D,n*E/2):Jc(M,m,L,0,n/2)),c=0;var tt=n*E+L;P.lineOffset=Math.max(L,A),f+=tt,++k}else f+=n,++k}var et,it=f,rt=Kc(a),ot=rt.horizontalAlign,nt=rt.verticalAlign;(function(t,e,i,r,o,n){for(var a=(e-i)*o,s=-n*r,l=0,u=t;l<u.length;l+=1)for(var h=0,p=u[l].positionedGlyphs;h<p.length;h+=1){var c=p[h];c.x+=a,c.y+=s}})(t.positionedLines,m,ot,nt,d,it),t.top+=-nt*it,t.bottom=t.top+it,t.left+=-ot*d,t.right=t.left+d,t.hasBaseline=y}(M,e,i,r,y,a,s,l,p,u,c,m),!function(t){for(var e=0,i=t;e<i.length;e+=1)if(0!==i[e].positionedGlyphs.length)return!1;return!0}(P)&&M}jc.fromFeature=function(t,e){for(var i=new jc,r=0;r<t.sections.length;r++){var o=t.sections[r];o.image?i.addImageSection(o):i.addTextSection(o,e)}return i},jc.prototype.length=function(){return this.text.length},jc.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},jc.prototype.getSections=function(){return this.sections},jc.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},jc.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},jc.prototype.verticalizePunctuation=function(t){this.text=function(t,e){for(var i="",r=0;r<t.length;r++){var o=t.charCodeAt(r+1)||null,n=t.charCodeAt(r-1)||null;i+=!e&&(o&&Ka(o)&&!ac[t[r+1]]||n&&Ka(n)&&!ac[t[r-1]])||!ac[t[r]]?t[r]:ac[t[r]]}return i}(this.text,t)},jc.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Vc[this.text.charCodeAt(e)];e++)t++;for(var i=this.text.length,r=this.text.length-1;r>=0&&r>=t&&Vc[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(t,i),this.sectionIndex=this.sectionIndex.slice(t,i)},jc.prototype.substring=function(t,e){var i=new jc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i},jc.prototype.toString=function(){return this.text},jc.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,i){return Math.max(e,t.sections[i].scale)}),0)},jc.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Uc.forText(t.scale,t.fontStack||e));for(var i=this.sections.length-1,r=0;r<t.text.length;++r)this.sectionIndex.push(i)},jc.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Uc.forImage(e)),this.sectionIndex.push(this.sections.length-1)):D("Reached maximum number of images 6401")}else D("Can't add FormattedSection with an empty image.")},jc.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Vc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Gc={};function Zc(t,e,i,r,o,n){if(e.imageName){var a=r[e.imageName];return a?a.displaySize[0]*e.scale*$p/n+o:0}var s=i[e.fontStack],l=s&&s.glyphs[t];return l?l.metrics.advance*e.scale+o:0}function qc(t,e,i,r){var o=Math.pow(t-e,2);return r?t<e?o/2:2*o:o+Math.abs(i)*i}function Xc(t,e,i){var r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function Wc(t,e,i,r,o,n){for(var a=null,s=qc(e,i,o,n),l=0,u=r;l<u.length;l+=1){var h=u[l],p=qc(e-h.x,i,o,n)+h.badness;p<=s&&(a=h,s=p)}return{index:t,x:e,priorBreak:a,badness:s}}function Hc(t){return t?Hc(t.priorBreak).concat(t.index):[]}function Yc(t,e,i,r,o,n,a){if("point"!==n)return[];if(!t)return[];for(var s,l=[],u=function(t,e,i,r,o,n){for(var a=0,s=0;s<t.length();s++){var l=t.getSection(s);a+=Zc(t.getCharCode(s),l,r,o,e,n)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,r,o,a),h=t.text.indexOf("​")>=0,p=0,c=0;c<t.length();c++){var f=t.getSection(c),d=t.getCharCode(c);if(Vc[d]||(p+=Zc(d,f,r,o,e,a)),c<t.length()-1){var m=!((s=d)<11904||!(La(s)||Ma(s)||Za(s)||Na(s)||Oa(s)||Ta(s)||Ca(s)||Ea(s)||Ra(s)||Ba(s)||za(s)||Wa(s)||Aa(s)||Sa(s)||Ia(s)||Da(s)||Pa(s)||Ga(s)||Ua(s)||Fa(s)));(Gc[d]||m||f.imageName)&&l.push(Wc(c+1,p,u,l,Xc(d,t.getCharCode(c+1),m&&h),!1))}}return Hc(Wc(t.length(),p,u,l,0,!0))}function Kc(t){var e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Jc(t,e,i,r,o){if(e||i||r||o)for(var n=t.length-1,a=t[n],s=(a.x+a.metrics.advance*a.scale)*e,l=0;l<=n;l++)t[l].x-=s,t[l].y+=i+r+o}function Qc(t,e,i,r,o,n){var a,s=t.image;if(s.content){var l=s.content,u=s.pixelRatio||1;a=[l[0]/u,l[1]/u,s.displaySize[0]-l[2]/u,s.displaySize[1]-l[3]/u]}var h,p,c,f,d=e.left*n,m=e.right*n;"width"===i||"both"===i?(f=o[0]+d-r[3],p=o[0]+m+r[1]):p=(f=o[0]+(d+m-s.displaySize[0])/2)+s.displaySize[0];var y=e.top*n,g=e.bottom*n;return"height"===i||"both"===i?(h=o[1]+y-r[0],c=o[1]+g+r[2]):c=(h=o[1]+(y+g-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:h,right:p,bottom:c,left:f,collisionPadding:a}}Gc[10]=!0,Gc[32]=!0,Gc[38]=!0,Gc[40]=!0,Gc[41]=!0,Gc[43]=!0,Gc[45]=!0,Gc[47]=!0,Gc[173]=!0,Gc[183]=!0,Gc[8203]=!0,Gc[8208]=!0,Gc[8211]=!0,Gc[8231]=!0;var $c=function(t){function e(e,i,r,o){t.call(this,e,i),this.angle=r,void 0!==o&&(this.segment=o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(r);function tf(t,e,i,r,o){if(void 0===e.segment)return!0;for(var n=e,a=e.segment+1,s=0;s>-i/2;){if(--a<0)return!1;s-=t[a].dist(n),n=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;s<i/2;){var h=t[a],p=t[a+1];if(!p)return!1;var c=t[a-1].angleTo(h)-h.angleTo(p);for(c=Math.abs((c+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:c}),u+=c;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>o)return!1;a++,s+=h.dist(p)}return!0}function ef(t){for(var e=0,i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function rf(t,e,i){return t?.6*e*i:0}function of(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function nf(t,e,i,r,o,n){for(var a=rf(i,o,n),s=of(i,r)*n,l=0,u=ef(t)/2,h=0;h<t.length-1;h++){var p=t[h],c=t[h+1],f=p.dist(c);if(l+f>u){var d=(u-l)/f,m=ki(p.x,c.x,d),y=ki(p.y,c.y,d),g=new $c(m,y,c.angleTo(p),h);return g._round(),!a||tf(t,g,s,a,e)?g:void 0}l+=f}}function af(t,e,i,r,o,n,a,s,l){var u=rf(r,n,a),h=of(r,o),p=h*a,c=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-p<e/4&&(e=p+e/4),sf(t,c?e/2*s%e:(h/2+2*n)*a*s%e,e,u,i,p,c,!1,l)}function sf(t,e,i,r,o,n,a,s,l){for(var u=n/2,h=ef(t),p=0,c=e-i,f=[],d=0;d<t.length-1;d++){for(var m=t[d],y=t[d+1],g=m.dist(y),_=y.angleTo(m);c+i<p+g;){var v=((c+=i)-p)/g,x=ki(m.x,y.x,v),b=ki(m.y,y.y,v);if(x>=0&&x<l&&b>=0&&b<l&&c-u>=0&&c+u<=h){var w=new $c(x,b,_,d);w._round(),r&&!tf(t,w,n,r,o)||f.push(w)}}p+=g}return s||f.length||a||(f=sf(t,p/2,i,r,o,n,a,!0,l)),f}function lf(t,e,i,o,n){for(var a=[],s=0;s<t.length;s++)for(var l=t[s],u=void 0,h=0;h<l.length-1;h++){var p=l[h],c=l[h+1];p.x<e&&c.x<e||(p.x<e?p=new r(e,p.y+(e-p.x)/(c.x-p.x)*(c.y-p.y))._round():c.x<e&&(c=new r(e,p.y+(e-p.x)/(c.x-p.x)*(c.y-p.y))._round()),p.y<i&&c.y<i||(p.y<i?p=new r(p.x+(i-p.y)/(c.y-p.y)*(c.x-p.x),i)._round():c.y<i&&(c=new r(p.x+(i-p.y)/(c.y-p.y)*(c.x-p.x),i)._round()),p.x>=o&&c.x>=o||(p.x>=o?p=new r(o,p.y+(o-p.x)/(c.x-p.x)*(c.y-p.y))._round():c.x>=o&&(c=new r(o,p.y+(o-p.x)/(c.x-p.x)*(c.y-p.y))._round()),p.y>=n&&c.y>=n||(p.y>=n?p=new r(p.x+(n-p.y)/(c.y-p.y)*(c.x-p.x),n)._round():c.y>=n&&(c=new r(p.x+(n-p.y)/(c.y-p.y)*(c.x-p.x),n)._round()),u&&p.equals(u[u.length-1])||a.push(u=[p]),u.push(c)))))}return a}da("Anchor",$c);var uf=cf,hf=cf,pf=1e20;function cf(t,e,i,r,o,n){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=o||"sans-serif",this.fontWeight=n||"normal",this.radius=i||8;var a=this.size=this.fontSize+2*this.buffer,s=a+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function ff(t,e,i,r,o,n){for(var a=0;a<e;a++)df(t,a,e,i,r,o,n);for(var s=0;s<i;s++)df(t,s*e,1,e,r,o,n)}function df(t,e,i,r,o,n,a){var s,l,u,h;for(n[0]=0,a[0]=-pf,a[1]=pf,s=0;s<r;s++)o[s]=t[e+s*i];for(s=1,l=0,u=0;s<r;s++){do{u=(o[s]-o[h=n[l]]+s*s-h*h)/(s-h)/2}while(u<=a[l]&&--l>-1);n[++l]=s,a[l]=u,a[l+1]=pf}for(s=0,l=0;s<r;s++){for(;a[l+1]<s;)l++;t[e+s*i]=o[h=n[l]]+(s-h)*(s-h)}}cf.prototype._draw=function(t,e){var i,r,o,n,a,s,l,u,h,p=this.ctx.measureText(t),c=p.width,f=2*this.buffer;e&&this.useMetrics?(a=Math.floor(p.actualBoundingBoxAscent),u=this.buffer+Math.ceil(p.actualBoundingBoxAscent),s=this.buffer,l=this.buffer,i=(r=Math.min(this.size,Math.ceil(p.actualBoundingBoxRight-p.actualBoundingBoxLeft)))+f,o=(n=Math.min(this.size-s,Math.ceil(p.actualBoundingBoxAscent+p.actualBoundingBoxDescent)))+f,this.ctx.textBaseline="alphabetic"):(i=r=this.size,o=n=this.size,a=19*this.fontSize/24,s=l=0,u=this.middle,this.ctx.textBaseline="middle"),r&&n&&(this.ctx.clearRect(l,s,r,n),this.ctx.fillText(t,this.buffer,u),h=this.ctx.getImageData(l,s,r,n));var d=new Uint8ClampedArray(i*o);return function(t,e,i,r,o,n,a){n.fill(pf,0,e*i),a.fill(0,0,e*i);for(var s=(e-r)/2,l=0;l<o;l++)for(var u=0;u<r;u++){var h=(l+s)*e+u+s,p=t.data[4*(l*r+u)+3]/255;if(1===p)n[h]=0,a[h]=pf;else if(0===p)n[h]=pf,a[h]=0;else{var c=Math.max(0,.5-p),f=Math.max(0,p-.5);n[h]=c*c,a[h]=f*f}}}(h,i,o,r,n,this.gridOuter,this.gridInner),ff(this.gridOuter,i,o,this.f,this.v,this.z),ff(this.gridInner,i,o,this.f,this.v,this.z),function(t,e,i,r,o,n,a){for(var s=0;s<e*i;s++){var l=Math.sqrt(r[s])-Math.sqrt(o[s]);t[s]=Math.round(255-255*(l/n+a))}}(d,i,o,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:d,metrics:{width:r,height:n,sdfWidth:i,sdfHeight:o,top:a,left:0,advance:c}}},cf.prototype.draw=function(t){return this._draw(t,!1).data},cf.prototype.drawWithMetrics=function(t){return this._draw(t,!0)},uf.default=hf;var mf={none:0,ideographs:1,all:2},yf=function(t,e,i){this.requestManager=t,this.localGlyphMode=e,this.localFontFamily=i,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}};function gf(t,e,i,o){var n=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,h=t.right-t.left,p=t.bottom-t.top,c=a.stretchX||[[0,l]],f=a.stretchY||[[0,u]],d=function(t,e){return t+e[1]-e[0]},m=c.reduce(d,0),y=f.reduce(d,0),g=l-m,_=u-y,v=0,x=m,b=0,w=y,k=0,T=g,I=0,S=_;if(a.content&&o){var E=a.content;v=_f(c,0,E[0]),b=_f(f,0,E[1]),x=_f(c,E[0],E[2]),w=_f(f,E[1],E[3]),k=E[0]-v,I=E[1]-b,T=E[2]-E[0]-x,S=E[3]-E[1]-w}var A=function(o,n,l,u){var c=xf(o.stretch-v,x,h,t.left),f=bf(o.fixed-k,T,o.stretch,m),d=xf(n.stretch-b,w,p,t.top),g=bf(n.fixed-I,S,n.stretch,y),_=xf(l.stretch-v,x,h,t.left),E=bf(l.fixed-k,T,l.stretch,m),A=xf(u.stretch-b,w,p,t.top),P=bf(u.fixed-I,S,u.stretch,y),M=new r(c,d),L=new r(_,d),C=new r(_,A),D=new r(c,A),z=new r(f/s,g/s),O=new r(E/s,P/s),R=e*Math.PI/180;if(R){var B=Math.sin(R),F=Math.cos(R),U=[F,-B,B,F];M._matMult(U),L._matMult(U),D._matMult(U),C._matMult(U)}var j=o.stretch+o.fixed,N=n.stretch+n.fixed;return{tl:M,tr:L,bl:D,br:C,tex:{x:a.paddedRect.x+1+j,y:a.paddedRect.y+1+N,w:l.stretch+l.fixed-j,h:u.stretch+u.fixed-N},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:O,minFontScaleX:T/s/h,minFontScaleY:S/s/p,isSDF:i}};if(o&&(a.stretchX||a.stretchY))for(var P=vf(c,g,m),M=vf(f,_,y),L=0;L<P.length-1;L++)for(var C=P[L],D=P[L+1],z=0;z<M.length-1;z++)n.push(A(C,M[z],D,M[z+1]));else n.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return n}function _f(t,e,i){for(var r=0,o=0,n=t;o<n.length;o+=1){var a=n[o];r+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]))}return r}function vf(t,e,i){for(var r=[{fixed:-1,stretch:0}],o=0,n=t;o<n.length;o+=1){var a=n[o],s=a[0],l=a[1],u=r[r.length-1];r.push({fixed:s-u.stretch,stretch:u.stretch}),r.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}return r.push({fixed:e+1,stretch:i}),r}function xf(t,e,i,r){return t/e*i+r}function bf(t,e,i,r){return t-e*i/r}function wf(t,e,i,r){var o=e+t.positionedLines[r].lineOffset;return 0===r?i+o/2:i+(o+(e+t.positionedLines[r-1].lineOffset))/2}yf.prototype.setURL=function(t){this.url=t},yf.prototype.getGlyphs=function(t,e){var i=this,r=[];for(var o in t)for(var n=0,a=t[o];n<a.length;n+=1)r.push({stack:o,id:a[n]});v(r,(function(t,e){var r=t.stack,o=t.id,n=i.entries[r];n||(n=i.entries[r]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});var a=n.glyphs[o];if(void 0===a){if(a=i._tinySDF(n,r,o))return n.glyphs[o]=a,void e(null,{stack:r,id:o,glyph:a});var s=Math.floor(o/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else if(n.ranges[s])e(null,{stack:r,id:o,glyph:a});else{var l=n.requests[s];l||(l=n.requests[s]=[],yf.loadGlyphRange(r,s,i.url,i.requestManager,(function(t,e){if(e){for(var r in n.ascender=e.ascender,n.descender=e.descender,e.glyphs)i._doesCharSupportLocalGlyph(+r)||(n.glyphs[+r]=e.glyphs[+r]);n.ranges[s]=!0}for(var o=0,a=l;o<a.length;o+=1)(0,a[o])(t,e);delete n.requests[s]}))),l.push((function(t,i){t?e(t):i&&e(null,{stack:r,id:o,glyph:i.glyphs[o]||null})}))}}else e(null,{stack:r,id:o,glyph:a})}),(function(t,r){if(t)e(t);else if(r){for(var o={},n=0,a=r;n<a.length;n+=1){var s=a[n],l=s.stack,u=s.id,h=s.glyph;void 0===o[l]&&(o[l]={}),void 0===o[l].glyphs&&(o[l].glyphs={}),o[l].glyphs[u]=h&&{id:h.id,bitmap:h.bitmap.clone(),metrics:h.metrics},o[l].ascender=i.entries[l].ascender,o[l].descender=i.entries[l].descender}e(null,o)}}))},yf.prototype._doesCharSupportLocalGlyph=function(t){return this.localGlyphMode!==mf.none&&(this.localGlyphMode===mf.all?!!this.localFontFamily:!!this.localFontFamily&&(Ba(t)||ja(t)||Aa(t)||Pa(t))||Ea(t))},yf.prototype._tinySDF=function(t,e,i){var r=this.localFontFamily;if(r&&this._doesCharSupportLocalGlyph(i)){var o=t.tinySDF;if(!o){var n="400";/bold/i.test(e)?n="900":/medium/i.test(e)?n="500":/light/i.test(e)&&(n="200"),o=t.tinySDF=new yf.TinySDF(48,6,16,.25,r,n)}if(this.localGlyphs[o.fontWeight][i])return this.localGlyphs[o.fontWeight][i];var a=o.drawWithMetrics(String.fromCharCode(i)),s=a.metrics,l=s.width,u=s.height,h=s.left,p=s.top,c=s.advance;return this.localGlyphs[o.fontWeight][i]={id:i,bitmap:new uh({width:s.sdfWidth,height:s.sdfHeight},a.data),metrics:{width:l/2,height:u/2,left:h/2,top:p/2-27,advance:c/2,localGlyph:!0}}}},yf.loadGlyphRange=function(t,e,i,r,o){var n=256*e,a=n+255,s=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",n+"-"+a),It.Glyphs);Lt(s,(function(t,e){if(t)o(t);else if(e){for(var i={},r=function(t){return new pc(t).readFields(Lc,{})}(e),n=0,a=r.glyphs;n<a.length;n+=1){var s=a[n];i[s.id]=s}o(null,{glyphs:i,ascender:r.ascender,descender:r.descender})}}))},yf.TinySDF=uf;var kf=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Tf),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};function Tf(t,e){return t<e?-1:t>e?1:0}function If(t,e,i){void 0===e&&(e=1),void 0===i&&(i=!1);for(var o=1/0,n=1/0,a=-1/0,s=-1/0,l=t[0],u=0;u<l.length;u++){var h=l[u];(!u||h.x<o)&&(o=h.x),(!u||h.y<n)&&(n=h.y),(!u||h.x>a)&&(a=h.x),(!u||h.y>s)&&(s=h.y)}var p=Math.min(a-o,s-n),c=p/2,f=new kf([],Sf);if(0===p)return new r(o,n);for(var d=o;d<a;d+=p)for(var m=n;m<s;m+=p)f.push(new Ef(d+c,m+c,c,t));var y=function(t){for(var e=0,i=0,r=0,o=t[0],n=0,a=o.length,s=a-1;n<a;s=n++){var l=o[n],u=o[s],h=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*h,r+=(l.y+u.y)*h,e+=3*h}return new Ef(i/e,r/e,0,t)}(t);for(f.length;f.length;){var g=f.pop();(g.d>y.d||!y.d)&&(y=g),g.max-y.d<=e||(f.push(new Ef(g.p.x-(c=g.h/2),g.p.y-c,c,t)),f.push(new Ef(g.p.x+c,g.p.y-c,c,t)),f.push(new Ef(g.p.x-c,g.p.y+c,c,t)),f.push(new Ef(g.p.x+c,g.p.y+c,c,t)),4)}return y.p}function Sf(t,e){return e.max-t.max}function Ef(t,e,i,o){this.p=new r(t,e),this.h=i,this.d=function(t,e){for(var i=!1,r=1/0,o=0;o<e.length;o++)for(var n=e[o],a=0,s=n.length,l=s-1;a<s;l=a++){var u=n[a],h=n[l];u.y>t.y!=h.y>t.y&&t.x<(h.x-u.x)*(t.y-u.y)/(h.y-u.y)+u.x&&(i=!i),r=Math.min(r,du(t,u,h))}return(i?1:-1)*Math.sqrt(r)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}kf.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},kf.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},kf.prototype.peek=function(){return this.data[0]},kf.prototype._up=function(t){for(var e=this.data,i=this.compare,r=e[t];t>0;){var o=t-1>>1,n=e[o];if(i(r,n)>=0)break;e[t]=n,t=o}e[t]=r},kf.prototype._down=function(t){for(var e=this.data,i=this.compare,r=this.length>>1,o=e[t];t<r;){var n=1+(t<<1),a=e[n],s=n+1;if(s<this.length&&i(e[s],a)<0&&(n=s,a=e[s]),i(a,o)>=0)break;e[t]=a,t=n}e[t]=o};var Af=Number.POSITIVE_INFINITY,Pf=Math.sqrt(2);function Mf(t,e){return e[1]!==Af?function(t,e,i){var r=0,o=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":o=i-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,o]}(t,e[0],e[1]):function(t,e){var i=0,r=0;e<0&&(e=0);var o=e/Pf;switch(t){case"top-right":case"top-left":r=o-7;break;case"bottom-right":case"bottom-left":r=7-o;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-o;break;case"top-left":case"bottom-left":i=o;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function Lf(t,e,i,r,o,n,a,s){t.createArrays(),t.tilePixelRatio=tu/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var l=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,h={};if("composite"===t.textSizeData.kind){var p=t.textSizeData,f=p.maxZoom;h.compositeTextSizes=[u["text-size"].possiblyEvaluate(new cs(p.minZoom),a),u["text-size"].possiblyEvaluate(new cs(f),a)]}if("composite"===t.iconSizeData.kind){var d=t.iconSizeData,m=d.maxZoom;h.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new cs(d.minZoom),a),u["icon-size"].possiblyEvaluate(new cs(m),a)]}h.layoutTextSize=u["text-size"].possiblyEvaluate(new cs(s+1),a),h.layoutIconSize=u["icon-size"].possiblyEvaluate(new cs(s+1),a),h.textMaxSize=u["text-size"].possiblyEvaluate(new cs(18),a);for(var y="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),g=l.get("text-keep-upright"),_=l.get("text-size"),v=function(){var n=b[x],s=l.get("text-font").evaluate(n,{},a).join(","),u=_.evaluate(n,{},a),p=h.layoutTextSize.evaluate(n,{},a),f=(h.layoutIconSize.evaluate(n,{},a),{horizontal:{},vertical:void 0}),d=n.text,m=[0,0];if(d){var v=d.toString(),w=l.get("text-letter-spacing").evaluate(n,{},a)*$p,k=l.get("text-line-height").evaluate(n,{},a)*$p,T=function(t){for(var e=0,i=t;e<i.length;e+=1)if(r=i[e].charCodeAt(0),ba(r)||wa(r)||ka(r)||Va(r)||Xa(r))return!1;var r;return!0}(v)?w:0,I=l.get("text-anchor").evaluate(n,{},a),S=l.get("text-variable-anchor");if(!S){var E=l.get("text-radial-offset").evaluate(n,{},a);m=E?Mf(I,[E*$p,Af]):l.get("text-offset").evaluate(n,{},a).map((function(t){return t*$p}))}var A=y?"center":l.get("text-justify").evaluate(n,{},a),P=l.get("symbol-placement"),M="point"===P?l.get("text-max-width").evaluate(n,{},a)*$p:0,L=function(){t.allowVerticalPlacement&&Ha(v)&&(f.vertical=Nc(d,e,i,o,s,M,k,I,"left",T,m,Fc.vertical,!0,P,p,u))};if(!y&&S){for(var C="auto"===A?S.map((function(t){return Cf(t)})):[A],z=!1,O=0;O<C.length;O++){var R=C[O];if(!f.horizontal[R])if(z)f.horizontal[R]=f.horizontal[0];else{var B=Nc(d,e,i,o,s,M,k,"center",R,T,m,Fc.horizontal,!1,P,p,u);B&&(f.horizontal[R]=B,z=1===B.positionedLines.length)}}L()}else{"auto"===A&&(A=Cf(I));var F=Nc(d,e,i,o,s,M,k,I,A,T,m,Fc.horizontal,!1,P,p,u);F&&(f.horizontal[A]=F),L(),Ha(v)&&y&&g&&(f.vertical=Nc(d,e,i,o,s,M,k,I,A,T,m,Fc.vertical,!1,P,p,u))}}var U=void 0,j=!1;if(n.icon&&n.icon.name){var N=r[n.icon.name];N&&(U=function(t,e,i){var r=Kc(i),o=e[0]-t.displaySize[0]*r.horizontalAlign,n=e[1]-t.displaySize[1]*r.verticalAlign;return{image:t,top:n,bottom:n+t.displaySize[1],left:o,right:o+t.displaySize[0]}}(o[n.icon.name],l.get("icon-offset").evaluate(n,{},a),l.get("icon-anchor").evaluate(n,{},a)),j=N.sdf,void 0===t.sdfIcons?t.sdfIcons=N.sdf:t.sdfIcons!==N.sdf&&D("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(N.pixelRatio!==t.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var V=Rf(f.horizontal)||f.vertical;t.iconsInText||(t.iconsInText=!!V&&V.iconsInText),(V||U)&&function(t,e,i,r,o,n,a,s,l,u,h){var p=n.textMaxSize.evaluate(e,{},h);void 0===p&&(p=a);var f,d=t.layers[0].layout,m=d.get("icon-offset").evaluate(e,{},h),y=Rf(i.horizontal),g=a/24,_=t.tilePixelRatio*p/24,v=t.tilePixelRatio*d.get("symbol-spacing"),x=d.get("text-padding")*t.tilePixelRatio,b=d.get("icon-padding")*t.tilePixelRatio,w=c(d.get("text-max-angle")),k="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),T="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),S=v/2,E=d.get("icon-text-fit");r&&"none"!==E&&(t.allowVerticalPlacement&&i.vertical&&(f=Qc(r,i.vertical,E,d.get("icon-text-fit-padding"),m,g)),y&&(r=Qc(r,y,E,d.get("icon-text-fit-padding"),m,g)));var A=function(s,p){p.x<0||p.x>=tu||p.y<0||p.y>=tu||function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,k){var T,I,S,E,A,P,M,L,C=t.addToLineVertexArray(e,i),z=0,O=0,R=0,B=0,F=-1,U=-1,j={},N=xl(""),V=0,G=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(V=(T=s.layout.get("text-offset").evaluate(v,{},w).map((function(t){return t*$p})))[0],G=T[1]):(V=s.layout.get("text-radial-offset").evaluate(v,{},w)*$p,G=Af),t.allowVerticalPlacement&&r.vertical){var Z=r.vertical;if(f)M=Ff(Z),a&&(L=Ff(a));else{var q=s.layout.get("text-rotate").evaluate(v,{},w)+90;E=Bf(l,e,u,h,p,Z,c,q,d),a&&(A=Bf(l,e,u,h,p,a,y,q))}}if(o){var X=s.layout.get("icon-rotate").evaluate(v,{},w),W="none"!==s.layout.get("icon-text-fit"),H=gf(o,X,b,W),Y=a?gf(a,X,b,W):void 0;S=Bf(l,e,u,h,p,o,y,X),z=4*H.length;var K=t.iconSizeData,J=null;"source"===K.kind?(J=[tc*s.layout.get("icon-size").evaluate(v,{},w)])[0]>zf&&D(t.layerIds[0]+': Value for "icon-size" is >= '+Df+'. Reduce your "icon-size".'):"composite"===K.kind&&((J=[tc*x.compositeIconSizes[0].evaluate(v,{},w),tc*x.compositeIconSizes[1].evaluate(v,{},w)])[0]>zf||J[1]>zf)&&D(t.layerIds[0]+': Value for "icon-size" is >= '+Df+'. Reduce your "icon-size".'),t.addSymbols(t.icon,H,J,_,g,v,!1,e,C.lineStartIndex,C.lineLength,-1,w),F=t.icon.placedSymbolArray.length-1,Y&&(O=4*Y.length,t.addSymbols(t.icon,Y,J,_,g,v,Fc.vertical,e,C.lineStartIndex,C.lineLength,-1,w),U=t.icon.placedSymbolArray.length-1)}for(var Q in r.horizontal){var $=r.horizontal[Q];I||(N=xl($.text),f?P=Ff($):I=Bf(l,e,u,h,p,$,c,s.layout.get("text-rotate").evaluate(v,{},w),d));var tt=1===$.positionedLines.length;if(R+=Of(t,e,$,n,s,f,v,d,C,r.vertical?Fc.horizontal:Fc.horizontalOnly,tt?Object.keys(r.horizontal):[Q],j,F,x,w),tt)break}r.vertical&&(B+=Of(t,e,r.vertical,n,s,f,v,d,C,Fc.vertical,["vertical"],j,U,x,w));var et=-1,it=function(t,e){return t?Math.max(t,e):e};et=it(P,et),et=it(M,et);var rt=(et=it(L,et))>-1?1:0;rt&&(et*=k/$p),t.glyphOffsetArray.length>=Wf.MAX_GLYPHS&&D("Too many glyphs being rendered in a tile"),void 0!==v.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical||-1,F,U,N,void 0!==I?I:t.collisionBoxArray.length,void 0!==I?I+1:t.collisionBoxArray.length,void 0!==E?E:t.collisionBoxArray.length,void 0!==E?E+1:t.collisionBoxArray.length,void 0!==S?S:t.collisionBoxArray.length,void 0!==S?S+1:t.collisionBoxArray.length,A||t.collisionBoxArray.length,A?A+1:t.collisionBoxArray.length,u,R,B,z,O,rt,0,V,G,et)}(t,p,s,i,r,o,f,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,k,l,0,b,T,m,e,n,u,h,a)};if("line"===I)for(var P=0,M=lf(e.geometry,0,0,tu,tu);P<M.length;P+=1)for(var L=M[P],C=0,z=af(L,v,w,i.vertical||y,r,24,_,t.overscaling,tu);C<z.length;C+=1){var O=z[C];y&&Uf(t,y.text,S,O)||A(L,O)}else if("line-center"===I)for(var R=0,B=e.geometry;R<B.length;R+=1){var F=B[R];if(F.length>1){var U=nf(F,w,i.vertical||y,r,24,_);U&&A(F,U)}}else if("Polygon"===e.type)for(var j=0,N=Yh(e.geometry,0);j<N.length;j+=1){var V=N[j],G=If(V,16);A(V[0],new $c(G.x,G.y,0))}else if("LineString"===e.type)for(var Z=0,q=e.geometry;Z<q.length;Z+=1){var X=q[Z];A(X,new $c(X[0].x,X[0].y,0))}else if("Point"===e.type)for(var W=0,H=e.geometry;W<H.length;W+=1)for(var Y=0,K=H[W];Y<K.length;Y+=1){var J=K[Y];A([J],new $c(J.x,J.y,0))}}(t,n,f,U,r,h,p,0,m,j,a)},x=0,b=t.features;x<b.length;x+=1)v();n&&t.generateCollisionDebugBuffers(s,t.collisionBoxArray)}function Cf(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var Df=255,zf=Df*tc;function Of(t,e,i,o,n,a,s,l,u,h,p,c,f,d,m){var y=function(t,e,i,o,n,a,s,l){var u=[];if(0===e.positionedLines.length)return u;for(var h=o.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,p=function(t){var e=t[0],i=t[1],r=e*i;return r>0?[e,-i]:r<0?[-e,i]:0===e?[i,e]:[i,-e]}(i),c=Math.abs(e.top-e.bottom),f=0,d=e.positionedLines;f<d.length;f+=1)c-=d[f].lineOffset;for(var m=e.positionedLines.length,y=c/m,g=e.top-i[1],_=0;_<m;++_){var v=e.positionedLines[_];g=wf(e,y,g,_);for(var x=0,b=v.positionedGlyphs;x<b.length;x+=1){var w=b[x];if(w.rect){var k=w.rect||{},T=4,I=!0,S=1,E=0,A=(n||l)&&w.vertical,P=w.metrics.advance*w.scale/2,M=w.metrics,L=w.rect;if(null!==L){if(l&&e.verticalizable&&(E=w.imageName?P-w.metrics.width*w.scale/2:0),w.imageName){var C=s[w.imageName];if(!C)continue;I=C.sdf,T=1/(S=C.pixelRatio)}var D=n?[w.x+P,w.y]:[0,0],z=[0,0],O=[0,0],R=!1;n||(A?(O=[w.x+P+p[0],w.y+p[1]-E],R=!0):z=[w.x+P+i[0],w.y+i[1]-E]);var B,F=L.w*w.scale/(S*(w.localGlyph?2:1)),U=L.h*w.scale/(S*(w.localGlyph?2:1)),j=void 0,N=void 0,V=void 0,G=void 0;if(A){var Z=w.y-g,q=new r(-P,P-Z),X=-Math.PI/2,W=new(Function.prototype.bind.apply(r,[null].concat(O)));(j=new r(-P+z[0],z[1]))._rotateAround(X,q)._add(W),j.x+=-Z+P,j.y-=(M.left-T)*w.scale;var H=w.imageName?M.advance*w.scale:$p*w.scale,Y=String.fromCharCode(w.glyph);sc(Y)?j.x+=(1-T)*w.scale:lc(Y)?j.x+=H-M.height*w.scale+(-T-1)*w.scale:j.x+=w.imageName||M.width+2*T===L.w&&M.height+2*T===L.h?(H-U)/2:(H-(M.height+2*T)*w.scale)/2,N=new r(j.x,j.y-F),V=new r(j.x+U,j.y),G=new r(j.x+U,j.y-F)}else{var K=(M.left-T)*w.scale-P+z[0],J=(-M.top-T)*w.scale+z[1],Q=K+F,$=J+U;j=new r(K,J),N=new r(Q,J),V=new r(K,$),G=new r(Q,$)}h&&(B=n?new r(0,0):R?new r(p[0],p[1]):new r(i[0],i[1]),j._rotateAround(h,B),N._rotateAround(h,B),V._rotateAround(h,B),G._rotateAround(h,B));var tt=new r(0,0),et=new r(0,0);u.push({tl:j,tr:N,bl:V,br:G,tex:k,writingMode:e.writingMode,glyphOffset:D,sectionIndex:w.sectionIndex,isSDF:I,pixelOffsetTL:tt,pixelOffsetBR:et,minFontScaleX:0,minFontScaleY:0})}}}}return u}(0,i,l,n,a,s,o,t.allowVerticalPlacement),g=t.textSizeData,_=null;"source"===g.kind?(_=[tc*n.layout.get("text-size").evaluate(s,{},m)])[0]>zf&&D(t.layerIds[0]+': Value for "text-size" is >= '+Df+'. Reduce your "text-size".'):"composite"===g.kind&&((_=[tc*d.compositeTextSizes[0].evaluate(s,{},m),tc*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>zf||_[1]>zf)&&D(t.layerIds[0]+': Value for "text-size" is >= '+Df+'. Reduce your "text-size".'),t.addSymbols(t.text,y,_,l,a,s,h,e,u.lineStartIndex,u.lineLength,f,m);for(var v=0,x=p;v<x.length;v+=1)c[x[v]]=t.text.placedSymbolArray.length-1;return 4*y.length}function Rf(t){for(var e in t)return t[e];return null}function Bf(t,e,i,o,n,a,s,l,u){var h=a.top,p=a.bottom,f=a.left,d=a.right,m=a.collisionPadding;if(m&&(f-=m[0],h-=m[1],d+=m[2],p+=m[3]),l){var y=new r(f,h),g=new r(d,h),_=new r(f,p),v=new r(d,p),x=c(l),b=new r(0,0);u&&(b=new r(u[0],u[1])),y._rotateAround(x,b),g._rotateAround(x,b),_._rotateAround(x,b),v._rotateAround(x,b),f=Math.min(y.x,g.x,_.x,v.x),d=Math.max(y.x,g.x,_.x,v.x),h=Math.min(y.y,g.y,_.y,v.y),p=Math.max(y.y,g.y,_.y,v.y)}return t.emplaceBack(e.x,e.y,f,h,d,p,s,i,o,n),t.length-1}function Ff(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);var e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Uf(t,e,i,r){var o=t.compareText;if(e in o){for(var n=o[e],a=n.length-1;a>=0;a--)if(r.dist(n[a])<i)return!0}else o[e]=[];return o[e].push(r),!1}var jf=bp.VectorTileFeature.types,Nf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Vf(t,e,i,r,o,n,a,s,l,u,h,p,c){var f=s?Math.min(zf,Math.round(s[0])):0,d=s?Math.min(zf,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*o),n,a,(f<<1)+(l?1:0),d,16*u,16*h,256*p,256*c)}function Gf(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Zf(t){for(var e=0,i=t.sections;e<i.length;e+=1)if($a(i[e].text))return!0;return!1}var qf=function(t){this.layoutVertexArray=new Vs,this.indexArray=new Ys,this.programConfigurations=t,this.segments=new $l,this.dynamicLayoutVertexArray=new Gs,this.opacityVertexArray=new Zs,this.placedSymbolArray=new sl};qf.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},qf.prototype.upload=function(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wp.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Hp.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Nf,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))},qf.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},da("SymbolBuffers",qf);var Xf=function(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new $l,this.collisionVertexArray=new Hs,this.collisionVertexArrayExt=new Gs};Xf.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Yp.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Kp.members,!0)},Xf.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())},da("CollisionBuffers",Xf);var Wf=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Eu([]),this.placementViewportMatrix=Eu([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ec(this.zoom,e["text-size"]),this.iconSizeData=ec(this.zoom,e["icon-size"]);var i=this.layers[0].layout,r=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map((function(t){return Fc[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};Wf.prototype.createArrays=function(){this.text=new qf(new Zl(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new qf(new Zl(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new hl,this.lineVertexArray=new pl,this.symbolInstances=new ul},Wf.prototype.calculateGlyphDependencies=function(t,e,i,r,o){for(var n=0;n<t.length;n++)if(e[t.charCodeAt(n)]=!0,(i||r)&&o){var a=ac[t.charAt(n)];a&&(e[a.charCodeAt(0)]=!0)}},Wf.prototype.populate=function(t,e,i){var r=this.layers[0],o=r.layout,n=o.get("text-font"),a=o.get("text-field"),s=o.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof xe&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==n.value.kind||n.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],l||u){for(var p=e.iconDependencies,c=e.glyphDependencies,f=e.availableImages,d=new cs(this.zoom),m=0,y=t;m<y.length;m+=1){var g=y[m],_=g.feature,v=g.id,x=g.index,b=g.sourceLayerIndex,w=r._featureFilter.needGeometry,k=ou(_,w);if(r._featureFilter.filter(d,k,i)){w||(k.geometry=ru(_));var T=void 0;if(l){var I=r.getValueAndResolveTokens("text-field",k,i,f),S=xe.factory(I);Zf(S)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===us()||this.hasRTLText&&ps.isParsed())&&(T=nc(S,r,k))}var E=void 0;if(u){var A=r.getValueAndResolveTokens("icon-image",k,i,f);E=A instanceof we?A:we.fromString(A)}if(T||E){var P=this.sortFeaturesByKey?h.evaluate(k,{},i):void 0;if(this.features.push({id:v,text:T,icon:E,index:x,sourceLayerIndex:b,geometry:k.geometry,properties:_.properties,type:jf[_.type],sortKey:P}),E&&(p[E.name]=!0),T){var M=n.evaluate(k,{},i).join(","),L="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Fc.vertical)>=0;for(var C=0,D=T.sections;C<D.length;C+=1){var z=D[C];if(z.image)p[z.image.name]=!0;else{var O=Ha(T.toString()),R=z.fontStack||M,B=c[R]=c[R]||{};this.calculateGlyphDependencies(z.text,B,L,this.allowVerticalPlacement,O)}}}}}}"line"===o.get("symbol-placement")&&(this.features=function(t){var e={},i={},r=[],o=0;function n(e){r.push(t[e]),o++}function a(t,e,o){var n=i[t];return delete i[t],i[e]=n,r[n].geometry[0].pop(),r[n].geometry[0]=r[n].geometry[0].concat(o[0]),n}function s(t,i,o){var n=e[i];return delete e[i],e[t]=n,r[n].geometry[0].shift(),r[n].geometry[0]=o[0].concat(r[n].geometry[0]),n}function l(t,e,i){var r=i?e[0][e[0].length-1]:e[0][0];return t+":"+r.x+":"+r.y}for(var u=0;u<t.length;u++){var h=t[u],p=h.geometry,c=h.text?h.text.toString():null;if(c){var f=l(c,p),d=l(c,p,!0);if(f in i&&d in e&&i[f]!==e[d]){var m=s(f,d,p),y=a(f,d,r[m].geometry);delete e[f],delete i[d],i[l(c,r[y].geometry,!0)]=y,r[m].geometry=null}else f in i?a(f,d,p):d in e?s(f,d,p):(n(u),e[f]=o-1,i[d]=o-1)}else n(u)}return r.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},Wf.prototype.update=function(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))},Wf.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},Wf.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},Wf.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},Wf.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},Wf.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},Wf.prototype.addToLineVertexArray=function(t,e){var i=this.lineVertexArray.length;if(void 0!==t.segment){for(var r=t.dist(e[t.segment+1]),o=t.dist(e[t.segment]),n={},a=t.segment+1;a<e.length;a++)n[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:r},a<e.length-1&&(r+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)n[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=e[s-1].dist(e[s]));for(var l=0;l<e.length;l++){var u=n[l];this.lineVertexArray.emplaceBack(u.x,u.y,u.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}},Wf.prototype.addSymbols=function(t,e,i,r,o,n,a,s,l,u,h,p){for(var c=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,c,this.canOverlap?n.sortKey:void 0),m=this.glyphOffsetArray.length,y=d.vertexLength,g=this.allowVerticalPlacement&&a===Fc.vertical?Math.PI/2:0,_=n.text&&n.text.sections,v=0;v<e.length;v++){var x=e[v],b=x.tl,w=x.tr,k=x.bl,T=x.br,I=x.tex,S=x.pixelOffsetTL,E=x.pixelOffsetBR,A=x.minFontScaleX,P=x.minFontScaleY,M=x.glyphOffset,L=x.isSDF,C=x.sectionIndex,D=d.vertexLength,z=M[1];Vf(f,s.x,s.y,b.x,z+b.y,I.x,I.y,i,L,S.x,S.y,A,P),Vf(f,s.x,s.y,w.x,z+w.y,I.x+I.w,I.y,i,L,E.x,S.y,A,P),Vf(f,s.x,s.y,k.x,z+k.y,I.x,I.y+I.h,i,L,S.x,E.y,A,P),Vf(f,s.x,s.y,T.x,z+T.y,I.x+I.w,I.y+I.h,i,L,E.x,E.y,A,P),Gf(t.dynamicLayoutVertexArray,s,g),c.emplaceBack(D,D+1,D+2),c.emplaceBack(D+1,D+2,D+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),v!==e.length-1&&C===e[v+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,n,n.index,{},p,_&&_[C])}t.placedSymbolArray.emplaceBack(s.x,s.y,m,this.glyphOffsetArray.length-m,y,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],a,0,!1,0,h,0)},Wf.prototype._commitLayoutVertex=function(t,e,i,r,o){t.emplaceBack(e.x,e.y,i,r,Math.round(o.x),Math.round(o.y))},Wf.prototype._addCollisionDebugVertices=function(t,e,i,o,n){for(var a=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),s=a.vertexLength,l=n.anchorX,u=n.anchorY,h=0;h<4;h++)i.collisionVertexArray.emplaceBack(0,0,0,0);i.collisionVertexArrayExt.emplaceBack(e,-t.padding,-t.padding),i.collisionVertexArrayExt.emplaceBack(e,t.padding,-t.padding),i.collisionVertexArrayExt.emplaceBack(e,t.padding,t.padding),i.collisionVertexArrayExt.emplaceBack(e,-t.padding,t.padding),this._commitLayoutVertex(i.layoutVertexArray,o,l,u,new r(t.x1,t.y1)),this._commitLayoutVertex(i.layoutVertexArray,o,l,u,new r(t.x2,t.y1)),this._commitLayoutVertex(i.layoutVertexArray,o,l,u,new r(t.x2,t.y2)),this._commitLayoutVertex(i.layoutVertexArray,o,l,u,new r(t.x1,t.y2)),a.vertexLength+=4;var p=i.indexArray;p.emplaceBack(s,s+1),p.emplaceBack(s+1,s+2),p.emplaceBack(s+2,s+3),p.emplaceBack(s+3,s),a.primitiveLength+=4},Wf.prototype._addTextDebugCollisionBoxes=function(t,e,i,r,o,n){for(var a=r;a<o;a++){var s=i.get(a),l=this.getSymbolInstanceTextSize(t,n,e,a);this._addCollisionDebugVertices(s,l,this.textCollisionBox,s.anchorPoint,n)}},Wf.prototype._addIconDebugCollisionBoxes=function(t,e,i,r,o,n){for(var a=r;a<o;a++){var s=i.get(a),l=this.getSymbolInstanceIconSize(t,e,a);this._addCollisionDebugVertices(s,l,this.iconCollisionBox,s.anchorPoint,n)}},Wf.prototype.generateCollisionDebugBuffers=function(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Xf(Xs,Jp.members,el),this.iconCollisionBox=new Xf(Xs,Jp.members,el);for(var i=rc(this.iconSizeData,t),r=rc(this.textSizeData,t),o=0;o<this.symbolInstances.length;o++){var n=this.symbolInstances.get(o);this._addTextDebugCollisionBoxes(r,t,e,n.textBoxStartIndex,n.textBoxEndIndex,n),this._addTextDebugCollisionBoxes(r,t,e,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n),this._addIconDebugCollisionBoxes(i,t,e,n.iconBoxStartIndex,n.iconBoxEndIndex,n),this._addIconDebugCollisionBoxes(i,t,e,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n)}},Wf.prototype.getSymbolInstanceTextSize=function(t,e,i,r){var o=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:r),n=ic(this.textSizeData,t,o)/$p;return this.tilePixelRatio*n},Wf.prototype.getSymbolInstanceIconSize=function(t,e,i){var r=this.icon.placedSymbolArray.get(i),o=ic(this.iconSizeData,t,r);return this.tilePixelRatio*o},Wf.prototype._commitDebugCollisionVertexUpdate=function(t,e,i){t.emplaceBack(e,-i,-i),t.emplaceBack(e,i,-i),t.emplaceBack(e,i,i),t.emplaceBack(e,-i,i)},Wf.prototype._updateTextDebugCollisionBoxes=function(t,e,i,r,o,n){for(var a=r;a<o;a++){var s=i.get(a),l=this.getSymbolInstanceTextSize(t,n,e,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,l,s.padding)}},Wf.prototype._updateIconDebugCollisionBoxes=function(t,e,i,r,o){for(var n=r;n<o;n++){var a=i.get(n),s=this.getSymbolInstanceIconSize(t,e,n);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,s,a.padding)}},Wf.prototype.updateCollisionDebugBuffers=function(t,e){if(this.hasDebugData()){this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();for(var i=rc(this.iconSizeData,t),r=rc(this.textSizeData,t),o=0;o<this.symbolInstances.length;o++){var n=this.symbolInstances.get(o);this._updateTextDebugCollisionBoxes(r,t,e,n.textBoxStartIndex,n.textBoxEndIndex,n),this._updateTextDebugCollisionBoxes(r,t,e,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n),this._updateIconDebugCollisionBoxes(i,t,e,n.iconBoxStartIndex,n.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(i,t,e,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}},Wf.prototype._deserializeCollisionBoxesForSymbol=function(t,e,i,r,o,n,a,s,l){for(var u={},h=e;h<i;h++){var p=t.get(h);u.textBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,padding:p.padding,anchorPointX:p.anchorPointX,anchorPointY:p.anchorPointY},u.textFeatureIndex=p.featureIndex;break}for(var c=r;c<o;c++){var f=t.get(c);u.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,padding:f.padding,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},u.verticalTextFeatureIndex=f.featureIndex;break}for(var d=n;d<a;d++){var m=t.get(d);u.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,padding:m.padding,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},u.iconFeatureIndex=m.featureIndex;break}for(var y=s;y<l;y++){var g=t.get(y);u.verticalIconBox={x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,padding:g.padding,anchorPointX:g.anchorPointX,anchorPointY:g.anchorPointY},u.verticalIconFeatureIndex=g.featureIndex;break}return u},Wf.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}},Wf.prototype.hasTextData=function(){return this.text.segments.get().length>0},Wf.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Wf.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},Wf.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},Wf.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},Wf.prototype.addIndicesForPlacedSymbol=function(t,e){for(var i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs,o=i.vertexStartIndex;o<r;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)},Wf.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var e=Math.sin(t),i=Math.cos(t),r=[],o=[],n=[],a=0;a<this.symbolInstances.length;++a){n.push(a);var s=this.symbolInstances.get(a);r.push(0|Math.round(e*s.anchorX+i*s.anchorY)),o.push(s.featureIndex)}return n.sort((function(t,e){return r[t]-r[e]||o[e]-o[t]})),n},Wf.prototype.addToSortKeyRanges=function(t,e){var i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},Wf.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var i=0,r=this.symbolInstanceIndexes;i<r.length;i+=1){var o=this.symbolInstances.get(r[i]);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t,i,r){t>=0&&r.indexOf(t)===i&&e.addIndicesForPlacedSymbol(e.text,t)})),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},da("SymbolBucket",Wf,{omit:["layers","collisionBoxArray","features","compareText"]}),Wf.MAX_GLYPHS=65535,Wf.addDynamicAttributes=Gf;var Hf=new Ss({"symbol-placement":new bs(Nt.layout_symbol["symbol-placement"]),"symbol-spacing":new bs(Nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new bs(Nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ws(Nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new bs(Nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new bs(Nt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new bs(Nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new bs(Nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new bs(Nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ws(Nt.layout_symbol["icon-size"]),"icon-text-fit":new bs(Nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new bs(Nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ws(Nt.layout_symbol["icon-image"]),"icon-rotate":new ws(Nt.layout_symbol["icon-rotate"]),"icon-padding":new bs(Nt.layout_symbol["icon-padding"]),"icon-keep-upright":new bs(Nt.layout_symbol["icon-keep-upright"]),"icon-offset":new ws(Nt.layout_symbol["icon-offset"]),"icon-anchor":new ws(Nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new bs(Nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new bs(Nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new bs(Nt.layout_symbol["text-rotation-alignment"]),"text-field":new ws(Nt.layout_symbol["text-field"]),"text-font":new ws(Nt.layout_symbol["text-font"]),"text-size":new ws(Nt.layout_symbol["text-size"]),"text-max-width":new ws(Nt.layout_symbol["text-max-width"]),"text-line-height":new ws(Nt.layout_symbol["text-line-height"]),"text-letter-spacing":new ws(Nt.layout_symbol["text-letter-spacing"]),"text-justify":new ws(Nt.layout_symbol["text-justify"]),"text-radial-offset":new ws(Nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new bs(Nt.layout_symbol["text-variable-anchor"]),"text-anchor":new ws(Nt.layout_symbol["text-anchor"]),"text-max-angle":new bs(Nt.layout_symbol["text-max-angle"]),"text-writing-mode":new bs(Nt.layout_symbol["text-writing-mode"]),"text-rotate":new ws(Nt.layout_symbol["text-rotate"]),"text-padding":new bs(Nt.layout_symbol["text-padding"]),"text-keep-upright":new bs(Nt.layout_symbol["text-keep-upright"]),"text-transform":new ws(Nt.layout_symbol["text-transform"]),"text-offset":new ws(Nt.layout_symbol["text-offset"]),"text-allow-overlap":new bs(Nt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new bs(Nt.layout_symbol["text-ignore-placement"]),"text-optional":new bs(Nt.layout_symbol["text-optional"])}),Yf={paint:new Ss({"icon-opacity":new ws(Nt.paint_symbol["icon-opacity"]),"icon-color":new ws(Nt.paint_symbol["icon-color"]),"icon-halo-color":new ws(Nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ws(Nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ws(Nt.paint_symbol["icon-halo-blur"]),"icon-translate":new bs(Nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new bs(Nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ws(Nt.paint_symbol["text-opacity"]),"text-color":new ws(Nt.paint_symbol["text-color"],{runtimeType:te,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new ws(Nt.paint_symbol["text-halo-color"]),"text-halo-width":new ws(Nt.paint_symbol["text-halo-width"]),"text-halo-blur":new ws(Nt.paint_symbol["text-halo-blur"]),"text-translate":new bs(Nt.paint_symbol["text-translate"]),"text-translate-anchor":new bs(Nt.paint_symbol["text-translate-anchor"])}),layout:Hf},Kf=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Kt,this.defaultValue=t};Kf.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},Kf.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Kf.prototype.outputDefined=function(){return!1},Kf.prototype.serialize=function(){return null},da("FormatSectionOverride",Kf,{omit:["defaultValue"]});var Jf=function(t){function e(e){t.call(this,e,Yf)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,i){if(t.prototype.recalculate.call(this,e,i),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var r=this.layout.get("text-writing-mode");if(r){for(var o=[],n=0,a=r;n<a.length;n+=1){var s=a[n];o.indexOf(s)<0&&o.push(s)}this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(t,e,i,r){var o=this.layout.get(t).evaluate(e,{},i,r),n=this._unevaluatedLayout._values[t];return n.isDataDriven()||Nr(n.value)||!o?o:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,i){return i in t?String(t[i]):""}))}(e.properties,o)},e.prototype.createBucket=function(t){return new Wf(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,i=Yf.paint.overridableProperties;t<i.length;t+=1){var r=i[t];if(e.hasPaintOverride(this.layout,r)){var o,n=this.paint.get(r),a=new Kf(n),s=new jr(a,n.property.specification);o="constant"===n.value.kind||"source"===n.value.kind?new Gr("source",s):new Zr("composite",s,n.value.zoomStops,n.value._interpolationType),this.paint._values[r]=new vs(n.property,o,n.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var i=t.get("text-field"),r=Yf.paint.properties[e],o=!1,n=function(t){for(var e=0,i=t;e<i.length;e+=1)if(r.overrides&&r.overrides.hasOverride(i[e]))return void(o=!0)};if("constant"===i.value.kind&&i.value.value instanceof xe)n(i.value.value.sections);else if("source"===i.value.kind){var a=function(t){o||(t instanceof Ae&&Ie(t.value)===oe?n(t.value.sections):t instanceof Oe?n(t.sections):t.eachChild(a))},s=i.value;s._styleExpression&&a(s._styleExpression.expression)}return o},e.prototype.getProgramConfiguration=function(t){return new Gl(this,t)},e}(Jl),Qf={paint:new Ss({"background-color":new bs(Nt.paint_background["background-color"]),"background-pattern":new Ts(Nt.paint_background["background-pattern"]),"background-opacity":new bs(Nt.paint_background["background-opacity"])})},$f=function(t){function e(e){t.call(this,e,Qf)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getProgramIds=function(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]},e}(Jl),td={paint:new Ss({"raster-opacity":new bs(Nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new bs(Nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new bs(Nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new bs(Nt.paint_raster["raster-brightness-max"]),"raster-saturation":new bs(Nt.paint_raster["raster-saturation"]),"raster-contrast":new bs(Nt.paint_raster["raster-contrast"]),"raster-resampling":new bs(Nt.paint_raster["raster-resampling"]),"raster-fade-duration":new bs(Nt.paint_raster["raster-fade-duration"])})},ed=function(t){function e(e){t.call(this,e,td)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getProgramIds=function(){return["raster"]},e}(Jl);new Ss({"model-default-color":new ws(Nt.paint_model["model-default-color"]),"model-blend-light":new ws(Nt.paint_model["model-blend-light"])});var id={paint:new Ss({"model-default-color":new ws(Nt.paint_model["model-default-color"]),"model-blend-light":new ws(Nt.paint_model["model-blend-light"])})},rd=Ls([{name:"a_pos3f",components:3,type:"Float32"},{name:"a_normal3f",components:3,type:"Float32"},{name:"a_texture2f",components:2,type:"Float32"}]).members,od={materialRoadSurface:{albedo:new Float32Array([.177888,.174647,.226966]),metallic:.428571,roughness:.714286},materialWhiteLine:{albedo:new Float32Array([.758376,.758376,.758376]),metallic:.571429,roughness:.285714},materialYellowLine:{albedo:new Float32Array([.899999,.699999,.3]),metallic:.571429,roughness:.285714},materialLightPole:{albedo:new Float32Array([.028426,.048172,.132868]),metallic:.285714,roughness:.428571},SilveryMetal:{albedo:new Float32Array([.168269,.198069,.246201]),metallic:.571429,roughness:.285714},WhitePaint:{albedo:new Float32Array([.991102,.991102,.991102]),metallic:.571429,roughness:.285714},RedPaint:{albedo:new Float32Array([.665387,.009134,.008023]),metallic:.571429,roughness:.285714},BluePaint:{albedo:new Float32Array([.006049,.061246,.520996]),metallic:.428571,roughness:.285714},BlackPaint:{albedo:new Float32Array([0,0,0]),metallic:.571429,roughness:.285714},CementBlock:{albedo:new Float32Array([.095307,.093059,.095307]),metallic:.428571,roughness:.714286},BrassMetal:{albedo:new Float32Array([.226966,.127438,.036889]),metallic:.942857,roughness:.714286},GreenMetal:{albedo:new Float32Array([.03125,.05,.005]),metallic:.921429,roughness:.285714},ParkingGround:{albedo:new Float32Array([.285871,.36,.0954]),metallic:0,roughness:.857143},ParkFloor:{albedo:new Float32Array([.285871,.36,.0954]),metallic:0,roughness:.857143},default:{albedo:new Float32Array([.6,.6,.6]),metallic:.3,roughness:.6}},nd={STAT_MEM:0,STAT_GRAPHS:1,STAT_TEXTURE:2,STAT_PRIMS:3,STAT_BUFFER:4,STAT_PROGRAM:5,STAT_COUNT:6},ad=function(t){this._total=20,this._type=t,this._totalUsedThisFrame=0};ad.prototype.begin=function(){this._beginTime=window.performance.now()},ad.prototype.end=function(){return this._endTime=window.performance.now(),this._totalUsedThisFrame+=this._endTime-this._beginTime,this._beginTime=this._endTime,this._totalUsedThisFrame},ad.prototype.elapse=function(){return window.performance.now()-this._beginTime},ad.prototype.recover=function(){this._totalUsedThisFrame=0},ad.prototype.getTotalUsedThisFrame=function(){return this._totalUsedThisFrame+this.elapse()},ad.prototype.isBudgetFinished=function(){return this._totalUsedThisFrame>this._total||this.getTotalUsedThisFrame()>this._total&&(this.end(),!0)};var sd=function(){this._statsElements=new Array(nd.STAT_COUNT);for(var t=0;t<nd.STAT_COUNT;++t)this._statsElements[t]=new ad(t);this._statsElements[nd.STAT_GRAPHS]._total=30,this._statsElements[nd.STAT_TEXTURE]._total=10,this._statsElements[nd.STAT_PROGRAM]._total=10};sd.prototype.getStatsElement=function(t){return t<nd.STAT_COUNT?this._statsElements[t]:null},sd.prototype.frameStart=function(){for(var t=0;t<nd.STAT_COUNT;++t)this._statsElements[t].recover()},sd.prototype.frameEnd=function(){};var ld=n.HTMLImageElement,ud=n.HTMLCanvasElement,hd=n.HTMLVideoElement,pd=n.ImageData,cd=n.ImageBitmap,fd=function(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)};fd.prototype.update=function(t,e,i){var r=t.width,o=t.height,n=!(this.size&&this.size[0]===r&&this.size[1]===o||i),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),n)this.size=[r,o],t instanceof ld||t instanceof ud||t instanceof hd||t instanceof pd||cd&&t instanceof cd?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,r,o,0,this.format,s.UNSIGNED_BYTE,t.data);else{var l=i||{x:0,y:0},u=l.x,h=l.y;t instanceof ld||t instanceof ud||t instanceof hd||t instanceof pd||cd&&t instanceof cd?s.texSubImage2D(s.TEXTURE_2D,0,u,h,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,u,h,r,o,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},fd.prototype.bind=function(t,e,i){var r=this.context.gl;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)},fd.prototype.isSizePowerOfTwo=function(){return Math.log(this.size[0])/Math.LN2%1==0&&Math.log(this.size[1])/Math.LN2%1==0},fd.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var dd=function(){this.loadedTexture=!1,this.layoutVertexArray=new Ns,this.indexArray=new Ys,this.vertexLength=0,this.primitiveLength=0,this.hasColor=!0,this.hasShadow=!1,this.segmentTexture=void 0,this.segmentImage=void 0,this.alphaMode=null,this.vaos={},this.vertexOffset=0,this.primitiveOffset=0};dd.prototype.UpdateTexture=function(){if(this.textureId&&!this.loadedTexture){var t=this.textureManager.getTexture(this.textureId);t&&(this.segmentTexture=t,this.loadedTexture=!0)}},dd.prototype.destroy=function(){this.layoutVertexArray&&this.layoutVertexArray.clear(),this.indexArray&&this.indexArray.clear()};var md=function(){this.segments=[]};md.prototype.prepareColorSegment=function(){var t=new dd;return this.segments.push(t),t},md.prototype.get=function(){return this.segments},md.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var i=e[t];for(var r in i.vaos)i.layoutVertexBuffer.destroy(),i.indexBuffer.destroy(),i.vaos[r].destroy()}},md.prototype.preRender=function(){for(var t=0;t<this.segments.length;++t)this.segments[t].UpdateTexture()},md.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,da("ModelSegmentVector",md);var yd=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ns,this.indexArray=new Ys,this.transparentSegments=new md,this.opaqueSegments=new md,this.programConfig=new Zl(t.layers,t.zoom),this.programTextureConfig=new Zl(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.bufferFilled=!1,this.currentNodeIndex=0,this.currentMeshPrim=0};yd.prototype.convertUint16Array=function(t){var e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(t),new Uint16Array(e)},yd.prototype.convertFloat32Array=function(t){var e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(t),new Float32Array(e)},yd.prototype.getBufferOfView=function(t,e,i){var r=this.modelData.getBufferView(t),o=this.modelData.gltf.binChunks[r.buffer];return new Uint8Array(o.arrayBuffer,(r.byteOffset||0)+o.byteOffset+e,i)},yd.prototype.parseUrl=function(t){var e=t.match(/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}},yd.prototype.preRender=function(t){"translucent"===t?this.transparentSegments.preRender():this.opaqueSegments.preRender()},yd.prototype.fillBuffers=function(t,e,i){if(this.map=e,this.externalImages=[],this.url=i||"",!this.bufferFilled){this.modelData=t;var r=t.getScene(0);for(var o in r.nodes){var n=t.getNode(o),a=t.getMesh(n.mesh);for(var s in a.primitives){var l=t.getMaterial(a.primitives[s].material);if(l.pbrMetallicRoughness&&l.pbrMetallicRoughness.baseColorTexture){var u=t.getTexture(l.pbrMetallicRoughness.baseColorTexture.index),h=t.getImage(u.source);if(this.url.indexOf("http")>-1&&!h.bufferView&&h.uri){var p=this.url+this.map._requestManager.normalizeImageLibURL(h.uri);this.externalImages.push(p)}}}}this.map.style._textureManager.loadImages(this.externalImages),this.bufferFilled=!0}},yd.prototype.populate=function(t,e,i){},yd.prototype.update=function(t,e,i){this.stateDependentLayers.length&&(this.programConfig.updatePaintArrays(t,e,this.stateDependentLayers,i),this.programTextureConfig.updatePaintArrays(t,e,this.stateDependentLayers,i))},yd.prototype.isEmpty=function(){return!1},yd.prototype.uploadPending=function(){return!this.uploaded||this.programConfig.needsUpload||this.programTextureConfig.needsUpload},yd.prototype.uploadStep=function(t){var e=this.layers[0].paint.get("model-default-color"),i=this.modelData.getNode(this.currentNodeIndex),r=this.modelData.getMesh(i.mesh).primitives[this.currentMeshPrim],o=this.modelData.getMaterial(r.material),n=null;if(o.alphaMode&&"BLEND"==o.alphaMode?(n=this.transparentSegments.prepareColorSegment()).alphaMode="BLEND":n=this.opaqueSegments.prepareColorSegment(),n.textureManager=this.map.style._textureManager,function(t,e,i){var r=od[t];r?(e.albedo=r.albedo,e.metallic=r.metallic,e.roughness=r.roughness):(e.albedo=i?new Float32Array([i.value.value.r,i.value.value.g,i.value.value.b]):od.default.albedo,e.metallic=od.default.metallic,e.roughness=od.default.roughness)}(o.name,n,e),o.pbrMetallicRoughness&&o.pbrMetallicRoughness.baseColorTexture){var a=this.modelData.getTexture(o.pbrMetallicRoughness.baseColorTexture.index),s=this.modelData.getImage(a.source);if(!s.bufferView&&s.uri){if(this.modelData.getBufferView(0),this.map&&this.map.style){var l=s.uri;this.url.indexOf("http")>-1&&(l=this.url+this.map._requestManager.normalizeImageLibURL(s.uri)),n.textureId=l;var u=this.map.style._textureManager.getTexture(l);n.hasColor=!1,u?(n.segmentTexture=u,n.loadedTexture=!0):(n.segmentTexture=this.map.style._textureManager.spaceTexture,n.loadedTexture=!1)}}else{var h=this.modelData.getBufferView(s.bufferView),p=this.modelData.getBuffer(h.buffer),c=this.modelData.gltf.binChunks[h.buffer];if(p.byteLength===c.byteLength){var f=new Uint8Array(c.arrayBuffer,h.byteOffset+c.byteOffset,h.byteLength);En.parse(f).then((function(t){n.hasColor=!1,n.loadedTexture=!0,n.segmentTexture=void 0,n.segmentImage=t})).catch((function(t){}))}}}for(var d=this.modelData.getAccessor(r.indices),m=this.modelData.getAccessor(r.attributes.POSITION),y=d.count,g=m.count,_=this.getBufferOfView(d.bufferView,void 0===d.byteOffset?0:d.byteOffset,2*y),v=this.getBufferOfView(m.bufferView,void 0===m.byteOffset?0:m.byteOffset,32*g),x=this.convertUint16Array(_),b=0;b<y;b+=3)n.indexArray.emplaceBack(x[b+2],x[b+1],x[b+0]);for(var w=this.convertFloat32Array(v),k=0;k<g;k++){var T=8*k+0,I=8*k+3,S=8*k+6;n.layoutVertexArray.emplaceBack(w[T],w[T+1],w[T+2],w[I],w[I+1],w[I+2],w[S],w[S+1])}n.vertexLength=g,n.primitiveLength=y/3,n.layoutVertexArray._trim(),n.indexArray._trim(),n.layoutVertexBuffer=t.createVertexBuffer(n.layoutVertexArray,rd),n.indexBuffer=t.createIndexBuffer(n.indexArray)},yd.prototype.upload=function(t){if(!this.uploaded){var e=this.map.style._statisticsTool.getStatsElement(nd.STAT_GRAPHS);e.begin();for(var i=this.modelData.getScene(0);this.currentNodeIndex<i.nodes.length;){for(var r=this.modelData.getNode(this.currentNodeIndex),o=this.modelData.getMesh(r.mesh);this.currentMeshPrim<o.primitives.length;)if(this.uploadStep(t),this.currentMeshPrim++,this.map.triggerRepaint(),e.isBudgetFinished())return;++this.currentNodeIndex}this.uploaded=!0}this.programConfig.upload(t),this.programTextureConfig.upload(t)},yd.prototype.destroy=function(){this.programConfig&&(this.programConfig.destroy(),this.programTextureConfig.destroy(),this.opaqueSegments.destroy(),this.transparentSegments.destroy())},yd.prototype.addFeature=function(t,e,i,r){},da("ModelBucket",yd,{omit:["layers","patternFeatures"]});var gd=function(t){function e(e){t.call(this,e,id)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new yd(t)},e.prototype.queryRadius=function(){return 1e3},e.prototype.isModel=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,i,r,o,n,a,s){return!1},e}(Jl),_d=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.is3D=function(){return"3d"===this.implementation.renderingMode},e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},e}(Jl),vd={paint:new Ss({"sky-type":new bs(Nt.paint_sky["sky-type"]),"sky-atmosphere-sun":new bs(Nt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new bs(Nt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new bs(Nt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new bs(Nt.paint_sky["sky-gradient-radius"]),"sky-gradient":new Is(Nt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new bs(Nt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new bs(Nt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new bs(Nt.paint_sky["sky-opacity"])})};function xd(t,e,i){var r=Du(0,0,1),o=Yu(Hu());return function(t,e,i){i*=.5;var r=e[0],o=e[1],n=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=r*l-n*s,t[1]=o*l+a*s,t[2]=n*l+r*s,t[3]=a*l-o*s}(o,o,i?-c(t)+Math.PI:c(t)),Ku(o,o,-c(e)),Vu(r,r,o),Uu(r,r)}var bd=function(t){function e(e){t.call(this,e,vd),this._updateColorRamp(),this.setSkyGradientDirty(!0)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"sky-gradient"===t?(this._updateColorRamp(),this.setSkyGradientDirty(!0)):"sky-atmosphere-sun"!==t&&"sky-atmosphere-halo-color"!==t&&"sky-atmosphere-color"!==t&&"sky-atmosphere-sun-intensity"!==t||(this._skyboxInvalidated=!0)},e.prototype._updateColorRamp=function(){this.colorRamp=ch({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)},e.prototype.needsSkyboxCapture=function(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry||!this.skyboxBrdfGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){var e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}},e.prototype.needsSkyboxGradientCapture=function(t){return!(!this._skyboxInvalidated&&this.skyboxTexture&&this.skyboxGeometry&&this.skyboxBrdfGeometry)||this.skyGradientDirty},e.prototype.setSkyGradientDirty=function(t){this.skyGradientDirty=t},e.prototype.getCenter=function(t,e){var i=this.paint.get("sky-type");if("atmosphere"===i){var r=this.paint.get("sky-atmosphere-sun"),o=!r,n=t.style.light,a=n.properties.get("position");return o&&"viewport"===n.properties.get("anchor")&&D("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),o?xd(a.azimuthal,90-a.polar,e):xd(r[0],90-r[1],e)}if("gradient"===i){var s=this.paint.get("sky-gradient-center");return xd(s[0],90-s[1],e)}},e.prototype.is3D=function(){return!1},e.prototype.isSky=function(){return!0},e.prototype.markSkyboxValid=function(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")},e.prototype.hasOffscreenPass=function(){return!0},e.prototype.getProgramIds=function(){var t=this.paint.get("sky-type");return"atmosphere"===t?["skyboxCapture","skybox","skyboxIrradiance","skyboxPreFiltered","skyboxBrdf"]:"gradient"===t?["skyboxGradient"]:null},e}(Jl),wd={circle:th,heatmap:fh,hillshade:mh,fill:ip,"fill-extrusion":Lp,line:qp,symbol:Jf,background:$f,raster:ed,sky:bd,model:gd},kd=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};kd.prototype.setNorthEast=function(t){return this.northeast=this._ne=t instanceof ix?new ix(t.lng,t.lat):ix.convert(t),this},kd.prototype.setSouthWest=function(t){return this.southwest=this._sw=t instanceof ix?new ix(t.lng,t.lat):ix.convert(t),this},kd.prototype.extend=function(t){var e,i,r=this._sw,o=this._ne;if(t instanceof ix)e=t,i=t;else{if(!(t instanceof kd))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(kd.convert(t)):this.extend(ix.convert(t)):this;if(i=t._ne,!(e=t._sw)||!i)return this}return r||o?(r.lng=Math.min(e.lng,r.lng),r.lat=Math.min(e.lat,r.lat),o.lng=Math.max(i.lng,o.lng),o.lat=Math.max(i.lat,o.lat),this.southwest=r,this.northeast=o):(this.southwest=this._sw=new ix(e.lng,e.lat),this.northeast=this._ne=new ix(i.lng,i.lat)),this},kd.prototype.getCenter=function(){return new ix((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},kd.prototype.getSouthWest=function(){return this._sw},kd.prototype.getNorthEast=function(){return this._ne},kd.prototype.getNorthWest=function(){return new ix(this.getWest(),this.getNorth())},kd.prototype.getSouthEast=function(){return new ix(this.getEast(),this.getSouth())},kd.prototype.getWest=function(){return this._sw.lng},kd.prototype.getSouth=function(){return this._sw.lat},kd.prototype.getEast=function(){return this._ne.lng},kd.prototype.getNorth=function(){return this._ne.lat},kd.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},kd.prototype.toString=function(){return this._sw.lng+","+this._sw.lat+";"+this._ne.lng+","+this._ne.lat},kd.prototype.getArray=function(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]},kd.prototype.isEmpty=function(){return!(this._sw&&this._ne)},kd.prototype.contains=function(t){var e=ix.convert(t),i=e.lng,r=e.lat,o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&o},kd.convert=function(t){return!t||t instanceof kd?t:new kd(t)};var Td=6371008.8,Id={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Td,metres:Td,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:5825721.287490856},Sd={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Td,yards:1/1.0936},Ed={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ad(t,e,i){void 0===i&&(i={});var r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=e||{},r.geometry=t,r}function Pd(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Gd(t[0])||!Gd(t[1]))throw new Error("coordinates must contain numbers");return Ad({type:"Point",coordinates:t},e,i)}function Md(t,e,i){void 0===i&&(i={});for(var r=0,o=t;r<o.length;r++){var n=o[r];if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<n[n.length-1].length;a++)if(n[n.length-1][a]!==n[0][a])throw new Error("First and last Position are not equivalent.")}return Ad({type:"Polygon",coordinates:t},e,i)}function Ld(t,e,i){if(void 0===i&&(i={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Ad({type:"LineString",coordinates:t},e,i)}function Cd(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function Dd(t,e,i){return void 0===i&&(i={}),Ad({type:"MultiLineString",coordinates:t},e,i)}function zd(t,e,i){return void 0===i&&(i={}),Ad({type:"MultiPoint",coordinates:t},e,i)}function Od(t,e,i){return void 0===i&&(i={}),Ad({type:"MultiPolygon",coordinates:t},e,i)}function Rd(t,e){void 0===e&&(e="kilometers");var i=Id[e];if(!i)throw new Error(e+" units is invalid");return t*i}function Bd(t,e){void 0===e&&(e="kilometers");var i=Id[e];if(!i)throw new Error(e+" units is invalid");return t/i}function Fd(t,e){return jd(Bd(t,e))}function Ud(t){var e=t%360;return e<0&&(e+=360),e}function jd(t){return t%(2*Math.PI)*180/Math.PI}function Nd(t){return t%360*Math.PI/180}function Vd(t,e,i){if(void 0===e&&(e="kilometers"),void 0===i&&(i="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Rd(Bd(t,e),i)}function Gd(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Zd(t){return!!t&&t.constructor===Object}function qd(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Xd(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Wd(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)}function Hd(t){return"Feature"===t.type?t.geometry:t}var Yd=function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var i=this.points[e],r=this.points[e+1];this.centers.push({x:(i.x+r.x)/2,y:(i.y+r.y)/2,z:(i.z+r.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),e=0;e<this.centers.length-1;e++){var o=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,n=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,a=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+o),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+n),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+a)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+o),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+n),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+a)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return t.prototype.cacheSteps=function(t){var e=[],i=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var o=this.pos(r);Math.sqrt((o.x-i.x)*(o.x-i.x)+(o.y-i.y)*(o.y-i.y)+(o.z-i.z)*(o.z-i.z))>t&&(e.push(r),i=o)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),i=this.pos(t-10);return{angle:180*Math.atan2(e.y-i.y,e.x-i.x)/3.14,speed:Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)+(i.z-e.z)*(i.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var i=e/this.duration;if(i>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*i);return function(t,e,i,r,o){var n=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:o.x*n[0]+r.x*n[1]+i.x*n[2]+e.x*n[3],y:o.y*n[0]+r.y*n[1]+i.y*n[2]+e.y*n[3],z:o.z*n[0]+r.z*n[1]+i.z*n[2]+e.z*n[3]}}((this.length-1)*i-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])},t}();function Kd(t,e,i,r){void 0===r&&(r={});var o=qd(t),n=Nd(o[0]),a=Nd(o[1]),s=Nd(i),l=Bd(e,r.units),u=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return Pd([jd(n+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(u))),jd(u)],r.properties)}function Jd(t,e,i){void 0===i&&(i={});for(var r=i.steps||64,o=i.properties?i.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},n=[],a=0;a<r;a++)n.push(Kd(t,e,-360*a/r,i).geometry.coordinates);return n.push(n[0]),Md([n],o)}function Qd(t,e,i){if(void 0===i&&(i={}),!0===i.final)return function(t,e){return(Qd(e,t)+180)%360}(t,e);var r=qd(t),o=qd(e),n=Nd(r[0]),a=Nd(o[0]),s=Nd(r[1]),l=Nd(o[1]),u=Math.sin(a-n)*Math.cos(l),h=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-n);return jd(Math.atan2(u,h))}function $d(t,e,i){void 0===i&&(i={});var r=qd(t),o=qd(e),n=Nd(o[1]-r[1]),a=Nd(o[0]-r[0]),s=Nd(r[1]),l=Nd(o[1]),u=Math.pow(Math.sin(n/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return Rd(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),i.units)}function tm(t,e){return Kd(t,$d(t,e)/2,Qd(t,e))}function em(t,e,i){if(null!==t)for(var r,o,n,a,s,l,u,h,p=0,c=0,f=t.type,d="FeatureCollection"===f,m="Feature"===f,y=d?t.features.length:1,g=0;g<y;g++){s=(h=!!(u=d?t.features[g].geometry:m?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var _=0;_<s;_++){var v=0,x=0;if(null!==(a=h?u.geometries[_]:u)){l=a.coordinates;var b=a.type;switch(p=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(l,c,g,v,x))return!1;c++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],c,g,v,x))return!1;c++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-p;o++){if(!1===e(l[r][o],c,g,v,x))return!1;c++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,o=0;o<l[r].length;o++){for(n=0;n<l[r][o].length-p;n++){if(!1===e(l[r][o][n],c,g,v,x))return!1;c++}x++}v++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===em(a.geometries[r],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function im(t,e){var i;switch(t.type){case"FeatureCollection":for(i=0;i<t.features.length&&!1!==e(t.features[i].properties,i);i++);break;case"Feature":e(t.properties,0)}}function rm(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i<t.features.length&&!1!==e(t.features[i],i);i++);}function om(t,e){var i,r,o,n,a,s,l,u,h,p,c=0,f="FeatureCollection"===t.type,d="Feature"===t.type,m=f?t.features.length:1;for(i=0;i<m;i++){for(u=f?t.features[i].properties:d?t.properties:{},h=f?t.features[i].bbox:d?t.bbox:void 0,p=f?t.features[i].id:d?t.id:void 0,a=(l=!!(s=f?t.features[i].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1,o=0;o<a;o++)if(null!==(n=l?s.geometries[o]:s))switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(n,c,u,h,p))return!1;break;case"GeometryCollection":for(r=0;r<n.geometries.length;r++)if(!1===e(n.geometries[r],c,u,h,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,h,p))return!1;c++}}function nm(t,e,i){var r=i;return om(t,(function(t,o,n,a,s){r=0===o&&void 0===i?t:e(r,t,o,n,a,s)})),r}function am(t,e){om(t,(function(t,i,r,o,n){var a,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Ad(t,r,{bbox:o,id:n}),i,0)&&void 0}switch(s){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<t.coordinates.length;l++)if(!1===e(Ad({type:a,coordinates:t.coordinates[l]},r),i,l))return!1}))}function sm(t,e){am(t,(function(t,i,r){var o=0;if(t.geometry){var n=t.geometry.type;if("Point"!==n&&"MultiPoint"!==n){var a,s=0,l=0,u=0;return!1!==em(t,(function(n,h,p,c,f){if(void 0===a||i>s||c>l||f>u)return a=n,s=i,l=c,u=f,void(o=0);var d=Ld([a,n],t.properties);if(!1===e(d,i,r,f,o))return!1;o++,a=n}))&&void 0}}}))}function lm(t,e,i){var r=i,o=!1;return sm(t,(function(t,n,a,s,l){r=!1===o&&void 0===i?t:e(r,t,n,a,s,l),o=!0})),r}function um(t,e){if(!t)throw new Error("geojson is required");am(t,(function(t,i,r){if(null!==t.geometry){var o=t.geometry.coordinates;switch(t.geometry.type){case"LineString":if(!1===e(t,i,r,0,0))return!1;break;case"Polygon":for(var n=0;n<o.length;n++)if(!1===e(Ld(o[n],t.properties),i,r,n))return!1}}}))}function hm(t){var e=[1/0,1/0,-1/0,-1/0];return em(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}hm.default=hm;var pm=fm,cm=fm;function fm(t,e,i){i=i||2;var r,o,n,a,s,l,u,h=e&&e.length,p=h?e[0]*i:t.length,c=dm(t,0,p,i,!0),f=[];if(!c||c.next===c.prev)return f;if(h&&(c=function(t,e,i,r){var o,n,a,s=[];for(o=0,n=e.length;o<n;o++)(a=dm(t,e[o]*r,o<n-1?e[o+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),s.push(Im(a));for(s.sort(bm),o=0;o<s.length;o++)wm(s[o],i),i=mm(i,i.next);return i}(t,e,c,i)),t.length>80*i){r=n=t[0],o=a=t[1];for(var d=i;d<p;d+=i)(s=t[d])<r&&(r=s),(l=t[d+1])<o&&(o=l),s>n&&(n=s),l>a&&(a=l);u=0!==(u=Math.max(n-r,a-o))?1/u:0}return ym(c,f,i,r,o,u),f}function dm(t,e,i,r,o){var n,a;if(o===Fm(t,e,i,r)>0)for(n=e;n<i;n+=r)a=Om(n,t[n],t[n+1],a);else for(n=i-r;n>=e;n-=r)a=Om(n,t[n],t[n+1],a);return a&&Pm(a,a.next)&&(Rm(a),a=a.next),a}function mm(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Pm(r,r.next)&&0!==Am(r.prev,r,r.next))r=r.next;else{if(Rm(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function ym(t,e,i,r,o,n,a){if(t){!a&&n&&function(t,e,i,r){var o=t;do{null===o.z&&(o.z=Tm(o.x,o.y,e,i,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==t);o.prevZ.nextZ=null,o.prevZ=null,function(t){var e,i,r,o,n,a,s,l,u=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,r=i,s=0,e=0;e<u&&(s++,r=r.nextZ);e++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(o=i,i=i.nextZ,s--):(o=r,r=r.nextZ,l--),n?n.nextZ=o:t=o,o.prevZ=n,n=o;i=r}n.nextZ=null,u*=2}while(a>1)}(o)}(t,r,o,n);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,n?_m(t,r,o,n):gm(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Rm(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ym(t=vm(mm(t),e,i),e,i,r,o,n,2):2===a&&xm(t,e,i,r,o,n):ym(mm(t),e,i,r,o,n,1);break}}}function gm(t){var e=t.prev,i=t,r=t.next;if(Am(e,i,r)>=0)return!1;for(var o=t.next.next;o!==t.prev;){if(Sm(e.x,e.y,i.x,i.y,r.x,r.y,o.x,o.y)&&Am(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function _m(t,e,i,r){var o=t.prev,n=t,a=t.next;if(Am(o,n,a)>=0)return!1;for(var s=o.x>n.x?o.x>a.x?o.x:a.x:n.x>a.x?n.x:a.x,l=o.y>n.y?o.y>a.y?o.y:a.y:n.y>a.y?n.y:a.y,u=Tm(o.x<n.x?o.x<a.x?o.x:a.x:n.x<a.x?n.x:a.x,o.y<n.y?o.y<a.y?o.y:a.y:n.y<a.y?n.y:a.y,e,i,r),h=Tm(s,l,e,i,r),p=t.prevZ,c=t.nextZ;p&&p.z>=u&&c&&c.z<=h;){if(p!==t.prev&&p!==t.next&&Sm(o.x,o.y,n.x,n.y,a.x,a.y,p.x,p.y)&&Am(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,c!==t.prev&&c!==t.next&&Sm(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Am(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Sm(o.x,o.y,n.x,n.y,a.x,a.y,p.x,p.y)&&Am(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;c&&c.z<=h;){if(c!==t.prev&&c!==t.next&&Sm(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Am(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function vm(t,e,i){var r=t;do{var o=r.prev,n=r.next.next;!Pm(o,n)&&Mm(o,r,r.next,n)&&Dm(o,n)&&Dm(n,o)&&(e.push(o.i/i),e.push(r.i/i),e.push(n.i/i),Rm(r),Rm(r.next),r=t=n),r=r.next}while(r!==t);return mm(r)}function xm(t,e,i,r,o,n){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Em(a,s)){var l=zm(a,s);return a=mm(a,a.next),l=mm(l,l.next),ym(a,e,i,r,o,n),void ym(l,e,i,r,o,n)}s=s.next}a=a.next}while(a!==t)}function bm(t,e){return t.x-e.x}function wm(t,e){if(e=function(t,e){var i,r=e,o=t.x,n=t.y,a=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var s=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a){if(a=s,s===o){if(n===r.y)return r;if(n===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(o===a)return i;var l,u=i,h=i.x,p=i.y,c=1/0;r=i;do{o>=r.x&&r.x>=h&&o!==r.x&&Sm(n<p?o:a,n,h,p,n<p?a:o,n,r.x,r.y)&&(l=Math.abs(n-r.y)/(o-r.x),Dm(r,t)&&(l<c||l===c&&(r.x>i.x||r.x===i.x&&km(i,r)))&&(i=r,c=l)),r=r.next}while(r!==u);return i}(t,e),e){var i=zm(e,t);mm(e,e.next),mm(i,i.next)}}function km(t,e){return Am(t.prev,t,e.prev)<0&&Am(e.next,t,t.next)<0}function Tm(t,e,i,r,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*o)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*o)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Im(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Sm(t,e,i,r,o,n,a,s){return(o-a)*(e-s)-(t-a)*(n-s)>=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(n-s)-(o-a)*(r-s)>=0}function Em(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Mm(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Dm(t,e)&&Dm(e,t)&&function(t,e){var i=t,r=!1,o=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&o<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Am(t.prev,t,e.prev)||Am(t,e.prev,e))||Pm(t,e)&&Am(t.prev,t,t.next)>0&&Am(e.prev,e,e.next)>0)}function Am(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Pm(t,e){return t.x===e.x&&t.y===e.y}function Mm(t,e,i,r){var o=Cm(Am(t,e,i)),n=Cm(Am(t,e,r)),a=Cm(Am(i,r,t)),s=Cm(Am(i,r,e));return o!==n&&a!==s||!(0!==o||!Lm(t,i,e))||!(0!==n||!Lm(t,r,e))||!(0!==a||!Lm(i,t,r))||!(0!==s||!Lm(i,e,r))}function Lm(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Cm(t){return t>0?1:t<0?-1:0}function Dm(t,e){return Am(t.prev,t,t.next)<0?Am(t,e,t.next)>=0&&Am(t,t.prev,e)>=0:Am(t,e,t.prev)<0||Am(t,t.next,e)<0}function zm(t,e){var i=new Bm(t.i,t.x,t.y),r=new Bm(e.i,e.x,e.y),o=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function Om(t,e,i,r){var o=new Bm(t,e,i);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function Rm(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bm(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Fm(t,e,i,r){for(var o=0,n=e,a=i-r;n<i;n+=r)o+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return o}function Um(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=jm(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(jm(t))})),e}function jm(t){var e=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,o=0;o<t.length;o++){for(var n=0;n<t[o].length;n++)for(var a=0;a<e;a++)i.vertices.push(t[o][n][a]);o>0&&i.holes.push(r+=t[o-1].length)}return i}(t),i=pm(e.vertices,e.holes,2),r=[],o=[];i.forEach((function(t,r){var n=i[r];o.push([e.vertices[2*n],e.vertices[2*n+1]])}));for(var n=0;n<o.length;n+=3){var a=o.slice(n,n+3);a.push(o[n]),r.push(Md([a]))}return r}function Nm(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=qd(t),o=Hd(e),n=o.type,a=e.bbox,s=o.coordinates;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(r,a))return!1;"Polygon"===n&&(s=[s]);for(var l=!1,u=0;u<s.length&&!l;u++)if(Vm(r,s[u][0],i.ignoreBoundary)){for(var h=!1,p=1;p<s[u].length&&!h;)Vm(r,s[u][p],!i.ignoreBoundary)&&(h=!0),p++;h||(l=!0)}return l}function Vm(t,e,i){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var o=0,n=e.length-1;o<e.length;n=o++){var a=e[o][0],s=e[o][1],l=e[n][0],u=e[n][1];if(t[1]*(a-l)+s*(l-t[0])+u*(t[0]-a)==0&&(a-t[0])*(l-t[0])<=0&&(s-t[1])*(u-t[1])<=0)return!i;s>t[1]!=u>t[1]&&t[0]<(l-a)*(t[1]-s)/(u-s)+a&&(r=!r)}return r}function Gm(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Zm(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Zm(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Xm(t);default:throw new Error("unknown GeoJSON type")}}function Zm(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qm(t.properties),e.geometry=Xm(t.geometry),e}function qm(t){var e={};return t?(Object.keys(t).forEach((function(i){var r=t[i];e[i]="object"==typeof r?null===r?null:Array.isArray(r)?r.map((function(t){return t})):qm(r):r})),e):e}function Xm(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Xm(t)})),e):(e.coordinates=Wm(t.coordinates),e)}function Wm(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Wm(t)}))}function Hm(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var i,r=1/0,o=0;return rm(e,(function(e,i){var n=$d(t,e);n<r&&(o=i,r=n)})),(i=Gm(e.features[o])).properties.featureIndex=o,i.properties.distanceToPoint=r,i}function Ym(t){if(!t)throw new Error("geojson is required");var e=[];return am(t,(function(t){!function(t,e){var i=[],r=t.geometry;if(null!==r){switch(r.type){case"Polygon":i=Xd(r);break;case"LineString":i=[Xd(r)]}i.forEach((function(i){var r=function(t,e){var i=[];return t.reduce((function(t,r){var o,n,a,s,l,u,h=Ld([t,r],e);return h.bbox=[(a=(o=t)[0])<(l=(n=r)[0])?a:l,(s=o[1])<(u=n[1])?s:u,a>l?a:l,s>u?s:u],i.push(h),r})),i}(i,t.properties);r.forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),Cd(e)}fm.deviation=function(t,e,i,r){var o=e&&e.length,n=Math.abs(Fm(t,0,o?e[0]*i:t.length,i));if(o)for(var a=0,s=e.length;a<s;a++)n-=Math.abs(Fm(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<r.length;a+=3){var u=r[a]*i,h=r[a+1]*i,p=r[a+2]*i;l+=Math.abs((t[u]-t[p])*(t[h+1]-t[u+1])-(t[u]-t[h])*(t[p+1]-t[u+1]))}return 0===n&&0===l?0:Math.abs((l-n)/n)},fm.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,o=0;o<t.length;o++){for(var n=0;n<t[o].length;n++)for(var a=0;a<e;a++)i.vertices.push(t[o][n][a]);o>0&&i.holes.push(r+=t[o-1].length)}return i},pm.default=cm;var Km="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Jm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Qm(t,e){return t(e={exports:{}},e.exports),e.exports}var $m=Qm((function(t,e){t.exports=function(){function t(i,r,o,n,a){for(;n>o;){if(n-o>600){var s=n-o+1,l=r-o+1,u=Math.log(s),h=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*h*(s-h)/s)*(l-s/2<0?-1:1);t(i,r,Math.max(o,Math.floor(r-l*h/s+p)),Math.min(n,Math.floor(r+(s-l)*h/s+p)),a)}var c=i[r],f=o,d=n;for(e(i,o,r),a(i[n],c)>0&&e(i,o,n);f<d;){for(e(i,f,d),f++,d--;a(i[f],c)<0;)f++;for(;a(i[d],c)>0;)d--}0===a(i[o],c)?e(i,o,d):e(i,++d,n),d<=r&&(o=d+1),r<=d&&(n=d-1)}}function e(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function i(t,e){return t<e?-1:t>e?1:0}return function(e,r,o,n,a){t(e,r,o||0,n||e.length-1,a||i)}}()})),ty=iy,ey=iy;function iy(t,e){if(!(this instanceof iy))return new iy(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function ry(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r<e.length;r++)if(i(t,e[r]))return r;return-1}function oy(t,e){ny(t,0,t.children.length,e,t)}function ny(t,e,i,r,o){o||(o=fy(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(var n,a=e;a<i;a++)n=t.children[a],ay(o,t.leaf?r(n):n);return o}function ay(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function sy(t,e){return t.minX-e.minX}function ly(t,e){return t.minY-e.minY}function uy(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function hy(t){return t.maxX-t.minX+(t.maxY-t.minY)}function py(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function cy(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function fy(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dy(t,e,i,r,o){for(var n,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=r||(n=e+Math.ceil((i-e)/r/2)*r,$m(t,n,e,i,o),a.push(e,n,n,i))}iy.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!cy(t,e))return i;for(var o,n,a,s,l=[];e;){for(o=0,n=e.children.length;o<n;o++)a=e.children[o],cy(t,s=e.leaf?r(a):a)&&(e.leaf?i.push(a):py(t,s)?this._all(a,i):l.push(a));e=l.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!cy(t,e))return!1;for(var r,o,n,a,s=[];e;){for(r=0,o=e.children.length;r<o;r++)if(n=e.children[r],cy(t,a=e.leaf?i(n):n)){if(e.leaf||py(t,a))return!0;s.push(n)}e=s.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,i=t.length;e<i;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var o=this.data;this.data=r,r=o}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=fy([]),this},remove:function(t,e){if(!t)return this;for(var i,r,o,n,a=this.data,s=this.toBBox(t),l=[],u=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],i=u.pop(),n=!0),a.leaf&&-1!==(o=ry(t,a.children,e)))return a.children.splice(o,1),l.push(a),this._condense(l),this;n||a.leaf||!py(a,s)?r?(i++,a=r.children[i],n=!1):a=null:(l.push(a),u.push(i),i=0,r=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:sy,compareMinY:ly,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},_build:function(t,e,i,r){var o,n=i-e+1,a=this._maxEntries;if(n<=a)return oy(o=fy(t.slice(e,i+1)),this.toBBox),o;r||(r=Math.ceil(Math.log(n)/Math.log(a)),a=Math.ceil(n/Math.pow(a,r-1))),(o=fy([])).leaf=!1,o.height=r;var s,l,u,h,p=Math.ceil(n/a),c=p*Math.ceil(Math.sqrt(a));for(dy(t,e,i,c,this.compareMinX),s=e;s<=i;s+=c)for(dy(t,s,u=Math.min(s+c-1,i),p,this.compareMinY),l=s;l<=u;l+=p)h=Math.min(l+p-1,u),o.children.push(this._build(t,l,h,r-1));return oy(o,this.toBBox),o},_chooseSubtree:function(t,e,i,r){for(var o,n,a,s,l,u,h,p,c,f;r.push(e),!e.leaf&&r.length-1!==i;){for(h=p=1/0,o=0,n=e.children.length;o<n;o++)l=uy(a=e.children[o]),c=t,f=a,(u=(Math.max(f.maxX,c.maxX)-Math.min(f.minX,c.minX))*(Math.max(f.maxY,c.maxY)-Math.min(f.minY,c.minY))-l)<p?(p=u,h=l<h?l:h,s=a):u===p&&l<h&&(h=l,s=a);e=s||e.children[0]}return e},_insert:function(t,e,i){var r=i?t:(0,this.toBBox)(t),o=[],n=this._chooseSubtree(r,this.data,e,o);for(n.children.push(t),ay(n,r);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(r,o,e)},_split:function(t,e){var i=t[e],r=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,r);var n=this._chooseSplitIndex(i,o,r),a=fy(i.children.splice(n,i.children.length-n));a.height=i.height,a.leaf=i.leaf,oy(i,this.toBBox),oy(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=fy([t,e]),this.data.height=t.height+1,this.data.leaf=!1,oy(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,o,n,a,s,l,u,h,p,c,f,d,m,y;for(l=u=1/0,r=e;r<=i-e;r++)p=o=ny(t,0,r,this.toBBox),c=n=ny(t,r,i,this.toBBox),f=Math.max(p.minX,c.minX),d=Math.max(p.minY,c.minY),m=Math.min(p.maxX,c.maxX),y=Math.min(p.maxY,c.maxY),a=Math.max(0,m-f)*Math.max(0,y-d),s=uy(o)+uy(n),a<l?(l=a,h=r,u=s<u?s:u):a===l&&s<u&&(u=s,h=r);return h},_chooseSplitAxis:function(t,e,i){var r=t.leaf?this.compareMinX:sy,o=t.leaf?this.compareMinY:ly;this._allDistMargin(t,e,i,r)<this._allDistMargin(t,e,i,o)&&t.children.sort(r)},_allDistMargin:function(t,e,i,r){t.children.sort(r);var o,n,a=this.toBBox,s=ny(t,0,e,a),l=ny(t,i-e,i,a),u=hy(s)+hy(l);for(o=e;o<i-e;o++)n=t.children[o],ay(s,t.leaf?a(n):n),u+=hy(s);for(o=i-e-1;o>=e;o--)n=t.children[o],ay(l,t.leaf?a(n):n),u+=hy(l);return u},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--)ay(e[r],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():oy(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},ty.default=ey;var my=Qm((function(t,e){function i(t,e,i){void 0===i&&(i={});var r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=e||{},r.geometry=t,r}function r(t,e,r){return void 0===r&&(r={}),i({type:"Point",coordinates:t},e,r)}function o(t,e,r){void 0===r&&(r={});for(var o=0,n=t;o<n.length;o++){var a=n[o];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return i({type:"Polygon",coordinates:t},e,r)}function n(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return i({type:"LineString",coordinates:t},e,r)}function a(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function s(t,e,r){return void 0===r&&(r={}),i({type:"MultiLineString",coordinates:t},e,r)}function l(t,e,r){return void 0===r&&(r={}),i({type:"MultiPoint",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),i({type:"MultiPolygon",coordinates:t},e,r)}function h(t,i){void 0===i&&(i="kilometers");var r=e.factors[i];if(!r)throw new Error(i+" units is invalid");return t*r}function p(t,i){void 0===i&&(i="kilometers");var r=e.factors[i];if(!r)throw new Error(i+" units is invalid");return t/r}function c(t){return t%(2*Math.PI)*180/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)&&!/^\s*$/.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius/1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1/1.0936},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=i,e.geometry=function(t,e,i){switch(t){case"Point":return r(e).geometry;case"LineString":return n(e).geometry;case"Polygon":return o(e).geometry;case"MultiPoint":return l(e).geometry;case"MultiLineString":return s(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}},e.point=r,e.points=function(t,e,i){return void 0===i&&(i={}),a(t.map((function(t){return r(t,e)})),i)},e.polygon=o,e.polygons=function(t,e,i){return void 0===i&&(i={}),a(t.map((function(t){return o(t,e)})),i)},e.lineString=n,e.lineStrings=function(t,e,i){return void 0===i&&(i={}),a(t.map((function(t){return n(t,e)})),i)},e.featureCollection=a,e.multiLineString=s,e.multiPoint=l,e.multiPolygon=u,e.geometryCollection=function(t,e,r){return void 0===r&&(r={}),i({type:"GeometryCollection",geometries:t},e,r)},e.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var i=Math.pow(10,e||0);return Math.round(t*i)/i},e.radiansToLength=h,e.lengthToRadians=p,e.lengthToDegrees=function(t,e){return c(p(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=c,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,i){if(void 0===e&&(e="kilometers"),void 0===i&&(i="kilometers"),!(t>=0))throw new Error("length must be a positive number");return h(p(t,e),i)},e.convertArea=function(t,i,r){if(void 0===i&&(i="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var o=e.areaFactors[i];if(!o)throw new Error("invalid original units");var n=e.areaFactors[r];if(!n)throw new Error("invalid final units");return t/o*n},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}}));Jm(my);var yy=Qm((function(t,e){function i(t,e,r){if(null!==t)for(var o,n,a,s,l,u,h,p,c=0,f=0,d=t.type,m="FeatureCollection"===d,y="Feature"===d,g=m?t.features.length:1,_=0;_<g;_++){l=(p=!!(h=m?t.features[_].geometry:y?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var v=0;v<l;v++){var x=0,b=0;if(null!==(s=p?h.geometries[v]:h)){u=s.coordinates;var w=s.type;switch(c=!r||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(u,f,_,x,b))return!1;f++,x++;break;case"LineString":case"MultiPoint":for(o=0;o<u.length;o++){if(!1===e(u[o],f,_,x,b))return!1;f++,"MultiPoint"===w&&x++}"LineString"===w&&x++;break;case"Polygon":case"MultiLineString":for(o=0;o<u.length;o++){for(n=0;n<u[o].length-c;n++){if(!1===e(u[o][n],f,_,x,b))return!1;f++}"MultiLineString"===w&&x++,"Polygon"===w&&b++}"Polygon"===w&&x++;break;case"MultiPolygon":for(o=0;o<u.length;o++){for(b=0,n=0;n<u[o].length;n++){for(a=0;a<u[o][n].length-c;a++){if(!1===e(u[o][n][a],f,_,x,b))return!1;f++}b++}x++}break;case"GeometryCollection":for(o=0;o<s.geometries.length;o++)if(!1===i(s.geometries[o],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function r(t,e){var i;switch(t.type){case"FeatureCollection":for(i=0;i<t.features.length&&!1!==e(t.features[i].properties,i);i++);break;case"Feature":e(t.properties,0)}}function o(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i<t.features.length&&!1!==e(t.features[i],i);i++);}function n(t,e){var i,r,o,n,a,s,l,u,h,p,c=0,f="FeatureCollection"===t.type,d="Feature"===t.type,m=f?t.features.length:1;for(i=0;i<m;i++){for(u=f?t.features[i].properties:d?t.properties:{},h=f?t.features[i].bbox:d?t.bbox:void 0,p=f?t.features[i].id:d?t.id:void 0,a=(l=!!(s=f?t.features[i].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1,o=0;o<a;o++)if(null!==(n=l?s.geometries[o]:s))switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(n,c,u,h,p))return!1;break;case"GeometryCollection":for(r=0;r<n.geometries.length;r++)if(!1===e(n.geometries[r],c,u,h,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,h,p))return!1;c++}}function a(t,e){n(t,(function(t,i,r,o,n){var a,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==e(my.feature(t,r,{bbox:o,id:n}),i,0)&&void 0}switch(s){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<t.coordinates.length;l++)if(!1===e(my.feature({type:a,coordinates:t.coordinates[l]},r),i,l))return!1}))}function s(t,e){a(t,(function(t,r,o){var n=0;if(t.geometry){var a=t.geometry.type;if("Point"!==a&&"MultiPoint"!==a){var s,l=0,u=0,h=0;return!1!==i(t,(function(i,a,p,c,f){if(void 0===s||r>l||c>u||f>h)return s=i,l=r,u=c,h=f,void(n=0);var d=my.lineString([s,i],t.properties);if(!1===e(d,r,o,f,n))return!1;n++,s=i}))&&void 0}}}))}function l(t,e){if(!t)throw new Error("geojson is required");a(t,(function(t,i,r){if(null!==t.geometry){var o=t.geometry.coordinates;switch(t.geometry.type){case"LineString":if(!1===e(t,i,r,0,0))return!1;break;case"Polygon":for(var n=0;n<o.length;n++)if(!1===e(my.lineString(o[n],t.properties),i,r,n))return!1}}}))}Object.defineProperty(e,"__esModule",{value:!0}),e.coordEach=i,e.coordReduce=function(t,e,r,o){var n=r;return i(t,(function(t,i,o,a,s){n=0===i&&void 0===r?t:e(n,t,i,o,a,s)}),o),n},e.propEach=r,e.propReduce=function(t,e,i){var o=i;return r(t,(function(t,r){o=0===r&&void 0===i?t:e(o,t,r)})),o},e.featureEach=o,e.featureReduce=function(t,e,i){var r=i;return o(t,(function(t,o){r=0===o&&void 0===i?t:e(r,t,o)})),r},e.coordAll=function(t){var e=[];return i(t,(function(t){e.push(t)})),e},e.geomEach=n,e.geomReduce=function(t,e,i){var r=i;return n(t,(function(t,o,n,a,s){r=0===o&&void 0===i?t:e(r,t,o,n,a,s)})),r},e.flattenEach=a,e.flattenReduce=function(t,e,i){var r=i;return a(t,(function(t,o,n){r=0===o&&0===n&&void 0===i?t:e(r,t,o,n)})),r},e.segmentEach=s,e.segmentReduce=function(t,e,i){var r=i,o=!1;return s(t,(function(t,n,a,s,l){r=!1===o&&void 0===i?t:e(r,t,n,a,s,l),o=!0})),r},e.lineEach=l,e.lineReduce=function(t,e,i){var r=i;return l(t,(function(t,o,n,a){r=0===o&&void 0===i?t:e(r,t,o,n,a)})),r},e.findSegment=function(t,e){if(!my.isObject(e=e||{}))throw new Error("options is invalid");var i,r=e.featureIndex||0,o=e.multiFeatureIndex||0,n=e.geometryIndex||0,a=e.segmentIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,i=t.features[r].geometry;break;case"Feature":s=s||t.properties,i=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=t;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=l.length+a-1),my.lineString([l[a],l[a+1]],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a-1),my.lineString([l[n][a],l[n][a+1]],s,e);case"MultiLineString":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a-1),my.lineString([l[o][a],l[o][a+1]],s,e);case"MultiPolygon":return o<0&&(o=l.length+o),n<0&&(n=l[o].length+n),a<0&&(a=l[o][n].length-a-1),my.lineString([l[o][n][a],l[o][n][a+1]],s,e)}throw new Error("geojson is invalid")},e.findPoint=function(t,e){if(!my.isObject(e=e||{}))throw new Error("options is invalid");var i,r=e.featureIndex||0,o=e.multiFeatureIndex||0,n=e.geometryIndex||0,a=e.coordIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,i=t.features[r].geometry;break;case"Feature":s=s||t.properties,i=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=t;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":return my.point(l,s,e);case"MultiPoint":return o<0&&(o=l.length+o),my.point(l[o],s,e);case"LineString":return a<0&&(a=l.length+a),my.point(l[a],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a),my.point(l[n][a],s,e);case"MultiLineString":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),my.point(l[o][a],s,e);case"MultiPolygon":return o<0&&(o=l.length+o),n<0&&(n=l[o].length+n),a<0&&(a=l[o][n].length-a),my.point(l[o][n][a],s,e)}throw new Error("geojson is invalid")}}));Jm(yy);var gy=hm.default,_y=yy.featureEach,vy=my.featureCollection;function xy(t){var e=ty(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:gy(t),ty.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:gy(t),e.push(t)})):_y(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:gy(t),e.push(t)})),ty.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:gy(t),ty.prototype.remove.call(this,t,e)},e.clear=function(){return ty.prototype.clear.call(this)},e.search=function(t){var e=ty.prototype.search.call(this,this.toBBox(t));return vy(e)},e.collides=function(t){return ty.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=ty.prototype.all.call(this);return vy(t)},e.toJSON=function(){return ty.prototype.toJSON.call(this)},e.fromJSON=function(t){return ty.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=gy(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=gy(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}var by=xy;function wy(t,e){var i={},r=[];if("LineString"===t.type&&(t=Ad(t)),"LineString"===e.type&&(e=Ad(e)),"Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var o=ky(t,e);return o&&r.push(o),Cd(r)}var n=by();return n.load(Ym(e)),rm(Ym(t),(function(t){rm(n.search(t),(function(e){var o=ky(t,e);if(o){var n=Xd(o).join(",");i[n]||(i[n]=!0,r.push(o))}}))})),Cd(r)}function ky(t,e){var i=Xd(t),r=Xd(e);if(2!==i.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=i[0][0],n=i[0][1],a=i[1][0],s=i[1][1],l=r[0][0],u=r[0][1],h=r[1][0],p=r[1][1],c=(p-u)*(a-o)-(h-l)*(s-n);if(0===c)return null;var f=((h-l)*(n-u)-(p-u)*(o-l))/c,d=((a-o)*(n-u)-(s-n)*(o-l))/c;return f>=0&&f<=1&&d>=0&&d<=1?Pd([o+f*(a-o),n+f*(s-n)]):null}function Ty(t,e,i){void 0===i&&(i={});var r=Pd([1/0,1/0],{dist:1/0}),o=0;return am(t,(function(t){for(var n=Xd(t),a=0;a<n.length-1;a++){var s=Pd(n[a]);s.properties.dist=$d(e,s,i);var l=Pd(n[a+1]);l.properties.dist=$d(e,l,i);var u=$d(s,l,i),h=Math.max(s.properties.dist,l.properties.dist),p=Qd(s,l),c=Kd(e,h,p+90,i),f=Kd(e,h,p-90,i),d=wy(Ld([c.geometry.coordinates,f.geometry.coordinates]),Ld([s.geometry.coordinates,l.geometry.coordinates])),m=null;d.features.length>0&&((m=d.features[0]).properties.dist=$d(e,m,i),m.properties.location=o+$d(s,m,i)),s.properties.dist<r.properties.dist&&((r=s).properties.index=a,r.properties.location=o),l.properties.dist<r.properties.dist&&((r=l).properties.index=a+1,r.properties.location=o+u),m&&m.properties.dist<r.properties.dist&&((r=m).properties.index=a),o+=u}})),r}by.default=xy;var Iy=6378137;function Sy(t){return nm(t,(function(t,e){return t+function(t){var e,i=0;switch(t.type){case"Polygon":return Ey(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)i+=Ey(t.coordinates[e]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Ey(t){var e=0;if(t&&t.length>0){e+=Math.abs(Ay(t[0]));for(var i=1;i<t.length;i++)e-=Math.abs(Ay(t[i]))}return e}function Ay(t){var e,i,r,o,n,a,s=0,l=t.length;if(l>2){for(a=0;a<l;a++)a===l-2?(r=l-2,o=l-1,n=0):a===l-1?(r=l-1,o=0,n=1):(r=a,o=a+1,n=a+2),e=t[r],i=t[o],s+=(Py(t[n][0])-Py(e[0]))*Math.sin(Py(i[1]));s=s*Iy*Iy/2}return s}function Py(t){return t*Math.PI/180}function My(t,e,i){void 0===i&&(i={});for(var r=Hd(t).coordinates,o=0,n=0;n<r.length&&!(e>=o&&n===r.length-1);n++){if(o>=e){var a=e-o;if(a){var s=Qd(r[n],r[n-1])-180;return Kd(r[n],a,s,i)}return Pd(r[n])}o+=$d(r[n],r[n+1],i)}return Pd(r[r.length-1])}function Ly(t,e){return void 0===e&&(e={}),lm(t,(function(t,i){var r=i.geometry.coordinates;return t+$d(r[0],r[1],e)}),0)}function Cy(t){if(!t)throw new Error("geojson is required");var e=[];return am(t,(function(t){e.push(t)})),Cd(e)}function Dy(t,e,i,r){if(!Zd(r=r||{}))throw new Error("options is invalid");var o,n=[];if("Feature"===t.type)o=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");o=t.coordinates}for(var a,s,l,u=o.length,h=0,p=0;p<o.length&&!(e>=h&&p===o.length-1);p++){if(h>e&&0===n.length){if(!(a=e-h))return n.push(o[p]),Ld(n);s=Qd(o[p],o[p-1])-180,l=Kd(o[p],a,s,r),n.push(l.geometry.coordinates)}if(h>=i)return(a=i-h)?(s=Qd(o[p],o[p-1])-180,l=Kd(o[p],a,s,r),n.push(l.geometry.coordinates),Ld(n)):(n.push(o[p]),Ld(n));if(h>=e&&n.push(o[p]),p===o.length-1)return Ld(n);h+=$d(o[p],o[p+1],r)}if(h<e&&o.length===u)throw new Error("Start position is beyond line");return Ld(o[o.length-1])}function zy(t,e,i){var r;return void 0===i&&(i={}),(r=i.final?Oy(qd(e),qd(t)):Oy(qd(t),qd(e)))>180?-(360-r):r}function Oy(t,e){var i=Nd(t[1]),r=Nd(e[1]),o=Nd(e[0]-t[0]);o>Math.PI&&(o-=2*Math.PI),o<-Math.PI&&(o+=2*Math.PI);var n=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(i/2+Math.PI/4));return(jd(Math.atan2(o,n))+360)%360}function Ry(t,e,i,r){void 0===r&&(r={});var o=e<0,n=Vd(Math.abs(e),r.units,"meters");o&&(n=-Math.abs(n));var a=qd(t),s=function(t,e,i,r){var o=e/(r=void 0===r?Td:Number(r)),n=t[0]*Math.PI/180,a=Nd(t[1]),s=Nd(i),l=o*Math.cos(s),u=a+l;Math.abs(u)>Math.PI/2&&(u=u>0?Math.PI-u:-Math.PI-u);var h=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),p=Math.abs(h)>1e-11?l/h:Math.cos(a);return[(180*(n+o*Math.sin(s)/p)/Math.PI+540)%360-180,180*u/Math.PI]}(a,n,i);return s[0]+=s[0]-a[0]>180?-360:a[0]-s[0]>180?360:0,Pd(s,r.properties)}function By(t,e,i){void 0===i&&(i={});var r=qd(t),o=qd(e);o[0]+=o[0]-r[0]>180?-360:r[0]-o[0]>180?360:0;var n=function(t,e,i){var r=i=void 0===i?Td:Number(i),o=t[1]*Math.PI/180,n=e[1]*Math.PI/180,a=n-o,s=Math.abs(e[0]-t[0])*Math.PI/180;s>Math.PI&&(s-=2*Math.PI);var l=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),u=Math.abs(l)>1e-11?a/l:Math.cos(o);return Math.sqrt(a*a+u*u*s*s)*r}(r,o);return Vd(n,"meters",i.units)}function Fy(t,e,i){if(!Zd(i=i||{}))throw new Error("options is invalid");var r=i.pivot,o=i.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("angle is required");return 0===e||(r||(r=function(t,e){void 0===e&&(e={});var i=0,r=0,o=0;return em(t,(function(t){i+=t[0],r+=t[1],o++}),!0),Pd([i/o,r/o],e.properties)}(t)),!1!==o&&void 0!==o||(t=Gm(t)),em(t,(function(t){var i=zy(r,t)+e,o=By(r,t),n=Xd(Ry(r,o,i));t[0]=n[0],t[1]=n[1]}))),t}function Uy(t,e,i){void 0===i&&(i={});for(var r=qd(t),o=Xd(e),n=0;n<o.length-1;n++){var a=!1;if(i.ignoreEndVertices&&(0===n&&(a="start"),n===o.length-2&&(a="end"),0===n&&n+1===o.length-1&&(a="both")),jy(o[n],o[n+1],r,a))return!0}return!1}function jy(t,e,i,r){var o=i[0],n=i[1],a=t[0],s=t[1],l=e[0],u=e[1],h=l-a,p=u-s;return 0==(i[0]-a)*p-(i[1]-s)*h&&(r?"start"===r?Math.abs(h)>=Math.abs(p)?h>0?a<o&&o<=l:l<=o&&o<a:p>0?s<n&&n<=u:u<=n&&n<s:"end"===r?Math.abs(h)>=Math.abs(p)?h>0?a<=o&&o<l:l<o&&o<=a:p>0?s<=n&&n<u:u<n&&n<=s:"both"===r&&(Math.abs(h)>=Math.abs(p)?h>0?a<o&&o<l:l<o&&o<a:p>0?s<n&&n<u:u<n&&n<s):Math.abs(h)>=Math.abs(p)?h>0?a<=o&&o<=l:l<=o&&o<=a:p>0?s<=n&&n<=u:u<=n&&n<=s)}function Ny(t,e){var i=Hd(t),r=Hd(e),o=i.type,n=r.type,a=i.coordinates,s=r.coordinates;switch(o){case"Point":if("Point"===n)return Gy(a,s);throw new Error("feature2 "+n+" geometry not supported");case"MultiPoint":switch(n){case"Point":return function(t,e){var i,r=!1;for(i=0;i<t.coordinates.length;i++)if(Gy(t.coordinates[i],e.coordinates)){r=!0;break}return r}(i,r);case"MultiPoint":return function(t,e){for(var i=0,r=e.coordinates;i<r.length;i++){for(var o=r[i],n=!1,a=0,s=t.coordinates;a<s.length;a++)if(Gy(o,s[a])){n=!0;break}if(!n)return!1}return!0}(i,r);default:throw new Error("feature2 "+n+" geometry not supported")}case"LineString":switch(n){case"Point":return Uy(r,i,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var i=!1,r=0,o=e.coordinates;r<o.length;r++){var n=o[r];if(Uy({type:"Point",coordinates:n},t,{ignoreEndVertices:!0})&&(i=!0),!Uy({type:"Point",coordinates:n},t,{ignoreEndVertices:!1}))return!1}return i}(i,r);case"MultiPoint":return function(t,e){for(var i=!1,r=0,o=e.coordinates;r<o.length;r++){var n=o[r];if(Uy(n,t,{ignoreEndVertices:!0})&&(i=!0),!Uy(n,t))return!1}return!!i}(i,r);default:throw new Error("feature2 "+n+" geometry not supported")}case"Polygon":switch(n){case"Point":return Nm(r,i,{ignoreBoundary:!0});case"LineString":return function(t,e){var i,r,o=!1,n=0;if(!Vy(hm(t),hm(e)))return!1;for(;n<e.coordinates.length-1;n++)if(Nm({type:"Point",coordinates:(i=e.coordinates[n],r=e.coordinates[n+1],[(i[0]+r[0])/2,(i[1]+r[1])/2])},t,{ignoreBoundary:!0})){o=!0;break}return o}(i,r);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;if(!Vy(hm(t),hm(e)))return!1;for(var i=0,r=Hd(e).coordinates;i<r.length;i++)for(var o=0,n=r[i];o<n.length;o++)if(!Nm(n[o],t))return!1;return!0}(i,r);case"MultiPoint":return function(t,e){for(var i=0,r=e.coordinates;i<r.length;i++)if(!Nm(r[i],t,{ignoreBoundary:!0}))return!1;return!0}(i,r);default:throw new Error("feature2 "+n+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function Vy(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Gy(t,e){return t[0]===e[0]&&t[1]===e[1]}function Zy(t){for(var e,i,r=Xd(t),o=0,n=1;n<r.length;)e=i||r[0],o+=((i=r[n])[0]-e[0])*(i[1]+e[1]),n++;return o>0}var qy,Xy=Object.prototype.toString,Wy=function(t){var e=Xy.call(t),i="[object Arguments]"===e;return i||(i="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===Xy.call(t.callee)),i};if(!Object.keys){var Hy=Object.prototype.hasOwnProperty,Yy=Object.prototype.toString,Ky=Wy,Jy=Object.prototype.propertyIsEnumerable,Qy=!Jy.call({toString:null},"toString"),$y=Jy.call((function(){}),"prototype"),tg=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],eg=function(t){var e=t.constructor;return e&&e.prototype===t},ig={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},rg=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!ig["$"+t]&&Hy.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{eg(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();qy=function(t){var e=null!==t&&"object"==typeof t,i="[object Function]"===Yy.call(t),r=Ky(t),o=e&&"[object String]"===Yy.call(t),n=[];if(!e&&!i&&!r)throw new TypeError("Object.keys called on a non-object");var a=$y&&i;if(o&&t.length>0&&!Hy.call(t,0))for(var s=0;s<t.length;++s)n.push(String(s));if(r&&t.length>0)for(var l=0;l<t.length;++l)n.push(String(l));else for(var u in t)a&&"prototype"===u||!Hy.call(t,u)||n.push(String(u));if(Qy)for(var h=function(t){if("undefined"==typeof window||!rg)return eg(t);try{return eg(t)}catch(t){return!1}}(t),p=0;p<tg.length;++p)h&&"constructor"===tg[p]||!Hy.call(t,tg[p])||n.push(tg[p]);return n}}var og=Array.prototype.slice,ng=Object.keys,ag=ng?function(t){return ng(t)}:qy,sg=Object.keys;ag.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return Wy(t)?sg(og.call(t)):sg(t)})}else Object.keys=ag;return Object.keys||ag};var lg,ug=ag,hg=Km.Symbol,pg=function(){return"function"==typeof hg&&"function"==typeof Symbol&&"symbol"==typeof hg("foo")&&"symbol"==typeof Symbol("bar")&&function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),i=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}()},cg=Array.prototype.slice,fg=Object.prototype.toString,dg=Function.prototype.bind||function(t){var e=this;if("function"!=typeof e||"[object Function]"!==fg.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var i,r=cg.call(arguments,1),o=Math.max(0,e.length-r.length),n=[],a=0;a<o;a++)n.push("$"+a);if(i=Function("binder","return function ("+n.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var o=e.apply(this,r.concat(cg.call(arguments)));return Object(o)===o?o:this}return e.apply(t,r.concat(cg.call(arguments)))})),e.prototype){var s=function(){};s.prototype=e.prototype,i.prototype=new s,s.prototype=null}return i},mg=dg.call(Function.call,Object.prototype.hasOwnProperty),yg=SyntaxError,gg=Function,_g=TypeError,vg=function(t){try{return Function('"use strict"; return ('+t+").constructor;")()}catch(t){}},xg=Object.getOwnPropertyDescriptor;if(xg)try{xg({},"")}catch(t){xg=null}var bg=function(){throw new _g},wg=xg?function(){try{return bg}catch(t){try{return xg(arguments,"callee").get}catch(t){return bg}}}():bg,kg=pg(),Tg=Object.getPrototypeOf||function(t){return t.__proto__},Ig=vg("async function* () {}"),Sg=Ig?Ig.prototype:lg,Eg=Sg?Sg.prototype:lg,Ag="undefined"==typeof Uint8Array?lg:Tg(Uint8Array),Pg={"%AggregateError%":"undefined"==typeof AggregateError?lg:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?lg:ArrayBuffer,"%ArrayIteratorPrototype%":kg?Tg([][Symbol.iterator]()):lg,"%AsyncFromSyncIteratorPrototype%":lg,"%AsyncFunction%":vg("async function () {}"),"%AsyncGenerator%":Sg,"%AsyncGeneratorFunction%":Ig,"%AsyncIteratorPrototype%":Eg?Tg(Eg):lg,"%Atomics%":"undefined"==typeof Atomics?lg:Atomics,"%BigInt%":"undefined"==typeof BigInt?lg:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?lg:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?lg:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?lg:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?lg:FinalizationRegistry,"%Function%":gg,"%GeneratorFunction%":vg("function* () {}"),"%Int8Array%":"undefined"==typeof Int8Array?lg:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?lg:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?lg:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":kg?Tg(Tg([][Symbol.iterator]())):lg,"%JSON%":"object"==typeof JSON?JSON:lg,"%Map%":"undefined"==typeof Map?lg:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&kg?Tg((new Map)[Symbol.iterator]()):lg,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?lg:Promise,"%Proxy%":"undefined"==typeof Proxy?lg:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?lg:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?lg:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&kg?Tg((new Set)[Symbol.iterator]()):lg,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?lg:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":kg?Tg(""[Symbol.iterator]()):lg,"%Symbol%":kg?Symbol:lg,"%SyntaxError%":yg,"%ThrowTypeError%":wg,"%TypedArray%":Ag,"%TypeError%":_g,"%Uint8Array%":"undefined"==typeof Uint8Array?lg:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?lg:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?lg:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?lg:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?lg:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?lg:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?lg:WeakSet},Mg={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Lg=dg.call(Function.call,Array.prototype.concat),Cg=dg.call(Function.apply,Array.prototype.splice),Dg=dg.call(Function.call,String.prototype.replace),zg=dg.call(Function.call,String.prototype.slice),Og=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Rg=/\\(\\)?/g,Bg=function(t,e){if("string"!=typeof t||0===t.length)throw new _g("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new _g('"allowMissing" argument must be a boolean');var i=function(t){var e=zg(t,0,1),i=zg(t,-1);if("%"===e&&"%"!==i)throw new yg("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==e)throw new yg("invalid intrinsic syntax, expected opening `%`");var r=[];return Dg(t,Og,(function(t,e,i,o){r[r.length]=i?Dg(o,Rg,"$1"):e||t})),r}(t),r=i.length>0?i[0]:"",o=function(t,e){var i,r=t;if(mg(Mg,r)&&(r="%"+(i=Mg[r])[0]+"%"),mg(Pg,r)){var o=Pg[r];if(void 0===o&&!e)throw new _g("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new yg("intrinsic "+t+" does not exist!")}("%"+r+"%",e),n=o.name,a=o.value,s=!1,l=o.alias;l&&(r=l[0],Cg(i,Lg([0,1],l)));for(var u=1,h=!0;u<i.length;u+=1){var p=i[u],c=zg(p,0,1),f=zg(p,-1);if(('"'===c||"'"===c||"`"===c||'"'===f||"'"===f||"`"===f)&&c!==f)throw new yg("property names with quotes must have matching quotes");if("constructor"!==p&&h||(s=!0),mg(Pg,n="%"+(r+="."+p)+"%"))a=Pg[n];else if(null!=a){if(!(p in a)){if(!e)throw new _g("base intrinsic for "+t+" exists, but the property is not available.");return}if(xg&&u+1>=i.length){var d=xg(a,p);a=(h=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[p]}else h=mg(a,p),a=a[p];h&&!s&&(Pg[n]=a)}}return a},Fg=Qm((function(t){var e=Bg("%Function.prototype.apply%"),i=Bg("%Function.prototype.call%"),r=Bg("%Reflect.apply%",!0)||dg.call(i,e),o=Bg("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(t){o=null}t.exports=function(){return r(dg,i,arguments)};var n=function(){return r(dg,e,arguments)};o?o(t.exports,"apply",{value:n}):t.exports.apply=n})),Ug=Fg(Bg("String.prototype.indexOf")),jg="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Ng=function(t){var e=Bg(t,!1);return"function"==typeof e&&Ug(t,".prototype.")>-1?Fg(e):e}("Object.prototype.toString"),Vg=function(t){return!(jg&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===Ng(t)},Gg=function(t){return!!Vg(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==Ng(t)&&"[object Function]"===Ng(t.callee)},Zg=function(){return Vg(arguments)}();Vg.isLegacyArguments=Gg;var qg=Zg?Vg:Gg,Xg="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),Wg=Object.prototype.toString,Hg=Array.prototype.concat,Yg=Object.defineProperty,Kg=Yg&&function(){var t={};try{for(var e in Yg(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),Jg=function(t,e,i,r){var o;(!(e in t)||"function"==typeof(o=r)&&"[object Function]"===Wg.call(o)&&r())&&(Kg?Yg(t,e,{configurable:!0,enumerable:!1,value:i,writable:!0}):t[e]=i)},Qg=function(t,e){var i=arguments.length>2?arguments[2]:{},r=ug(e);Xg&&(r=Hg.call(r,Object.getOwnPropertySymbols(e)));for(var o=0;o<r.length;o+=1)Jg(t,r[o],e[r[o]],i[r[o]])};Qg.supportsDescriptors=!!Kg;var $g=Qg,t_=function(t){return t!=t},e_=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!t_(t)||!t_(e))},i_=function(){return"function"==typeof Object.is?Object.is:e_},r_=Fg(i_(),Object);$g(r_,{getPolyfill:i_,implementation:e_,shim:function(){var t=i_();return $g(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var o_,n_,a_,s_,l_=r_,u_=pg()&&"symbol"==typeof Symbol.toStringTag;if(u_){o_=Function.call.bind(Object.prototype.hasOwnProperty),n_=Function.call.bind(RegExp.prototype.exec),a_={};var h_=function(){throw a_};s_={toString:h_,valueOf:h_},"symbol"==typeof Symbol.toPrimitive&&(s_[Symbol.toPrimitive]=h_)}var p_,c_=Object.prototype.toString,f_=Object.getOwnPropertyDescriptor,d_=u_?function(t){if(!t||"object"!=typeof t)return!1;var e=f_(t,"lastIndex");if(!e||!o_(e,"value"))return!1;try{n_(t,s_)}catch(t){return t===a_}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===c_.call(t)},m_=TypeError,y_=Object.getOwnPropertyDescriptor;if(y_)try{y_({},"")}catch(t){y_=null}var g_=function(){throw new m_},__=y_?function(){try{return g_}catch(t){try{return y_(arguments,"callee").get}catch(t){return g_}}}():g_,v_=pg(),x_=Object.getPrototypeOf||function(t){return t.__proto__},b_=p_,w_=p_,k_=p_,T_="undefined"==typeof Uint8Array?p_:x_(Uint8Array),I_={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?p_:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?p_:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":v_?x_([][Symbol.iterator]()):p_,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":p_,"%AsyncFunction%":w_,"%AsyncFunctionPrototype%":p_,"%AsyncGenerator%":p_,"%AsyncGeneratorFunction%":k_,"%AsyncGeneratorPrototype%":p_,"%AsyncIteratorPrototype%":p_,"%Atomics%":"undefined"==typeof Atomics?p_:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?p_:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?p_:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?p_:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?p_:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?p_:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?p_:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":p_,"%GeneratorFunction%":b_,"%GeneratorPrototype%":p_,"%Int8Array%":"undefined"==typeof Int8Array?p_:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?p_:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?p_:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?p_:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?p_:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?p_:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":v_?x_(x_([][Symbol.iterator]())):p_,"%JSON%":"object"==typeof JSON?JSON:p_,"%JSONParse%":"object"==typeof JSON?JSON.parse:p_,"%Map%":"undefined"==typeof Map?p_:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&v_?x_((new Map)[Symbol.iterator]()):p_,"%MapPrototype%":"undefined"==typeof Map?p_:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?p_:Promise,"%PromisePrototype%":"undefined"==typeof Promise?p_:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?p_:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?p_:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?p_:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?p_:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?p_:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?p_:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?p_:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&v_?x_((new Set)[Symbol.iterator]()):p_,"%SetPrototype%":"undefined"==typeof Set?p_:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?p_:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?p_:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":v_?x_(""[Symbol.iterator]()):p_,"%StringPrototype%":String.prototype,"%Symbol%":v_?Symbol:p_,"%SymbolPrototype%":v_?Symbol.prototype:p_,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":__,"%TypedArray%":T_,"%TypedArrayPrototype%":T_?T_.prototype:p_,"%TypeError%":m_,"%TypeErrorPrototype%":m_.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?p_:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?p_:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?p_:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?p_:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?p_:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?p_:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?p_:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?p_:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?p_:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?p_:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?p_:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?p_:WeakSet.prototype},S_=dg.call(Function.call,String.prototype.replace),E_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A_=/\\(\\)?/g,P_=function(t,e){if("string"!=typeof t||0===t.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new TypeError('"allowMissing" argument must be a boolean');for(var i,r=(i=[],S_(t,E_,(function(t,e,r,o){i[i.length]=r?S_(o,A_,"$1"):e||t})),i),o=function(t,e){if(!(t in I_))throw new SyntaxError("intrinsic "+t+" does not exist!");if(void 0===I_[t]&&!e)throw new m_("intrinsic "+t+" exists, but is not available. Please file an issue!");return I_[t]}("%"+(r.length>0?r[0]:"")+"%",e),n=1;n<r.length;n+=1)if(null!=o)if(y_&&n+1>=r.length){var a=y_(o,r[n]);if(!e&&!(r[n]in o))throw new m_("base intrinsic for "+t+" exists, but the property is not available.");o=a&&"get"in a&&!("originalValue"in a.get)?a.get:o[r[n]]}else o=o[r[n]];return o},M_=Qm((function(t){var e=P_("%Function.prototype.apply%"),i=P_("%Function.prototype.call%"),r=P_("%Reflect.apply%",!0)||dg.call(i,e),o=P_("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(t){o=null}t.exports=function(){return r(dg,i,arguments)};var n=function(){return r(dg,e,arguments)};o?o(t.exports,"apply",{value:n}):t.exports.apply=n})),L_=Object,C_=TypeError,D_=function(){if(null!=this&&this!==L_(this))throw new C_("RegExp.prototype.flags getter called on non-object");var t="";return this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.sticky&&(t+="y"),t},z_=$g.supportsDescriptors,O_=Object.getOwnPropertyDescriptor,R_=TypeError,B_=function(){if(!z_)throw new R_("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var t=O_(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof/a/.dotAll)return t.get}return D_},F_=$g.supportsDescriptors,U_=Object.getOwnPropertyDescriptor,j_=Object.defineProperty,N_=TypeError,V_=Object.getPrototypeOf,G_=/a/,Z_=M_(D_);$g(Z_,{getPolyfill:B_,implementation:D_,shim:function(){if(!F_||!V_)throw new N_("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=B_(),e=V_(G_),i=U_(e,"flags");return i&&i.get===t||j_(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var q_=Z_,X_=Date.prototype.getDay,W_=Object.prototype.toString,H_="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Y_=function(t){return"object"==typeof t&&null!==t&&(H_?function(t){try{return X_.call(t),!0}catch(t){return!1}}(t):"[object Date]"===W_.call(t))},K_=Date.prototype.getTime;function J_(t){return null==t}function Q_(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}var $_=function t(e,i,r){var o=r||{};return!!(o.strict?l_(e,i):e===i)||(!e||!i||"object"!=typeof e&&"object"!=typeof i?o.strict?l_(e,i):e==i:function(e,i,r){var o,n;if(typeof e!=typeof i)return!1;if(J_(e)||J_(i))return!1;if(e.prototype!==i.prototype)return!1;if(qg(e)!==qg(i))return!1;var a=d_(e),s=d_(i);if(a!==s)return!1;if(a||s)return e.source===i.source&&q_(e)===q_(i);if(Y_(e)&&Y_(i))return K_.call(e)===K_.call(i);var l=Q_(e),u=Q_(i);if(l!==u)return!1;if(l||u){if(e.length!==i.length)return!1;for(o=0;o<e.length;o++)if(e[o]!==i[o])return!1;return!0}if(typeof e!=typeof i)return!1;try{var h=ug(e),p=ug(i)}catch(t){return!1}if(h.length!==p.length)return!1;for(h.sort(),p.sort(),o=h.length-1;o>=0;o--)if(h[o]!=p[o])return!1;for(o=h.length-1;o>=0;o--)if(!t(e[n=h[o]],i[n],r))return!1;return!0}(e,i,o))};function tv(t,e){var i=Xd(e),r=Xd(t),o=r[0],n=r[r.length-1],a=t.geometry.coordinates;return $_(i[0],o)?a.unshift(i[1]):$_(i[0],n)?a.push(i[1]):$_(i[1],o)?a.unshift(i[0]):$_(i[1],n)&&a.push(i[0]),t}var ev=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:ov};function iv(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function rv(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function ov(t,e){return $_(t,e,{strict:!0})}ev.prototype.compare=function(t,e){if(t.type!==e.type||!rv(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var i=this,r=iv(t),o=iv(e);return r.every((function(t){return this.some((function(e){return i.compare(t,e)}))}),o)}}return!1},ev.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i].toFixed(this.precision)!==e[i].toFixed(this.precision))return!1;return!0},ev.prototype.compareLine=function(t,e,i,r){if(!rv(t,e))return!1;var o=this.pseudoNode?t:this.removePseudo(t),n=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(o[0],n[0])||(n=this.fixStartIndex(n,o))){var a=this.compareCoord(o[i],n[i]);return this.direction||a?this.comparePath(o,n):!!this.compareCoord(o[i],n[n.length-(1+i)])&&this.comparePath(o.slice().reverse(),n)}},ev.prototype.fixStartIndex=function(t,e){for(var i,r=-1,o=0;o<t.length;o++)if(this.compareCoord(t[o],e[0])){r=o;break}return r>=0&&(i=[].concat(t.slice(r,t.length),t.slice(1,r+1))),i},ev.prototype.comparePath=function(t,e){var i=this;return t.every((function(t,e){return i.compareCoord(t,this[e])}),e)},ev.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var i=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),o=this;return i.every((function(t){return this.some((function(e){return o.compareLine(t,e,1,!0)}))}),r)}return!1},ev.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},ev.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},ev.prototype.removePseudo=function(t){return t};var nv=ev;function av(t,e){var i=Hd(t),r=Hd(e),o=i.type,n=r.type;if("MultiPoint"===o&&"MultiPoint"!==n||("LineString"===o||"MultiLineString"===o)&&"LineString"!==n&&"MultiLineString"!==n||("Polygon"===o||"MultiPolygon"===o)&&"Polygon"!==n&&"MultiPolygon"!==n)throw new Error("features must be of the same type");if("Point"===o)throw new Error("Point geometry not supported");if(new nv({precision:6}).compare(t,e))return!1;var a=0;switch(o){case"MultiPoint":for(var s=0;s<i.coordinates.length;s++)for(var l=0;l<r.coordinates.length;l++){var u=i.coordinates[s],h=r.coordinates[l];if(u[0]===h[0]&&u[1]===h[1])return!0}return!1;case"LineString":case"MultiLineString":sm(t,(function(t){sm(e,(function(e){(function(t,e,i){if(void 0===i&&(i={}),!Zd(i=i||{}))throw new Error("options is invalid");var r,o=i.tolerance||0,n=[],a=by(),s=Ym(t);return a.load(s),sm(e,(function(t){var e=!1;rm(a.search(t),(function(i){if(!1===e){var n=Xd(t).sort(),a=Xd(i).sort();$_(n,a)||(0===o?Uy(n[0],i)&&Uy(n[1],i):Ty(i,n[0]).properties.dist<=o&&Ty(i,n[1]).properties.dist<=o)?(e=!0,r=r?tv(r,t):t):(0===o?Uy(a[0],t)&&Uy(a[1],t):Ty(t,a[0]).properties.dist<=o&&Ty(t,a[1]).properties.dist<=o)&&(r=r?tv(r,i):i)}})),!1===e&&r&&(n.push(r),r=void 0)})),r&&n.push(r),Cd(n)})(t,e).features.length&&a++}))}));break;case"Polygon":case"MultiPolygon":sm(t,(function(t){sm(e,(function(e){wy(t,e).features.length&&a++}))}))}return a>0}function sv(t,e,i){if(void 0===i&&(i={}),i.method||(i.method="geodesic"),i.units||(i.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=Pd(t):"Point"===t.type?t=Ad(t):Wd(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=Ld(e):"LineString"===e.type?e=Ad(e):Wd(e,"LineString","line");var r=1/0,o=t.geometry.coordinates;return sm(e,(function(t){var e=function(t,e,i,r){var o=[i[0]-e[0],i[1]-e[1]],n=lv([t[0]-e[0],t[1]-e[1]],o);if(n<=0)return uv(t,e,{method:r.method,units:"degrees"});var a=lv(o,o);if(a<=n)return uv(t,i,{method:r.method,units:"degrees"});var s=n/a;return uv(t,[e[0]+s*o[0],e[1]+s*o[1]],{method:r.method,units:"degrees"})}(o,t.geometry.coordinates[0],t.geometry.coordinates[1],i);e<r&&(r=e)})),Vd(r,"degrees",i.units)}function lv(t,e){return t[0]*e[0]+t[1]*e[1]}function uv(t,e,i){return"planar"===i.method?By(t,e,i):$d(t,e,i)}var hv=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function pv(t,e){return t>e?1:t<e?-1:0}function cv(t,e,i){for(var r=new hv(null,null),o=r,n=r;;){var a=i(t,e.key);if(a<0){if(null===e.left)break;if(i(t,e.left.key)<0&&(e.left=(s=e.left).right,s.right=e,null===(e=s).left))break;n.left=e,n=e,e=e.left}else{if(!(a>0))break;if(null===e.right)break;var s;if(i(t,e.right.key)>0&&(e.right=(s=e.right).left,s.left=e,null===(e=s).right))break;o.right=e,o=e,e=e.right}}return o.right=e.left,n.left=e.right,e.left=r.right,e.right=r.left,e}function fv(t,e,i,r){var o=new hv(t,e);if(null===i)return o.left=o.right=null,o;var n=r(t,(i=cv(t,i,r)).key);return n<0?(o.left=i.left,o.right=i,i.left=null):n>=0&&(o.right=i.right,o.left=i,i.right=null),o}function dv(t,e,i){var r=null,o=null;if(e){var n=i((e=cv(t,e,i)).key,t);0===n?(r=e.left,o=e.right):n<0?(o=e.right,e.right=null,r=e):(r=e.left,e.left=null,o=e)}return{left:r,right:o}}function mv(t,e,i,r,o){if(t){r(e+(i?"└── ":"├── ")+o(t)+"\n");var n=e+(i?"    ":"│   ");t.left&&mv(t.left,n,!1,r,o),t.right&&mv(t.right,n,!0,r,o)}}var yv=function(){function t(t){void 0===t&&(t=pv),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=fv(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var i=new hv(t,e);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,o=cv(t,this._root,r),n=r(t,o.key);return 0===n?this._root=o:(n<0?(i.left=o.left,i.right=o,o.left=null):n>0&&(i.right=o.right,i.left=o,o.right=null),this._size++,this._root=i),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,i){var r;return null===e?null:0===i(t,(e=cv(t,e,i)).key)?(null===e.left?r=e.right:(r=cv(t,e.left,i)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=cv(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,i=this._comparator;e;){var r=i(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=cv(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,i=this._comparator;e;){var r=i(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var i=this._root,r=[],o=!1;!o;)null!==i?(r.push(i),i=i.left):0!==r.length?(i=r.pop(),t.call(e,i),i=i.right):o=!0;return this},t.prototype.range=function(t,e,i,r){for(var o=[],n=this._comparator,a=this._root;0!==o.length||a;)if(a)o.push(a),a=a.left;else{if(n((a=o.pop()).key,e)>0)break;if(n(a.key,t)>=0&&i.call(r,a))return this;a=a.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){return t.push(e.key)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){return t.push(e.data)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,i=!1,r=0,o=[];!i;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),r===t)return e;r++,e=e.right}else i=!0;return null},t.prototype.next=function(t){var e=this._root,i=null;if(t.right){for(i=t.right;i.left;)i=i.left;return i}for(var r=this._comparator;e;){var o=r(t.key,e.key);if(0===o)break;o<0?(i=e,e=e.left):e=e.right}return i},t.prototype.prev=function(t){var e=this._root,i=null;if(null!==t.left){for(i=t.left;i.right;)i=i.right;return i}for(var r=this._comparator;e;){var o=r(t.key,e.key);if(0===o)break;o<0?e=e.left:(i=e,e=e.right)}return i},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,i=[],r=!1,o=new hv(null,null),n=o;!r;)e?(i.push(e),e=e.left):i.length>0?e=(e=n=n.next=i.pop()).right:r=!0;return n.next=null,o.next}(this._root)},t.prototype.load=function(t,e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=t.length,o=this._comparator;if(i&&vv(t,e,0,r-1,o),null===this._root)this._root=gv(t,e,0,r),this._size=r;else{var n=function(t,e,i){for(var r=new hv(null,null),o=r,n=t,a=e;null!==n&&null!==a;)i(n.key,a.key)<0?(o.next=n,n=n.next):(o.next=a,a=a.next),o=o.next;return null!==n?o.next=n:null!==a&&(o.next=a),r.next}(this.toList(),function(t,e){for(var i=new hv(null,null),r=i,o=0;o<t.length;o++)r=r.next=new hv(t[o],e[o]);return r.next=null,i.next}(t,e),o);this._root=_v({head:n},0,r=this._size+r)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return mv(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,i){var r=this._comparator,o=dv(t,this._root,r),n=o.left,a=o.right;r(t,e)<0?a=fv(e,i,a,r):n=fv(e,i,n,r),this._root=function(t,e,i){return null===e?t:(null===t||((e=cv(t.key,e,i)).left=t),e)}(n,a,r)},t.prototype.split=function(t){return dv(t,this._root,this._comparator)},t}();function gv(t,e,i,r){var o=r-i;if(o>0){var n=i+Math.floor(o/2),a=new hv(t[n],e[n]);return a.left=gv(t,e,i,n),a.right=gv(t,e,n+1,r),a}return null}function _v(t,e,i){var r=i-e;if(r>0){var o=e+Math.floor(r/2),n=_v(t,e,o),a=t.head;return a.left=n,t.head=t.head.next,a.right=_v(t,o+1,i),a}return null}function vv(t,e,i,r,o){if(!(i>=r)){for(var n=t[i+r>>1],a=i-1,s=r+1;;){do{a++}while(o(t[a],n)<0);do{s--}while(o(t[s],n)>0);if(a>=s)break;var l=t[a];t[a]=t[s],t[s]=l,l=e[a],e[a]=e[s],e[s]=l}vv(t,e,i,s,o),vv(t,e,s+1,r,o)}}function xv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bv(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function wv(t,e,i){return e&&bv(t.prototype,e),i&&bv(t,i),t}var kv=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},Tv=function(t,e){return e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y?null:{ll:{x:t.ll.x<e.ll.x?e.ll.x:t.ll.x,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:t.ur.x<e.ur.x?t.ur.x:e.ur.x,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},Iv=Number.EPSILON;void 0===Iv&&(Iv=Math.pow(2,-52));var Sv=Iv*Iv,Ev=function(t,e){if(-Iv<t&&t<Iv&&-Iv<e&&e<Iv)return 0;var i=t-e;return i*i<Sv*t*e?0:t<e?-1:1},Av=function(){function t(){xv(this,t),this.reset()}return wv(t,[{key:"reset",value:function(){this.xRounder=new Pv,this.yRounder=new Pv}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),Pv=function(){function t(){xv(this,t),this.tree=new yv,this.round(0)}return wv(t,[{key:"round",value:function(t){var e=this.tree.add(t),i=this.tree.prev(e);if(null!==i&&0===Ev(e.key,i.key))return this.tree.remove(t),i.key;var r=this.tree.next(e);return null!==r&&0===Ev(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),t}(),Mv=new Av,Lv=function(t,e){return t.x*e.y-t.y*e.x},Cv=function(t,e){return t.x*e.x+t.y*e.y},Dv=function(t,e,i){var r=Lv({x:e.x-t.x,y:e.y-t.y},{x:i.x-t.x,y:i.y-t.y});return Ev(r,0)},zv=function(t){return Math.sqrt(Cv(t,t))},Ov=function(t,e,i){var r={x:e.x-t.x,y:e.y-t.y},o={x:i.x-t.x,y:i.y-t.y};return Cv(o,r)/zv(o)/zv(r)},Rv=function(t,e,i){return 0===e.y?null:{x:t.x+e.x/e.y*(i-t.y),y:i}},Bv=function(t,e,i){return 0===e.x?null:{x:i,y:t.y+e.y/e.x*(i-t.x)}},Fv=function(){function t(e,i){xv(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=i}return wv(t,null,[{key:"compare",value:function(e,i){var r=t.comparePoints(e.point,i.point);return 0!==r?r:(e.point!==i.point&&e.link(i),e.isLeft!==i.isLeft?e.isLeft?1:-1:jv.compare(e.segment,i.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),wv(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,i=0,r=e.length;i<r;i++){var o=e[i];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var i=this.point.events[e];if(void 0===i.segment.consumedBy)for(var r=e+1;r<t;r++){var o=this.point.events[r];void 0===o.consumedBy&&i.otherSE.point.events===o.otherSE.point.events&&i.segment.consume(o.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,i=this.point.events.length;e<i;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,i=new Map,r=function(r){var o,n,a,s,l,u=r.otherSE;i.set(r,{sine:(o=e.point,n=t.point,a=u.point,s={x:n.x-o.x,y:n.y-o.y},l={x:a.x-o.x,y:a.y-o.y},Lv(l,s)/zv(l)/zv(s)),cosine:Ov(e.point,t.point,u.point)})};return function(t,e){i.has(t)||r(t),i.has(e)||r(e);var o=i.get(t),n=o.sine,a=o.cosine,s=i.get(e),l=s.sine,u=s.cosine;return n>=0&&l>=0?a<u?1:a>u?-1:0:n<0&&l<0?a<u?-1:a>u?1:0:l<n?-1:l>n?1:0}}}]),t}(),Uv=0,jv=function(){function t(e,i,r,o){xv(this,t),this.id=++Uv,this.leftSE=e,e.segment=this,e.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=e,this.rings=r,this.windings=o}return wv(t,null,[{key:"compare",value:function(t,e){var i=t.leftSE.point.x,r=e.leftSE.point.x,o=t.rightSE.point.x,n=e.rightSE.point.x;if(n<i)return 1;if(o<r)return-1;var a=t.leftSE.point.y,s=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(i<r){if(s<a&&s<l)return 1;if(s>a&&s>l)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var p=e.comparePoint(t.rightSE.point);return 0!==p?p:-1}if(i>r){if(a<s&&a<u)return-1;if(a>s&&a>u)return 1;var c=e.comparePoint(t.leftSE.point);if(0!==c)return c;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(a<s)return-1;if(a>s)return 1;if(o<n){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(o>n){var m=t.comparePoint(e.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(o!==n){var y=l-a,g=o-i,_=u-s,v=n-r;if(y>g&&_<v)return 1;if(y<g&&_>v)return-1}return o>n?1:o<n||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),wv(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,i=this.rightSE.point,r=this.vector();if(e.x===i.x)return t.x===e.x?0:t.x<e.x?1:-1;if(t.x===e.x+(t.y-e.y)/r.y*r.x)return 0;var o=e.y+(t.x-e.x)/r.x*r.y;return t.y===o?0:t.y<o?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),i=t.bbox(),r=Tv(e,i);if(null===r)return null;var o=this.leftSE.point,n=this.rightSE.point,a=t.leftSE.point,s=t.rightSE.point,l=kv(e,a)&&0===this.comparePoint(a),u=kv(i,o)&&0===t.comparePoint(o),h=kv(e,s)&&0===this.comparePoint(s),p=kv(i,n)&&0===t.comparePoint(n);if(u&&l)return p&&!h?n:!p&&h?s:null;if(u)return h&&o.x===s.x&&o.y===s.y?null:o;if(l)return p&&n.x===a.x&&n.y===a.y?null:a;if(p&&h)return null;if(p)return n;if(h)return s;var c=function(t,e,i,r){if(0===e.x)return Bv(i,r,t.x);if(0===r.x)return Bv(t,e,i.x);if(0===e.y)return Rv(i,r,t.y);if(0===r.y)return Rv(t,e,i.y);var o=Lv(e,r);if(0==o)return null;var n={x:i.x-t.x,y:i.y-t.y},a=Lv(n,e)/o,s=Lv(n,r)/o;return{x:(t.x+s*e.x+(i.x+a*r.x))/2,y:(t.y+s*e.y+(i.y+a*r.y))/2}}(o,this.vector(),a,t.vector());return null===c?null:kv(r,c)?Mv.round(c.x,c.y):null}},{key:"split",value:function(e){var i=[],r=void 0!==e.events,o=new Fv(e,!0),n=new Fv(e,!1),a=this.rightSE;this.replaceRightSE(n),i.push(n),i.push(o);var s=new t(o,a,this.rings.slice(),this.windings.slice());return Fv.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),Fv.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(o.checkForConsuming(),n.checkForConsuming()),i}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,i=this.windings.length;e<i;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var i=this,r=e;i.consumedBy;)i=i.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var o=t.compare(i,r);if(0!==o){if(o>0){var n=i;i=r,r=n}if(i.prev===r){var a=i;i=r,r=a}for(var s=0,l=r.rings.length;s<l;s++){var u=r.rings[s],h=r.windings[s],p=i.rings.indexOf(u);-1===p?(i.rings.push(u),i.windings.push(h)):i.windings[p]+=h}r.rings=null,r.windings=null,r.consumedBy=i,r.leftSE.consumedBy=i.leftSE,r.rightSE.consumedBy=i.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this._prevInResult=this.prev?this.prev.isInResult()?this.prev:this.prev.prevInResult():null),this._prevInResult}},{key:"beforeState",value:function(){return void 0!==this._beforeState||(this._beforeState=this.prev?(this.prev.consumedBy||this.prev).afterState():{rings:[],windings:[],multiPolys:[]}),this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,i=this._afterState.windings,r=this._afterState.multiPolys,o=0,n=this.rings.length;o<n;o++){var a=this.rings[o],s=this.windings[o],l=e.indexOf(a);-1===l?(e.push(a),i.push(s)):i[l]+=s}for(var u=[],h=[],p=0,c=e.length;p<c;p++)if(0!==i[p]){var f=e[p],d=f.poly;if(-1===h.indexOf(d))if(f.isExterior)u.push(d);else{-1===h.indexOf(d)&&h.push(d);var m=u.indexOf(f.poly);-1!==m&&u.splice(m,1)}}for(var y=0,g=u.length;y<g;y++){var _=u[y].multiPoly;-1===r.indexOf(_)&&r.push(_)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Hv.type){case"union":this._isInResult=0===t.length!=(0===e.length);break;case"intersection":var i,r;t.length<e.length?(i=t.length,r=e.length):(i=e.length,r=t.length),this._isInResult=r===Hv.numMultiPolys&&i<r;break;case"xor":var o=Math.abs(t.length-e.length);this._isInResult=o%2==1;break;case"difference":var n=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=n(t)!==n(e);break;default:throw new Error("Unrecognized operation type found ".concat(Hv.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,i,r){var o,n,a,s=Fv.comparePoints(e,i);if(s<0)o=e,n=i,a=1;else{if(!(s>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));o=i,n=e,a=-1}return new t(new Fv(o,!0),new Fv(n,!1),[r],[a])}}]),t}(),Nv=function(){function t(e,i,r){if(xv(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=i,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=Mv.round(e[0][0],e[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var n=o,a=1,s=e.length;a<s;a++){if("number"!=typeof e[a][0]||"number"!=typeof e[a][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=Mv.round(e[a][0],e[a][1]);l.x===n.x&&l.y===n.y||(this.segments.push(jv.fromRing(n,l,this)),l.x<this.bbox.ll.x&&(this.bbox.ll.x=l.x),l.y<this.bbox.ll.y&&(this.bbox.ll.y=l.y),l.x>this.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),n=l)}o.x===n.x&&o.y===n.y||this.segments.push(jv.fromRing(n,o,this))}return wv(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,i=this.segments.length;e<i;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),t}(),Vv=function(){function t(e,i){if(xv(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Nv(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var r=1,o=e.length;r<o;r++){var n=new Nv(e[r],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=i}return wv(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,i=this.interiorRings.length;e<i;e++)for(var r=this.interiorRings[e].getSweepEvents(),o=0,n=r.length;o<n;o++)t.push(r[o]);return t}}]),t}(),Gv=function(){function t(e,i){if(xv(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var r=0,o=e.length;r<o;r++){var n=new Vv(e[r],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=i}return wv(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,i=this.polys.length;e<i;e++)for(var r=this.polys[e].getSweepEvents(),o=0,n=r.length;o<n;o++)t.push(r[o]);return t}}]),t}(),Zv=function(){function t(e){xv(this,t),this.events=e;for(var i=0,r=e.length;i<r;i++)e[i].segment.ringOut=this;this.poly=null}return wv(t,null,[{key:"factory",value:function(e){for(var i=[],r=0,o=e.length;r<o;r++){var n=e[r];if(n.isInResult()&&!n.ringOut){for(var a=null,s=n.leftSE,l=n.rightSE,u=[s],h=s.point,p=[];a=s,u.push(s=l),s.point!==h;)for(;;){var c=s.getAvailableLinkedEvents();if(0===c.length){var f=u[0].point,d=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===c.length){l=c[0].otherSE;break}for(var m=null,y=0,g=p.length;y<g;y++)if(p[y].point===s.point){m=y;break}if(null===m){p.push({index:u.length,point:s.point});var _=s.getLeftmostComparator(a);l=c.sort(_)[0].otherSE;break}var v=p.splice(m)[0],x=u.splice(v.index);x.unshift(x[0].otherSE),i.push(new t(x.reverse()))}i.push(new t(u))}}return i}}]),wv(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],i=1,r=this.events.length-1;i<r;i++){var o=this.events[i].point;0!==Dv(o,t,this.events[i+1].point)&&(e.push(o),t=o)}if(1===e.length)return null;0===Dv(e[0],t,e[1])&&e.shift(),e.push(e[0]);for(var n=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,l=[],u=a;u!=s;u+=n)l.push([e[u].x,e[u].y]);return l}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,i=this.events.length;e<i;e++){var r=this.events[e];Fv.compare(t,r)>0&&(t=r)}for(var o=t.segment.prevInResult(),n=o?o.prevInResult():null;;){if(!o)return null;if(!n)return o.ringOut;if(n.ringOut!==o.ringOut)return n.ringOut.enclosingRing()!==o.ringOut?o.ringOut:o.ringOut.enclosingRing();o=n.prevInResult(),n=o?o.prevInResult():null}}}]),t}(),qv=function(){function t(e){xv(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return wv(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,i=this.interiorRings.length;e<i;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),t}(),Xv=function(){function t(e){xv(this,t),this.rings=e,this.polys=this._composePolys(e)}return wv(t,[{key:"getGeom",value:function(){for(var t=[],e=0,i=this.polys.length;e<i;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],i=0,r=t.length;i<r;i++){var o=t[i];if(!o.poly)if(o.isExteriorRing())e.push(new qv(o));else{var n=o.enclosingRing();n.poly||e.push(new qv(n)),n.poly.addInterior(o)}}return e}}]),t}(),Wv=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jv.compare;xv(this,t),this.queue=e,this.tree=new yv(i),this.segments=[]}return wv(t,[{key:"process",value:function(t){var e=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),i;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var o=r,n=r,a=void 0,s=void 0;void 0===a;)null===(o=this.tree.prev(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);for(;void 0===s;)null===(n=this.tree.next(n))?s=null:void 0===n.key.consumedBy&&(s=n.key);if(t.isLeft){var l=null;if(a){var u=a.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(l=u),!a.isAnEndpoint(u)))for(var h=this._splitSafely(a,u),p=0,c=h.length;p<c;p++)i.push(h[p])}var f=null;if(s){var d=s.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(f=d),!s.isAnEndpoint(d)))for(var m=this._splitSafely(s,d),y=0,g=m.length;y<g;y++)i.push(m[y])}if(null!==l||null!==f){var _;_=null===l?f:null===f||Fv.comparePoints(l,f)<=0?l:f,this.queue.remove(e.rightSE),i.push(e.rightSE);for(var v=e.split(_),x=0,b=v.length;x<b;x++)i.push(v[x])}i.length>0?(this.tree.remove(e),i.push(t)):(this.segments.push(e),e.prev=a)}else{if(a&&s){var w=a.getIntersection(s);if(null!==w){if(!a.isAnEndpoint(w))for(var k=this._splitSafely(a,w),T=0,I=k.length;T<I;T++)i.push(k[T]);if(!s.isAnEndpoint(w))for(var S=this._splitSafely(s,w),E=0,A=S.length;E<A;E++)i.push(S[E])}}this.tree.remove(e)}return i}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var i=t.rightSE;this.queue.remove(i);var r=t.split(e);return r.push(i),void 0===t.consumedBy&&this.tree.insert(t),r}}]),t}(),Hv=new(function(){function t(){xv(this,t)}return wv(t,[{key:"run",value:function(t,e,i){Hv.type=t,Mv.reset();for(var r=[new Gv(e,!0)],o=0,n=i.length;o<n;o++)r.push(new Gv(i[o],!1));if(Hv.numMultiPolys=r.length,"difference"===Hv.type)for(var a=r[0],s=1;s<r.length;)null!==Tv(r[s].bbox,a.bbox)?s++:r.splice(s,1);if("intersection"===Hv.type)for(var l=0,u=r.length;l<u;l++)for(var h=r[l],p=l+1,c=r.length;p<c;p++)if(null===Tv(h.bbox,r[p].bbox))return[];for(var f=new yv(Fv.compare),d=0,m=r.length;d<m;d++)for(var y=r[d].getSweepEvents(),g=0,_=y.length;g<_;g++)f.insert(y[g]);for(var v=new Wv(f),x=f.size,b=f.pop();b;){var w=b.key;if(f.size===x){var k=w.segment;throw new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(k.id," ")+"[".concat(k.leftSE.point.x,", ").concat(k.leftSE.point.y,"] -> ")+"[".concat(k.rightSE.point.x,", ").concat(k.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}for(var T=v.process(w),I=0,S=T.length;I<S;I++){var E=T[I];void 0===E.consumedBy&&f.insert(E)}x=f.size,b=f.pop()}Mv.reset();var A=Zv.factory(v.segments);return new Xv(A).getGeom()}}]),t}());function Yv(t,e,i){void 0===i&&(i={});var r=Hd(t),o=Hd(e),n=function(t){for(var e=arguments,i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=e[o];return Hv.run("intersection",t,r)}(r.coordinates,o.coordinates);return 0===n.length?null:1===n.length?Md(n[0],i.properties):Od(n,i.properties)}function Kv(t,e,i){void 0===i&&(i={});var r=Hd(t),o=Hd(e),n=function(t){for(var e=arguments,i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=e[o];return Hv.run("union",t,r)}(r.coordinates,o.coordinates);return 0===n.length?null:1===n.length?Md(n[0],i.properties):Od(n,i.properties)}function Jv(t,e){var i,r,o=function(t){return Md(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e),n=(i=[],r=[],am(t,(function(t){var e=t.geometry.coordinates,o=e[0],n=e.slice(1);i.push(Md([o])),n.forEach((function(t){r.push(Md([t]))}))})),[Cd(i),Cd(r)]),a=n[0],s=n[1],l=function(t,e,i){var r=[];return r.push(t.geometry.coordinates[0]),am(e,(function(t){r.push(t.geometry.coordinates[0])})),am(i,(function(t){r.push(t.geometry.coordinates[0])})),Md(r)}(o,a=Qv(a),s=Qv(s));return l}function Qv(t){if(t.features.length<=1)return t;var e=function(t){var e=ty(),i=[];return am(t,(function(t,e){var r=hm(t);i.push({minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],geojson:t,index:e})})),e.load(i),e}(t),i=[],r={};return am(t,(function(t,o){if(r[o])return!0;for(e.remove({index:o},$v),r[o]=!0;;){var n=hm(t),a=e.search({minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]});if(a.length>0)for(var s=a.map((function(t){return r[t.index]=!0,e.remove({index:t.index},$v),t.geojson})),l=0,u=s.length;l<u;l++)t=Kv(t,s[l]);if(0===a.length)break}i.push(t)})),Cd(i)}function $v(t,e){return t.index===e.index}var tx=Object.freeze({__proto__:null,along:My,angle:function(t,e,i,r){if(void 0===r&&(r={}),!Zd(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!i)throw new Error("endPoint is required");var o=t,n=e,a=i,s=Ud(!0!==r.mercator?Qd(o,n):zy(o,n)),l=Ud(!0!==r.mercator?Qd(a,n):zy(a,n)),u=Math.abs(s-l);return!0===r.explementary?360-u:u},area:Sy,areaFactors:Ed,bbox:hm,bearing:Qd,bearingToAngle:Ud,bearingToAzimuth:Ud,bezierSpline:function(t,e){void 0===e&&(e={});for(var i=e.resolution||1e4,r=e.sharpness||.85,o=[],n=Hd(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),a=new Yd({duration:i,points:n,sharpness:r}),s=0;s<a.duration;s+=10){var l=a.pos(s);Math.floor(s/100)%2==0&&o.push([l.x,l.y])}return Ld(o,e.properties)},booleanClockwise:Zy,booleanContains:Ny,booleanOverlap:av,booleanPointInPolygon:Nm,booleanPointOnLine:Uy,circle:Jd,convertArea:function(t,e,i){if(void 0===e&&(e="meters"),void 0===i&&(i="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Ed[e];if(!r)throw new Error("invalid original units");var o=Ed[i];if(!o)throw new Error("invalid final units");return t/r*o},convertDistance:Vd,convertLength:Vd,coordAll:function(t){var e=[];return em(t,(function(t){e.push(t)})),e},coordEach:em,coordReduce:function(t,e,i,r){var o=i;return em(t,(function(t,r,n,a,s){o=0===r&&void 0===i?t:e(o,t,r,n,a,s)}),r),o},degrees2radians:Nd,degreesToRadians:Nd,distance:$d,distanceToDegrees:Fd,distanceToRadians:Bd,earthRadius:Td,factors:Id,feature:Ad,featureCollection:Cd,featureEach:rm,featureReduce:function(t,e,i){var r=i;return rm(t,(function(t,o){r=0===o&&void 0===i?t:e(r,t,o)})),r},findPoint:function(t,e){if(!Zd(e=e||{}))throw new Error("options is invalid");var i,r=e.featureIndex||0,o=e.multiFeatureIndex||0,n=e.geometryIndex||0,a=e.coordIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,i=t.features[r].geometry;break;case"Feature":s=s||t.properties,i=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=t;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":return Pd(l,s,e);case"MultiPoint":return o<0&&(o=l.length+o),Pd(l[o],s,e);case"LineString":return a<0&&(a=l.length+a),Pd(l[a],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a),Pd(l[n][a],s,e);case"MultiLineString":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),Pd(l[o][a],s,e);case"MultiPolygon":return o<0&&(o=l.length+o),n<0&&(n=l[o].length+n),a<0&&(a=l[o][n].length-a),Pd(l[o][n][a],s,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Zd(e=e||{}))throw new Error("options is invalid");var i,r=e.featureIndex||0,o=e.multiFeatureIndex||0,n=e.geometryIndex||0,a=e.segmentIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,i=t.features[r].geometry;break;case"Feature":s=s||t.properties,i=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=t;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=l.length+a-1),Ld([l[a],l[a+1]],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a-1),Ld([l[n][a],l[n][a+1]],s,e);case"MultiLineString":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a-1),Ld([l[o][a],l[o][a+1]],s,e);case"MultiPolygon":return o<0&&(o=l.length+o),n<0&&(n=l[o].length+n),a<0&&(a=l[o][n].length-a-1),Ld([l[o][n][a],l[o][n][a+1]],s,e)}throw new Error("geojson is invalid")},flatten:Cy,flattenEach:am,flattenReduce:function(t,e,i){var r=i;return am(t,(function(t,o,n){r=0===o&&0===n&&void 0===i?t:e(r,t,o,n)})),r},geomEach:om,geomReduce:nm,geometry:function(t,e,i){switch(t){case"Point":return Pd(e).geometry;case"LineString":return Ld(e).geometry;case"Polygon":return Md(e).geometry;case"MultiPoint":return zd(e).geometry;case"MultiLineString":return Dd(e).geometry;case"MultiPolygon":return Od(e).geometry;default:throw new Error(t+" is invalid")}},geometryCollection:function(t,e,i){return void 0===i&&(i={}),Ad({type:"GeometryCollection",geometries:t},e,i)},intersect:Yv,isNumber:Gd,isObject:Zd,length:Ly,lengthToDegrees:Fd,lengthToRadians:Bd,lineChunk:function(t,e,i){if(!Zd(i=i||{}))throw new Error("options is invalid");var r=i.units,o=i.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var n=[];return am(t,(function(t){o&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,i,r){var o=Ly(t,{units:i});if(o<=e)return r(t);var n=o/e;Number.isInteger(n)||(n=Math.floor(n)+1);for(var a=0;a<n;a++)r(Dy(t,e*a,e*(a+1),{units:i}))}(t,e,r,(function(t){n.push(t)}))})),Cd(n)},lineDistance:Ly,lineEach:um,lineIntersect:wy,lineReduce:function(t,e,i){var r=i;return um(t,(function(t,o,n,a){r=0===o&&void 0===i?t:e(r,t,o,n,a)})),r},lineString:Ld,lineStrings:function(t,e,i){return void 0===i&&(i={}),Cd(t.map((function(t){return Ld(t,e)})),i)},mask:Jv,midpoint:tm,multiLineString:Dd,multiPoint:zd,multiPolygon:Od,nearestPoint:Hm,nearestPointOnLine:Ty,point:Pd,pointToLineDistance:sv,points:function(t,e,i){return void 0===i&&(i={}),Cd(t.map((function(t){return Pd(t,e)})),i)},polygon:Md,polygons:function(t,e,i){return void 0===i&&(i={}),Cd(t.map((function(t){return Md(t,e)})),i)},propEach:im,propReduce:function(t,e,i){var r=i;return im(t,(function(t,o){r=0===o&&void 0===i?t:e(r,t,o)})),r},radians2degrees:jd,radiansToDegrees:jd,radiansToDistance:Rd,radiansToLength:Rd,rhumbBearing:zy,rhumbDestination:Ry,round:function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var i=Math.pow(10,e||0);return Math.round(t*i)/i},segmentEach:sm,segmentReduce:lm,tesselate:Um,transformRotate:Fy,unitsFactors:Sd,validateBBox:function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!Gd(t))throw new Error("bbox must only contain numbers")}))},validateId:function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}}),ex=6371008.8,ix=function(t,e,i){if(void 0===i&&(i=!1),isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");this.lng=+t,this.lat=+e,i||((this.lng>180||this.lng<-180)&&(this.lng=_(this.lng,-180,180)),(this.lat>90||this.lat<-90)&&(this.lat=_(this.lat,-90,90)))};ix.prototype.wrap=function(){return new ix(_(this.lng,-180,180),this.lat)},ix.prototype.toArray=function(){return[this.lng,this.lat]},ix.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},ix.prototype.distanceTo=function(t){var e=Math.PI/180,i=this.lat*e,r=t.lat*e,o=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return ex*Math.acos(Math.min(o,1))},ix.prototype.distance=function(t){var e=Pd(this.toArray());if(t){var i=Pd(this.toArray());t.lng?i=Pd(t.toArray()):t.length>1&&(i=Pd(Ty(Ld(t),e,{units:"kilometers"}).geometry.coordinates));var r=(1e3*$d(i,e,{units:"kilometers"})).toFixed(2);return parseFloat(r)}},ix.prototype.getLng=function(){return this.lng},ix.prototype.getLat=function(){return this.lat},ix.prototype.equals=function(t){var e=!1;return t.lng==this.lng&&t.lat==this.lat&&(e=!0),e},ix.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new kd(new ix(this.lng-i,this.lat-e),new ix(this.lng+i,this.lat+e))},ix.convert=function(t){if(t instanceof ix)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new ix(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new ix(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var rx=2*Math.PI*ex;function ox(t){return rx}function nx(t){return(180+t)/360}function ax(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sx(t,e){return t/ox()}function lx(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function ux(t,e){return t*ox()}var hx=function(t,e,i){void 0===i&&(i=0),this.x=+t,this.y=+e,this.z=+i};hx.fromLngLat=function(t,e){void 0===e&&(e=0);var i=ix.convert(t);return new hx(nx(i.lng),ax(i.lat),sx(e))},hx.prototype.toLngLat=function(){return new ix(360*this.x-180,lx(this.y))},hx.prototype.toAltitude=function(){return ux(this.z)},hx.prototype.meterInMercatorCoordinateUnits=function(){return 1/rx*(t=lx(this.y),1/Math.cos(t*Math.PI/180));var t};var px=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new uh({width:t,height:e}),this.positions={},this.uploaded=!1};px.prototype.getDash=function(t,e){var i=this.getKey(t,e);return this.positions[i]},px.prototype.trim=function(){var t=this.width,e=this.height=I(this.nextRow);this.image.resize({width:t,height:e})},px.prototype.getKey=function(t,e){return t.join(",")+e},px.prototype.getDashRanges=function(t,e,i){var r=[],o=t.length%2==1?-t[t.length-1]*i:0,n=t[0]*i,a=!0;r.push({left:o,right:n,isDash:a,zeroLength:0===t[0]});for(var s=t[0],l=1;l<t.length;l++){var u=t[l];r.push({left:o=s*i,right:n=(s+=u)*i,isDash:a=!a,zeroLength:0===u})}return r},px.prototype.addRoundDash=function(t,e,i){for(var r=e/2,o=-i;o<=i;o++)for(var n=this.width*(this.nextRow+i+o),a=0,s=t[a],l=0;l<this.width;l++){l/s.right>1&&(s=t[++a]);var u=Math.abs(l-s.left),h=Math.abs(l-s.right),p=Math.min(u,h),c=void 0,f=o/i*(r+1);if(s.isDash){var d=r-Math.abs(f);c=Math.sqrt(p*p+d*d)}else c=r-Math.sqrt(p*p+f*f);this.image.data[n+l]=Math.max(0,Math.min(255,c+128))}},px.prototype.addRegularDash=function(t,e){for(var i=t.length-1;i>=0;--i){var r=t[i],o=t[i+1];r.zeroLength?t.splice(i,1):o&&o.isDash===r.isDash&&(o.left=r.left,t.splice(i,1))}var n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);for(var s=this.width*this.nextRow,l=0,u=t[l],h=0;h<this.width;h++){h/u.right>1&&(u=t[++l]);var p=Math.abs(h-u.left),c=Math.abs(h-u.right),f=Math.min(p,c);this.image.data[s+h]=Math.max(0,Math.min(255,(u.isDash?f:-f)+e+128))}},px.prototype.addDash=function(t,e){var i=this.getKey(t,e);if(this.positions[i])return this.positions[i];var r="round"===e,o=r?7:0,n=2*o+1;if(this.nextRow+n>this.height)return D("LineAtlas out of space"),null;0===t.length&&t.push(1);for(var a=0,s=0;s<t.length;s++)t[s]<0&&(D("Negative value is found in line dasharray, replacing values with 0"),t[s]=0),a+=t[s];if(0!==a){var l=this.width/a,u=this.getDashRanges(t,this.width,l);r?this.addRoundDash(u,l,o):this.addRegularDash(u,"square"===e?.5*l:0)}var h=this.nextRow+o;this.nextRow+=n;var p={tl:[h,o],br:[a,0]};return this.positions[i]=p,p},da("LineAtlas",px);var cx=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};cx.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){t._triggered=!1,t._callback()}),0))},cx.prototype.remove=function(){delete this._channel,this._callback=function(){}};var fx=n.performance;function dx(t){var e=t?t.url.toString():void 0;return fx.getEntriesByName(e)}var mx=function(){this.tasks={},this.taskQueue=[],E(["process"],this),this.invoker=new cx(this.process),this.nextId=0};mx.prototype.add=function(t,e){var i,r,o,n,a=this,s=this.nextId++,l=(o=(i=e).isSymbolTile,n=(n=i.zoom)||0,"message"===(r=i.type)?0:"maybePrepare"!==r||o?"parseTile"!==r||o?"parseTile"===r&&o?300-n:"maybePrepare"===r&&o?400-n:500:200-n:100-n);if(0===l){R();try{t()}finally{}return{cancel:function(){}}}return this.tasks[s]={fn:t,metadata:e,priority:l,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:function(){delete a.tasks[s]}}},mx.prototype.process=function(){var t=this;R();try{if(this.taskQueue=this.taskQueue.filter((function(e){return!!t.tasks[e]})),!this.taskQueue.length)return;var e=this.pick();if(null===e)return;var i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}},mx.prototype.pick=function(){for(var t=null,e=1/0,i=0;i<this.taskQueue.length;i++){var r=this.tasks[this.taskQueue[i]];r.priority<e&&(e=r.priority,t=i)}if(null===t)return null;var o=this.taskQueue[t];return this.taskQueue.splice(t,1),o},mx.prototype.remove=function(){this.invoker.remove()};var yx=function(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.cancelCallbacks={},E(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=R()?t:n,this.scheduler=new mx};function gx(t,e,i){var r=_x(256*t,256*(e=Math.pow(2,i)-e-1),i),o=_x(256*(t+1),256*(e+1),i);return r[0]+","+r[1]+","+o[0]+","+o[1]}function _x(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}yx.prototype.send=function(t,e,i,r,o,n){var a=this;void 0===o&&(o=!1);var s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=n,this.callbacks[s]=i);var l=V(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!i,targetMapId:r,mustQueue:o,sourceMapId:this.mapId,data:_a(e,l)},l),{cancel:function(){i&&delete a.callbacks[s],a.target.postMessage({id:s,type:"<cancel>",targetMapId:r,sourceMapId:a.mapId})}}},yx.prototype.receive=function(t){var e=this,i=t.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if("<cancel>"===i.type){var o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o.cancel()}else if(i.mustQueue||R()){var n=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((function(){return e.processTask(r,i)}),n&&n.metadata||{type:"message"})}else this.processTask(r,i)},yx.prototype.processTask=function(t,e){var i=this;if("<response>"===e.type){var r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(va(e.error)):r(null,va(e.data)))}else{var o=V(this.globalScope)?void 0:[],n=e.hasCallback?function(e,r){delete i.cancelCallbacks[t],i.target.postMessage({id:t,type:"<response>",sourceMapId:i.mapId,error:e?_a(e):null,data:_a(r,o)},o)}:function(t){},a=va(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,a,n);else if(this.parent.getWorkerSource){var s=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,s[0],a.source)[s[1]](a,n)}else n(new Error("Could not find function "+e.type))}},yx.prototype.remove=function(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)};var vx=function(t,e,i){this.z=t,this.x=e,this.y=i,this.key=wx(0,t,t,e,i)};vx.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},vx.prototype.url=function(t,e){var i=gx(this.x,this.y,this.z),r=kx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)},vx.prototype.getTileBBox=function(){return gx(this.x,this.y,this.z)},vx.prototype.getQuadkey=function(){return kx(this.z,this.x,this.y)},vx.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new r((t.x*e-this.x)*tu,(t.y*e-this.y)*tu)},vx.prototype.getTileVec3=function(t){var e=Math.pow(2,this.z);return Du((t.x*e-this.x)*tu,(t.y*e-this.y)*tu,ux(t.z))},vx.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var xx=function(t,e){this.wrap=t,this.canonical=e,this.key=wx(t,e.z,e.z,e.x,e.y)},bx=function(t,e,i,r,o){this.overscaledZ=t,this.wrap=e,this.canonical=new vx(i,+r,+o),this.key=0===e&&t===i?this.canonical.key:wx(e,t,i,r,o)};function wx(t,e,i,r,o){var n=1<<Math.min(i,22),a=n*(o%n)+r%n;return t&&i<22&&(a+=n*n*((t<0?-2*t-1:2*t)%(1<<2*(22-i)))),16*(32*a+i)+(e-i)}function kx(t,e,i){for(var r,o="",n=t;n>0;n--)o+=(e&(r=1<<n-1)?1:0)+(i&r?2:0);return o}bx.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},bx.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new bx(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bx(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},bx.prototype.calculateScaledKey=function(t,e){if(void 0===e&&(e=!0),this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return wx(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-t;return wx(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)},bx.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},bx.prototype.children=function(t){if(this.overscaledZ>=t)return[new bx(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new bx(e,this.wrap,e,i,r),new bx(e,this.wrap,e,i+1,r),new bx(e,this.wrap,e,i,r+1),new bx(e,this.wrap,e,i+1,r+1)]},bx.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},bx.prototype.wrapped=function(){return new bx(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},bx.prototype.unwrapTo=function(t){return new bx(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},bx.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},bx.prototype.toUnwrapped=function(){return new xx(this.wrap,this.canonical)},bx.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},bx.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new hx(t.x-this.wrap,t.y))},bx.prototype.getTileVec3=function(t){return this.canonical.getTileVec3(new hx(t.x-this.wrap,t.y,t.z))},da("CanonicalTileID",vx),da("OverscaledTileID",bx,{omit:["projMatrix"]});var Tx=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}};Tx.prototype.encode=function(t){return this._stringToNumber[t]},Tx.prototype.decode=function(t){return this._numberToString[t]};var Ix=function(t,e,i,r,o){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=o},Sx={geometry:{configurable:!0}};function Ex(t,e){var i={};if(!e)return i;for(var r=function(){var t=n[o],r=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==r.length){t.layers=r,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return r.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=r;a<s.length;a+=1)i[s[a].id]=t}},o=0,n=t;o<n.length;o+=1)r();return i}Sx.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},Sx.geometry.set=function(t){this._geometry=t},Ix.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(Ix.prototype,Sx);var Ax=Ls([{name:"a_pos",type:"Int16",components:2}]),Px=function(t,e,i){this.tileID=t,this.uid=k(),this.uses=0,this.tileSize=e,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};Px.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<X.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},Px.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},Px.prototype.loadVectorData=function(t,e,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var r in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Ex(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var o=this.buckets[r];if(o instanceof Wf){if(this.hasSymbolBuckets=!0,!i)break;o.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var n in this.buckets){var a=this.buckets[n];if(a instanceof Wf&&a.hasRTLText){this.hasRTLText=!0,ps.isLoading()||ps.isLoaded()||"deferred"!==us()||hs();break}}for(var s in this.queryPadding=0,this.buckets){var l=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(s).queryRadius(l))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas)}else this.collisionBoxArray=new nl},Px.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},Px.prototype.getBucket=function(t){return this.buckets[t.id]},Px.prototype.upload=function(t){for(var e in this.buckets){var i=this.buckets[e];i.uploadPending()&&i.upload(t)}var r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new fd(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new fd(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new fd(t,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)},Px.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},Px.prototype.queryRenderedFeatures=function(t,e,i,r,o,n,a,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:a,transform:n,params:o},t,e,i):{}},Px.prototype.querySourceFeatures=function(t,e){var i=this.latestFeatureIndex;if(i&&i.rawTileData){var r=i.loadVTLayers(),o=e?e.sourceLayer:"",n=r._geojsonTileLayer||r[o];if(n)for(var a=io(e&&e.filter),s=this.tileID.canonical,l=s.z,u=s.x,h=s.y,p={z:l,x:u,y:h},c=0;c<n.length;c++){var f=n.feature(c);if(a.needGeometry){var d=ou(f,!0);if(!a.filter(new cs(this.tileID.overscaledZ),d,this.tileID.canonical))continue}else if(!a.filter(new cs(this.tileID.overscaledZ),f))continue;var m=i.getId(f,o),y=new Ix(f,l,u,h,m);y.tile=p,t.push(y)}}},Px.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Px.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Px.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var i=B(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var r=Date.now(),o=!1;if(this.expirationTime>r)o=!1;else if(e)if(this.expirationTime<e)o=!0;else{var n=this.expirationTime-e;n?this.expirationTime=r+Math.max(n,3e4):o=!0}else o=!0;o?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Px.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},Px.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var i=this.latestFeatureIndex.loadVTLayers();for(var r in this.buckets)if(e.style.hasLayer(r)){var o=this.buckets[r],n=o.layers[0].sourceLayer||"_geojsonTileLayer",a=i[n],s=t[n];if(a&&s&&0!==Object.keys(s).length){o.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});var l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(o)))}}}},Px.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},Px.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<X.now()},Px.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},Px.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=X.now()+t},Px.prototype.setDependencies=function(t,e){for(var i={},r=0,o=e;r<o.length;r+=1)i[o[r]]=!0;this.dependencies[t]=i},Px.prototype.hasDependency=function(t,e){for(var i=0,r=t;i<r.length;i+=1){var o=this.dependencies[r[i]];if(o)for(var n=0,a=e;n<a.length;n+=1)if(o[a[n]])return!0}return!1},Px.prototype.clearQueryDebugViz=function(){};var Mx=function(){this.state={},this.stateChanges={},this.deletedStates={}};Mx.prototype.updateState=function(t,e,i){var r=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},b(this.stateChanges[t][r],i),null===this.deletedStates[t])for(var o in this.deletedStates[t]={},this.state[t])o!==r&&(this.deletedStates[t][o]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][r])for(var n in this.deletedStates[t][r]={},this.state[t][r])i[n]||(this.deletedStates[t][r][n]=null);else for(var a in i)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][a]&&delete this.deletedStates[t][r][a]},Mx.prototype.removeFeatureState=function(t,e,i){if(null!==this.deletedStates[t]){var r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}},Mx.prototype.getState=function(t,e){var i=String(e),r=b({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var o=this.deletedStates[t][e];if(null===o)return{};for(var n in o)delete r[n]}return r},Mx.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},Mx.prototype.coalesceChanges=function(t,e){var i={};for(var r in this.stateChanges){this.state[r]=this.state[r]||{};var o={};for(var n in this.stateChanges[r])this.state[r][n]||(this.state[r][n]={}),b(this.state[r][n],this.stateChanges[r][n]),o[n]=this.state[r][n];i[r]=o}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var l in this.state[a])s[l]={},this.state[a][l]={};else for(var u in this.deletedStates[a]){if(null===this.deletedStates[a][u])this.state[a][u]={};else for(var h=0,p=Object.keys(this.deletedStates[a][u]);h<p.length;h+=1)delete this.state[a][u][p[h]];s[u]=this.state[a][u]}i[a]=i[a]||{},b(i[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(var c in t)t[c].setFeatureState(i,e)};var Lx=function(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]};function Cx(t,e,i,r){for(var o=0,n=Number.MAX_VALUE,a=0;a<3;a++)if(Math.abs(r[a])<1e-15){if(i[a]<t[a]||i[a]>e[a])return null}else{var s=1/r[a],l=(t[a]-i[a])*s,u=(e[a]-i[a])*s;if(l>u){var h=l;l=u,u=h}if(l>o&&(o=l),u<n&&(n=u),o>n)return null}return o}function Dx(t,e,i,r,o,n,a,s,l,u,h){var p=r-t,c=o-e,f=n-i,d=a-t,m=s-e,y=l-i,g=h[1]*y-h[2]*m,_=h[2]*d-h[0]*y,v=h[0]*m-h[1]*d,x=p*g+c*_+f*v;if(Math.abs(x)<1e-15)return null;var b=1/x,w=u[0]-t,k=u[1]-e,T=u[2]-i,I=(w*g+k*_+T*v)*b;if(I<0||I>1)return null;var S=k*f-T*c,E=T*p-w*f,A=w*c-k*p,P=(h[0]*S+h[1]*E+h[2]*A)*b;return P<0||I+P>1?null:(d*S+m*E+y*A)*b}function zx(t,e,i){return(t-e)/(i-e)}function Ox(t,e,i,r,o,n,a,s,l){var u=1<<i,h=n-r,p=a-o,c=(t+1)/u*h+r,f=(e+0)/u*p+o,d=(e+1)/u*p+o;s[0]=(t+0)/u*h+r,s[1]=f,l[0]=c,l[1]=d}Lx.prototype.getElevation=function(t,e){var i=this.toIdx(t,e);return{min:this.minimums[i],max:this.maximums[i]}},Lx.prototype.isLeaf=function(t,e){return this.leaves[this.toIdx(t,e)]},Lx.prototype.toIdx=function(t,e){return e*this.size+t};var Rx=function(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],this.dem){var e=function(t){for(var e=Math.ceil(Math.log2(t.dim/8)),i=[],r=Math.ceil(Math.pow(2,e)),o=1/r,n=function(t,e,i,r,o){var n=r?1:0,a=(t+1)*i-n,s=e*i,l=(e+1)*i-n;o[0]=t*i,o[1]=s,o[2]=a,o[3]=l},a=new Lx(r),s=[],l=0;l<r*r;l++){n(l%r,Math.floor(l/r),o,!1,s);var u=Fx(s[0],s[1],t),h=Fx(s[2],s[1],t),p=Fx(s[2],s[3],t),c=Fx(s[0],s[3],t);a.minimums.push(Math.min(u,h,p,c)),a.maximums.push(Math.max(u,h,p,c)),a.leaves.push(1)}for(i.push(a),r/=2;r>=1;r/=2){var f=i[i.length-1];a=new Lx(r);for(var d=0;d<r*r;d++){n(d%r,Math.floor(d/r),2,!0,s);var m=f.getElevation(s[0],s[1]),y=f.getElevation(s[2],s[1]),g=f.getElevation(s[2],s[3]),_=f.getElevation(s[0],s[3]),v=f.isLeaf(s[0],s[1]),x=f.isLeaf(s[2],s[1]),b=f.isLeaf(s[2],s[3]),w=f.isLeaf(s[0],s[3]),k=Math.min(m.min,y.min,g.min,_.min),T=Math.max(m.max,y.max,g.max,_.max),I=v&&x&&b&&w;a.maximums.push(T),a.minimums.push(k),a.leaves.push(T-k<=5&&I?1:0)}i.push(a)}return i}(this.dem),i=e.length-1,r=e[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(e,0,0,i,0)}};function Bx(t,e,i,r,o,n){return ki(ki(t,i,n),ki(e,r,n),o)}function Fx(t,e,i){var r=i.dim,o=g(t*r-.5,0,r-1),n=g(e*r-.5,0,r-1),a=Math.floor(o),s=Math.floor(n),l=Math.min(a+1,r-1),u=Math.min(s+1,r-1);return Bx(i.get(a,s),i.get(l,s),i.get(a,u),i.get(l,u),o-a,n-s)}Rx.prototype.raycastRoot=function(t,e,i,r,o,n,a){return void 0===a&&(a=1),Cx([t,e,-100],[i,r,this.maximums[0]*a],o,n)},Rx.prototype.raycast=function(t,e,i,r,o,n,a){if(void 0===a&&(a=1),!this.nodeCount)return null;var s=this.raycastRoot(t,e,i,r,o,n,a);if(null==s)return null;for(var l=[],u=[],h=[],p=[],c=[{idx:0,t:s,nodex:0,nodey:0,depth:0}];c.length>0;){var f=c.pop(),d=f.idx,m=f.t,y=f.nodex,g=f.nodey,_=f.depth;if(this.leaves[d]){Ox(y,g,_,t,e,i,r,h,p);var v=1<<_,x=(y+0)/v,b=(y+1)/v,w=(g+0)/v,k=(g+1)/v,T=Fx(x,w,this.dem)*a,I=Fx(b,w,this.dem)*a,S=Fx(b,k,this.dem)*a,E=Fx(x,k,this.dem)*a,A=Dx(h[0],h[1],T,p[0],h[1],I,p[0],p[1],S,o,n),P=Dx(p[0],p[1],S,h[0],p[1],E,h[0],h[1],T,o,n),M=Math.min(null!==A?A:Number.MAX_VALUE,null!==P?P:Number.MAX_VALUE);if(M!==Number.MAX_VALUE)return M;var L=Fu([],o,n,m);if(Bx(T,I,E,S,zx(L[0],h[0],p[0]),zx(L[1],h[1],p[1]))>=L[2])return m}else{for(var C=0,D=0;D<this._siblingOffset.length;D++){Ox((y<<1)+this._siblingOffset[D][0],(g<<1)+this._siblingOffset[D][1],_+1,t,e,i,r,h,p),h[2]=-100,p[2]=this.maximums[this.childOffsets[d]+D]*a;var z=Cx(h,p,o,n);if(null!=z){var O=z;l[D]=O;for(var R=!1,B=0;B<C&&!R;B++)O>=l[u[B]]&&(u.splice(B,0,D),R=!0);R||(u[C]=D),C++}}for(var F=0;F<C;F++){var U=u[F];c.push({idx:this.childOffsets[d]+U,t:l[U],nodex:(y<<1)+this._siblingOffset[U][0],nodey:(g<<1)+this._siblingOffset[U][1],depth:_+1})}}}return null},Rx.prototype._addNode=function(t,e,i){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++},Rx.prototype._construct=function(t,e,i,r,o){if(1!==t[r].isLeaf(e,i)){this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);for(var n,a=r-1,s=t[a],l=0,u=0;u<this._siblingOffset.length;u++){var h=2*e+this._siblingOffset[u][0],p=2*i+this._siblingOffset[u][1],c=s.getElevation(h,p),f=s.isLeaf(h,p),d=this._addNode(c.min,c.max,f);f&&(l|=1<<u),n||(n=d)}for(var m=0;m<this._siblingOffset.length;m++)l&1<<m||this._construct(t,2*e+this._siblingOffset[m][0],2*i+this._siblingOffset[m][1],a,n+m)}};var Ux={lkmap:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]},jx=function(t,e,i,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!1),this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"lkmap"!==i&&"terrarium"!==i)return D('"'+i+'" is not a valid encoding type. Valid types include "lkmap" and "terrarium".');this.stride=e.height;var n=this.dim=e.height-2;if(this.data=new Uint32Array(e.data.buffer),this.encoding=i||"lkmap",this.borderReady=r,!r){for(var a=0;a<n;a++)this.data[this._idx(-1,a)]=this.data[this._idx(0,a)],this.data[this._idx(n,a)]=this.data[this._idx(n-1,a)],this.data[this._idx(a,-1)]=this.data[this._idx(a,0)],this.data[this._idx(a,n)]=this.data[this._idx(a,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)],o&&this._buildQuadTree()}},Nx={tree:{configurable:!0},unpackVector:{configurable:!0}};Nx.tree.get=function(){return this._tree||this._buildQuadTree(),this._tree},jx.prototype._buildQuadTree=function(){this._tree=new Rx(this)},jx.prototype.get=function(t,e,i){void 0===i&&(i=!1);var r=new Uint8Array(this.data.buffer);i&&(t=g(t,-1,this.dim),e=g(e,-1,this.dim));var o=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackLKMap)(r[o],r[o+1],r[o+2])},jx.getUnpackVector=function(t){return Ux[t]},Nx.unpackVector.get=function(){return Ux[this.encoding]},jx.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},jx.prototype._unpackLKMap=function(t,e,i){return(256*t*256+256*e+i)/10-1e4},jx.prototype._unpackTerrarium=function(t,e,i){return 256*t+e+i/256-32768},jx.pack=function(t,e){var i=[0,0,0,0],r=jx.getUnpackVector(e),o=Math.floor((t+r[3])/r[2]);return i[2]=o%256,o=Math.floor(o/256),i[1]=o%256,o=Math.floor(o/256),i[0]=o,i},jx.prototype.getPixels=function(){return new hh({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},jx.prototype.backfillBorder=function(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var r=e*this.dim,o=e*this.dim+this.dim,n=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:r=o-1;break;case 1:o=r+1}switch(i){case-1:n=a-1;break;case 1:a=n+1}for(var s=-e*this.dim,l=-i*this.dim,u=n;u<a;u++)for(var h=r;h<o;h++)this.data[this._idx(h,u)]=t.data[this._idx(h+s,u+l)]},jx.prototype.onDeserialize=function(){this._tree&&(this._tree.dem=this)},Object.defineProperties(jx.prototype,Nx),da("DEMData",jx),da("DemMinMaxQuadTree",Rx,{omit:["dem"]});var Vx=function(t,e){this.max=t,this.onRemove=e,this.reset()};Vx.prototype.reset=function(){for(var t in this.data)for(var e=0,i=this.data[t];e<i.length;e+=1){var r=i[e];r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value)}return this.data={},this.order=[],this},Vx.prototype.add=function(t,e,i){var r=this,o=t.wrapped().key;void 0===this.data[o]&&(this.data[o]=[]);var n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((function(){r.remove(t,n)}),i)),this.data[o].push(n),this.order.push(o),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},Vx.prototype.has=function(t){return t.wrapped().key in this.data},Vx.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},Vx.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},Vx.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},Vx.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},Vx.prototype.remove=function(t,e){if(!this.has(t))return this;var i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),o=this.data[i][r];return this.data[i].splice(r,1),o.timeout&&clearTimeout(o.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this},Vx.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},Vx.prototype.filter=function(t){var e=[];for(var i in this.data)for(var r=0,o=this.data[i];r<o.length;r+=1){var n=o[r];t(n.value)||e.push(n)}for(var a=0,s=e;a<s.length;a+=1){var l=s[a];this.remove(l.value.tileID,l)}};var Gx=function(t,e,i){this.context=t;var r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};Gx.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},Gx.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},Gx.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var Zx={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},qx=function(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;var o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};qx.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},qx.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},qx.prototype.enableAttributes=function(t,e){for(var i=0;i<this.attributes.length;i++){var r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}},qx.prototype.setVertexAttribPointers=function(t,e,i){for(var r=0;r<this.attributes.length;r++){var o=this.attributes[r],n=e.attributes[o.name];void 0!==n&&t.vertexAttribPointer(n,o.components,t[Zx[o.type]],!1,this.itemSize,o.offset+this.itemSize*(i||0))}},qx.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var Xx=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};Xx.prototype.get=function(){return this.current},Xx.prototype.set=function(t){},Xx.prototype.getDefault=function(){return this.default},Xx.prototype.setDefault=function(){this.set(this.default)};var Wx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return me.transparent},e.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},e}(Xx),Hx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(Xx),Yx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(Xx),Kx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(Xx),Jx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(Xx),Qx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(Xx),$x=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(Xx),tb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(Xx),eb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(Xx),ib=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(Xx),rb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(Xx),ob=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(Xx),nb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(Xx),ab=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(Xx),sb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return me.transparent},e.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},e}(Xx),lb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(Xx),ub=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(Xx),hb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(Xx),pb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(Xx),cb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(Xx),fb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(Xx),db=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(Xx),mb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(Xx),yb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(Xx),gb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(Xx),_b=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(Xx),vb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(Xx),xb=function(t){function e(e){t.call(this,e),e.extVertexArrayObject&&(this.vao=e.extVertexArrayObject)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.gl.isWebGL2&&t===this.current&&!this.dirty||!this.gl.isWebGL2&&!this.vao||t===this.current&&!this.dirty||(this.gl.isWebGL2?this.gl.bindVertexArray(t):this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(Xx),bb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(Xx),wb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(Xx),kb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(Xx),Tb=function(t){function e(e,i){t.call(this,e),this.context=e,this.parent=i}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(Xx),Ib=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(Tb),Sb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.attachment=function(){return this.gl.DEPTH_ATTACHMENT},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,this.attachment(),e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(Tb),Eb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.attachment=function(){return this.gl.DEPTH_STENCIL_ATTACHMENT},e}(Sb),Ab=function(t,e,i,r){this.context=t,this.width=e,this.height=i;var o=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new Ib(t,o),r&&(this.depthAttachment=new Sb(t,o))};Ab.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)};var Pb=function(t,e,i){this.func=t,this.mask=e,this.range=i};Pb.ReadOnly=!1,Pb.ReadWrite=!0,Pb.disabled=new Pb(519,Pb.ReadOnly,[0,1]);var Mb=7680,Lb=function(t,e,i,r,o,n){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=o,this.pass=n};Lb.disabled=new Lb({func:519,mask:0},0,0,Mb,Mb,Mb);var Cb=function(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i};Cb.disabled=new Cb(Cb.Replace=[1,0],me.transparent,[!1,!1,!1,!1]),Cb.unblended=new Cb(Cb.Replace,me.transparent,[!0,!0,!0,!0]),Cb.alphaBlended=new Cb([1,771],me.transparent,[!0,!0,!0,!0]),Cb.alphaBlendedSRCALPHA=new Cb([770,771],me.transparent,[!0,!0,!0,!0]);var Db=1029,zb=2305,Ob=function(t,e,i){this.enable=t,this.mode=e,this.frontFace=i};Ob.disabled=new Ob(!1,Db,zb),Ob.backCCW=new Ob(!0,Db,zb),Ob.backCW=new Ob(!0,Db,2304),Ob.frontCW=new Ob(!0,1028,2304),Ob.frontCCW=new Ob(!0,1028,zb);var Rb=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Wx(this),this.clearDepth=new Hx(this),this.clearStencil=new Yx(this),this.colorMask=new Kx(this),this.depthMask=new Jx(this),this.stencilMask=new Qx(this),this.stencilFunc=new $x(this),this.stencilOp=new tb(this),this.stencilTest=new eb(this),this.depthRange=new ib(this),this.depthTest=new rb(this),this.depthFunc=new ob(this),this.blend=new nb(this),this.blendFunc=new ab(this),this.blendColor=new sb(this),this.blendEquation=new lb(this),this.cullFace=new ub(this),this.cullFaceSide=new hb(this),this.frontFace=new pb(this),this.program=new cb(this),this.activeTexture=new fb(this),this.viewport=new db(this),this.bindFramebuffer=new mb(this),this.bindRenderbuffer=new yb(this),this.bindTexture=new gb(this),this.bindVertexBuffer=new _b(this),this.bindElementBuffer=new vb(this),this.bindVertexArrayOES=(this.gl.isWebGL2||this.extVertexArrayObject)&&new xb(this),this.pixelStoreUnpack=new bb(this),this.pixelStoreUnpackPremultiplyAlpha=new wb(this),this.pixelStoreUnpackFlipY=new kb(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.gl.isWebGL2?(t.getExtension("EXT_color_buffer_float"),t.getExtension("OES_texture_float_linear")):(this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"))),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)};Rb.prototype.setDefault=function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()},Rb.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},Rb.prototype.createIndexBuffer=function(t,e){return new Gx(this,t,e)},Rb.prototype.createVertexBuffer=function(t,e,i){return new qx(this,t,e,i)},Rb.prototype.createRenderbuffer=function(t,e,i){var r=this.gl,o=r.createRenderbuffer();return this.bindRenderbuffer.set(o),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),o},Rb.prototype.createFramebuffer=function(t,e,i){return new Ab(this,t,e,i)},Rb.prototype.clear=function(t){var e=t.color,i=t.depth,r=t.stencil,o=this.gl,n=0;e&&(n|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(n|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(n|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),o.clear(n)},Rb.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},Rb.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},Rb.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},Rb.prototype.setColorMode=function(t){s(t.blendFunction,Cb.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)},Rb.prototype.unbindVAO=function(){this.bindVertexArrayOES.set(null)};var Bb=function(t){function e(e,i,r){var o=this;t.call(this),this.id=e,this._onlySymbols=r,i.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),i.on("error",(function(){o._sourceErrored=!0})),this._source=i,this._tiles={},this._cache=new Vx(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Mx}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null},e.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},e.prototype.getSource=function(){return this._source},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},e.prototype._loadTile=function(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)},e.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},e.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},e.prototype.serialize=function(){return this._source.serialize()},e.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}},e.prototype.getIds=function(){return x(this._tiles).map((function(t){return t.tileID})).sort(Fb).map((function(t){return t.key}))},e.prototype.getRenderableIds=function(t){var e=this,i=[];for(var o in this._tiles)this._isIdRenderable(+o,t)&&i.push(this._tiles[o]);return t?i.sort((function(t,i){var o=t.tileID,n=i.tileID,a=new r(o.canonical.x,o.canonical.y)._rotate(e.transform.angle),s=new r(n.canonical.x,n.canonical.y)._rotate(e.transform.angle);return o.overscaledZ-n.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):i.map((function(t){return t.tileID})).sort(Fb).map((function(t){return t.key}))},e.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},e.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},e.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")},e.prototype._reloadTile=function(t,e){var i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))},e.prototype._tileLoaded=function(t,e,i,r){if(r)return t.state="errored",void(404!==r.status?this._source.fire(new Ut(r,{tile:t})):this.update(this.transform));t.timeAdded=X.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Ft("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))},e.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),i=0;i<e.length;i++){var r=e[i];if(t.neighboringTiles&&t.neighboringTiles[r]){var o=this.getTileByID(r);n(t,o),n(o,t)}}function n(t,e){if(t.dem&&!t.dem.borderReady){t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0;var i=e.tileID.canonical.x-t.tileID.canonical.x,r=e.tileID.canonical.y-t.tileID.canonical.y,o=Math.pow(2,t.tileID.canonical.z),n=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[n]&&(t.neighboringTiles[n].backfilled=!0)))}}},e.prototype.getTile=function(t){return this.getTileByID(t.key)},e.prototype.getTileByID=function(t){return this._tiles[t]},e.prototype._retainLoadedChildren=function(t,e,i,r){for(var o in this._tiles){var n=this._tiles[o];if(!(r[o]||!n.hasData()||n.tileID.overscaledZ<=e||n.tileID.overscaledZ>i)){for(var a=n.tileID;n&&n.tileID.overscaledZ>e+1;){var s=n.tileID.scaledTo(n.tileID.overscaledZ-1);(n=this._tiles[s.key])&&n.hasData()&&(a=s)}for(var l=a;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){r[a.key]=a;break}}}},e.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(var r=t.overscaledZ-1;r>=e;r--){var o=t.scaledTo(r),n=this._getLoadedTile(o);if(n)return n}},e.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)},e.prototype.updateCacheSize=function(t,e){e=e||this._source.tileSize;var i=Math.ceil(t.width/e)+1,r=Math.ceil(t.height/e)+1,o=Math.floor(i*r*5),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(n)},e.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var i={};for(var r in this._tiles){var o=this._tiles[r];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+e),i[o.tileID.key]=o}for(var n in this._tiles=i,this._timers)clearTimeout(this._timers[n]),delete this._timers[n];for(var a in this._tiles)this._setTileReloadTimer(+a,this._tiles[a])}},e.prototype.update=function(t,i,r){var o=this;if(this.transform=t,this._sourceLoaded&&!this._paused&&!this.transform.freezeTileCoverage&&(!this.usedForTerrain||r)){var n;this.updateCacheSize(t,i),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(t){return new bx(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)})):(n=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((function(t){return o._source.hasTile(t)})))):n=[];var a=this._updateRetainedTiles(n);if(Ub(this._source.type)&&0!==n.length){for(var s={},l={},u=0,h=Object.keys(a);u<h.length;u+=1){var p=h[u],c=a[p],f=this._tiles[p];if(f&&!(f.fadeEndTime&&f.fadeEndTime<=X.now())){var d=this.findLoadedParent(c,Math.max(c.overscaledZ-e.maxOverzooming,this._source.minzoom));d&&(this._addTile(d.tileID),s[d.tileID.key]=d.tileID),l[p]=c}}var m=n[n.length-1].overscaledZ;for(var y in this._tiles){var g=this._tiles[y];if(!a[y]&&g.hasData())for(var _=g.tileID;_.overscaledZ>m;){_=_.scaledTo(_.overscaledZ-1);var v=this._tiles[_.key];if(v&&v.hasData()&&l[_.key]){a[y]=g.tileID;break}}}for(var x in s)a[x]||(this._coveredTiles[x]=!0,a[x]=s[x])}for(var b in a)this._tiles[b].clearFadeHold();for(var w=function(t,e){var i=[];for(var r in t)r in e||i.push(r);return i}(this._tiles,a),k=0,T=w;k<T.length;k+=1){var I=T[k],S=this._tiles[I];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(+I)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}},e.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)},e.prototype._updateRetainedTiles=function(t){var i={};if(0===t.length)return i;for(var r={},o=t[t.length-1].overscaledZ,n=t[0].overscaledZ,a=Math.max(n-e.maxOverzooming,this._source.minzoom),s=Math.max(n+e.maxUnderzooming,this._source.minzoom),l={},u=0,h=t;u<h.length;u+=1){var p=h[u],c=this._addTile(p);i[p.key]=p,c.hasData()||o<this._source.maxzoom&&(l[p.key]=p)}this._retainLoadedChildren(l,o,s,i);for(var f=0,d=t;f<d.length;f+=1){var m=d[f],y=this._tiles[m.key];if(!y.hasData()){if(m.canonical.z>=this._source.maxzoom){var g=m.children(this._source.maxzoom)[0],_=this.getTile(g);if(_&&_.hasData()){i[g.key]=g;continue}}else{var v=m.children(this._source.maxzoom);if(i[v[0].key]&&i[v[1].key]&&i[v[2].key]&&i[v[3].key])continue}for(var x=y.wasRequested(),b=m.overscaledZ-1;b>=a;--b){var w=m.scaledTo(b);if(r[w.key])break;if(r[w.key]=!0,!(y=this.getTile(w))&&x&&(y=this._addTile(w)),y&&(i[w.key]=w,x=y.wasRequested(),y.hasData()))break}}}return i},e.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],i=void 0,r=this._tiles[t].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);var o=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(o))break;r=o}for(var n=0,a=e;n<a.length;n+=1)this._loadedParentTiles[a[n]]=i}},e.prototype._addTile=function(t){var e=this._tiles[t.key];if(e)return e;(e=this._cache.getAndRemove(t))&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));var i=Boolean(e);return i||(e=new Px(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e?(e.uses++,this._tiles[t.key]=e,i||this._source.fire(new Ft("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null},e.prototype._setTileReloadTimer=function(t,e){var i=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((function(){i._reloadTile(t,"expired"),delete i._timers[t]}),r))},e.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},e.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+t);this._cache.reset()},e.prototype.tilesIn=function(t,e,i){var r=[],o=this.transform;if(!o)return r;for(var n in this._tiles){var a=this._tiles[n];if(i&&a.clearQueryDebugViz(),!a.holdingForFade()){var s=t.containsTile(a,o,e);s&&r.push(s)}}return r},e.prototype.getVisibleCoordinates=function(t){for(var e=this,i=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),r=0,o=i;r<o.length;r+=1){var n=o[r];n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped())}return i},e.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(Ub(this._source.type))for(var t in this._tiles){var e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=X.now())return!0}return!1},e.prototype.setFeatureState=function(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)},e.prototype.removeFeatureState=function(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)},e.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},e.prototype.setDependencies=function(t,e,i){var r=this._tiles[t];r&&r.setDependencies(e,i)},e.prototype.reloadTilesForDependencies=function(t,e){for(var i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(+i,"reloading");this._cache.filter((function(i){return!i.hasDependency(t,e)}))},e}(jt);function Fb(t,e){var i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Ub(t){return"raster"===t||"image"===t||"video"===t}Bb.maxOverzooming=10,Bb.maxUnderzooming=3;var jb=function(){},Nb={visibleDemTiles:{configurable:!0}};jb.prototype.getAtPointOrZero=function(t,e){return void 0===e&&(e=0),this.getAtPoint(t,e)||0},jb.prototype.getAtPoint=function(t,e,i){void 0===i&&(i=!0),null==e&&(e=null);var r=this._source();if(!r)return e;if(t.y<0||t.y>1)return e;var o=r.getSource().maxzoom,n=1<<o,a=Math.floor(t.x),s=t.x-a,l=new bx(o,a,o,Math.floor(s*n),Math.floor(t.y*n)),u=this.findDEMTileFor(l);if(!u||!u.dem)return e;var h=u.dem,p=1<<u.tileID.canonical.z,c=(s*p-u.tileID.canonical.x)*h.dim,f=(t.y*p-u.tileID.canonical.y)*h.dim,d=Math.floor(c),m=Math.floor(f);return(i?this.exaggeration():1)*ki(ki(h.get(d,m),h.get(d,m+1),f-m),ki(h.get(d+1,m),h.get(d+1,m+1),f-m),c-d)},jb.prototype.getAtTileOffset=function(t,e,i){var r=1<<t.canonical.z;return this.getAtPointOrZero(new hx(t.wrap+(t.canonical.x+e/tu)/r,(t.canonical.y+i/tu)/r))},jb.prototype.getForTilePoints=function(t,e,i,r){var o=this,n=Vb.create(this,t,r);return!!n&&(e.forEach((function(t){t[2]=o.exaggeration()*n.getElevationAt(t[0],t[1],i)})),!0)},jb.prototype.getMinMaxForTile=function(t){var e=this.findDEMTileFor(t);if(!e||!e.dem)return null;for(var i=e.dem.tree,r=e.tileID,o=1<<t.canonical.z-r.canonical.z,n=t.canonical.x/o-r.canonical.x,a=t.canonical.y/o-r.canonical.y,s=0,l=0;l<t.canonical.z-r.canonical.z&&!i.leaves[s];l++){n*=2,a*=2;var u=2*Math.floor(a)+Math.floor(n);s=i.childOffsets[s]+u,n%=1,a%=1}return{min:this.exaggeration()*i.minimums[s],max:this.exaggeration()*i.maximums[s]}},jb.prototype.getMinElevationBelowMSL=function(){throw new Error("Pure virtual method called.")},jb.prototype.raycast=function(t,e,i){throw new Error("Pure virtual method called.")},jb.prototype.pointCoordinate=function(t){throw new Error("Pure virtual method called.")},jb.prototype._source=function(){throw new Error("Pure virtual method called.")},jb.prototype.exaggeration=function(){throw new Error("Pure virtual method called.")},jb.prototype.findDEMTileFor=function(t){throw new Error("Pure virtual method called.")},Nb.visibleDemTiles.get=function(){throw new Error("Getter must be implemented in subclass.")},Object.defineProperties(jb.prototype,Nb);var Vb=function(t,e,i){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=i};Vb.create=function(t,e,i){var r=i||t.findDEMTileFor(e);if(r&&r.dem){var o=r.dem,n=r.tileID,a=1<<e.canonical.z-n.canonical.z;return new Vb(r,r.tileSize/tu/a,[(e.canonical.x/a-n.canonical.x)*o.dim,(e.canonical.y/a-n.canonical.y)*o.dim])}},Vb.prototype.tileCoordToPixel=function(t,e){var i=e*this._scale+this._offset[1],o=Math.floor(t*this._scale+this._offset[0]),n=Math.floor(i);return new r(o,n)},Vb.prototype.getElevationAt=function(t,e,i,r){var o=t*this._scale+this._offset[0],n=e*this._scale+this._offset[1],a=Math.floor(o),s=Math.floor(n),l=this._dem;return r=!!r,i?ki(ki(l.get(a,s,r),l.get(a,s+1,r),n-s),ki(l.get(a+1,s,r),l.get(a+1,s+1,r),n-s),o-a):l.get(a,s,r)},Vb.prototype.getElevationAtPixel=function(t,e,i){return this._dem.get(t,e,!!i)},Vb.prototype.getMeterToDEM=function(t){return(1<<this._demTile.tileID.canonical.z)*sx(1)*this._dem.stride};var Gb=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Oo(tu,16,0),this.featureIndexArray=new fl,this.promoteId=e};function Zb(t,e,i,r,o){return P(t,(function(t,n){var a=e instanceof xs?e.get(n):null;return a&&a.evaluate?a.evaluate(i,r,o):a}))}function qb(t,e){return e-t}Gb.prototype.insert=function(t,e,i,r,o,n){void 0===n&&(n=0);var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,o,n);for(var s=this.grid,l=0;l<e.length;l++){for(var u=e[l],h=[1/0,1/0,-1/0,-1/0],p=0;p<u.length;p++){var c=u[p];h[0]=Math.min(h[0],c.x),h[1]=Math.min(h[1],c.y),h[2]=Math.max(h[2],c.x),h[3]=Math.max(h[3],c.y)}h[0]<tu&&h[1]<tu&&h[2]>=0&&h[3]>=0&&s.insert(a,h[0],h[1],h[2],h[3])}},Gb.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new bp.VectorTile(new pc(this.rawTileData)).layers,this.sourceLayerCoder=new Tx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Gb.prototype.query=function(t,e,i,r){var o=this;this.loadVTLayers();var n=t.params||{},a=io(n.filter),s=t.tileResult,l=t.transform,u=s.bufferedTilespaceBounds,h=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(function(t,e,i,r){return gu(s.bufferedTilespaceGeometry,t,e,i,r)}));h.sort(qb);var p=null;l.elevation&&h.length>0&&(p=Vb.create(l.elevation,this.tileID));for(var c,f={},d=function(l){var u=h[l];if(u!==c){c=u;var d=o.featureIndexArray.get(u),m=null;o.loadMatchingFeature(f,d,a,n.layers,n.availableImages,e,i,r,(function(e,i,r,n){return void 0===n&&(n=0),m||(m=ru(e)),i.queryIntersectsFeature(s,e,r,m,o.z,t.transform,t.pixelPosMatrix,p,n)}))}},m=0;m<h.length;m++)d(m);return f},Gb.prototype.loadMatchingFeature=function(t,e,i,r,o,n,a,s,l){var u=e.featureIndex,h=e.sourceLayerIndex,p=e.layoutVertexArrayOffset,c=this.bucketLayerIDs[e.bucketIndex];if(!r||function(t,e){for(var i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(r,c)){var f=this.sourceLayerCoder.decode(h),d=this.vtLayers[f].feature(u);if(i.needGeometry){var m=ou(d,!0);if(!i.filter(new cs(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new cs(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),g=0;g<c.length;g++){var _=c[g];if(!(r&&r.indexOf(_)<0)){var v=n[_];if(v){var x={};void 0!==y&&s&&(x=s.getState(v.sourceLayer||"_geojsonTileLayer",y));var w=b({},a[_]);w.paint=Zb(w.paint,v.paint,d,x,o),w.layout=Zb(w.layout,v.layout,d,x,o);var k=!l||l(d,v,x,p);if(k){var T=new Ix(d,this.z,this.x,this.y,y);T.layer=w;var I=t[_];void 0===I&&(I=t[_]=[]),I.push({featureIndex:u,feature:T,intersectionZ:k})}}}}}},Gb.prototype.lookupSymbolFeatures=function(t,e,i,r,o,n,a,s){var l={};this.loadVTLayers();for(var u=io(o),h=0,p=t;h<p.length;h+=1)this.loadMatchingFeature(l,{bucketIndex:i,sourceLayerIndex:r,featureIndex:p[h],layoutVertexArrayOffset:0},u,n,a,s,e);return l},Gb.prototype.hasLayer=function(t){for(var e=0,i=this.bucketLayerIDs;e<i.length;e+=1)for(var r=0,o=i[e];r<o.length;r+=1)if(t===o[r])return!0;return!1},Gb.prototype.getId=function(t,e){var i=t.id;return this.promoteId&&"boolean"==typeof(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(i=Number(i)),i},da("FeatureIndex",Gb,{omit:["rawTileData","sourceLayerCoder"]});var Xb=function(t){var e={},i=[];for(var r in t){var o=t[r],n=e[r]={};for(var a in o.glyphs){var s=o.glyphs[+a];if(s&&0!==s.bitmap.width&&0!==s.bitmap.height){var l=s.metrics.localGlyph?2:1,u={x:0,y:0,w:s.bitmap.width+2*l,h:s.bitmap.height+2*l};i.push(u),n[a]=u}}}var h=zc(i),p=new uh({width:h.w||1,height:h.h||1});for(var c in t){var f=t[c];for(var d in f.glyphs){var m=f.glyphs[+d];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var y=e[c][d],g=m.metrics.localGlyph?2:1;uh.copy(m.bitmap,p,{x:0,y:0},{x:y.x+g,y:y.y+g},m.bitmap)}}}this.image=p,this.positions=e};da("GlyphAtlas",Xb);var Wb=function(t){this.tileID=new bx(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile};function Hb(t,e,i){for(var r=new cs(e),o=0,n=t;o<n.length;o+=1)n[o].recalculate(r,i)}Wb.prototype.parse=function(t,e,i,r,o){var n=this;this.status="parsing",this.data=t,this.collisionBoxArray=new nl;var a=new Tx(Object.keys(t.layers).sort()),s=new Gb(this.tileID,this.promoteId);s.bucketLayerIDs=[];var l,u,h,p,c={},f=new px(256,256),d={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:f,availableImages:i},m=e.familiesBySource[this.source];for(var y in m){var g=t.layers[y];if(g){for(var _=!1,v=!1,b=0,w=m[y];b<w.length;b+=1)"symbol"===w[b][0].type?_=!0:v=!0;if((!0!==this.isSymbolTile||_)&&(!1!==this.isSymbolTile||v)){1===g.version&&D('Vector tile source "'+this.source+'" layer "'+y+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var k=a.encode(y),T=[],I=0;I<g.length;I++){var S=g.feature(I),E=s.getId(S,y);T.push({feature:S,id:E,index:I,sourceLayerIndex:k})}for(var A=0,M=m[y];A<M.length;A+=1){var L=M[A],C=L[0];void 0!==this.isSymbolTile&&"symbol"===C.type!==this.isSymbolTile||C.minzoom&&this.zoom<Math.floor(C.minzoom)||C.maxzoom&&this.zoom>=C.maxzoom||"none"!==C.visibility&&(Hb(L,this.zoom,i),(c[C.id]=C.createBucket({index:s.bucketLayerIDs.length,layers:L,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k,sourceID:this.source,enableTerrain:this.enableTerrain})).populate(T,d,this.tileID.canonical),s.bucketLayerIDs.push(L.map((function(t){return t.id}))))}}}}f.trim();var z={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},O=P(d.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(O).length?r.send("getGlyphs",{uid:this.uid,stacks:O},(function(t,e){l||(l=t,u=e,F.call(n))}),void 0,!1,z):u={};var R=Object.keys(d.iconDependencies);R.length?r.send("getImages",{icons:R,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){l||(l=t,h=e,F.call(n))}),void 0,!1,z):h={};var B=Object.keys(d.patternDependencies);function F(){if(l)return o(l);if(u&&h&&p){var t=new Xb(u),e=new Bc(h,p);for(var r in c){var n=c[r];n instanceof Wf?(Hb(n.layers,this.zoom,i),Lf(n,u,t.positions,h,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical,this.tileZoom)):n.hasPattern&&(n instanceof jp||n instanceof $h||n instanceof Ep)&&(Hb(n.layers,this.zoom,i),n.addFeatures(d,this.tileID.canonical,e.patternPositions))}this.status="done",o(null,{buckets:x(c).filter((function(t){return!t.isEmpty()})),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:f,imageAtlas:e,glyphMap:this.returnDependencies?u:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?t.positions:null})}}B.length?r.send("getImages",{icons:B,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){l||(l=t,p=e,F.call(n))}),void 0,!1,z):p={},F.call(this)};var Yb=function(t){this.entries={},this.scheduler=t};function Kb(t,e,i){var r=JSON.stringify(t.request);return t.data&&(this.deduped.entries[r]={result:[null,t.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(function(e){var r=Lt(t.request,(function(t,r,o,n){t?e(t):r&&e(null,{vectorTile:i?void 0:new bp.VectorTile(new pc(r)),rawData:r,cacheControl:o,expires:n})}));return function(){r.cancel(),e()}}),e)}Yb.prototype.request=function(t,e,i,r){var o=this,n=this.entries[t]=this.entries[t]||{callbacks:[]};if(n.result){var a=n.result,s=a[0],l=a[1];return this.scheduler?this.scheduler.add((function(){r(s,l)}),e):r(s,l),function(){}}return n.callbacks.push(r),n.cancel||(n.cancel=i((function(i,r){n.result=[i,r];for(var a=function(){var t=l[s];o.scheduler?o.scheduler.add((function(){t(i,r)}),e):t(i,r)},s=0,l=n.callbacks;s<l.length;s+=1)a();setTimeout((function(){return delete o.entries[t]}),3e3)}))),function(){n.result||(n.callbacks=n.callbacks.filter((function(t){return t!==r})),n.callbacks.length||(n.cancel(),delete o.entries[t]))}};var Jb=function(t){function e(e,i,r,o,n){t.call(this),this.actor=e,this.layerIndex=i,this.availableImages=r,this.loadVectorData=n||Kb,this.loading={},this.loaded={},this.deduped=new Yb(e.scheduler),this.isSpriteLoaded=o,this.scheduler=e.scheduler}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.loadTile=function(t,e){var i=this,r=t.uid,o=t&&t.request,n=o&&o.collectResourceTiming,a=this.loading[r]=new Wb(t);a.abort=this.loadVectorData(t,(function(s,l){var u=!i.loading[r];if(delete i.loading[r],u||s||!l)return a.status="done",u||(i.loaded[r]=a),e(s);var h=l.rawData,p={};l.expires&&(p.expires=l.expires),l.cacheControl&&(p.cacheControl=l.cacheControl),a.vectorTile=l.vectorTile||new bp.VectorTile(new pc(h));var c=function(){a.parse(a.vectorTile,i.layerIndex,i.availableImages,i.actor,(function(t,i){if(t||!i)return e(t);var r={};if(n){var a=dx(o);a.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(a)))}e(null,b({rawTileData:h.slice(0)},i,p,r))}))};i.isSpriteLoaded?c():i.once("isSpriteLoaded",(function(){i.scheduler?i.scheduler.add(c,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):c()})),i.loaded=i.loaded||{},i.loaded[r]=a}))},e.prototype.reloadTile=function(t,e){var i=this,r=this.loaded,o=t.uid,n=this;if(r&&r[o]){var a=r[o];a.showCollisionBoxes=t.showCollisionBoxes,a.enableTerrain=!!t.enableTerrain;var s=function(t,r){var o=a.reloadCallback;o&&(delete a.reloadCallback,a.parse(a.vectorTile,n.layerIndex,i.availableImages,n.actor,o)),e(t,r)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},e.prototype.abortTile=function(t,e){var i=t.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),e()},e.prototype.removeTile=function(t,e){var i=this.loaded,r=t.uid;i&&i[r]&&delete i[r],e()},e}(jt),Qb=function(t){return"function"==typeof t},$b=function(t){return null!==t&&"object"===Vo(t)},tw=function(t){return t&&"function"==typeof t[Symbol.asyncIterator]},ew=function(t){return"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json},iw=function(t){return"undefined"!=typeof Blob&&t instanceof Blob},rw=function(t){return function(t){return"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||$b(t)&&Qb(t.tee)&&Qb(t.cancel)&&Qb(t.getReader)}(t)||function(t){return $b(t)&&Qb(t.read)&&Qb(t.pipe)&&function(t){return"boolean"==typeof t}(t.readable)}(t)},ow=function(){function t(e,i){Hn(this,t),this._fileOrBlob=e,this.bodyUsed=!1}var e,i,r;return Kn(t,[{key:"arrayBuffer",value:(r=Xo(No.mark((function t(){var e,i;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this._getFileReader(),i=e.promise,e.reader.readAsArrayBuffer(this._fileOrBlob),t.abrupt("return",i);case 3:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"text",value:(i=Xo(No.mark((function t(){var e,i;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this._getFileReader(),i=e.promise,e.reader.readAsText(this._fileOrBlob),t.abrupt("return",i);case 3:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"json",value:(e=Xo(No.mark((function t(){return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.text();case 2:return t.abrupt("return",JSON.parse(t.sent));case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"_getFileReader",value:function(){this.bodyUsed=!0;var t=new FileReader,e=new Promise((function(e,i){try{t.onerror=function(t){return i(new Error("Read error"))},t.onabort=function(){return i(new Error("Read aborted."))},t.onload=function(){return e(t.result)}}catch(t){i(t)}}));return{reader:t,promise:e}}},{key:"headers",get:function(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}},{key:"ok",get:function(){return!0}},{key:"status",get:function(){return 200}},{key:"url",get:function(){return this._fileOrBlob.name||""}}]),t}();function nw(t,e){return Promise.resolve(new ow(t,e))}function aw(t){return sw.apply(this,arguments)}function sw(){return(sw=Xo(No.mark((function t(e){var i;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="Failed to fetch resource ".concat(e.url," (").concat(e.status,"): "),t.prev=1,!e.headers.get("Content-Type").includes("application/json")){t.next=10;break}return t.t0=i,t.next=7,e.text();case 7:i=t.t0+=t.sent,t.next=11;break;case 10:i+=e.statusText;case 11:t.next=16;break;case 13:return t.prev=13,t.t1=t.catch(1),t.abrupt("return",i);case 16:return t.abrupt("return",i);case 17:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function lw(t){return uw.apply(this,arguments)}function uw(){return uw=Xo(No.mark((function t(e){var i,r,o=arguments;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:{},!iw(e)){t.next=3;break}return t.abrupt("return",nw(e,i));case 3:return e=Nn(e),t.next=6,fetch(e,i);case 6:if((r=t.sent).ok||!i.throws){t.next=13;break}return t.t0=Error,t.next=11,aw(r);case 11:throw t.t1=t.sent,new t.t0(t.t1);case 13:return t.abrupt("return",r);case 14:case"end":return t.stop()}}),t)}))),uw.apply(this,arguments)}var hw=function(){function t(){Hn(this,t)}return Kn(t,[{key:"log",value:function(){return function(t){}}},{key:"info",value:function(){return function(t){}}},{key:"warn",value:function(){return function(t){}}},{key:"error",value:function(){return function(t){}}}]),t}(),pw=function(){function t(){Hn(this,t),this.console=console}return Kn(t,[{key:"log",value:function(){for(var t,e=arguments,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o];return(t=this.console.log).bind.apply(t,[this.console].concat(r))}},{key:"info",value:function(){for(var t,e=arguments,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o];return(t=this.console.info).bind.apply(t,[this.console].concat(r))}},{key:"warn",value:function(){for(var t,e=arguments,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o];return(t=this.console.warn).bind.apply(t,[this.console].concat(r))}},{key:"error",value:function(){for(var t,e=arguments,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o];return(t=this.console.error).bind.apply(t,[this.console].concat(r))}}]),t}(),cw={CDN:"https://unpkg.com/@loaders.gl",worker:!0,log:new pw,dataType:"arraybuffer",metadata:!1};function fw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function dw(t){for(var e=arguments,i=1;i<arguments.length;i++){var r=null!=e[i]?e[i]:{};i%2?fw(Object(r),!0).forEach((function(e){Zo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fw(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var mw=function(t){return t&&"object"===Vo(t)&&t.constructor==={}.constructor},yw=function(){zn.loaders=zn.loaders||{};var t=zn.loaders;return t._state=t._state||{},t._state};function gw(t,e,i){return function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cw,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:console;if(i)for(var o in e)"object"===Vo(e[o])||i[o]||r.warn("Top-level loader option ".concat(o," not recognized"));var n=e&&e[t.id]||{},a=t.options&&t.options[t.id]||{},s=t.defaultOptions&&t.defaultOptions[t.id]||{};for(var l in n)l in a||r.warn(l in s?"".concat(t.name," loader option ").concat(t.id,".").concat(l," deprecated, use ").concat(s[l]):"".concat(t.name," loader option ").concat(t.id,".").concat(l," not recognized"))}(t,e,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),function(t,e,i){var r,o=dw({},t.options||{});return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(o,i),null===o.log&&(o.log=new hw),_w(o,((r=yw()).globalOptions=r.globalOptions||dw({},cw),r.globalOptions)),_w(o,e),o}(t,e,i)}function _w(t,e){for(var i in e)i in e&&(t[i]=mw(e[i])&&mw(t[i])?dw(dw({},t[i]),e[i]):e[i])}function vw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function xw(t){for(var e=arguments,i=1;i<arguments.length;i++){var r=null!=e[i]?e[i]:{};i%2?vw(Object(r),!0).forEach((function(e){Zo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vw(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function bw(t){if(!t)return!1;Array.isArray(t)&&(t=t[0]);var e=t.options&&t.options[t.id];return t.parseTextSync||t.parseSync||t.parse||t.parseStream||t.parseInBatches||e&&e.workerUrl}function ww(t){var e;return Array.isArray(t)&&(e=t[1],t=xw(xw({},t=t[0]),{},{options:xw(xw({},t.options),e)})),t.extension&&(t.extensions=t.extensions||t.extension,delete t.extension),Array.isArray(t.extensions)||(t.extensions=[t.extensions]),t.parseTextSync&&(t.text=!0),t.text||(t.binary=!0),t}var kw=No.mark(Tw);function Tw(t){var e,i,r,o,n,a,s=arguments;return No.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:i=void 0===(e=(s.length>1&&void 0!==s[1]?s[1]:{}).chunkSize)?262144:e,r=0,o=new TextEncoder;case 4:if(!(r<t.length)){l.next=12;break}return n=Math.min(t.length-r,i),a=t.slice(r,r+n),r+=n,l.next=10,o.encode(a);case 10:l.next=4;break;case 12:case"end":return l.stop()}}),kw)}var Iw=No.mark(Sw);function Sw(t){var e,i,r,o,n,a,s=arguments;return No.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:i=void 0===(e=(s.length>1&&void 0!==s[1]?s[1]:{}).chunkSize)?262144:e,r=0;case 3:if(!(r<t.byteLength)){l.next=14;break}return o=Math.min(t.byteLength-r,i),n=new ArrayBuffer(o),a=new Uint8Array(t,r,o),new Uint8Array(n).set(a),r+=o,l.next=12,n;case 12:l.next=3;break;case 14:case"end":return l.stop()}}),Iw)}function Ew(){return Ew=Zn(No.mark((function t(e){var i,r,o,n,a,s=arguments;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=(s.length>1&&void 0!==s[1]?s[1]:{}).chunkSize||1048576,r=0;case 3:if(!(r<e.size)){t.next=14;break}return n=e.slice(r,o=r+i),t.next=8,Gn(Aw(n));case 8:return a=t.sent,r=o,t.next=12,a;case 12:t.next=3;break;case 14:case"end":return t.stop()}}),t)}))),Ew.apply(this,arguments)}function Aw(t){return Pw.apply(this,arguments)}function Pw(){return Pw=Xo(No.mark((function t(e){return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var r=new FileReader;r.onloadend=function(e){return t(e.target.result)},r.onerror=function(t){return i(t)},r.readAsArrayBuffer(e)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),Pw.apply(this,arguments)}function Mw(t){if(On||Bn>=10){if("function"==typeof t[Symbol.asyncIterator])return t;if("function"==typeof t.getIterator)return t.getIterator()}return On?function(t){return Lw.apply(this,arguments)}(t):function(t){return Cw.apply(this,arguments)}(t)}function Lw(){return(Lw=Zn(No.mark((function t(e){var i,r,o;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.getReader(),t.prev=1;case 2:return t.next=5,Gn(i.read());case 5:if(o=(r=t.sent).value,!r.done){t.next=10;break}return t.abrupt("return");case 10:return t.next=12,o;case 12:t.next=2;break;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(1),i.releaseLock();case 19:case"end":return t.stop()}}),t,null,[[1,16]])})))).apply(this,arguments)}function Cw(){return(Cw=Zn(No.mark((function t(e){var i;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Gn(e);case 2:e=t.sent;case 3:if(null===(i=e.read())){t.next=9;break}return t.next=8,i;case 8:return t.abrupt("continue",3);case 9:if(!e._readableState.ended){t.next=11;break}return t.abrupt("return");case 11:return t.next=13,Gn(Dw(e));case 13:t.next=3;break;case 15:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Dw(t){return zw.apply(this,arguments)}function zw(){return(zw=Xo(No.mark((function t(e){return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){e.once("readable",t)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ow(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t?Tw(t,e):t instanceof ArrayBuffer?Sw(t,e):iw(t)?function(t){return Ew.apply(this,arguments)}(t,e):rw(t)?Mw(t):ew(t)?Mw(t.body):Mn(!1)}function Rw(t){return Bw.apply(this,arguments)}function Bw(){return(Bw=Xo(No.mark((function t(e){var i,r,o,n,a,s,l,u,h;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=new ArrayBuffer(0),r="",o=!0,n=!1,t.prev=4,s=Xn(e);case 6:return t.next=8,s.next();case 8:return o=(l=t.sent).done,t.next=12,l.value;case 12:if(u=t.sent,o){t.next=19;break}"string"==typeof(h=u)?r+=h:(c=h,m=void 0,f=(p=i)instanceof ArrayBuffer?new Uint8Array(p):p,d=c instanceof ArrayBuffer?new Uint8Array(c):c,(m=new Uint8Array(f.byteLength+d.byteLength)).set(f,0),m.set(d,f.byteLength),i=m);case 16:o=!0,t.next=6;break;case 19:t.next=25;break;case 21:t.prev=21,t.t0=t.catch(4),n=!0,a=t.t0;case 25:if(t.prev=25,t.prev=26,o||null==s.return){t.next=30;break}return t.next=30,s.return();case 30:if(t.prev=30,!n){t.next=33;break}throw a;case 33:return t.finish(30);case 34:return t.finish(25);case 35:return t.abrupt("return",r||i);case 36:case"end":return t.stop()}var p,c,f,d,m}),t,null,[[4,21,25,35],[26,,30,34]])})))).apply(this,arguments)}function Fw(t){return Uw.apply(this,arguments)}function Uw(){return(Uw=Xo(No.mark((function t(e){var i;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.ok){t.next=12;break}return i="fetch failed ".concat(e.status," ").concat(e.statusText),t.prev=2,t.next=5,e.text().slice(10);case 5:i+=t.sent,t.next=11;break;case 9:t.prev=9,t.t0=t.catch(2);case 11:throw new Error(i);case 12:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}var jw="Cannot convert supplied data type";function Nw(t,e){return ew(t)?e=e||t.url:iw(e)&&(e=e.name),"string"==typeof e?e.replace(/\?.*/,""):e}function Vw(t,e){if(e.text&&"string"==typeof t)return t;if(t instanceof ArrayBuffer){var i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)||(n=t)&&"object"===Vo(n)&&n.isBuffer){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);var r=t.buffer,o=t.byteLength||t.length;return 0===t.byteOffset&&o===r.byteLength||(r=r.slice(t.byteOffset,t.byteOffset+o)),r}var n;throw new Error(jw)}function Gw(t,e){return Zw.apply(this,arguments)}function Zw(){return Zw=Xo(No.mark((function t(e,i){var r,o;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:if(r=(e=t.sent)instanceof ArrayBuffer||ArrayBuffer.isView(e),"string"!=typeof e&&!r){t.next=6;break}return t.abrupt("return",Vw(e,i));case 6:if(!iw(e)){t.next=10;break}return t.next=9,nw(e);case 9:e=t.sent;case 10:if(!ew(e)){t.next=24;break}return o=e,t.next=14,Fw(o);case 14:if(!i.binary){t.next=20;break}return t.next=17,o.arrayBuffer();case 17:t.t0=t.sent,t.next=23;break;case 20:return t.next=22,o.text();case 22:t.t0=t.sent;case 23:return t.abrupt("return",t.t0);case 24:if(rw(e)&&(e=Ow(e)),!((n=e)&&"function"==typeof n[Symbol.iterator]||tw(e))){t.next=27;break}return t.abrupt("return",Rw(e));case 27:throw new Error(jw);case 28:case"end":return t.stop()}var n}),t)}))),Zw.apply(this,arguments)}function qw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function Xw(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||(t=function(t){for(var e=arguments,i=1;i<arguments.length;i++){var r=null!=e[i]?e[i]:{};i%2?qw(Object(r),!0).forEach((function(e){Zo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qw(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({fetch:t.fetch||lw},t),Array.isArray(t.loaders)||(t.loaders=null),t)}function Ww(t,e){if(!e&&!Array.isArray(t))return t;var i;if(t&&(i=Array.isArray(t)?t:[t]),e&&e.loaders){var r=Array.isArray(e.loaders)?e.loaders:[e.loaders];i=i?[].concat(Qn(i),Qn(r)):r}return i&&i.length?i:null}var Hw=new Map,Yw=0;function Kw(t){(0,t.resolve)(t.data)}var Jw=function(){function t(e){var i=e.source,r=e.name,o=void 0===r?"web-worker-".concat(Yw++):r,n=e.onMessage;Hn(this,t);var a=function(t){if(t.startsWith("url(")&&t.endsWith(")")){var e=t.match(/^url\((.*)\)$/)[1];if(e&&!e.startsWith("http"))return e;t=function(t){return"try {\n  importScripts('".concat(t,"');\n} catch (error) {\n  console.error(error);\n}")}(e)}var i=Hw.get(t);if(!i){var r=new Blob([t],{type:"application/javascript"});i=URL.createObjectURL(r),Hw.set(t,i)}return i}(i);this.worker=new Worker(a,{name:o}),this.name=o,this.onMessage=n||Kw}var e;return Kn(t,[{key:"process",value:(e=Xo(No.mark((function t(e){var i=this;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,r){i.worker.onmessage=function(e){return i.onMessage({worker:i.worker,data:e.data,resolve:t,reject:r})},i.worker.onerror=function(t){var e="".concat(i.name,": WorkerThread.process() failed");t.message&&(e+=" ".concat(t.message," ").concat(t.filename,":").concat(t.lineno,":").concat(t.colno));var o=new Error(e);r(o)};var o=An(e);i.worker.postMessage(e,o)})));case 1:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})},{key:"destroy",value:function(){this.worker.terminate(),this.worker=null}}]),t}(),Qw=function(){function t(e){var i=e.source,r=e.name,o=void 0===r?"unnamed":r,n=e.maxConcurrency,a=void 0===n?1:n,s=e.onMessage,l=e.onDebug,u=void 0===l?function(){}:l;Hn(this,t),this.source=i,this.name=o,this.maxConcurrency=a,this.onMessage=s,this.onDebug=u,this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1}var e;return Kn(t,[{key:"destroy",value:function(){this.idleQueue.forEach((function(t){return t.destroy()})),this.isDestroyed=!0}},{key:"process",value:(e=Xo(No.mark((function t(e,i){var r=this;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){r.jobQueue.push({data:e,jobName:i,resolve:t,reject:o}),r._startQueuedJob()})));case 1:case"end":return t.stop()}}),t)}))),function(t,i){return e.apply(this,arguments)})},{key:"_startQueuedJob",value:function(){var t=this;if(this.jobQueue.length){var e=this._getAvailableWorker();if(e){var i=this.jobQueue.shift();this.onDebug({message:"processing",worker:e.name,job:i.jobName,backlog:this.jobQueue.length}),e.process(i.data).then((function(t){return i.resolve(t)})).catch((function(t){return i.reject(t)})).then((function(){return t._onWorkerDone(e)}))}}}},{key:"_onWorkerDone",value:function(t){this.isDestroyed?t.destroy():(this.idleQueue.push(t),this._startQueuedJob())}},{key:"_getAvailableWorker",value:function(){if(this.idleQueue.length>0)return this.idleQueue.shift();if(this.count<this.maxConcurrency){this.count++;var t="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new Jw({source:this.source,onMessage:this.onMessage,name:t})}return null}}]),t}(),$w=function(){function t(e){var i=e.maxConcurrency,r=void 0===i?5:i,o=e.onMessage,n=e.onDebug,a=void 0===n?function(){}:n;Hn(this,t),this.maxConcurrency=r,this.onMessage=o,this.onDebug=a,this.workerPools=new Map}var e;return Kn(t,null,[{key:"isSupported",value:function(){return"undefined"!=typeof Worker}}]),Kn(t,[{key:"setProps",value:function(t){"maxConcurrency"in t&&(this.maxConcurrency=t.maxConcurrency),"onDebug"in t&&(this.onDebug=t.onDebug)}},{key:"destroy",value:function(){this.workerPools.forEach((function(t){return t.destroy()}))}},{key:"process",value:(e=Xo(No.mark((function t(e,i,r){var o;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this._getWorkerPool(e,i),t.abrupt("return",o.process(r));case 2:case"end":return t.stop()}}),t,this)}))),function(t,i,r){return e.apply(this,arguments)})},{key:"_getWorkerPool",value:function(t,e){var i=this.workerPools.get(e);return i||(i=new Qw({source:t,name:e,onMessage:this.onMessage,maxConcurrency:this.maxConcurrency,onDebug:this.onDebug}),this.workerPools.set(e,i)),i}}]),t}();function tk(t){if(Fn&&(t=Fn(t)),t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.buffer;if("string"==typeof t){var e=t;return(new TextEncoder).encode(e).buffer}return Mn(!1)}var ek="2.2.8";function ik(t,e,i,r){if(!$w.isSupported())return!1;var o=i&&i[t.id];return!!("local"===i.worker&&o&&o.localWorkerUrl||i.worker&&o&&o.workerUrl)&&(!t.useWorker||t.useWorker(i))}function rk(t,e,i,r){var o=i&&i[t.id]||{},n="url(".concat("local"===(i||{}).worker?o.localWorkerUrl:o.workerUrl,")"),a=t.name,s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};return t.maxConcurrency&&(e.maxConcurrency=t.maxConcurrency),t.onDebug&&(e.onDebug=t.onDebug),ok||(ok=new $w({onMessage:nk})),ok.setProps(e),ok}(i);i=JSON.parse(JSON.stringify(i));var l=t.version!==ek?"(core version ".concat(ek,")"):"";return s.process(n,"".concat(a,"-worker@").concat(t.version).concat(l),{arraybuffer:tk(e),options:i,source:"loaders.gl@".concat(ek),type:"parse"})}var ok=null;function nk(t){return ak.apply(this,arguments)}function ak(){return(ak=Xo(No.mark((function t(e){var i,r,o,n,a;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.worker,o=e.resolve,n=e.reject,t.t0=(r=e.data).type,t.next="done"===t.t0?4:"parse"===t.t0?6:"error"===t.t0?17:19;break;case 4:return o(r.result),t.abrupt("break",19);case 6:return t.prev=6,t.next=9,vk(r.arraybuffer,r.options,r.url);case 9:i.postMessage({type:"parse-done",id:r.id,result:a=t.sent},An(a)),t.next=16;break;case 13:t.prev=13,t.t1=t.catch(6),i.postMessage({type:"parse-error",id:r.id,message:t.t1.message});case 16:return t.abrupt("break",19);case 17:return n(r.message),t.abrupt("break",19);case 19:case"end":return t.stop()}}),t,null,[[6,13]])})))).apply(this,arguments)}var sk=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,lk=/^([-\w.]+\/[-\w.+]+)/;function uk(t){if("string"!=typeof t)return"";var e=t.match(sk);return e?e[1]:""}var hk=/\?.*/;function pk(t){return t.replace(hk,"")}function ck(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return fk(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fk(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,n=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw n}}}}function fk(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}var dk=/\.([^.]+)$/;function mk(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i&&!Array.isArray(i))return ww(i);!function(t){var e,i=ck(t);try{for(i.s();!(e=i.n()).done;)ww(e.value)}catch(t){i.e(t)}finally{i.f()}}(i=[].concat(Qn(i||[]),Qn(((e=yw()).loaderRegistry=e.loaderRegistry||[],e.loaderRegistry))));var n=function(t){if(ew(t)){var e=function(t){if("string"!=typeof t)return"";var e=t.match(lk);return e?e[1]:t}(t.headers.get("content-type")),i=uk(t.url);return{url:pk(t.url||""),type:e||i||null}}return iw(t)?{url:pk(t.url||""),type:t.type||""}:"string"==typeof t?{url:pk(t),type:uk(t)}:{url:"",type:""}}(t),a=n.url,s=n.type,l=function(t,e){var i=e&&e.match(dk),r=i&&i[1];return r&&function(t,e){e=e.toLowerCase();var i,r=ck(t);try{for(r.s();!(i=r.n()).done;){var o,n=i.value,a=ck(n.extensions);try{for(a.s();!(o=a.n()).done;)if(o.value.toLowerCase()===e)return n}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}return null}(t,r)}(i,a||o.url);if(l=l||function(t,e){var i,r=ck(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.mimeTypes&&o.mimeTypes.includes(e))return o;if(e==="application/x.".concat(o.id))return o}}catch(t){r.e(t)}finally{r.f()}return null}(i,s),l=l||function(t,e){if(!e)return null;var i,r=ck(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;if("string"==typeof e){if(yk(e,o))return o}else if(ArrayBuffer.isView(e)){if(gk(e.buffer,e.byteOffset,o))return o}else if(e instanceof ArrayBuffer&&gk(e,0,o))return o}}catch(t){r.e(t)}finally{r.f()}return null}(i,t),!l&&!r.nothrow)throw new Error(function(t,e){var i="No valid loader found";return t&&(i+=' data: "'.concat(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?_k(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?_k(t,0,e):""}(t),'"')),e&&(i+=" for ".concat(e)),i}(t,a));return l}function yk(t,e){return e.testText&&e.testText(t)}function gk(t,e,i){switch(Array.isArray(i.test)?"array":Vo(i.test)){case"function":return i.test(t,i);case"string":case"array":return(Array.isArray(i.test)?i.test:[i.test]).some((function(i){return i===_k(t,e,i.length)}));default:return!1}}function _k(t,e,i){if(t.byteLength<=e+i)return"";for(var r=new DataView(t),o="",n=0;n<i;n++)o+=String.fromCharCode(r.getUint8(e+n));return o}function vk(t,e,i,r){return xk.apply(this,arguments)}function xk(){return(xk=Xo(No.mark((function t(e,i,r,o){var n,a,s,l;return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||Array.isArray(i)||bw(i)||(o=r,r=i,i=null),n="","string"==typeof o&&(n=o,o=null),r=r||{},a=Nw(e,n),s=Ww(i,o),l=mk(e,s,r,{url:a})){t.next=9;break}return t.abrupt("return",null);case 9:return r=gw(l,r,a),o=Xw({url:a,parse:vk,loaders:s},r,o),t.next=13,bk(l,e,r,o);case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function bk(t,e,i,r){return wk.apply(this,arguments)}function wk(){return(wk=Xo(No.mark((function t(e,i,r,o){return No.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Ln(e),t.next=3,Gw(i,e);case 3:if(i=t.sent,!e.parseTextSync||"string"!=typeof i){t.next=7;break}return r.dataType="text",t.abrupt("return",e.parseTextSync(i,r,o,e));case 7:if(!ik(e,0,r)){t.next=11;break}return t.next=10,rk(e,i,r);case 10:case 14:return t.abrupt("return",t.sent);case 11:if(!e.parse){t.next=15;break}return t.next=14,e.parse(i,r,o,e);case 15:return t.abrupt("return",Mn(!1));case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t.ARRAY_TYPE=Iu,t.AUTH_ERR_MSG=Q,t.Aabb=$u,t.Actor=yx,t.CanonicalTileID=vx,t.Color=me,t.ColorMode=Cb,t.Context=Rb,t.CullFaceMode=Ob,t.DEMData=jx,t.DataConstantProperty=bs,t.DedupedRequest=Yb,t.DepthMode=Pb,t.DepthStencilAttachment=Eb,t.EStatsType=nd,t.EXTENT=tu,t.Elevation=jb,t.ErrorEvent=Ut,t.EvaluationParameters=cs,t.Event=Ft,t.Evented=jt,t.FILE_API=p,t.FeatureIndex=Gb,t.Frustum=Qu,t.GLBLoader=ua,t.GLTFScenegraph=na,t.GlyphManager=yf,t.ImageLoader=En,t.ImagePoolLoader=function(t,e){this.uid=t,this.state=e||"unloaded"},t.ImagePosition=Oc,t.LKTurf=tx,t.LineAtlas=px,t.LngLat=ix,t.LngLatBounds=kd,t.LocalGlyphMode=mf,t.MAX_SAFE_INTEGER=l,t.MercatorCoordinate=hx,t.ONE_EM=$p,t.OverscaledTileID=bx,t.Properties=Ss,t.RGBAImage=hh,t.Ray=Ju,t.RequestManager=$,t.ResourceType=It,t.SegmentVector=$l,t.SourceCache=Bb,t.StatisticsTool=sd,t.StencilMode=Lb,t.StructArrayLayout1ui2=il,t.StructArrayLayout2f1f2i16=Ws,t.StructArrayLayout2i4=Ds,t.StructArrayLayout2ui4=el,t.StructArrayLayout3f12=Gs,t.StructArrayLayout3ui6=Ys,t.StructArrayLayout4i8=zs,t.StructArrayLayout8f32=Ns,t.Texture=fd,t.Tile=Px,t.Transitionable=ms,t.Uniform1f=Al,t.Uniform1i=El,t.Uniform2f=Pl,t.Uniform3f=Ml,t.Uniform4f=Ll,t.UniformColor=Cl,t.UniformMatrix3f=Rl,t.UniformMatrix4f=zl,t.UnwrappedTileID=xx,t.ValidationError=Vt,t.VectorTileWorkerSource=Jb,t.WorkerTile=Wb,t.WritingMode=Fc,t.ZoomHistory=xa,t.add=zu,t.addDynamicAttributes=Gf,t.along=My,t.altitudeFromMercatorZ=ux,t.area$1=Sy,t.asyncAll=v,t.bearing=Qd,t.bezier=m,t.bindAll=E,t.booleanClockwise=Zy,t.booleanContains=Ny,t.booleanOverlap=av,t.booleanPointInPolygon=Nm,t.booleanPointOnLine=Uy,t.bufferConvexPolygon=function(t,e){for(var i=[],r=0;r<t.length;r++){var o=_(r-1,-1,t.length-1),n=_(r+1,-1,t.length-1),a=t[r],s=t[n],l=t[o].sub(a).unit(),u=s.sub(a).unit(),h=u.angleWithSep(l.x,l.y),p=l.add(u).unit().mult(-1*e/Math.sin(h/2));i.push(a.add(p))}return i},t.cacheEntryPossiblyAdded=function(t){++Tt>bt&&(t.getActor().send("enforceCacheSizeLimit",xt),Tt=0)},t.circle=Jd,t.clamp=g,t.clearTileCache=function(t){var e=n.caches.delete(vt);t&&e.catch(t).then((function(){return t()}))},t.clipLine=lf,t.clone=function(t){var e=new Iu(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=L,t.collisionCircleLayout=Qp,t.config=a,t.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.create=function(){var t=new Iu(16);return Iu!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=Su,t.create$2=Mu,t.create$3=Hu,t.createExpression=Vr,t.createFilter=io,t.createLayout=Ls,t.createStyleLayer=function(t){return"custom"===t.type?new _d(t):new wd[t.type](t)},t.cross=Nu,t.deepEqual=s,t.degToRad=c,t.deserialize=Ex,t.distance=$d,t.div=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t},t.dot=ju,t.ease=y,t.easeCubicInOut=d,t.emitValidationErrors=zo,t.endsWith=A,t.enforceCacheSizeLimit=function(t){wt(),st&&st.then((function(e){e.keys().then((function(i){for(var r=0;r<i.length-t;r++)e.delete(i[r])}))}))},t.evaluateSizeForFeature=ic,t.evaluateSizeForZoom=rc,t.evaluateVariableOffset=Mf,t.evented=ls,t.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},t.exactEquals$1=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},t.exported=X,t.exported$1=W,t.extend=b,t.featureCollection=Cd,t.filterObject=M,t.flatten=Cy,t.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},t.fromQuat=function(t,e){var i=e[0],r=e[1],o=e[2],n=e[3],a=i+i,s=r+r,l=o+o,u=i*a,h=r*a,p=r*s,c=o*a,f=o*s,d=o*l,m=n*a,y=n*s,g=n*l;return t[0]=1-p-d,t[1]=h+g,t[2]=c-y,t[3]=0,t[4]=h-g,t[5]=1-u-d,t[6]=f+m,t[7]=0,t[8]=c+y,t[9]=f-m,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.fromRotation=function(t,e){var i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.fromRotationTranslationScale=function(t,e,i,r){var o=e[0],n=e[1],a=e[2],s=e[3],l=o+o,u=n+n,h=a+a,p=o*l,c=o*u,f=o*h,d=n*u,m=n*h,y=a*h,g=s*l,_=s*u,v=s*h,x=r[0],b=r[1],w=r[2];return t[0]=(1-(d+y))*x,t[1]=(c+v)*x,t[2]=(f-_)*x,t[3]=0,t[4]=(c-v)*b,t[5]=(1-(p+y))*b,t[6]=(m+g)*b,t[7]=0,t[8]=(f+_)*w,t[9]=(m-g)*w,t[10]=(1-(p+d))*w,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t},t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.furthestTileCorner=function(t){var e=Math.round((t+45+360)%360/90)%4;return f[e]},t.getAABBPointSquareDist=function(t,e,i){for(var r=0,o=0;o<2;++o){var n=i?i[o]:0;t[o]>n&&(r+=(t[o]-n)*(t[o]-n)),e[o]<n&&(r+=(n-e[o])*(n-e[o]))}return r},t.getAnchorAlignment=Kc,t.getAnchorJustification=Cf,t.getArrayBuffer=Lt,t.getBounds=function(t){for(var e=1/0,i=1/0,o=-1/0,n=-1/0,a=0,s=t;a<s.length;a+=1){var l=s[a];e=Math.min(e,l.x),i=Math.min(i,l.y),o=Math.max(o,l.x),n=Math.max(n,l.y)}return{min:new r(e,i),max:new r(o,n)}},t.getImage=Ot,t.getJSON=function(t,e){return Mt(b(t,{type:"json"}),e)},t.getMapSessionAPI=gt,t.getPerformanceMeasurement=dx,t.getRTLTextPluginStatus=us,t.getRandomId=function(t){void 0===t&&(t=6);for(var e=(new Date).getTime().toString(),i=t,r="",o="",n=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F","G","H","I","G","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"),a=new Array("A","B","C","D","E","F","G","H","I","G","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",0,1,2,3,4,5,6,7,8,9),s=0;s<i;s++)o+=a[Math.floor(32*Math.random())];for(var l=0;l<i;l++)r+=n[Math.floor(32*Math.random())];return r.length!=i&&createCode(),r+e+o},t.getReferrer=Pt,t.getUrl=function(t){var e=new n.Request(t),i=e.url;return e=null,i},t.getVideo=function(t,e){var i,r,o=n.document.createElement("video");o.muted=!0,o.onloadstart=function(){e(null,o)};for(var a=0;a<t.length;a++){var s=n.document.createElement("source");i=t[a],r=void 0,(r=n.document.createElement("a")).href=i,(r.protocol!==n.document.location.protocol||r.host!==n.document.location.host)&&(o.crossOrigin="Anonymous"),s.src=t[a],o.appendChild(s)}return{cancel:function(){}}},t.identity=Eu,t.identity$1=Yu,t.intersect=Yv,t.invert=function(t,e){var i=e[0],r=e[1],o=e[2],n=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],p=e[9],c=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15],_=i*s-r*a,v=i*l-o*a,x=i*u-n*a,b=r*l-o*s,w=r*u-n*s,k=o*u-n*l,T=h*m-p*d,I=h*y-c*d,S=h*g-f*d,E=p*y-c*m,A=p*g-f*m,P=c*g-f*y,M=_*P-v*A+x*E+b*S-w*I+k*T;return M?(t[0]=(s*P-l*A+u*E)*(M=1/M),t[1]=(o*A-r*P-n*E)*M,t[2]=(m*k-y*w+g*b)*M,t[3]=(c*w-p*k-f*b)*M,t[4]=(l*S-a*P-u*I)*M,t[5]=(i*P-o*S+n*I)*M,t[6]=(y*x-d*k-g*v)*M,t[7]=(h*k-c*x+f*v)*M,t[8]=(a*A-s*S+u*T)*M,t[9]=(r*S-i*A-n*T)*M,t[10]=(d*w-m*x+g*_)*M,t[11]=(p*x-h*w-f*_)*M,t[12]=(s*I-a*E-l*T)*M,t[13]=(i*E-r*I+o*T)*M,t[14]=(m*v-d*b-y*_)*M,t[15]=(h*b-p*v+c*_)*M,t):null},t.isLKMapURL=tt,t.isMapAuthenticated=function(t){return _t.has(t)},t.latFromMercatorY=lx,t.len=Xu,t.length=Cu,t.length$1=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},t.length$2=Ly,t.lineIntersect=wy,t.lineString=Ld,t.loadVectorTile=Kb,t.makeRequest=Mt,t.mask=Jv,t.members=rd,t.mercatorXfromLng=nx,t.mercatorYfromLat=ax,t.mercatorZfromAltitude=sx,t.midpoint=tm,t.mul=Pu,t.mul$1=qu,t.multiPolygon=Od,t.multiply=Au,t.multiply$1=Ru,t.nearestPoint=Hm,t.nearestPointOnLine=Ty,t.nextPowerOfTwo=I,t.normalize=Uu,t.normalize$1=function(t,e){var i=e[0],r=e[1],o=e[2],n=e[3],a=i*i+r*r+o*o+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=i*a,t[1]=r*a,t[2]=o*a,t[3]=n*a,t},t.number=ki,t.ortho=function(t,e,i,r,o,n,a){var s=1/(e-i),l=1/(r-o),u=1/(n-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+i)*s,t[13]=(o+r)*l,t[14]=(a+n)*u,t[15]=1,t},t.parse=vk,t.pbf=pc,t.perspective=function(t,e,i,r,o){var n,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(t[10]=(o+r)*(n=1/(r-o)),t[14]=2*o*r*n):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){for(var i={},r=0;r<e.length;r++){var o=e[r];o in t&&(i[o]=t[o])}return i},t.plugin=ps,t.point=Pd,t.pointGeometry=r,t.pointToLineDistance=sv,t.polygon=Md,t.polygonIntersectsBox=gu,t.polygonIntersectsPolygon=su,t.polygonizeBounds=function(t,e,i,o){void 0===i&&(i=0),void 0===o&&(o=!0);var n=new r(i,i),a=t.sub(n),s=e.add(n),l=[a,new r(s.x,a.y),s,new r(a.x,s.y)];return o&&l.push(a),l},t.posAttributes=Ax,t.postMapLoadEvent=mt,t.postTurnstileEvent=ft,t.potpack=zc,t.prevPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},t.radToDeg=function(t){return t*h},t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.registerForPluginStateChange=function(t){return t({pluginStatus:os,pluginURL:ns}),ls.on("pluginStateChange",t),t},t.removeAuthState=function(t){_t.delete(t)},t.renderColorRamp=ch,t.replaceRequestAK=function(t){var e="?";return t.indexOf("?")>-1&&(e="&"),t+e+"ak="+a.USER_AK},t.rotateX=function(t,e,i){var r=Math.sin(i),o=Math.cos(i),n=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=e[9],p=e[10],c=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=n*o+u*r,t[5]=a*o+h*r,t[6]=s*o+p*r,t[7]=l*o+c*r,t[8]=u*o-n*r,t[9]=h*o-a*r,t[10]=p*o-s*r,t[11]=c*o-l*r,t},t.rotateX$1=Ku,t.rotateY=function(t,e,i){var r=Math.sin(i),o=Math.cos(i),n=e[0],a=e[1],s=e[2],l=e[3],u=e[8],h=e[9],p=e[10],c=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*o-u*r,t[1]=a*o-h*r,t[2]=s*o-p*r,t[3]=l*o-c*r,t[8]=n*r+u*o,t[9]=a*r+h*o,t[10]=s*r+p*o,t[11]=l*r+c*o,t},t.rotateZ=function(t,e,i){var r=Math.sin(i),o=Math.cos(i),n=e[0],a=e[1],s=e[2],l=e[3],u=e[4],h=e[5],p=e[6],c=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*o+u*r,t[1]=a*o+h*r,t[2]=s*o+p*r,t[3]=l*o+c*r,t[4]=u*o-n*r,t[5]=h*o-a*r,t[6]=p*o-s*r,t[7]=c*o-l*r,t},t.rotateZ$1=function(t,e,i){i*=.5;var r=e[0],o=e[1],n=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=r*l+o*s,t[1]=o*l-r*s,t[2]=n*l+a*s,t[3]=a*l-n*s,t},t.scale=function(t,e,i){var r=i[0],o=i[1],n=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},t.scale$2=Bu,t.scaleAndAdd=Fu,t.set=function(t,e,i,r){return t[0]=e,t[1]=i,t[2]=r,t},t.set$1=function(t,e,i,r,o){return t[0]=e,t[1]=i,t[2]=r,t[3]=o,t},t.setCacheLimits=function(t,e){xt=t,bt=e},t.setRTLTextPlugin=function(t,e,i){if(void 0===i&&(i=!1),os===ts||os===es||os===is)throw new Error("setRTLTextPlugin cannot be called multiple times.");ns=X.resolveURL(t),os=ts,rs=e,ss(),i||hs()},t.smoothstep=function(t,e,i){return(i=g((i-t)/(e-t),0,1))*i*(3-2*i)},t.spec=Nt,t.storeAuthState=function(t,e){e?_t.add(t):_t.delete(t)},t.sub=Zu,t.subtract=Ou,t.symbolSize=oc,t.tesselate=Um,t.transformMat3=function(t,e,i){var r=e[0],o=e[1],n=e[2];return t[0]=r*i[0]+o*i[3]+n*i[6],t[1]=r*i[1]+o*i[4]+n*i[7],t[2]=r*i[2]+o*i[5]+n*i[8],t},t.transformMat4=function(t,e,i){var r=e[0],o=e[1],n=e[2],a=i[3]*r+i[7]*o+i[11]*n+i[15];return t[0]=(i[0]*r+i[4]*o+i[8]*n+i[12])/(a=a||1),t[1]=(i[1]*r+i[5]*o+i[9]*n+i[13])/a,t[2]=(i[2]*r+i[6]*o+i[10]*n+i[14])/a,t},t.transformMat4$1=Wu,t.transformQuat=Vu,t.transformRotate=Fy,t.translate=function(t,e,i){var r,o,n,a,s,l,u,h,p,c,f,d,m=i[0],y=i[1],g=i[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],p=e[8],c=e[9],f=e[10],d=e[11],t[0]=r=e[0],t[1]=o,t[2]=n,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=p,t[9]=c,t[10]=f,t[11]=d,t[12]=r*m+s*y+p*g+e[12],t[13]=o*m+l*y+c*g+e[13],t[14]=n*m+u*y+f*g+e[14],t[15]=a*m+h*y+d*g+e[15]),t},t.triggerPluginCompletionEvent=as,t.uniqueId=k,t.validateCustomStyleLayer=function(t){var e=[],i=t.id;return void 0===i&&e.push({message:"layers."+i+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+i+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+i+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateFog=Lo,t.validateLight=Mo,t.validateStyle=Po,t.values=x,t.vectortile_emg=bp,t.warnOnce=D,t.window=n,t.wrap=_})),r(0,(function(t){function e(t){var i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var r="[",o=0,n=t;o<n.length;o+=1)r+=e(n[o])+",";return r+"]"}for(var a=Object.keys(t).sort(),s="{",l=0;l<a.length;l++)s+=JSON.stringify(a[l])+":"+e(t[a[l]])+",";return s+"}"}function i(i){for(var r="",o=0,n=t.refProperties;o<n.length;o+=1)r+="/"+e(i[n[o]]);return r}var r=function(t){this.keyCache={},t&&this.replace(t)};r.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},r.prototype.update=function(e,r){for(var o=this,n=0,a=e;n<a.length;n+=1){var s=a[n];this._layerConfigs[s.id]=s;var l=this._layers[s.id]=t.createStyleLayer(s);l._featureFilter=t.createFilter(l.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var u=0,h=r;u<h.length;u+=1){var p=h[u];delete this.keyCache[p],delete this._layerConfigs[p],delete this._layers[p]}this.familiesBySource={};for(var c=function(t,e){for(var r={},o=0;o<t.length;o++){var n=e&&e[t[o].id]||i(t[o]);e&&(e[t[o].id]=n);var a=r[n];a||(a=r[n]=[]),a.push(t[o])}var s=[];for(var l in r)s.push(r[l]);return s}(t.values(this._layerConfigs),this.keyCache),f=0,d=c;f<d.length;f+=1){var m=d[f].map((function(t){return o._layers[t.id]})),y=m[0];if("none"!==y.visibility){var g=y.source||"",_=this.familiesBySource[g];_||(_=this.familiesBySource[g]={});var v=y.sourceLayer||"_geojsonTileLayer",x=_[v];x||(x=_[v]=[]),x.push(m)}}};var o=t.window.ImageBitmap,n=function(){};n.prototype.loadTile=function(e,i){var r=e.uid,n=e.encoding,a=e.rawImageData,s=e.padding,l=e.buildQuadTree,u=o&&a instanceof o?this.getImageData(a,s):a;i(null,new t.DEMData(r,u,n,s<1,l))},n.prototype.getImageData=function(e,i){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-i,-i,e.width+2*i,e.height+2*i);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)};var a=function(t,e,i){this.loaded={},this.actor=t,this.layerIndex=e,this.availableImages=i};a.prototype.reloadTile=function(t,e){},a.prototype.loadTile=function(e,i){var r=this,o=e.uid;this.loading||(this.loading={});var n=this.loading[o]=new t.WorkerTile(e);n.abort=function(e,i){var r=t.getArrayBuffer(e.request,(function(e,r,o,n){if(e)i(e);else if(r){if(r.byteLength<=4)return i("Empty glb data ...");var a=r.slice(0);t.parse(r,t.GLBLoader).then((function(e){i(null,{rawData:a,modelData:new t.GLTFScenegraph(e),cacheControl:o,expires:n})})).catch((function(t){i(t)}))}}));return function(){r.cancel(),i()}}(e,(function(a,s){if(delete r.loading[o],n.status="done",r.loaded[o]=n,a||!s)return i(a);r.loaded=r.loaded||{},r.loaded[o]=n;var l=new t.FeatureIndex(n.tileID,n.promoteId);l.bucketLayerIDs=[];var u={},h=r.layerIndex.familiesBySource[e.source];for(var p in h)for(var c=0,f=h[p];c<f.length;c+=1){var d=f[c],m=d[0];u[m.id]=m.createBucket({index:l.bucketLayerIDs.length,layers:d,zoom:n.zoom,pixelRatio:n.pixelRatio,overscaling:n.overscaling,collisionBoxArray:n.collisionBoxArray,sourceID:n.source}),l.bucketLayerIDs.push(d.map((function(t){return t.id})))}s.buckets=t.values(u).filter((function(t){return!t.isEmpty()})),i(null,s)}))};var s=function(t,e){this.loaded={},this.actor=t,this.layerIndex=e};s.prototype.reloadPoolImage=function(t,e){},s.prototype.loadPoolImage=function(e,i){var r=this,o=e.uid;this.loading||(this.loading={});var n=this.loading[o]=new t.ImagePoolLoader(e);n.abort=function(e,i){var r=t.getImage(e.request,(function(t,e,r,o){t?i(t):e&&i(null,{data:e,cacheControl:r,expires:o})}));return function(){r.cancel(),i()}}(e,(function(t,e){if(delete r.loading[o],n.status="done",r.loaded[o]=n,t||!e)return i(t);i(null,e)}))};var l=function t(e,i){var r,o=e&&e.type;if("FeatureCollection"===o)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===o)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===o)t(e.geometry,i);else if("Polygon"===o)u(e.coordinates,i);else if("MultiPolygon"===o)for(r=0;r<e.coordinates.length;r++)u(e.coordinates[r],i);return e};function u(t,e){if(0!==t.length){h(t[0],e);for(var i=1;i<t.length;i++)h(t[i],!e)}}function h(t,e){for(var i=0,r=0,o=0,n=t.length,a=n-1;o<n;a=o++){var s=(t[o][0]-t[a][0])*(t[a][1]+t[o][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}var p=t.vectortile_emg.VectorTileFeature.prototype.toGeoJSON,c=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};c.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],i=0,r=this._feature.geometry;i<r.length;i+=1){var o=r[i];e.push([new t.pointGeometry(o[0],o[1])])}return e}for(var n=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var l=[],u=0,h=s[a];u<h.length;u+=1){var p=h[u];l.push(new t.pointGeometry(p[0],p[1]))}n.push(l)}return n},c.prototype.toGeoJSON=function(t,e,i){return p.call(this,t,e,i)};var f=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};f.prototype.feature=function(t){return new c(this._features[t])};var d=t.vectortile_emg.VectorTileFeature,m=y;function y(t,e){this.options=e||{},this.features=t,this.length=t.length}function g(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}y.prototype.feature=function(t){return new g(this.features[t],this.options.extent)},g.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i<e.length;i++){for(var r=e[i],o=[],n=0;n<r.length;n++)o.push(new t.pointGeometry(r[n][0],r[n][1]));this.geometry.push(o)}return this.geometry},g.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,o=-1/0,n=0;n<t.length;n++)for(var a=t[n],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),o=Math.max(o,l.y)}return[e,r,i,o]},g.prototype.toGeoJSON=d.prototype.toGeoJSON;var _=x,v=m;function x(e){var i=new t.pbf;return function(t,e){for(var i in t.layers)e.writeMessage(2,b,t.layers[i])}(e,i),i.finish()}function b(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(6,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,w,r);var o=r.keys;for(i=0;i<o.length;i++)e.writeStringField(4,o[i]);var n=r.values;for(i=0;i<n.length;i++)e.writeMessage(5,E,n[i])}function w(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(7,k,t),e.writeVarintField(6,i.type),e.writeMessage(2,S,i)}function k(t,e){var i=t.feature,r=t.keys,o=t.values,n=t.keycache,a=t.valuecache;for(var s in i.properties){var l=n[s];void 0===l&&(r.push(s),n[s]=l=r.length-1),e.writeVarint(l);var u=i.properties[s],h=typeof u;"string"!==h&&"boolean"!==h&&"number"!==h&&(u=JSON.stringify(u));var p=h+":"+u,c=a[p];void 0===c&&(o.push(u),a[p]=c=o.length-1),e.writeVarint(c)}}function T(t,e){return(e<<3)+(7&t)}function I(t){return t<<1^t>>31}function S(t,e){for(var i=t.loadGeometry(),r=t.type,o=0,n=0,a=i.length,s=0;s<a;s++){var l=i[s],u=1;1===r&&(u=l.length),e.writeVarint(T(1,u));for(var h=3===r?l.length-1:l.length,p=0;p<h;p++){1===p&&1!==r&&e.writeVarint(T(2,h-1));var c=l[p].x-o,f=l[p].y-n;e.writeVarint(I(c)),e.writeVarint(I(f)),o+=c,n+=f}3===r&&e.writeVarint(T(7,1))}}function E(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function A(t,e,i,r,o,n){if(!(o-r<=i)){var a=r+o>>1;P(t,e,a,r,o,n%2),A(t,e,i,r,a-1,n+1),A(t,e,i,a+1,o,n+1)}}function P(t,e,i,r,o,n){for(;o>r;){if(o-r>600){var a=o-r+1,s=i-r+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);P(t,e,i,Math.max(r,Math.floor(i-s*u/a+h)),Math.min(o,Math.floor(i+(a-s)*u/a+h)),n)}var p=e[2*i+n],c=r,f=o;for(M(t,e,r,i),e[2*o+n]>p&&M(t,e,r,o);c<f;){for(M(t,e,c,f),c++,f--;e[2*c+n]<p;)c++;for(;e[2*f+n]>p;)f--}e[2*r+n]===p?M(t,e,r,f):M(t,e,++f,o),f<=i&&(r=f+1),i<=f&&(o=f-1)}}function M(t,e,i,r){L(t,i,r),L(e,2*i,2*r),L(e,2*i+1,2*r+1)}function L(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function C(t,e,i,r){var o=t-i,n=e-r;return o*o+n*n}_.fromVectorTileJs=x,_.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new m(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return x({layers:i})},_.GeoJSONWrapper=v;var D=function(t){return t[0]},z=function(t){return t[1]},O=function(t,e,i,r,o){void 0===e&&(e=D),void 0===i&&(i=z),void 0===r&&(r=64),void 0===o&&(o=Float64Array),this.nodeSize=r,this.points=t;for(var n=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new n(t.length),s=this.coords=new o(2*t.length),l=0;l<t.length;l++)a[l]=l,s[2*l]=e(t[l]),s[2*l+1]=i(t[l]);A(a,s,r,0,a.length-1,0)};O.prototype.range=function(t,e,i,r){return function(t,e,i,r,o,n,a){for(var s,l,u=[0,t.length-1,0],h=[];u.length;){var p=u.pop(),c=u.pop(),f=u.pop();if(c-f<=a)for(var d=f;d<=c;d++)l=e[2*d+1],(s=e[2*d])>=i&&s<=o&&l>=r&&l<=n&&h.push(t[d]);else{var m=Math.floor((f+c)/2);l=e[2*m+1],(s=e[2*m])>=i&&s<=o&&l>=r&&l<=n&&h.push(t[m]);var y=(p+1)%2;(0===p?i<=s:r<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===p?o>=s:n>=l)&&(u.push(m+1),u.push(c),u.push(y))}}return h}(this.ids,this.coords,t,e,i,r,this.nodeSize)},O.prototype.within=function(t,e,i){return function(t,e,i,r,o,n){for(var a=[0,t.length-1,0],s=[],l=o*o;a.length;){var u=a.pop(),h=a.pop(),p=a.pop();if(h-p<=n)for(var c=p;c<=h;c++)C(e[2*c],e[2*c+1],i,r)<=l&&s.push(t[c]);else{var f=Math.floor((p+h)/2),d=e[2*f],m=e[2*f+1];C(d,m,i,r)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?i-o<=d:r-o<=m)&&(a.push(p),a.push(f-1),a.push(y)),(0===u?i+o>=d:r+o>=m)&&(a.push(f+1),a.push(h),a.push(y))}}return s}(this.ids,this.coords,t,e,i,this.nodeSize)};var R,B={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=Math.fround||(R=new Float32Array(1),function(t){return R[0]=+t,R[0]}),U=function(t){this.options=X(Object.create(B),t),this.trees=new Array(this.options.maxZoom+1)};function j(t,e,i,r,o){return{x:F(t),y:F(e),zoom:1/0,id:i,parentId:-1,numPoints:r,properties:o}}function N(t,e){var i=t.geometry.coordinates,r=i[1];return{x:F(Z(i[0])),y:F(q(r)),zoom:1/0,index:e,parentId:-1}}function V(t){return{type:"Feature",id:t.id,properties:G(t),geometry:{type:"Point",coordinates:[(r=t.x,360*(r-.5)),(e=t.y,i=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(i))/Math.PI-90)]}};var e,i,r}function G(t){var e=t.numPoints,i=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return X(X({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function Z(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function X(t,e){for(var i in e)t[i]=e[i];return t}function W(t){return t.x}function H(t){return t.y}function Y(t,e,i,r){for(var o,n=r,a=i-e>>1,s=i-e,l=t[e],u=t[e+1],h=t[i],p=t[i+1],c=e+3;c<i;c+=3){var f=K(t[c],t[c+1],l,u,h,p);if(f>n)o=c,n=f;else if(f===n){var d=Math.abs(c-a);d<s&&(o=c,s=d)}}n>r&&(o-e>3&&Y(t,e,o,r),t[o+2]=n,i-o>3&&Y(t,o,i,r))}function K(t,e,i,r,o,n){var a=o-i,s=n-r;if(0!==a||0!==s){var l=((t-i)*a+(e-r)*s)/(a*a+s*s);l>1?(i=o,r=n):l>0&&(i+=a*l,r+=s*l)}return(a=t-i)*a+(s=e-r)*s}function J(t,e,i,r){var o={id:void 0===t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)Q(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<e.length;r++)Q(t,e[r]);else if("MultiPolygon"===i)for(r=0;r<e.length;r++)for(var o=0;o<e[r].length;o++)Q(t,e[r][o])}(o),o}function Q(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function $(t,e,i,r){if(e.geometry){var o=e.geometry.coordinates,n=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===n)tt(o,s);else if("MultiPoint"===n)for(var u=0;u<o.length;u++)tt(o[u],s);else if("LineString"===n)et(o,s,a,!1);else if("MultiLineString"===n){if(i.lineMetrics){for(u=0;u<o.length;u++)et(o[u],s=[],a,!1),t.push(J(l,"LineString",s,e.properties));return}it(o,s,a,!1)}else if("Polygon"===n)it(o,s,a,!0);else{if("MultiPolygon"!==n){if("GeometryCollection"===n){for(u=0;u<e.geometry.geometries.length;u++)$(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<o.length;u++){var h=[];it(o[u],h,a,!0),s.push(h)}}t.push(J(l,n,s,e.properties))}}function tt(t,e){e.push(rt(t[0])),e.push(ot(t[1])),e.push(0)}function et(t,e,i,r){for(var o,n,a=0,s=0;s<t.length;s++){var l=rt(t[s][0]),u=ot(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(a+=r?(o*u-l*n)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-n,2))),o=l,n=u}var h=e.length-3;e[2]=1,Y(e,0,h,i),e[h+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function it(t,e,i,r){for(var o=0;o<t.length;o++){var n=[];et(t[o],n,i,r),e.push(n)}}function rt(t){return t/360+.5}function ot(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function nt(t,e,i,r,o,n,a,s){if(r/=e,n>=(i/=e)&&a<r)return t;if(a<i||n>=r)return null;for(var l=[],u=0;u<t.length;u++){var h=t[u],p=h.geometry,c=h.type,f=0===o?h.minX:h.minY,d=0===o?h.maxX:h.maxY;if(f>=i&&d<r)l.push(h);else if(!(d<i||f>=r)){var m=[];if("Point"===c||"MultiPoint"===c)at(p,m,i,r,o);else if("LineString"===c)st(p,m,i,r,o,!1,s.lineMetrics);else if("MultiLineString"===c)ut(p,m,i,r,o,!1);else if("Polygon"===c)ut(p,m,i,r,o,!0);else if("MultiPolygon"===c)for(var y=0;y<p.length;y++){var g=[];ut(p[y],g,i,r,o,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&"LineString"===c){for(y=0;y<m.length;y++)l.push(J(h.id,c,m[y],h.tags));continue}"LineString"!==c&&"MultiLineString"!==c||(1===m.length?(c="LineString",m=m[0]):c="MultiLineString"),"Point"!==c&&"MultiPoint"!==c||(c=3===m.length?"Point":"MultiPoint"),l.push(J(h.id,c,m,h.tags))}}}return l.length?l:null}function at(t,e,i,r,o){for(var n=0;n<t.length;n+=3){var a=t[n+o];a>=i&&a<=r&&(e.push(t[n]),e.push(t[n+1]),e.push(t[n+2]))}}function st(t,e,i,r,o,n,a){for(var s,l,u=lt(t),h=0===o?pt:ct,p=t.start,c=0;c<t.length-3;c+=3){var f=t[c],d=t[c+1],m=t[c+2],y=t[c+3],g=t[c+4],_=0===o?f:d,v=0===o?y:g,x=!1;a&&(s=Math.sqrt(Math.pow(f-y,2)+Math.pow(d-g,2))),_<i?v>i&&(l=h(u,f,d,y,g,i),a&&(u.start=p+s*l)):_>r?v<r&&(l=h(u,f,d,y,g,r),a&&(u.start=p+s*l)):ht(u,f,d,m),v<i&&_>=i&&(l=h(u,f,d,y,g,i),x=!0),v>r&&_<=r&&(l=h(u,f,d,y,g,r),x=!0),!n&&x&&(a&&(u.end=p+s*l),e.push(u),u=lt(t)),a&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(_=0===o?f:d)>=i&&_<=r&&ht(u,f,d,m),b=u.length-3,n&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ht(u,u[0],u[1],u[2]),u.length&&e.push(u)}function lt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ut(t,e,i,r,o,n){for(var a=0;a<t.length;a++)st(t[a],e,i,r,o,n,!1)}function ht(t,e,i,r){t.push(e),t.push(i),t.push(r)}function pt(t,e,i,r,o,n){var a=(n-e)/(r-e);return t.push(n),t.push(i+(o-i)*a),t.push(1),a}function ct(t,e,i,r,o,n){var a=(n-i)/(o-i);return t.push(e+(r-e)*a),t.push(n),t.push(1),a}function ft(t,e){for(var i=[],r=0;r<t.length;r++){var o,n=t[r],a=n.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)o=dt(n.geometry,e);else if("MultiLineString"===a||"Polygon"===a){o=[];for(var s=0;s<n.geometry.length;s++)o.push(dt(n.geometry[s],e))}else if("MultiPolygon"===a)for(o=[],s=0;s<n.geometry.length;s++){for(var l=[],u=0;u<n.geometry[s].length;u++)l.push(dt(n.geometry[s][u],e));o.push(l)}i.push(J(n.id,a,o,n.tags))}return i}function dt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function mt(t,e){if(t.transformed)return t;var i,r,o,n=1<<t.z,a=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],u=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<u.length;r+=2)l.geometry.push(yt(u[r],u[r+1],e,n,a,s));else for(r=0;r<u.length;r++){var p=[];for(o=0;o<u[r].length;o+=2)p.push(yt(u[r][o],u[r][o+1],e,n,a,s));l.geometry.push(p)}}return t.transformed=!0,t}function yt(t,e,i,r,o,n){return[Math.round(i*(t*r-o)),Math.round(i*(e*r-n))]}function gt(t,e,i,r,o){for(var n=e===o.maxZoom?0:o.tolerance/((1<<e)*o.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,_t(a,t[s],n,o);var l=t[s].minX,u=t[s].minY,h=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),h>a.maxX&&(a.maxX=h),p>a.maxY&&(a.maxY=p)}return a}function _t(t,e,i,r){var o=e.geometry,n=e.type,a=[];if("Point"===n||"MultiPoint"===n)for(var s=0;s<o.length;s+=3)a.push(o[s]),a.push(o[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===n)vt(a,o,t,i,!1,!1);else if("MultiLineString"===n||"Polygon"===n)for(s=0;s<o.length;s++)vt(a,o[s],t,i,"Polygon"===n,0===s);else if("MultiPolygon"===n)for(var l=0;l<o.length;l++){var u=o[l];for(s=0;s<u.length;s++)vt(a,u[s],t,i,!0,0===s)}if(a.length){var h=e.tags||null;if("LineString"===n&&r.lineMetrics){for(var p in h={},e.tags)h[p]=e.tags[p];h.lkmap_clip_start=o.start/o.size,h.lkmap_clip_end=o.end/o.size}var c={geometry:a,type:"Polygon"===n||"MultiPolygon"===n?3:"LineString"===n||"MultiLineString"===n?2:1,tags:h};null!==e.id&&(c.id=e.id),t.features.push(c)}}function vt(t,e,i,r,o,n){var a=r*r;if(r>0&&e.size<(o?a:r))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>a)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;o&&function(t,e){for(var i=0,r=0,o=t.length,n=o-2;r<o;n=r,r+=2)i+=(t[r]-t[n])*(t[r+1]+t[n+1]);if(i>0===e)for(r=0,o=t.length;r<o/2;r+=2){var a=t[r],s=t[r+1];t[r]=t[o-2-r],t[r+1]=t[o-1-r],t[o-2-r]=a,t[o-1-r]=s}}(s,n),t.push(s)}}function xt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)$(i,t.features[r],e,r);else $(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(this.stats={},this.total=0),r=function(t,e){var i=e.buffer/e.extent,r=t,o=nt(t,1,-1-i,i,0,-1,2,e),n=nt(t,1,1-i,2+i,0,-1,2,e);return(o||n)&&(r=nt(t,1,-i,1+i,0,-1,2,e)||[],o&&(r=ft(o,1).concat(r)),n&&(r=r.concat(ft(n,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&r.length}function bt(t,e,i){return 32*((1<<t)*i+e)+t}function wt(t,e){var i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return e(null,null);var o=new f(r.features),n=_(o);0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),e(null,{vectorTile:o,rawData:n.buffer})}U.prototype.load=function(t){var e=this.options,i=(e.log,e.minZoom),r=e.maxZoom,o=e.nodeSize;t.length;this.points=t;for(var n=[],a=0;a<t.length;a++)t[a].geometry&&n.push(N(t[a],a));this.trees[r+1]=new O(n,W,H,o,Float32Array);for(var s=r;s>=i;s--){Date.now();n=this._cluster(n,s),this.trees[s]=new O(n,W,H,o,Float32Array)}return this},U.prototype.getClusters=function(t,e){var i=((t[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,t[1])),o=180===t[2]?180:((t[2]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,o=180;else if(i>o){var a=this.getClusters([i,r,180,n],e),s=this.getClusters([-180,r,o,n],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],h=0,p=l.range(Z(i),q(n),Z(o),q(r));h<p.length;h+=1){var c=l.points[p[h]];u.push(c.numPoints?V(c):this.points[c.index])}return u},U.prototype.getChildren=function(t){var e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",o=this.trees[i];if(!o)throw new Error(r);var n=o.points[e];if(!n)throw new Error(r);for(var a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=[],l=0,u=o.within(n.x,n.y,a);l<u.length;l+=1){var h=o.points[u[l]];h.parentId===t&&s.push(h.numPoints?V(h):this.points[h.index])}if(0===s.length)throw new Error(r);return s},U.prototype.getLeaves=function(t,e,i){var r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r},U.prototype.getTile=function(t,e,i){var r=this.trees[this._limitZoom(t)],o=Math.pow(2,t),n=this.options,a=n.radius/n.extent,s=(i-a)/o,l=(i+1+a)/o,u={features:[]};return this._addTileFeatures(r.range((e-a)/o,s,(e+1+a)/o,l),r.points,e,i,o,u),0===e&&this._addTileFeatures(r.range(1-a/o,s,1,l),r.points,o,i,o,u),e===o-1&&this._addTileFeatures(r.range(0,s,a/o,l),r.points,-1,i,o,u),u.features.length?u:null},U.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e},U.prototype._appendLeaves=function(t,e,i,r,o){for(var n=0,a=this.getChildren(e);n<a.length;n+=1){var s=a[n],l=s.properties;if(l&&l.cluster?o+l.point_count<=r?o+=l.point_count:o=this._appendLeaves(t,l.cluster_id,i,r,o):o<r?o++:t.push(s),t.length===i)break}return o},U.prototype._addTileFeatures=function(t,e,i,r,o,n){for(var a=0,s=t;a<s.length;a+=1){var l=e[s[a]],u=l.numPoints,h=void 0,p=void 0,c=void 0;if(u)h=G(l),p=l.x,c=l.y;else{var f=this.points[l.index];h=f.properties,p=Z(f.geometry.coordinates[0]),c=q(f.geometry.coordinates[1])}var d={type:1,geometry:[[Math.round(this.options.extent*(p*o-i)),Math.round(this.options.extent*(c*o-r))]],tags:h},m=void 0;u?m=l.id:this.options.generateId?m=l.index:this.points[l.index].id&&(m=this.points[l.index].id),void 0!==m&&(d.id=m),n.features.push(d)}},U.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))},U.prototype._cluster=function(t,e){for(var i=[],r=this.options,o=r.reduce,n=r.minPoints,a=r.radius/(r.extent*Math.pow(2,e)),s=0;s<t.length;s++){var l=t[s];if(!(l.zoom<=e)){l.zoom=e;for(var u=this.trees[e+1],h=u.within(l.x,l.y,a),p=l.numPoints||1,c=p,f=0,d=h;f<d.length;f+=1){var m=u.points[d[f]];m.zoom>e&&(c+=m.numPoints||1)}if(c>p&&c>=n){for(var y=l.x*p,g=l.y*p,_=o&&p>1?this._map(l,!0):null,v=(s<<5)+(e+1)+this.points.length,x=0,b=h;x<b.length;x+=1){var w=u.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var k=w.numPoints||1;y+=w.x*k,g+=w.y*k,w.parentId=v,o&&(_||(_=this._map(l,!0)),o(_,this._map(w)))}}l.parentId=v,i.push(j(y/c,g/c,v,c,_))}else if(i.push(l),c>1)for(var T=0,I=h;T<I.length;T+=1){var S=u.points[I[T]];S.zoom<=e||(S.zoom=e,i.push(S))}}}return i},U.prototype._getOriginId=function(t){return t-this.points.length>>5},U.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},U.prototype._map=function(t,e){if(t.numPoints)return e?X({},t.properties):t.properties;var i=this.points[t.index].properties,r=this.options.map(i);return e&&r===i?X({},r):r},xt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},xt.prototype.splitTile=function(t,e,i,r,o,n,a){for(var s=[t,e,i,r],l=this.options,u=l.debug;s.length;){r=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var h=1<<e,p=bt(e,i,r),c=this.tiles[p];if(!c&&(c=this.tiles[p]=gt(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),u)){var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(c.source=t,o){if(e===l.maxZoom||e===o)continue;var d=1<<o-e;if(i!==Math.floor(n/d)||r!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||c.numPoints<=l.indexMaxPoints)continue;if(c.source=null,0!==t.length){var m,y,g,_,v,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,T=1+b;m=y=g=_=null,v=nt(t,h,i-b,i+k,0,c.minX,c.maxX,l),x=nt(t,h,i+w,i+T,0,c.minX,c.maxX,l),t=null,v&&(m=nt(v,h,r-b,r+k,1,c.minY,c.maxY,l),y=nt(v,h,r+w,r+T,1,c.minY,c.maxY,l),v=null),x&&(g=nt(x,h,r-b,r+k,1,c.minY,c.maxY,l),_=nt(x,h,r+w,r+T,1,c.minY,c.maxY,l),x=null),s.push(m||[],e+1,2*i,2*r),s.push(y||[],e+1,2*i,2*r+1),s.push(g||[],e+1,2*i+1,2*r),s.push(_||[],e+1,2*i+1,2*r+1)}}},xt.prototype.getTile=function(t,e,i){var r=this.options,o=r.extent;r.debug;if(t<0||t>24)return null;var n=1<<t,a=bt(t,e=(e%n+n)%n,i);if(this.tiles[a])return mt(this.tiles[a],o);for(var s,l=t,u=e,h=i;!s&&l>0;)l--,u=Math.floor(u/2),h=Math.floor(h/2),s=this.tiles[bt(l,u,h)];return s&&s.source?(this.splitTile(s.source,l,u,h,t,e,i),this.tiles[a]?mt(this.tiles[a],o):null):null};var kt=function(e){function i(t,i,r,o,n){e.call(this,t,i,r,o,wt),n&&(this.loadGeoJSON=n)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.loadData=function(e,i){var r=this,o=e&&e.request,n=o&&o.collectResourceTiming;this.loadGeoJSON(e,(function(a,s){if(a||!s)return i(a);if("object"!=typeof s)return i(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));l(s,!0);try{if(e.filter){var u=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===u.result)throw new Error(u.value.map((function(t){return t.key+": "+t.message})).join(", "));var h=s.features.filter((function(t){return u.value.evaluate({zoom:0},t)}));s={type:"FeatureCollection",features:h}}r._geoJSONIndex=e.cluster?new U(function(e){var i=e.superclusterOptions,r=e.clusterProperties;if(!r||!i)return i;for(var o={},n={},a={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),u=0,h=l;u<h.length;u+=1){var p=h[u],c=r[p],f=c[0],d=t.createExpression(c[1]),m=t.createExpression("string"==typeof f?[f,["accumulated"],["get",p]]:f);o[p]=d.value,n[p]=m.value}return i.map=function(t){s.properties=t;for(var e={},i=0,r=l;i<r.length;i+=1){var n=r[i];e[n]=o[n].evaluate(a,s)}return e},i.reduce=function(t,e){s.properties=e;for(var i=0,r=l;i<r.length;i+=1){var o=r[i];a.accumulated=t[o],t[o]=n[o].evaluate(a,s)}},i}(e)).load(s.features):function(t,e){return new xt(t,e)}(s,e.geojsonVtOptions)}catch(t){return i(t)}r.loaded={};var p={};if(n){var c=t.getPerformanceMeasurement(o);c&&(p.resourceTiming={},p.resourceTiming[e.source]=JSON.parse(JSON.stringify(c)))}i(null,p)}))},i.prototype.reloadTile=function(t,i){var r=this.loaded;return r&&r[t.uid]?e.prototype.reloadTile.call(this,t,i):this.loadTile(t,i)},i.prototype.loadGeoJSON=function(e,i){if(e.request)t.getJSON(e.request,i);else{if("string"!=typeof e.data)return i(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return i(null,JSON.parse(e.data))}catch(t){return i(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},i.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}},i.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}},i.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}},i}(t.VectorTileWorkerSource),Tt=function(e){var i=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded=!1,this.workerSourceTypes={vector:t.VectorTileWorkerSource,geojson:kt,model:a,texturePool:s},this.workerSources={},this.demWorkerSources={},this.modelWorkerSources={},this.imagePoolWorkerSources={},this.self.registerWorkerSource=function(t,e){if(i.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');i.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return Tt.prototype.checkIfReady=function(t,e,i){i()},Tt.prototype.setReferrer=function(t,e){this.referrer=e},Tt.prototype.spriteLoaded=function(e,i){for(var r in this.isSpriteLoaded=i,this.workerSources[e]){var o=this.workerSources[e][r];for(var n in o)o[n]instanceof t.VectorTileWorkerSource&&(o[n].isSpriteLoaded=i,o[n].fire(new t.Event("isSpriteLoaded")))}},Tt.prototype.setImages=function(t,e,i){for(var r in this.availableImages[t]=e,this.workerSources[t]){var o=this.workerSources[t][r];for(var n in o)o[n].availableImages=e}i()},Tt.prototype.enableTerrain=function(t,e,i){this.terrain=e,i()},Tt.prototype.setLayers=function(t,e,i){this.getLayerIndex(t).replace(e),i()},Tt.prototype.updateLayers=function(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()},Tt.prototype.loadTile=function(e,i,r){var o=this.enableTerrain?t.extend({enableTerrain:this.terrain},i):i;this.getWorkerSource(e,i.type,i.source).loadTile(o,r)},Tt.prototype.loadDEMTile=function(e,i,r){var o=this.enableTerrain?t.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(e,i.source).loadTile(o,r)},Tt.prototype.loadModelTile=function(t,e,i){this.getModelWorkerSource(t,e.source).loadTile(e,i)},Tt.prototype.reloadTile=function(e,i,r){var o=this.enableTerrain?t.extend({enableTerrain:this.terrain},i):i;this.getWorkerSource(e,i.type,i.source).reloadTile(o,r)},Tt.prototype.abortTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)},Tt.prototype.removeTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)},Tt.prototype.removeModelTile=function(t,e){this.getModelWorkerSource(t,e.source).removeTile(e)},Tt.prototype.removeSource=function(t,e,i){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,i):i()}},Tt.prototype.loadWorkerSource=function(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}},Tt.prototype.syncRTLPluginState=function(e,i,r){try{t.plugin.setState(i);var o=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=o){this.self.importScripts(o);var n=t.plugin.isParsed();r(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+o),n)}}catch(t){r(t.toString())}},Tt.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},Tt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new r),e},Tt.prototype.getWorkerSource=function(t,e,i){var r=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){var o={send:function(e,i,o,n,a,s){r.actor.send(e,i,o,t,a,s)},scheduler:this.actor.scheduler};this.workerSources[t][e][i]=new this.workerSourceTypes[e](o,this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded)}return this.workerSources[t][e][i]},Tt.prototype.getModelWorkerSource=function(t,e){return this.modelWorkerSources[t]||(this.modelWorkerSources[t]={}),this.modelWorkerSources[t][e]||(this.modelWorkerSources[t][e]=new a(this.getLayerIndex(t),this.getAvailableImages(t))),this.modelWorkerSources[t][e]},Tt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new n),this.demWorkerSources[t][e]},Tt.prototype.enforceCacheSizeLimit=function(e,i){t.enforceCacheSizeLimit(i)},Tt.prototype.getWorkerPerformanceMetrics=function(t,e,i){i(void 0,void 0)},Tt.prototype.getImagePoolWorkerSources=function(t,e){var i=this;return this.imagePoolWorkerSources[t]||(this.imagePoolWorkerSources[t]={}),this.imagePoolWorkerSources[t][e]||(this.imagePoolWorkerSources[t][e]=new s({send:function(e,r,o,n,a,s){i.actor.send(e,r,o,t,a,s)},scheduler:this.actor.scheduler},this.getLayerIndex(t))),this.imagePoolWorkerSources[t][e]},Tt.prototype.loadPoolImage=function(t,e,i){this.getImagePoolWorkerSources(t,e.type,e.source).loadPoolImage(e,i)},Tt.prototype.reLoadPoolImage=function(t,e,i){this.getImagePoolWorkerSources(t,e.type,e.source).reLoadPoolImage(e,i)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Tt(self)),Tt})),r(0,(function(t){var e=r;function r(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{e=new Worker(r),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===o[e=t&&t.failIfMajorPerformanceCaveat]&&(o[e]=function(t){var e,i=function(t){var e=document.createElement("canvas"),i=Object.create(r.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,e.getContext("webgl",i)||e.getContext("experimental-webgl",i)}(t);if(!i)return!1;try{e=i.createShader(i.VERTEX_SHADER)}catch(t){return!1}return!(!e||i.isContextLost())&&(i.shaderSource(e,"void main() {}"),i.compileShader(e),!0===i.getShaderParameter(e,i.COMPILE_STATUS))}(e)),o[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var o={};r.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var n,a={create:function(e,i,r){var o=t.window.document.createElement(e);return void 0!==i&&(o.className=i),r&&r.appendChild(o),o},createNS:function(e,i){return t.window.document.createElementNS(e,i)}},s=t.window.document&&t.window.document.documentElement.style,l=s&&void 0!==s.userSelect?"userSelect":"WebkitUserSelect";a.disableDrag=function(){s&&l&&(n=s[l],s[l]="none")},a.enableDrag=function(){s&&l&&(s[l]=n)},a.setTransform=function(t,e){t.style.transform=e};var u=!1;try{var h=Object.defineProperty({},"passive",{get:function(){u=!0}});t.window.addEventListener("test",h,h),t.window.removeEventListener("test",h,h)}catch(t){u=!1}a.addEventListener=function(t,e,i,r){void 0===r&&(r={}),t.addEventListener(e,i,"passive"in r&&u?r:{passive:!1,capture:!1})},a.removeEventListener=function(t,e,i,r){void 0===r&&(r={}),t.removeEventListener(e,i,"passive"in r&&u?r:r.capture)};var p=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",p,!0)};function c(e,i,r){var o=e.offsetWidth===i.width?1:e.offsetWidth/i.width;return new t.pointGeometry((r.clientX-i.left)*o,(r.clientY-i.top)*o)}function f(e,i,r,o){var n,a,s,l=t.exported.devicePixelRatio>1?"@2x":"",u=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,s||(s=t,n=e,p())})),h=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),(function(t,e){h=null,s||(s=t,a=e,p())}));function p(e){if(s)r(s);else if(n&&a){var i=t.exported.getImageData(a),o={};for(var l in n){var u=n[l],h=u.width,p=u.height,c=u.x,f=u.y,d=u.sdf,m=u.pixelRatio,y=u.stretchX,g=u.stretchY,_=u.content,v=new t.RGBAImage({width:h,height:p});t.RGBAImage.copy(i,v,{x:c,y:f},{x:0,y:0},{width:h,height:p}),o[l]={data:v,pixelRatio:m,sdf:d,stretchX:y,stretchY:g,content:_}}r(null,o)}}return{cancel:function(){u&&(u.cancel(),u=null),h&&(h.cancel(),h=null)}}}function d(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}a.suppressClick=function(){t.window.addEventListener("click",p,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",p,!0)}),0)},a.mousePos=function(t,e){var i=t.getBoundingClientRect();return c(t,i,e)},a.touchPos=function(t,e){for(var i=t.getBoundingClientRect(),r=[],o=0;o<e.length;o++)r.push(c(t,i,e[o]));return r},a.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},a.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var m=function(e){function i(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.isLoaded=function(){return this.loaded},i.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,i=this.requestors;e<i.length;e+=1){var r=i[e];this._notify(r.ids,r.callback)}this.requestors=[]}},i.prototype.getImage=function(t){return this.images[t]},i.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},i.prototype._validate=function(e,i){var r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),r=!1),r},i.prototype._validateStretch=function(t,e){if(!t)return!0;for(var i=0,r=0,o=t;r<o.length;r+=1){var n=o[r];if(n[0]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0},i.prototype._validateContent=function(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))},i.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},i.prototype.removeImage=function(t){var e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()},i.prototype.listImages=function(){return Object.keys(this.images)},i.prototype.getImages=function(t,e){var i=!0;if(!this.isLoaded())for(var r=0,o=t;r<o.length;r+=1)this.images[o[r]]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})},i.prototype._notify=function(e,i){for(var r={},o=0,n=e;o<n.length;o+=1){var a=n[o];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];if(s){var l=null;s.data instanceof ImageData?(l=new ImageData(s.data.width,s.data.height)).data.set(s.data.data):s.data instanceof t.RGBAImage&&(l=s.data.clone()),r[a]={data:l,pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}}}i(null,r)},i.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},i.prototype.getPattern=function(e){var i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{var o={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.ImagePosition(o,r);this.patterns[e]={bin:o,position:n}}return this._updatePatternAtlas(),this.patterns[e].position},i.prototype.bind=function(e){var i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)},i.prototype._updatePatternAtlas=function(){var e=[];for(var i in this.patterns)e.push(this.patterns[i].bin);var r=t.potpack(e),o=r.w,n=r.h,a=this.atlasImage;for(var s in a.resize({width:o||1,height:n||1}),this.patterns){var l=this.patterns[s].bin,u=l.x+1,h=l.y+1,p=this.images[s].data,c=p.width,f=p.height;t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:h},{width:c,height:f}),t.RGBAImage.copy(p,a,{x:0,y:f-1},{x:u,y:h-1},{width:c,height:1}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:h+f},{width:c,height:1}),t.RGBAImage.copy(p,a,{x:c-1,y:0},{x:u-1,y:h},{width:1,height:f}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u+c,y:h},{width:1,height:f})}this.dirty=!0},i.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},i.prototype.dispatchRenderCallbacks=function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e];if(!this.callbackDispatchedThisFrame[r]){this.callbackDispatchedThisFrame[r]=!0;var o=this.images[r];d(o)&&this.updateImage(r,o)}}},i}(t.Evented),y=function(){this.specification=t.spec.light.position};y.prototype.possiblyEvaluate=function(e,i){return o=(r=e.expression.evaluate(i))[0],a=r[2],s=t.degToRad((n=r[1])+90),l=t.degToRad(a),{x:o*Math.cos(s)*Math.sin(l),y:o*Math.sin(s)*Math.sin(l),z:o*Math.cos(l),azimuthal:n,polar:a};var r,o,n,a,s,l},y.prototype.interpolate=function(e,i,r){return{x:t.number(e.x,i.x,r),y:t.number(e.y,i.y,r),z:t.number(e.z,i.z,r),azimuthal:t.number(e.azimuthal,i.azimuthal,r),polar:t.number(e.polar,i.polar,r)}};var g=new t.Properties({anchor:new t.DataConstantProperty(t.spec.light.anchor),position:new y,color:new t.DataConstantProperty(t.spec.light.color),intensity:new t.DataConstantProperty(t.spec.light.intensity)}),_=function(e){function i(i){e.call(this),this._transitionable=new t.Transitionable(g),this.setLight(i),this._transitioning=this._transitionable.untransitioned()}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getLight=function(){return this._transitionable.serialize()},i.prototype.setLight=function(e,i){if(void 0===i&&(i={}),!this._validate(t.validateLight,e,i))for(var r in e){var o=e[r];t.endsWith(r,"-transition")?this._transitionable.setTransition(r.slice(0,-11),o):this._transitionable.setValue(r,o)}},i.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},i.prototype.hasTransition=function(){return this._transitioning.hasTransition()},i.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},i.prototype._validate=function(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))},i}(t.Evented),v=new t.Properties({source:new t.DataConstantProperty(t.spec.terrain.source),exaggeration:new t.DataConstantProperty(t.spec.terrain.exaggeration)}),x=function(e){function i(i){e.call(this),this._transitionable=new t.Transitionable(v),this.set(i),this._transitioning=this._transitionable.untransitioned()}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.get=function(){return this._transitionable.serialize()},i.prototype.set=function(e){for(var i in e){var r=e[i];t.endsWith(i,"-transition")?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}},i.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},i.prototype.hasTransition=function(){return this._transitioning.hasTransition()},i.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},i}(t.Evented);function b(e,i,r,o){var n=t.smoothstep(45,65,r),a=w(e,o),s=a[0],l=a[1],u=t.length(i),h=1-Math.min(1,Math.exp((u-s)/(l-s)*-6));return h*=h*h,(h=Math.min(1,1.00747*h))*n*e.alpha}function w(t,e){var i=.5/Math.tan(.5*e);return[t.range[0]+i,t.range[1]+i]}var k=new t.Properties({range:new t.DataConstantProperty(t.spec.fog.range),color:new t.DataConstantProperty(t.spec.fog.color),"horizon-blend":new t.DataConstantProperty(t.spec.fog["horizon-blend"])}),T=function(e){function i(i){e.call(this),this._transitionable=new t.Transitionable(k),this.set(i),this._transitioning=this._transitionable.untransitioned()}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={state:{configurable:!0}};return r.state.get=function(){return{range:this.properties.get("range"),horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}},i.prototype.get=function(){return this._transitionable.serialize()},i.prototype.set=function(e){if(!this._validate(t.validateFog,e))for(var i in e){var r=e[i];t.endsWith(i,"-transition")?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}},i.prototype.getOpacity=function(e){var i=this.properties&&this.properties.get("color")||1;return t.smoothstep(45,65,e)*i.a},i.prototype.getOpacityAtLatLng=function(e,i){return function(e,i,r){var o=t.MercatorCoordinate.fromLngLat(i),n=r.elevation?r.elevation.getAtPointOrZero(o):0,a=[o.x,o.y,n];return t.transformMat4(a,a,r.mercatorFogMatrix),b(e,a,r.pitch,r._fov)}(this.state,e,i)},i.prototype.getFovAdjustedRange=function(t){return w(this.state,t)},i.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},i.prototype.hasTransition=function(){return this._transitioning.hasTransition()},i.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},i.prototype._validate=function(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))},Object.defineProperties(i.prototype,r),i}(t.Evented),I=function e(i,r){var o=this;this.workerPool=i,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var n=this.workerPool.acquire(this.id),a=0;a<n.length;a++){var s=new e.Actor(n[a],r,this.id);s.name="Worker "+a,this.actors.push(s)}this.ready=!1,this.broadcast("checkIfReady",null,(function(){o.ready=!0}))};function S(e,i,r){return i*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}I.prototype.broadcast=function(e,i,r){t.asyncAll(this.actors,(function(t,r){t.send(e,i,r)}),r=r||function(){})},I.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},I.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},I.Actor=t.Actor;var E=function(t,e,i,r){this.screenBounds=t,this.cameraPoint=e,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this.screenGeometry.map((function(t){return r.pointCoordinate3D(t)})),this.cameraGeometry=this.bufferedCameraGeometry(0)};function A(t){return 100*t|0}function P(e,i,r){var o=function(o,n){if(o)return r(o);if(n){var a=t.pick(t.extend(n,e),["tiles","minzoom","maxzoom","attribution","lkmap_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(a.vectorLayers=n.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),a.tiles=i.canonicalizeTileset(a,e.url),r(null,a)}};return e.url?t.getJSON(i.transformRequest(i.normalizeSourceURL(e.url),t.ResourceType.Source),o):t.exported.frame((function(){return o(null,e)}))}E.createFromScreenPoints=function(e,i){var r,o;if(e instanceof t.pointGeometry||"number"==typeof e[0]){var n=t.pointGeometry.convert(e);r=[t.pointGeometry.convert(e)],o=i.isPointAboveHorizon(n)}else{var a=t.pointGeometry.convert(e[0]),s=t.pointGeometry.convert(e[1]);r=[a,s],o=t.polygonizeBounds(a,s).every((function(t){return i.isPointAboveHorizon(t)}))}return new E(r,i.getCameraPoint(),o,i)},E.prototype.isPointQuery=function(){return 1===this.screenBounds.length},E.prototype.bufferedScreenGeometry=function(e){return t.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)},E.prototype.bufferedCameraGeometry=function(e){var i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new t.pointGeometry(1,1)):this.screenBounds[1],o=t.polygonizeBounds(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?o[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(o[3]=this.cameraPoint)),t.bufferConvexPolygon(o,e)},E.prototype.containsTile=function(e,i,r){var o,n=e.queryPadding+1,a=r?this._bufferedCameraMercator(n,i).map((function(t){return e.tileID.getTilePoint(t)})):this._bufferedScreenMercator(n,i).map((function(t){return e.tileID.getTilePoint(t)})),s=this.screenGeometryMercator.map((function(t){return e.tileID.getTileVec3(t)})),l=s.map((function(e){return new t.pointGeometry(e[0],e[1])})),u=i.getFreeCameraOptions().position||new t.MercatorCoordinate(0,0,0),h=e.tileID.getTileVec3(u),p=s.map((function(e){var i=t.sub(e,e,h);return t.normalize(i,i),new t.Ray(h,i)})),c=S(e,1,i.zoom);if(t.polygonIntersectsBox(a,0,0,t.EXTENT,t.EXTENT))return{queryGeometry:this,tilespaceGeometry:l,tilespaceRays:p,bufferedTilespaceGeometry:a,bufferedTilespaceBounds:(o=t.getBounds(a),o.min.x=t.clamp(o.min.x,0,t.EXTENT),o.min.y=t.clamp(o.min.y,0,t.EXTENT),o.max.x=t.clamp(o.max.x,0,t.EXTENT),o.max.y=t.clamp(o.max.y,0,t.EXTENT),o),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:c}},E.prototype._bufferedScreenMercator=function(t,e){var i=A(t);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];var r=this.bufferedScreenGeometry(t).map((function(t){return e.pointCoordinate3D(t)}));return this._screenRaycastCache[i]=r,r},E.prototype._bufferedCameraMercator=function(t,e){var i=A(t);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];var r=this.bufferedCameraGeometry(t).map((function(t){return e.pointCoordinate3D(t)}));return this._cameraRaycastCache[i]=r,r};var M=function(e,i,r){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=r||24};M.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},M.prototype.contains=function(e){var i=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),o=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),n=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=r&&e.x<n&&e.y>=o&&e.y<a};var L,C=function(e){function i(i,r,o,n){if(e.call(this),this.id=i,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(r,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new t.DedupedRequest}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,(function(i,r){e._tileJSONRequest=null,e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new M(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles,e.map._requestManager._customAccessToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},i.prototype.loaded=function(){return this._loaded},i.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t();for(var e=0,i=this.map.style._getSourceCaches(this.id);e<i.length;e+=1)i[e].clearTiles();this.load()},i.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},i.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},i.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},i.prototype.serialize=function(){return t.extend({},this._options)},i.prototype.loadTile=function(e,i){var r=this,o=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(o,t.ResourceType.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile};if(n.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state)"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",n,s.bind(this));else if(e.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)e.request=e.actor.send("loadTile",n,s.bind(this),void 0,!0);else{var a=t.loadVectorTile.call({deduped:this._deduped},n,(function(t,i){t||!i?s.call(r,t):(n.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},e.actor&&e.actor.send("loadTile",n,s.bind(r),void 0,!0))}),!0);e.request={cancel:a}}function s(r,o){return delete e.request,e.aborted?i(null):r&&404!==r.status?i(r):(o&&o.resourceTiming&&(e.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&e.setExpiryData(o),e.loadVectorData(o,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id})},i.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},i.prototype.hasTransition=function(){return!1},i.prototype.afterUpdate=function(){this._tileWorkers={}},i}(t.Evented),D=function(e){function i(i,r,o,n){e.call(this),this.id=i,this.dispatcher=o,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,r.hasOwnProperty("getTileUrl")&&"function"==typeof r.getTileUrl?(this.getTileUrl=r.getTileUrl,delete r.getTileUrl):this.getTileUrl=null,r.hasOwnProperty("wms")?(this.wms=!0,delete r.wms):this.wms=!1,this._options=t.extend({type:"raster"},r),t.extend(this,t.pick(r,["url","scheme","tileSize"]))}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,(function(i,r){e._tileJSONRequest=null,e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new M(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},i.prototype.loaded=function(){return this._loaded},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},i.prototype.serialize=function(){return t.extend({},this._options)},i.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},i.prototype.loadTile=function(e,i){var r=this,o=t.exported.devicePixelRatio>=2,n="";if(0==this.tiles.length&&this.getTileUrl&&"function"==typeof this.getTileUrl)if(this.wms){var a=e.tileID.canonical.getTileBBox(),s=e.tileID.canonical.getQuadkey();n=this.getTileUrl(a,s)}else{var l=e.tileID.canonical;n=this.getTileUrl(l.x,l.y,l.z)}else n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),(function(o,n,a,s){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(o)e.state="errored",i(o);else if(n){r.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:a,expires:s});var l=r.map.painter.context,u=l.gl;e.texture=r.map.painter.getTileTexture(n.width),e.texture?e.texture.update(n,{useMipmap:!0}):(e.texture=new t.Texture(l,n,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST),l.extTextureFilterAnisotropic&&u.texParameterf(u.TEXTURE_2D,l.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,l.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(r.dispatcher),i(null)}}))},i.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},i.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},i.prototype.hasTransition=function(){return!1},i}(t.Evented),z=function(e){function i(i,r,o,n){e.call(this,i,r,o,n),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},r),this.encoding=r.encoding||"lkmap"}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.loadTile=function(e,i){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function o(t,r){t&&(e.state="errored",i(t)),r&&(e.dem=r,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),function(r,n,a,s){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(r)e.state="errored",i(r);else if(n){this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:a,expires:s});var l=t.window.ImageBitmap&&n instanceof t.window.ImageBitmap&&(null==L&&(L=t.window.OffscreenCanvas&&new t.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof t.window.createImageBitmap),L),u=1-(n.width-t.prevPowerOfTwo(n.width))/2;u<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));var h=l?n:t.exported.getImageData(n,u),p={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:h,encoding:this.encoding,padding:u};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",p,o.bind(this),void 0,!0))}}.bind(this))},i.prototype._getNeighboringTiles=function(e){var i=e.canonical,r=Math.pow(2,i.z),o=(i.x-1+r)%r,n=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+r)%r,s=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,n,i.z,o,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,n,i.z,o,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,n,i.z,o,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l},i.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded"},i}(D),O=function(e){function i(i,r,o,n){e.call(this),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(n),this._data=r.data,this._options=t.extend({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*a,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:t.EXTENT,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.onAdd=function(t){this.map=t,this.setData(this._data)},i.prototype.setData=function(t){return this._data=t,this._updateWorkerData(),this},i.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},i.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},i.prototype.getClusterLeaves=function(t,e,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},r),this},i.prototype._updateWorkerData=function(){var e=this;if(this._pendingLoad)this._coalesce=!0;else{this.fire(new t.Event("dataloading",{dataType:"source"})),this._loaded=!1;var i=t.extend({},this.workerOptions),r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(r),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send(this.type+".loadData",i,(function(i,r){if(e._loaded=!0,e._pendingLoad=null,i)e.fire(new t.ErrorEvent(i));else{var o={dataType:"source",sourceDataType:e._metadataFired?"content":"metadata"};e._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[e.id]&&(o.resourceTiming=r.resourceTiming[e.id]),e.fire(new t.Event("data",o)),e._metadataFired=!0}e._coalesce&&(e._updateWorkerData(),e._coalesce=!1)}))}},i.prototype.loaded=function(){return this._loaded},i.prototype.loadTile=function(e,i){var r=this,o=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(o,{type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,n){return delete e.request,e.unloadVectorData(),e.aborted?i(null):t?i(t):(e.loadVectorData(n,r.map.painter,"reloadTile"===o),i(null))}),void 0,"loadTile"===o)},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},i.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},i.prototype.onRemove=function(){this._pendingLoad&&this._pendingLoad.cancel()},i.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},i.prototype.hasTransition=function(){return!1},i}(t.Evented),R=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),B=function(e){function i(t,i,r,o){e.call(this),this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=i}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(e,i){var r=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(o,n){r._loaded=!0,o?r.fire(new t.ErrorEvent(o)):n&&(r.image=t.exported.getImageData(n),e&&(r.coordinates=e),i&&i(),r._finishLoading())}))},i.prototype.loaded=function(){return this._loaded},i.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},i.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.setCoordinates=function(e){var i=this;this.coordinates=e;var r=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var i=1/0,r=1/0,o=-1/0,n=-1/0,a=0,s=e;a<s.length;a+=1){var l=s[a];i=Math.min(i,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),n=Math.max(n,l.y)}var u=Math.max(o-i,n-r),h=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),p=Math.pow(2,h);return new t.CanonicalTileID(h,Math.floor((i+o)/2*p),Math.floor((r+n)/2*p))}(r),this.minzoom=this.maxzoom=this.tileID.z;var o=r.map((function(t){return i.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(o[2].x,o[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},i.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,i=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var o=this.tiles[r];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},i.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},i.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return!1},i}(t.Evented),F=function(e){function i(t,i,r,o){e.call(this,t,i,r,o),this.roundZoom=!0,this.type="video",this.options=i}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1;var i=this.options;this.urls=[];for(var r=0,o=i.urls;r<o.length;r+=1)this.urls.push(this.map._requestManager.transformRequest(o[r],t.ResourceType.Source).url);t.getVideo(this.urls,(function(i,r){e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(e.video=r,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},i.prototype.pause=function(){this.video&&this.video.pause()},i.prototype.play=function(){this.video&&this.video.play()},i.prototype.seek=function(e){if(this.video){var i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+i.start(0)+" and "+i.end(0)+"-second mark."))):this.video.currentTime=e}},i.prototype.getVideo=function(){return this.video},i.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},i.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,i=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var o=this.tiles[r];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},i.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this.video&&!this.video.paused},i}(B),U=function(e){function i(i,r,o,n){e.call(this,i,r,o,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},i.prototype.onRemove=function(){this.pause()},i.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context,r=i.gl;for(var o in this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(i,this.canvas,r.RGBA,{premultiply:!0}),this.tiles){var n=this.tiles[o];"loaded"!==n.state&&(n.state="loaded",n.texture=this.texture)}}},i.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this._playing},i.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var i=e[t];if(isNaN(i)||i<=0)return!0}return!1},i}(B),j={vector:C,raster:D,"raster-dem":z,geojson:O,video:F,image:B,canvas:U,model:function(e){function i(i,r,o,n){e.call(this),this.sprite=null,r.hasOwnProperty("sprite")&&r.sprite.length>0&&(this.sprite=r.sprite,r.sprite.indexOf("http")<0&&(this.sprite=t.getUrl(r.sprite))),this.id=i,this.options=r,this.dispatcher=o,this._eventedParent=n,this.type="model",this.minzoom=15,this.maxzoom=15,this.tileSize=512,this.reparseOverscaled=!1,this.scheme="xyz",t.extend(this,t.pick(r,["url"]))}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.loaded=function(){return this._loaded},i.prototype.load=function(){this._loaded=!0,this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"}))},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.prepare=function(){},i.prototype.transformRequest=function(t){var e="?";return t.indexOf("?")>-1&&(e="&"),t+e+"ak="+window.LKMap.config.USER_AK},i.prototype.loadTile=function(e,i){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url([this.url],this.scheme));if("VirtualSpace"in this.map&&this.map.VirtualSpace.DrawModelTile)this.map.VirtualSpace.DrawModelTile.loadModel({sprite:this.sprite,url:this.transformRequest(r)});else{var o={request:this.map._requestManager.transformRequest(r,t.ResourceType.Model),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:!1};o.request.collectResourceTiming=!1,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",o,n.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",o,n.bind(this)))}function n(r,o){if(delete e.request,e.aborted)return i(null);if(r&&404!==r.status)return i(r);if(null==o)return i(null);for(var n in this.map._refreshExpiredTiles&&o&&e.setExpiryData(o),e.state="loaded",e.buckets=t.deserialize(o.buckets,this.map.painter.style),e.buckets)e.buckets[n].fillBuffers(o.modelData,this.map,this.sprite);i(null),e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)}},i.prototype.serialize=function(){return{type:"model",url:this.options.url,modelType:this.options.modelType}},i.prototype.hasTransition=function(){return!1},i}(t.Evented)},N=function(e,i,r,o){var n=new j[i.type](e,i,r,o);if(n.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+n.id);return t.bindAll(["load","abort","unload","serialize","prepare"],n),n};function V(e,i){var r=t.identity([]);return t.scale(r,r,[.5*e.width,.5*-e.height,1]),t.translate(r,r,[1,-1,0]),t.multiply(r,r,e.calculateProjMatrix(i.toUnwrapped()))}function G(t,e,i,r,o,n,a,s){void 0===s&&(s=!1);var l=t.tilesIn(r,a,s);l.sort(q);for(var u=[],h=0,p=l;h<p.length;h+=1){var c=p[h];u.push({wrappedTileID:c.tile.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(e,i,t._state,c,o,n,V(t.transform,c.tile.tileID),s)})}var f=function(t){for(var e={},i={},r=0,o=t;r<o.length;r+=1){var n=o[r],a=n.queryResults,s=n.wrappedTileID,l=i[s]=i[s]||{};for(var u in a)for(var h=a[u],p=l[u]=l[u]||{},c=e[u]=e[u]||[],f=0,d=h;f<d.length;f+=1){var m=d[f];p[m.featureIndex]||(p[m.featureIndex]=!0,c.push(m))}}return e}(u);for(var d in f)f[d].forEach((function(e){var i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}));return f}function Z(t,e){for(var i=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),r=[],o={},n=0;n<i.length;n++){var a=i[n],s=a.tileID.canonical.key;o[s]||(o[s]=!0,a.querySourceFeatures(r,e))}return r}function q(t,e){var i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function X(){return null!=wa.workerClass?new wa.workerClass:new t.window.Worker(wa.workerUrl)}var W,H="lkmap_preloaded_worker_pool",Y=function(){this.active={}};function K(){return W||(W=new Y),W}function J(e,i){var r={};for(var o in e)"ref"!==o&&(r[o]=e[o]);return t.refProperties.forEach((function(t){t in i&&(r[t]=i[t])})),r}function Q(t){t=t.slice();for(var e=Object.create(null),i=0;i<t.length;i++)e[t[i].id]=t[i];for(var r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=J(t[r],e[t[r].ref]));return t}Y.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Y.workerCount;)this.workers.push(new X);return this.active[t]=!0,this.workers.slice()},Y.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Y.prototype.isPreloaded=function(){return!!this.active[H]},Y.prototype.numActive=function(){return Object.keys(this.active).length},Y.workerCount=2;var $={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog"};function tt(t,e,i){i.push({command:$.addSource,args:[t,e[t]]})}function et(t,e,i){e.push({command:$.removeSource,args:[t]}),i[t]=!0}function it(t,e,i,r){et(t,i,r),tt(t,e,i)}function rt(e,i,r){var o;for(o in e[r])if(e[r].hasOwnProperty(o)&&"data"!==o&&!t.deepEqual(e[r][o],i[r][o]))return!1;for(o in i[r])if(i[r].hasOwnProperty(o)&&"data"!==o&&!t.deepEqual(e[r][o],i[r][o]))return!1;return!0}function ot(e,i,r,o,n,a){var s;for(s in i=i||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],i[s])||r.push({command:a,args:[o,s,i[s],n]}));for(s in i)i.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],i[s])||r.push({command:a,args:[o,s,i[s],n]}))}function nt(t){return t.id}function at(t,e){return t[e.id]=e,t}var st=function(t,e){this.reset(t,e)};st.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding},st.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var i=1,r=this._distances[i],o=e*this.paddedLength+this.padding;r<o&&i<this._distances.length;)r=this._distances[++i];var n=i-1,a=this._distances[n],s=r-a,l=s>0?(o-a)/s:0;return this.points[n].mult(1-l).add(this.points[i].mult(l))};var lt=function(t,e,i){var r=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(var n=0;n<this.xCellCount*this.yCellCount;n++)r.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};lt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},lt.prototype.insert=function(t,e,i,r,o){this._forEachCell(e,i,r,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(o)},lt.prototype.insertCircle=function(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)},lt.prototype._insertBoxCell=function(t,e,i,r,o,n){this.boxCells[o].push(n)},lt.prototype._insertCircleCell=function(t,e,i,r,o,n){this.circleCells[o].push(n)},lt.prototype._query=function(t,e,i,r,o,n){if(i<0||t>this.width||r<0||e>this.height)return!o&&[];var a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(o)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],h=this.circles[3*l+1],p=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:u-p,y1:h-p,x2:u+p,y2:h+p})}return n?a.filter(n):a}return this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:o,seenUids:{box:{},circle:{}}},n),o?a.length>0:a},lt.prototype._queryCircle=function(t,e,i,r,o){var n=t-i,a=t+i,s=e-i,l=e+i;if(a<0||n>this.width||l<0||s>this.height)return!r&&[];var u=[];return this._forEachCell(n,s,a,l,this._queryCellCircle,u,{hitTest:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},o),r?u.length>0:u},lt.prototype.query=function(t,e,i,r,o){return this._query(t,e,i,r,!1,o)},lt.prototype.hitTest=function(t,e,i,r,o){return this._query(t,e,i,r,!0,o)},lt.prototype.hitTestCircle=function(t,e,i,r){return this._queryCircle(t,e,i,!0,r)},lt.prototype._queryCell=function(t,e,i,r,o,n,a,s){var l=a.seenUids,u=this.boxCells[o];if(null!==u)for(var h=this.bboxes,p=0,c=u;p<c.length;p+=1){var f=c[p];if(!l.box[f]){l.box[f]=!0;var d=4*f;if(t<=h[d+2]&&e<=h[d+3]&&i>=h[d+0]&&r>=h[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return n.push(!0),!0;n.push({key:this.boxKeys[f],x1:h[d],y1:h[d+1],x2:h[d+2],y2:h[d+3]})}}}var m=this.circleCells[o];if(null!==m)for(var y=this.circles,g=0,_=m;g<_.length;g+=1){var v=_[g];if(!l.circle[v]){l.circle[v]=!0;var x=3*v;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,i,r)&&(!s||s(this.circleKeys[v]))){if(a.hitTest)return n.push(!0),!0;var b=y[x],w=y[x+1],k=y[x+2];n.push({key:this.circleKeys[v],x1:b-k,y1:w-k,x2:b+k,y2:w+k})}}}},lt.prototype._queryCellCircle=function(t,e,i,r,o,n,a,s){var l=a.circle,u=a.seenUids,h=this.boxCells[o];if(null!==h)for(var p=this.bboxes,c=0,f=h;c<f.length;c+=1){var d=f[c];if(!u.box[d]){u.box[d]=!0;var m=4*d;if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(this.boxKeys[d])))return n.push(!0),!0}}var y=this.circleCells[o];if(null!==y)for(var g=this.circles,_=0,v=y;_<v.length;_+=1){var x=v[_];if(!u.circle[x]){u.circle[x]=!0;var b=3*x;if(this._circlesCollide(g[b],g[b+1],g[b+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[x])))return n.push(!0),!0}}},lt.prototype._forEachCell=function(t,e,i,r,o,n,a,s){for(var l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),p=this._convertToYCellCoord(r),c=l;c<=h;c++)for(var f=u;f<=p;f++)if(o.call(this,t,e,i,r,this.xCellCount*f+c,n,a,s))return},lt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},lt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},lt.prototype._circlesCollide=function(t,e,i,r,o,n){var a=r-t,s=o-e,l=i+n;return l*l>a*a+s*s},lt.prototype._circleAndRectCollide=function(t,e,i,r,o,n,a){var s=(n-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return!1;var u=(a-o)/2,h=Math.abs(e-(o+u));if(h>u+i)return!1;if(l<=s||h<=u)return!0;var p=l-s,c=h-u;return p*p+c*c<=i*i};var ut=Math.tan(85*Math.PI/180);function ht(e,i,r,o,n){var a=t.create();return i?(t.scale(a,a,[1/n,1/n,1]),r||t.rotateZ(a,a,o.angle)):t.multiply(a,o.labelPlaneMatrix,e),a}function pt(e,i,r,o,n){if(i){var a=t.clone(e);return t.scale(a,a,[n,n,1]),r||t.rotateZ(a,a,-o.angle),a}return o.glCoordMatrix}function ct(e,i,r){void 0===r&&(r=0);var o=[e.x,e.y,r,1];r?t.transformMat4$1(o,o,i):wt(o,o,i);var n=o[3];return{point:new t.pointGeometry(o[0]/n,o[1]/n),signedDistanceFromCamera:n}}function ft(t,e){return Math.min(.5+t/e*.5,1.5)}function dt(t,e){var i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function mt(t,e,i,r,o,n,a,s,l,u,h,p,c){var f=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,m=s.lineStartIndex+s.lineLength,y=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(f-1),_=vt(t*y,i,r,o,n,a,s.segment,d,m,l,u,h,p,c,!0);if(!_)return null;var v=vt(t*g,i,r,o,n,a,s.segment,d,m,l,u,h,p,c,!0);return v?{first:_,last:v}:null}function yt(e,i,r,o){return e.writingMode===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*o?{useVertical:!0}:e.writingMode===t.WritingMode.vertical?i.y<r.y?{needsFlipping:!0}:null:0!==e.flipState&&function(t,e,i){var r=(e.x-t.x)*i;return 0===r||Math.abs((e.y-t.y)/r)>ut}(i,r,o)?1===e.flipState?{needsFlipping:!0}:null:i.x>r.x?{needsFlipping:!0}:null}function gt(e,i,r,o,n,a,s,l,u,h,p,c,f,d,m){var y,g=i/24,_=e.lineOffsetX*g,v=e.lineOffsetY*g;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,b=e.lineStartIndex,w=e.lineStartIndex+e.lineLength,k=mt(g,l,_,v,r,p,c,e,u,a,f,m);if(!k)return{notEnoughRoom:!0};var T=ct(k.first.point,s).point,I=ct(k.last.point,s).point;if(o&&!r){var S=yt(e,T,I,d);if(e.flipState=S&&S.needsFlipping?1:2,S)return S}y=[k.first];for(var E=e.glyphStartIndex+1;E<x-1;E++)y.push(vt(g*l.getoffsetX(E),_,v,r,p,c,e.segment,b,w,u,a,f,m));y.push(k.last)}else{if(o&&!r){var A=ct(c,n).point,P=e.lineStartIndex+e.segment+1,M=new t.pointGeometry(u.getx(P),u.gety(P)),L=ct(M,n),C=yt(e,A,L.signedDistanceFromCamera>0?L.point:_t(c,M,A,1,n),d);if(e.flipState=C&&C.needsFlipping?1:2,C)return C}var D=vt(g*l.getoffsetX(e.glyphStartIndex),_,v,r,p,c,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,m);if(!D)return{notEnoughRoom:!0};y=[D]}for(var z=0,O=y;z<O.length;z+=1){var R=O[z];t.addDynamicAttributes(h,R.point,R.angle)}return{}}function _t(t,e,i,r,o,n){var a=t.add(t.sub(e)._unit()),s=ct(a,o,n?n(a):0).point,l=i.sub(s);return i.add(l._mult(r/l.mag()))}function vt(e,i,r,o,n,a,s,l,u,h,p,c,f,d,m){var y=o?e-i:e+i,g=y>0?1:-1,_=0;o&&(g*=-1,_=Math.PI),g<0&&(_+=Math.PI);for(var v=g>0?l+s:l+s+1,x=n,b=n,w=0,k=0,T=Math.abs(y),I=[],S=[],E=a,A=function(){var e=v-g;return 0===w?a:new t.pointGeometry(h.getx(e),h.gety(e))},P=function(){return _t(A(),E,b,T-w+1,p,f)};w+k<=T;){if((v+=g)<l||v>=u)return null;if(b=x,I.push(x),d&&S.push(E||A()),void 0===(x=c[v])){var M=ct(E=new t.pointGeometry(h.getx(v),h.gety(v)),p,f?f(E):0);x=M.signedDistanceFromCamera>0?c[v]=M.point:P()}else E=null;w+=k,k=b.dist(x)}m&&f&&(E=E||new t.pointGeometry(h.getx(v),h.gety(v)),c[v]=x=void 0===c[v]?x:P(),k=b.dist(x));var L=(T-w)/k,C=x.sub(b),D=C.mult(L)._add(b);r&&D._add(C._unit()._perp()._mult(r*g));var z,O,R,B,F=_+Math.atan2(x.y-b.y,x.x-b.x);return I.push(D),d&&(E=E||new t.pointGeometry(h.getx(v),h.gety(v)),S.push(new t.pointGeometry((z=S.length>0?S[S.length-1]:E).x*(B=1-(R=L))+(O=E).x*R,z.y*B+O.y*R))),{point:D,angle:F,path:I,tilePath:S}}var xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function bt(t,e){for(var i=0;i<t;i++){var r=e.length;e.resize(r+4),e.float32.set(xt,3*r)}}function wt(t,e,i){var r=e[0],o=e[1];return t[0]=i[0]*r+i[4]*o+i[12],t[1]=i[1]*r+i[5]*o+i[13],t[3]=i[3]*r+i[7]*o+i[15],t}var kt=100,Tt=function(t,e,i,r){void 0===i&&(i=new lt(t.width+200,t.height+200,25)),void 0===r&&(r=new lt(t.width+200,t.height+200,25)),this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+kt,this.screenBottomBoundary=t.height+kt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=e};Tt.prototype.placeCollisionBox=function(t,e,i,r,o,n,a){var s=this.projectAndGetPerspectiveRatio(n,e.anchorPointX,e.anchorPointY,e.elevation,e.tileID),l=o*s.perspectiveRatio,u=(e.x1*t+i.x-e.padding)*l+s.point.x,h=(e.y1*t+i.y-e.padding)*l+s.point.y,p=(e.x2*t+i.x+e.padding)*l+s.point.x,c=(e.y2*t+i.y+e.padding)*l+s.point.y,f=s.perspectiveRatio<=.55||s.aboveHorizon;return!this.isInsideGrid(u,h,p,c)||!r&&this.grid.hitTest(u,h,p,c,a)||f?{box:[],offscreen:!1}:{box:[u,h,p,c],offscreen:this.isOffscreen(u,h,p,c)}},Tt.prototype.placeCollisionCircles=function(e,i,r,o,n,a,s,l,u,h,p,c,f,d){var m=[],y=this.transform.elevation,g=y?function(t){return y.getAtTileOffset(d,t.x,t.y)}:function(t){return 0},_=new t.pointGeometry(i.anchorX,i.anchorY),v=g(_),x=this.projectAndGetPerspectiveRatio(a,_.x,_.y,v,d),b=x.perspectiveRatio,w=(h?n/b:n*b)/t.ONE_EM,k=ct(_,s,v).point,T=x.signedDistanceFromCamera>0?mt(w,o,i.lineOffsetX*w,i.lineOffsetY*w,!1,k,_,i,r,s,{},y&&!h?g:null,h&&!!y):null,I=!1,S=!1,E=!0;if(T&&!x.aboveHorizon){for(var A=.5*c*b+f,P=new t.pointGeometry(-100,-100),M=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),L=new st,C=T.first,D=T.last,z=[],O=C.path.length-1;O>=1;O--)z.push(C.path[O]);for(var R=1;R<D.path.length;R++)z.push(D.path[R]);var B=2.5*A;if(l){var F=z.map(y?function(t,e){var i=g(e<C.path.length-1?C.tilePath[C.path.length-1-e]:D.tilePath[e-C.path.length+2]);return ct(t,l,i)}:function(t){return ct(t,l)});z=F.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:F.map((function(t){return t.point}))}var U=[];if(z.length>0){for(var j=z[0].clone(),N=z[0].clone(),V=1;V<z.length;V++)j.x=Math.min(j.x,z[V].x),j.y=Math.min(j.y,z[V].y),N.x=Math.max(N.x,z[V].x),N.y=Math.max(N.y,z[V].y);U=j.x>=P.x&&N.x<=M.x&&j.y>=P.y&&N.y<=M.y?[z]:N.x<P.x||j.x>M.x||N.y<P.y||j.y>M.y?[]:t.clipLine([z],P.x,P.y,M.x,M.y)}for(var G=0,Z=U;G<Z.length;G+=1){var q;L.reset(Z[G],.25*A),q=L.length<=.5*A?1:Math.ceil(L.paddedLength/B)+1;for(var X=0;X<q;X++){var W=X/Math.max(q-1,1),H=L.lerp(W),Y=H.x+kt,K=H.y+kt;m.push(Y,K,A,0);var J=Y-A,Q=K-A,$=Y+A,tt=K+A;if(E=E&&this.isOffscreen(J,Q,$,tt),S=S||this.isInsideGrid(J,Q,$,tt),!e&&this.grid.hitTestCircle(Y,K,A,p)&&(I=!0,!u))return{circles:[],offscreen:!1,collisionDetected:I}}}}return{circles:!u&&I||!S?[]:m,offscreen:E,collisionDetected:I}},Tt.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var i=[],r=1/0,o=1/0,n=-1/0,a=-1/0,s=0,l=e;s<l.length;s+=1){var u=l[s],h=new t.pointGeometry(u.x+kt,u.y+kt);r=Math.min(r,h.x),o=Math.min(o,h.y),n=Math.max(n,h.x),a=Math.max(a,h.y),i.push(h)}for(var p={},c={},f=0,d=this.grid.query(r,o,n,a).concat(this.ignoredGrid.query(r,o,n,a));f<d.length;f+=1){var m=d[f],y=m.key;if(void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]={}),!p[y.bucketInstanceId][y.featureIndex]){var g=[new t.pointGeometry(m.x1,m.y1),new t.pointGeometry(m.x2,m.y1),new t.pointGeometry(m.x2,m.y2),new t.pointGeometry(m.x1,m.y2)];t.polygonIntersectsPolygon(i,g)&&(p[y.bucketInstanceId][y.featureIndex]=!0,void 0===c[y.bucketInstanceId]&&(c[y.bucketInstanceId]=[]),c[y.bucketInstanceId].push(y.featureIndex))}}return c},Tt.prototype.insertCollisionBox=function(t,e,i,r,o){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:o},t[0],t[1],t[2],t[3])},Tt.prototype.insertCollisionCircles=function(t,e,i,r,o){for(var n=e?this.ignoredGrid:this.grid,a={bucketInstanceId:i,featureIndex:r,collisionGroupID:o},s=0;s<t.length;s+=4)n.insertCircle(a,t[s],t[s+1],t[s+2])},Tt.prototype.projectAndGetPerspectiveRatio=function(e,i,r,o,n){var a=[i,r,o||0,1],s=!1;if(o||this.transform.pitch>0){t.transformMat4$1(a,a,e);var l=!1;if(this.fogState&&n){var u=function(e,i,r,o,n,a){var s=a.calculateFogTileMatrix(n),l=[i,r,o];return t.transformMat4(l,l,s),b(e,l,a.pitch,a._fov)}(this.fogState,i,r,o||0,n.toUnwrapped(),this.transform);l=u>.9}s=a[2]>a[3]||l}else wt(a,a,e);return{point:new t.pointGeometry((a[0]/a[3]+1)/2*this.transform.width+kt,(-a[1]/a[3]+1)/2*this.transform.height+kt),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/a[3]*.5,1.5),signedDistanceFromCamera:a[3],aboveHorizon:s}},Tt.prototype.isOffscreen=function(t,e,i,r){return i<kt||t>=this.screenRightBoundary||r<kt||e>this.screenBottomBoundary},Tt.prototype.isInsideGrid=function(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary},Tt.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var It=function(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i};It.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var St=function(t,e,i,r,o){this.text=new It(t?t.text:null,e,i,o),this.icon=new It(t?t.icon:null,e,r,o)};St.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Et=function(t,e,i){this.text=t,this.icon=e,this.skipFade=i},At=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},Pt=function(t,e,i,r,o){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=o},Mt=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function Lt(e,i,r,o,n){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*i,l=-(a.verticalAlign-.5)*r,u=t.evaluateVariableOffset(e,o);return new t.pointGeometry(s+u[0]*n,l+u[1]*n)}function Ct(e,i,r,o,n){var a=new t.pointGeometry(e,i);return r&&a._rotate(o?n:-n),a}Mt.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var Dt=function(t,e,i,r,o){this.transform=t.clone(),this.collisionIndex=new Tt(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new Mt(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}};function zt(t,e,i,r,o){t.emplaceBack(e?1:0,i?1:0,r||0,o||0),t.emplaceBack(e?1:0,i?1:0,r||0,o||0),t.emplaceBack(e?1:0,i?1:0,r||0,o||0),t.emplaceBack(e?1:0,i?1:0,r||0,o||0)}Dt.prototype.getBucketParts=function(e,i,r,o){var n=r.getBucket(i),a=r.latestFeatureIndex;if(n&&a&&i.id===n.layerIds[0]){var s=r.collisionBoxArray,l=n.layers[0].layout,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.EXTENT,p=this.transform.calculateProjMatrix(r.tileID.toUnwrapped()),c="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),d=S(r,1,this.transform.zoom),m=ht(p,c,f,this.transform,d),y=null;if(c){var g=pt(p,c,f,this.transform,d);y=t.multiply([],this.transform.labelPlaneMatrix,g)}this.retainedQueryData[n.bucketInstanceId]=new Pt(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,r.tileID);var _={bucket:n,layout:l,posMatrix:p,textLabelPlaneMatrix:m,labelToScreenMatrix:y,scale:u,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(n.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:t.evaluateSizeForZoom(n.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(o)for(var v=0,x=n.sortKeyRanges;v<x.length;v+=1){var b=x[v];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:_})}},Dt.prototype.attemptAnchorPlacement=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m,y,g){var _,v=[p.textOffset0,p.textOffset1],x=Lt(t,i,r,v,o),b=this.collisionIndex.placeCollisionBox(o,e,Ct(x.x,x.y,n,a,this.transform.angle),h,s,l,u.predicate);if(!m||0!==this.collisionIndex.placeCollisionBox(f.getSymbolInstanceIconSize(g,this.transform.zoom,c),m,Ct(x.x,x.y,n,a,this.transform.angle),h,s,l,u.predicate).box.length)return b.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(_=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:v,width:i,height:r,anchor:t,textScale:o,prevAnchor:_},this.markUsedJustification(f,t,p,d),f.allowVerticalPlacement&&(this.markUsedOrientation(f,d,p),this.placedOrientations[p.crossTileID]=d),{shift:x,placedGlyphBoxes:b}):void 0},Dt.prototype.placeLayerBucketPart=function(e,i,r){var o=this,n=e.parameters,a=n.bucket,s=n.layout,l=n.posMatrix,u=n.textLabelPlaneMatrix,h=n.labelToScreenMatrix,p=n.textPixelRatio,c=n.holdingForFade,f=n.collisionBoxArray,d=n.partiallyEvaluatedTextSize,m=n.partiallyEvaluatedIconSize,y=n.collisionGroup,g=s.get("text-optional"),_=s.get("icon-optional"),v=s.get("text-allow-overlap"),x=s.get("icon-allow-overlap"),b="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),k="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),I=v&&(x||!a.hasIconData()||_),S=x&&(v||!a.hasTextData()||g);!a.collisionArrays&&f&&a.deserializeCollisionBoxes(f),r&&a.updateCollisionDebugBuffers(this.transform.zoom,f);var E=function(e,n,f){if(!i[e.crossTileID])if(c)o.placements[e.crossTileID]=new Et(!1,!1,!1);else{var T,E=!1,A=!1,P=!0,M=null,L={box:null,offscreen:null},C={box:null,offscreen:null},D=null,z=null,O=0,R=0,B=0;f.textFeatureIndex?O=f.textFeatureIndex:e.useRuntimeCollisionCircles&&(O=e.featureIndex),f.verticalTextFeatureIndex&&(R=f.verticalTextFeatureIndex);var F=function(t){t.tileID=o.retainedQueryData[a.bucketInstanceId].tileID,(o.transform.elevation||t.elevation)&&(t.elevation=o.transform.elevation?o.transform.elevation.getAtTileOffset(o.retainedQueryData[a.bucketInstanceId].tileID,t.anchorPointX,t.anchorPointY):0)},U=f.textBox;if(U){F(U);var j=function(i){var r=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!i&&o.prevPlacement){var n=o.prevPlacement.placedOrientations[e.crossTileID];n&&(o.placedOrientations[e.crossTileID]=n,o.markUsedOrientation(a,r=n,e))}return r},N=function(i,r){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&f.verticalTextBox)for(var o=0,n=a.writingModes;o<n.length&&(n[o]===t.WritingMode.vertical?(L=r(),C=L):L=i(),!(L&&L.box&&L.box.length));o+=1);else L=i()};if(s.get("text-variable-anchor")){var V=s.get("text-variable-anchor");if(o.prevPlacement&&o.prevPlacement.variableOffsets[e.crossTileID]){var G=o.prevPlacement.variableOffsets[e.crossTileID];V.indexOf(G.anchor)>0&&(V=V.filter((function(t){return t!==G.anchor}))).unshift(G.anchor)}var Z=function(t,i,r){var s=a.getSymbolInstanceTextSize(d,e,o.transform.zoom,n),u=(t.x2-t.x1)*s+2*t.padding,h=(t.y2-t.y1)*s+2*t.padding,c=k&&!x?i:null;c&&F(c);for(var f={box:[],offscreen:!1},g=v?2*V.length:V.length,_=0;_<g;++_){var T=o.attemptAnchorPlacement(V[_%V.length],t,u,h,s,b,w,p,l,y,_>=V.length,e,n,a,r,c,d,m);if(T&&(f=T.placedGlyphBoxes)&&f.box&&f.box.length){E=!0,M=T.shift;break}}return f};N((function(){return Z(U,f.iconBox,t.WritingMode.horizontal)}),(function(){var i=f.verticalTextBox;return i&&F(i),a.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&e.numVerticalGlyphVertices>0&&i?Z(i,f.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),L&&(E=L.box,P=L.offscreen);var q=j(L&&L.box);if(!E&&o.prevPlacement){var X=o.prevPlacement.variableOffsets[e.crossTileID];X&&(o.variableOffsets[e.crossTileID]=X,o.markUsedJustification(a,X.anchor,e,q))}}else{var W=function(i,r){var s=a.getSymbolInstanceTextSize(d,e,o.transform.zoom,n),u=o.collisionIndex.placeCollisionBox(s,i,new t.pointGeometry(0,0),v,p,l,y.predicate);return u&&u.box&&u.box.length&&(o.markUsedOrientation(a,r,e),o.placedOrientations[e.crossTileID]=r),u};N((function(){return W(U,t.WritingMode.horizontal)}),(function(){var i=f.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?(F(i),W(i,t.WritingMode.vertical)):{box:null,offscreen:null}})),j(L&&L.box&&L.box.length)}}if(E=(T=L)&&T.box&&T.box.length>0,P=T&&T.offscreen,e.useRuntimeCollisionCircles){var H=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Y=t.evaluateSizeForFeature(a.textSizeData,d,H),K=s.get("text-padding");D=o.collisionIndex.placeCollisionCircles(v,H,a.lineVertexArray,a.glyphOffsetArray,Y,l,u,h,r,w,y.predicate,e.collisionCircleDiameter,K,o.retainedQueryData[a.bucketInstanceId].tileID),E=v||D.circles.length>0&&!D.collisionDetected,P=P&&D.offscreen}if(f.iconFeatureIndex&&(B=f.iconFeatureIndex),f.iconBox){var J=function(e){F(e);var i=k&&M?Ct(M.x,M.y,b,w,o.transform.angle):new t.pointGeometry(0,0),r=a.getSymbolInstanceIconSize(m,o.transform.zoom,n);return o.collisionIndex.placeCollisionBox(r,e,i,x,p,l,y.predicate)};A=C&&C.box&&C.box.length&&f.verticalIconBox?(z=J(f.verticalIconBox)).box.length>0:(z=J(f.iconBox)).box.length>0,P=P&&z.offscreen}var Q=g||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=_||0===e.numIconVertices;if(Q||$?$?Q||(A=A&&E):E=A&&E:A=E=A&&E,E&&T&&T.box&&o.collisionIndex.insertCollisionBox(T.box,s.get("text-ignore-placement"),a.bucketInstanceId,C&&C.box&&R?R:O,y.ID),A&&z&&o.collisionIndex.insertCollisionBox(z.box,s.get("icon-ignore-placement"),a.bucketInstanceId,B,y.ID),D&&(E&&o.collisionIndex.insertCollisionCircles(D.circles,s.get("text-ignore-placement"),a.bucketInstanceId,O,y.ID),r)){var tt=a.bucketInstanceId,et=o.collisionCircleArrays[tt];void 0===et&&(et=o.collisionCircleArrays[tt]=new At);for(var it=0;it<D.circles.length;it+=4)et.circles.push(D.circles[it+0]),et.circles.push(D.circles[it+1]),et.circles.push(D.circles[it+2]),et.circles.push(D.collisionDetected?1:0)}o.placements[e.crossTileID]=new Et(E||I,A||S,P||a.justReloaded),i[e.crossTileID]=!0}};if(T)for(var A=a.getSortedSymbolIndexes(this.transform.angle),P=A.length-1;P>=0;--P){var M=A[P];E(a.symbolInstances.get(M),M,a.collisionArrays[M])}else for(var L=e.symbolInstanceStart;L<e.symbolInstanceEnd;L++)E(a.symbolInstances.get(L),L,a.collisionArrays[L]);if(r&&a.bucketInstanceId in this.collisionCircleArrays){var C=this.collisionCircleArrays[a.bucketInstanceId];t.invert(C.invProjMatrix,l),C.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},Dt.prototype.markUsedJustification=function(e,i,r,o){var n;n=o===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];for(var a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var l=s[a];l>=0&&(e.text.placedSymbolArray.get(l).crossTileID=n>=0&&l!==n?0:r.crossTileID)}},Dt.prototype.markUsedOrientation=function(e,i,r){for(var o=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,n=i===t.WritingMode.vertical?i:0,a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=o;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=n)},Dt.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var r=e?e.symbolFadeChange(t):1,o=e?e.opacities:{},n=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var l=this.placements[s],u=o[s];u?(this.opacities[s]=new St(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new St(null,r,l.text,l.icon,l.skipFade),i=i||l.text||l.icon)}for(var h in o){var p=o[h];if(!this.opacities[h]){var c=new St(p,r,!1,!1);c.isHidden()||(this.opacities[h]=c,i=i||p.text.placed||p.icon.placed)}}for(var f in n)this.variableOffsets[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.variableOffsets[f]=n[f]);for(var d in a)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=a[d]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},Dt.prototype.updateLayerOpacities=function(t,e){for(var i={},r=0,o=e;r<o.length;r+=1){var n=o[r],a=n.getBucket(t);a&&n.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,i,n.collisionBoxArray)}},Dt.prototype.updateBucketOpacities=function(e,i,r){var o=this;e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();var n=e.layers[0].layout,a=new St(null,0,!1,!1,!0),s=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),u=n.get("text-variable-anchor"),h="map"===n.get("text-rotation-alignment"),p="map"===n.get("text-pitch-alignment"),c="none"!==n.get("icon-text-fit"),f=new St(null,0,s&&(l||!e.hasIconData()||n.get("icon-optional")),l&&(s||!e.hasTextData()||n.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);for(var d=function(t,e,i){for(var r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i)},m=function(r){var n=e.symbolInstances.get(r),s=n.numHorizontalGlyphVertices,l=n.numVerticalGlyphVertices,m=n.crossTileID,y=o.opacities[m];i[m]?y=a:y||(o.opacities[m]=y=f),i[m]=!0;var g=n.numIconVertices>0,_=o.placedOrientations[n.crossTileID],v=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Vt(y.text);d(e.text,s,v?Gt:b),d(e.text,l,x?Gt:b);var w=y.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||v?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var k=o.variableOffsets[n.crossTileID];k&&o.markUsedJustification(e,k.anchor,n,_);var T=o.placedOrientations[n.crossTileID];T&&(o.markUsedJustification(e,"left",n,T),o.markUsedOrientation(e,T,n))}if(g){var I=Vt(y.icon),S=!(c&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(d(e.icon,n.numIconVertices,S?I:Gt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=y.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,n.numVerticalIconVertices,S?Gt:I),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var E=e.collisionArrays[r];if(E){var A=new t.pointGeometry(0,0);if(E.textBox||E.verticalTextBox){var P=!0;if(u){var M=o.variableOffsets[m];M?(A=Lt(M.anchor,M.width,M.height,M.textOffset,M.textScale),h&&A._rotate(p?o.transform.angle:-o.transform.angle)):P=!1}E.textBox&&zt(e.textCollisionBox.collisionVertexArray,y.text.placed,!P||v,A.x,A.y),E.verticalTextBox&&zt(e.textCollisionBox.collisionVertexArray,y.text.placed,!P||x,A.x,A.y)}var L=Boolean(!x&&E.verticalIconBox);E.iconBox&&zt(e.iconCollisionBox.collisionVertexArray,y.icon.placed,L,c?A.x:0,c?A.y:0),E.verticalIconBox&&zt(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!L,c?A.x:0,c?A.y:0)}}},y=0;y<e.symbolInstances.length;y++)m(y);if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){var g=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=g.invProjMatrix,e.placementViewportMatrix=g.viewportMatrix,e.collisionCircleArray=g.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},Dt.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},Dt.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},Dt.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},Dt.prototype.stillRecent=function(t,e){var i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t},Dt.prototype.setStale=function(){this.stale=!0};var Ot=Math.pow(2,25),Rt=Math.pow(2,24),Bt=Math.pow(2,17),Ft=Math.pow(2,16),Ut=Math.pow(2,9),jt=Math.pow(2,8),Nt=Math.pow(2,1);function Vt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Ot+e*Rt+i*Bt+e*Ft+i*Ut+e*jt+i*Nt+e}var Gt=0,Zt=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Zt.prototype.continuePlacement=function(t,e,i,r,o){for(var n=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(n,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort((function(t,e){return t.sortKey-e.sortKey})));this._currentPartIndex<n.length;)if(e.placeLayerBucketPart(n[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,o())return!0;return!1};var qt=function(t,e,i,r,o,n,a,s){this.placement=new Dt(t,o,n,a,s),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=r,this._done=!1};qt.prototype.isDone=function(){return this._done},qt.prototype.continuePlacement=function(e,i,r){for(var o=this,n=t.exported.now(),a=function(){var e=t.exported.now()-n;return!o._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=i[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Zt(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},qt.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Xt=512/t.EXTENT/2,Wt=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var r=0;r<e.length;r++){var o=e.get(r),n=o.key;this.indexedSymbolInstances[n]||(this.indexedSymbolInstances[n]=[]),this.indexedSymbolInstances[n].push({crossTileID:o.crossTileID,coord:this.getScaledCoordinates(o,t)})}};Wt.prototype.getScaledCoordinates=function(e,i){var r=Xt/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.anchorX)*r),y:Math.floor((i.canonical.y*t.EXTENT+e.anchorY)*r)}},Wt.prototype.findMatches=function(t,e,i){for(var r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),o=0;o<t.length;o++){var n=t.get(o);if(!n.crossTileID){var a=this.indexedSymbolInstances[n.key];if(a)for(var s=this.getScaledCoordinates(n,e),l=0,u=a;l<u.length;l+=1){var h=u[l];if(Math.abs(h.coord.x-s.x)<=r&&Math.abs(h.coord.y-s.y)<=r&&!i[h.crossTileID]){i[h.crossTileID]=!0,n.crossTileID=h.crossTileID;break}}}}};var Ht=function(){this.maxCrossTileID=0};Ht.prototype.generate=function(){return++this.maxCrossTileID};var Yt=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Yt.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var i in this.indexes){var r=this.indexes[i],o={};for(var n in r){var a=r[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),o[a.tileID.key]=a}this.indexes[i]=o}this.lng=t},Yt.prototype.addBucket=function(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var r=0;r<e.symbolInstances.length;r++)e.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var o=this.usedCrossTileIDs[t.overscaledZ];for(var n in this.indexes){var a=this.indexes[n];if(Number(n)>t.overscaledZ)for(var s in a){var l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,o)}else{var u=a[t.scaledTo(Number(n)).key];u&&u.findMatches(e.symbolInstances,t,o)}}for(var h=0;h<e.symbolInstances.length;h++){var p=e.symbolInstances.get(h);p.crossTileID||(p.crossTileID=i.generate(),o[p.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Wt(t,e.symbolInstances,e.bucketInstanceId),!0},Yt.prototype.removeBucketCrossTileIDs=function(t,e){for(var i in e.indexedSymbolInstances)for(var r=0,o=e.indexedSymbolInstances[i];r<o.length;r+=1)delete this.usedCrossTileIDs[t][o[r].crossTileID]},Yt.prototype.removeStaleBuckets=function(t){var e=!1;for(var i in this.indexes){var r=this.indexes[i];for(var o in r)t[r[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[o]),delete r[o],e=!0)}return e};var Kt=function(){this.layerIndexes={},this.crossTileIDs=new Ht,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Kt.prototype.addLayer=function(t,e,i){var r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Yt);var o=!1,n={};r.handleWrapJump(i);for(var a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.getBucket(t);u&&t.id===u.layerIds[0]&&(u.bucketInstanceId||(u.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(l.tileID,u,this.crossTileIDs)&&(o=!0),n[u.bucketInstanceId]=!0)}return r.removeStaleBuckets(n)&&(o=!0),o},Kt.prototype.pruneUnusedLayers=function(t){var e={};for(var i in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[i]||delete this.layerIndexes[i]};var Jt=window.HTMLImageElement,Qt=window.ImageBitmap,$t=function(e){function i(t,i,r,o){e.call(this),this.id=t,this.dispatcher=r,this.type="texturePool",this.spaceTexture=null,this.setEventedParent(o),this.images={},this.textures={},this.map=i}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.upload=function(e){var i=e.gl;this.spaceTexture||(this.spaceTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([255,255,255,0])},e.gl.RGBA));var r=this.map.style._statisticsTool.getStatsElement(t.EStatsType.STAT_TEXTURE);r.begin();var o=[],n=!1;for(var a in this.images){var s=this.images[a];if(s){if("loaded"==s.state){n=!0;var l=s.image;(Qt&&s.image instanceof Qt||s.image instanceof Jt)&&(l=t.exported.getImageData(s.image)),this.textures[a]?this.textures[a].update(l):this.textures[a]=new t.Texture(e,l,i.RGBA,{useMipmap:!0}),o.push(a)}if(r.isBudgetFinished())break}else o.push(a)}n&&this.map.triggerRepaint();for(var u=0;u<o.length;++u)delete this.images[o[u]]},i.prototype.getTexture=function(t){return t?this.textures[t]?this.textures[t]:(t&&t.indexOf("http")>-1&&this.loadImages(t),null):null},i.prototype.removeTexture=function(t){this.textures[t]&&(this.textures[t].destroy(),delete this.textures[t])},i.prototype.updateSprite=function(e){for(var i in e)if(!this.images[i]&&!this.textures[i]){var r=new t.ImagePoolLoader(i,"loaded");r.image=e[i].data,this.images[i]=r}},i.prototype.loadImage=function(e,i){this.images[e.uid]=e;var r=this.map._requestManager.normalizeImageLibURL(e.uid),o=this.map._requestManager.transformRequest(r,t.ResourceType.Image),n={request:o,data:void 0,type:this.type,source:this.id,uid:r};function a(t,r){return delete e.request,e.aborted?i(null):t&&404!==t.status?i(t):void(null!=r?(e.state="loaded",e.image=r.data,i&&i(null),e.reloadCallback&&(e.loadImage(e,e.reloadCallback),e.reloadCallback=null)):i&&i(null))}n.request.collectResourceTiming=!1,navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")<0?e.request=t.getImage(o,function(t,r){return delete e.request,e.aborted?i(null):t&&404!==t.status?i(t):void(null!=r?(e.state="loaded",e.image=r,!i||i(null),e.reloadCallback&&(e.loadImage(e,e.reloadCallback),e.reloadCallback=null)):i&&i(null))}.bind(this)):e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reLoadPoolImage",n,a.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadPoolImage",n,a.bind(this)))},i.prototype.loadImages=function(e,i){var r,o;Array.isArray(e)?r=e:(r=[]).push(e);for(var n=0;n<r.length;++n)if((o=r[n])&&!this.images[o]&&!this.textures[o]){var a=new t.ImagePoolLoader(o);this.loadImage(a,i)}},i.prototype.afterUpdate=function(){this._tileWorkers={}},i}(t.Evented),te=function(e,i){return t.emitValidationErrors(e,i&&i.filter((function(t){return"source.canvas"!==t.identifier})))},ee=t.pick($,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog"]),ie=t.pick($,["setCenter","setZoom","setBearing","setPitch"]),re=function(){var e={},i=t.spec.$version;for(var r in t.spec.$root){var o,n=t.spec.$root[r];n.required&&null!=(o="version"===r?i:"array"===n.type?[]:{})&&(e[r]=o)}return e}(),oe={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0},ne=function(e){function i(r,o){var n=this;void 0===o&&(o={}),e.call(this),this._enableLayerAnimate=!1,this.map=r,this.dispatcher=new I(K(),this),this.imageManager=new m,this.imageManager.setEventedParent(this),this.glyphManager=new t.GlyphManager(r._requestManager,o.localFontFamily?t.LocalGlyphMode.all:o.localIdeographFontFamily?t.LocalGlyphMode.ideographs:t.LocalGlyphMode.none,o.localFontFamily||o.localIdeographFontFamily),this.lineAtlas=new t.LineAtlas(256,512),this.crossTileSymbolIndex=new Kt,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._customLayers={},this._markersNeedUpdate=!1,this._sky=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer()),this._statisticsTool=new t.StatisticsTool,this._textureManager=new $t("textureManager",r,this.dispatcher,this);var a=this;this._rtlTextPluginCallback=i.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,i){if(t.triggerPluginCompletionEvent(e),i&&i.every((function(t){return t})))for(var r in a._sourceCaches){var o=a._sourceCaches[r],n=o.getSource().type;"vector"!==n&&"geojson"!==n||o.reload()}}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=n.getSource(t.sourceId);if(e&&e.vectorLayerIds)for(var i in n._layers){var r=n._layers[i];r.source===e.id&&n._validateLayer(r)}}}))}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={order:{configurable:!0}};return i.prototype.loadURL=function(e,i){var r=this;void 0===i&&(i={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var o="boolean"==typeof i.validate?i.validate:!t.isLKMapURL(e);e=this.map._requestManager.normalizeStyleURL(e,i.accessToken);var n=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(n,(function(e,i){r._request=null,e?r.fire(new t.ErrorEvent(e)):i&&r._load(i,o)}))},i.prototype.repaintMap=function(){this.map.triggerRepaint()},i.prototype.enableLayerAnimate=function(t){if(this._enableLayerAnimate!==t){this._enableLayerAnimate=t;var e=this.map;this._enableLayerAnimate?e.on("render",this.repaintMap.bind(this)):e.off("render",this.repaintMap.bind(this))}},i.prototype.loadJSON=function(e,i){var r=this;void 0===i&&(i={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((function(){r._request=null,r._load(e,!1!==i.validate)}))},i.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(re,!1)},i.prototype._updateLayerCount=function(t,e){var i=e?1:-1;t.is3D()&&(this._num3DLayers+=i),"circle"===t.type&&(this._numCircleLayers+=i),"symbol"===t.type&&(this._numSymbolLayers+=i)},i.prototype._load=function(e,i){var r=this;if(!i||!te(this,t.validateStyle(e))){for(var o in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(o,e.sources[o],{validate:!1});if(this._changed=!1,this.spriteListLoad={},e&&e.hasOwnProperty("custom_sprite")&&e.custom_sprite.forEach((function(t,e){r._loadSprite(t)})),e.sprite)if(e.sprite.indexOf(",")>0)for(var n=0,a=e.sprite.split(",");n<a.length;n+=1)this._loadSprite(a[n]);else this._loadSprite(e.sprite);else this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new t.Event("data",{dataType:"style"}));this.glyphManager.setURL(e.glyphs),e.sources.hasOwnProperty("indoor")&&!this.map._options.indoor&&this._settingsIndoorNone(this.stylesheet);var s=Q(this.stylesheet.layers);this._order=s.map((function(t){return t.id})),this._layers={},this._serializedLayers={};for(var l=0,u=s;l<u.length;l+=1){var h=u[l];(h=t.createStyleLayer(h)).setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=h,this._serializedLayers[h.id]=h.serialize(),this._updateLayerCount(h,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new _(this.stylesheet.light),this.stylesheet.terrain&&this._createTerrain(this.stylesheet.terrain),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),(this.map._options.sky||this.map._SkyClass)&&this.map.addSky(),this.map._options.fog&&this.map.addFog(),(this._isHotspot||this.map._isHotspotActive)&&this.map._addPoiHoverStyle(),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},i.prototype._settingsIndoorNone=function(t){t.layers.forEach((function(t){"indoor"==t.source&&(t.hasOwnProperty("layout")?t.layout.visibility="none":t.layout={visibility:"none"})}))},i.prototype._loadSprite=function(e){var i=this;this.spriteListLoad[e]=!1,this._spriteRequest=f(e,this.map._requestManager,(function(r,o){if(i._spriteRequest=null,r)i.fire(new t.ErrorEvent(r));else if(o)for(var n in o)i.imageManager.addImage(n,o[n]);i.spriteListLoad[e]=!0;var a=!0;for(var s in i.spriteListLoad)if(!i.spriteListLoad[s]){a=!1;break}a&&(i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.dispatcher.broadcast("spriteLoaded",!0),i.fire(new t.Event("data",{dataType:"style"})),i.spriteListLoad={})}))},i.prototype._loadImageSprite=function(e,i,r){var o=this;void 0===r&&(r={});var n=e.match(/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/),a=e;n||(a=t.getUrl(e)),this._spriteRequest=f(a,this.map._requestManager,(function(t,e){if(o._spriteRequest=null,e){for(var n in e)o.imageManager.addImage(n,e[n]);r.hasOwnProperty("textureManager")&&r.textureManager&&o._textureManager.updateSprite(e)}o.imageManager.setLoaded(!0),o._availableImages=o.imageManager.listImages(),o.dispatcher.broadcast("setImages",o._availableImages),i&&i(t,e)}))},i.prototype._validateLayer=function(e){var i=this.getSource(e.source);if(i){var r=e.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+r+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}},i.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},i.prototype._serializeLayers=function(t){for(var e=[],i=0,r=t;i<r.length;i+=1){var o=this._layers[r[i]];o&&"custom"!==o.type&&e.push(o.serialize())}return e},i.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(var t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},r.order.get=function(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order},i.prototype.isLayerDraped=function(t){return!!this.terrain&&oe[t.type]},i.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},i.prototype.update=function(e){if(this._loaded){var i=this._changed;if(this._changed){var r=Object.keys(this._updatedLayers),o=Object.keys(this._removedLayers);for(var n in(r.length||o.length)&&this._updateWorkerLayers(r,o),this._updatedSources){var a=this._updatedSources[n];"reload"===a?this._reloadSource(n):"clear"===a&&this._clearSource(n)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this.fog&&this.fog.updateTransitions(e),this._resetUpdates()}var l={};for(var u in this._sourceCaches){var h=this._sourceCaches[u];l[u]=h.used,h.used=!1}for(var p=!1,c=0,f=this._order;c<f.length;c+=1){var d=this._layers[f[c]];if(d.isContinuousDraw()&&(p=!0),d.recalculate(e,this._availableImages),!d.isHidden(e.zoom)){var m=this._getLayerSourceCache(d);m&&(m.used=!0)}var y=this.map.painter;if(y){var g=d.getProgramIds();if(!g)continue;for(var _=d.getProgramConfiguration(e.zoom),v=0,x=g;v<x.length;v+=1)y.useProgram(x[v],_)}}for(var b in this.enableLayerAnimate(p),l){var w=this._sourceCaches[b];l[b]!==w.used&&w.getSource().fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:w.getSource().id}))}this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.fog&&this.fog.recalculate(e),this.z=e.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new t.Event("data",{dataType:"style"}))}},i.prototype._updateTilesForChangedImages=function(){var t=Object.keys(this._changedImages);if(t.length){for(var e in this._sourceCaches)this._sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}},i.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},i.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},i.prototype.setState=function(e){var i=this;if(this._checkLoaded(),te(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Q(e.layers);var r=function(e,i){if(!e)return[{command:$.setStyle,args:[i]}];var r=[];try{if(!t.deepEqual(e.version,i.version))return[{command:$.setStyle,args:[i]}];t.deepEqual(e.center,i.center)||r.push({command:$.setCenter,args:[i.center]}),t.deepEqual(e.zoom,i.zoom)||r.push({command:$.setZoom,args:[i.zoom]}),t.deepEqual(e.bearing,i.bearing)||r.push({command:$.setBearing,args:[i.bearing]}),t.deepEqual(e.pitch,i.pitch)||r.push({command:$.setPitch,args:[i.pitch]}),t.deepEqual(e.sprite,i.sprite)||r.push({command:$.setSprite,args:[i.sprite]}),t.deepEqual(e.glyphs,i.glyphs)||r.push({command:$.setGlyphs,args:[i.glyphs]}),t.deepEqual(e.transition,i.transition)||r.push({command:$.setTransition,args:[i.transition]}),t.deepEqual(e.light,i.light)||r.push({command:$.setLight,args:[i.light]}),t.deepEqual(e.fog,i.fog)||r.push({command:$.setFog,args:[i.fog]});var o={},n=[];!function(e,i,r,o){var n;for(n in i=i||{},e=e||{})e.hasOwnProperty(n)&&(i.hasOwnProperty(n)||et(n,r,o));for(n in i)i.hasOwnProperty(n)&&(e.hasOwnProperty(n)?t.deepEqual(e[n],i[n])||("geojson"===e[n].type&&"geojson"===i[n].type&&rt(e,i,n)?r.push({command:$.setGeoJSONSourceData,args:[n,i[n].data]}):it(n,i,r,o)):tt(n,i,r))}(e.sources,i.sources,n,o);var a=[];e.layers&&e.layers.forEach((function(t){o[t.source]?r.push({command:$.removeLayer,args:[t.id]}):a.push(t)}));var s=e.terrain;s&&o[s.source]&&(r.push({command:$.setTerrain,args:[void 0]}),s=void 0),r=r.concat(n),t.deepEqual(s,i.terrain)||r.push({command:$.setTerrain,args:[i.terrain]}),function(e,i,r){i=i||[];var o,n,a,s,l,u,h,p=(e=e||[]).map(nt),c=i.map(nt),f=e.reduce(at,{}),d=i.reduce(at,{}),m=p.slice(),y=Object.create(null);for(o=0,n=0;o<p.length;o++)d.hasOwnProperty(a=p[o])?n++:(r.push({command:$.removeLayer,args:[a]}),m.splice(m.indexOf(a,n),1));for(o=0,n=0;o<c.length;o++)m[m.length-1-o]!==(a=c[c.length-1-o])&&(f.hasOwnProperty(a)?(r.push({command:$.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-n),1)):n++,r.push({command:$.addLayer,args:[d[a],u=m[m.length-o]]}),m.splice(m.length-o,0,a),y[a]=!0);for(o=0;o<c.length;o++)if(s=f[a=c[o]],l=d[a],!y[a]&&!t.deepEqual(s,l))if(t.deepEqual(s.source,l.source)&&t.deepEqual(s["source-layer"],l["source-layer"])&&t.deepEqual(s.type,l.type)){for(h in ot(s.layout,l.layout,r,a,null,$.setLayoutProperty),ot(s.paint,l.paint,r,a,null,$.setPaintProperty),t.deepEqual(s.filter,l.filter)||r.push({command:$.setFilter,args:[a,l.filter]}),t.deepEqual(s.minzoom,l.minzoom)&&t.deepEqual(s.maxzoom,l.maxzoom)||r.push({command:$.setLayerZoomRange,args:[a,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(h)&&"layout"!==h&&"paint"!==h&&"filter"!==h&&"metadata"!==h&&"minzoom"!==h&&"maxzoom"!==h&&(0===h.indexOf("paint.")?ot(s[h],l[h],r,a,h.slice(6),$.setPaintProperty):t.deepEqual(s[h],l[h])||r.push({command:$.setLayerProperty,args:[a,h,l[h]]}));for(h in l)l.hasOwnProperty(h)&&!s.hasOwnProperty(h)&&"layout"!==h&&"paint"!==h&&"filter"!==h&&"metadata"!==h&&"minzoom"!==h&&"maxzoom"!==h&&(0===h.indexOf("paint.")?ot(s[h],l[h],r,a,h.slice(6),$.setPaintProperty):t.deepEqual(s[h],l[h])||r.push({command:$.setLayerProperty,args:[a,h,l[h]]}))}else r.push({command:$.removeLayer,args:[a]}),u=m[m.lastIndexOf(a)+1],r.push({command:$.addLayer,args:[l,u]})}(a,i.layers,r)}catch(t){r=[{command:$.setStyle,args:[i]}]}return r}(this.serialize(),e).filter((function(t){return!(t.command in ie)}));if(0===r.length)return!1;var o=r.filter((function(t){return!(t.command in ee)}));if(o.length>0)throw new Error("Unimplemented: "+o.map((function(t){return t.command})).join(", ")+".");return r.forEach((function(t){"setTransition"!==t.command&&i[t.command].apply(i,t.args)})),this.stylesheet=e,!0},i.prototype.addImage=function(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,i),this._afterImageUpdated(e)},i.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},i.prototype.getImage=function(t){return this.imageManager.getImage(t)},i.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)},i.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},i.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},i.prototype.addSource=function(e,i,r){var o=this;if(void 0===r&&(r={}),this._checkLoaded(),void 0!==this.getSource(e))throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(i).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,r))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var n=N(e,i,this.dispatcher,this);n.setEventedParent(this,(function(){return{isSourceLoaded:o.loaded(),source:n.serialize(),sourceId:e}}));var a=function(i){var r=(i?"symbol:":"other:")+e,a=o._sourceCaches[r]=new t.SourceCache(r,n,i);(i?o._symbolSourceCaches:o._otherSourceCaches)[e]=a,a.style=o,a.onAdd(o.map)};a(!1),"vector"!==i.type&&"geojson"!==i.type||a(!0),n.onAdd&&n.onAdd(this.map),this._changed=!0}},i.prototype.removeSource=function(e){this._checkLoaded();var i=this.getSource(e);if(void 0===i)throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));if(this.terrain&&this.terrain.get().source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while terrain is using it.')));for(var o=0,n=this._getSourceCaches(e);o<n.length;o+=1){var a=n[o];delete this._sourceCaches[a.id],delete this._updatedSources[a.id],a.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles()}delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0},i.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.getSource(t).setData(e),this._changed=!0},i.prototype.getSource=function(t){var e=this._getSourceCache(t);return e&&e.getSource()},i.prototype.addLayer=function(e,i,r,o){var n;void 0===r&&(r={}),this._checkLoaded();var a=e.id;if(this.getLayer(a))this.fire(new t.ErrorEvent(new Error('Layer with id "'+a+'" already exists on this map')));else{var s;if("sky"===e.type&&(this._sky=!0),"custom"===e.type){if(te(this,t.validateCustomStyleLayer(e)))return;s=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(a,e.source),e=t.clone$1(e),e=t.extend(e,{source:a})),this._validate(t.validateStyle.layer,"layers."+a,e,{arrayIndex:-1},r))return;s=t.createStyleLayer(e),this._validateLayer(s),s.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[s.id]=s.serialize(),this._updateLayerCount(s,!0)}var l=this._order.length;if(i?l=this._order.indexOf(i):"number"==typeof o&&(l=this.getLayerIndex(o)),i&&-1===l)this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.')));else{this._order.splice(l,0,a);var u=this._order.indexOf("VirtualSpace_custom_layer");u>-1&&u!=this._order.length-1&&(this._order.splice(u,1),this._order.push("VirtualSpace_custom_layer"));var h=[];this._order.forEach((function(t){t.indexOf("VirtualSpace_custom_Spring_")>-1&&h.push(t)})),this._order.filter((function(t){return t.indexOf("VirtualSpace_custom_Spring_")<0})),h.length>0&&(n=this._order).push.apply(n,h),this._layerOrderChanged=!0,this._layers[a]=s,0==a.indexOf("custom_")&&(this._customLayers[a]=s);var p=this._getLayerSourceCache(s);if(this._removedLayers[a]&&s.source&&p&&"custom"!==s.type){var c=this._removedLayers[a];delete this._removedLayers[a],c.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",p.pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map),this._updateDrapeFirstLayers()}}},i.prototype.getLayerIndex=function(t){var e=this._order.length,i=this._getOldLayer(t).oldLayerID;return i&&(e=this._order.indexOf(i)),e},i.prototype.updateOverLayerzIndex=function(t){if(t){var e=this._getOldLayer(t.options.zIndex),i=e.oldLayer,r=e.oldLayerID,o=Object.values(t._layers).filter((function(t,e){return t.length>0}));if(i&&r)for(o.reverse(),this.map.moveLayer(o[0],r),n=1;n<o.length;n++)this.map.moveLayer(o[n],o[n-1]);else for(var n=0;n<o.length;n++)this.map.moveLayer(o[n])}},i.prototype._getOldLayer=function(t){var e=null,i=null,r={},o=[];for(var n in this.map._customLayers)if(this.map._customLayers[n].options&&(this.map._customLayers[n].options.zIndex||0==this.map._customLayers[n].options.zIndex)){var a=this.map._customLayers[n].options.zIndex;r[n]=parseInt(a),o.indexOf(a)<0&&o.push(a)}if(o.length>0){o.sort((function(t,e){return t-e}));var s=null;for(var l in o)if(o[l]>t){s=o[l];break}if(null!=s){var u=Object.keys(r);for(var h in u)if(r[h]==s){e=this.map._customLayers[parseInt(h)],i=Object.values(e._layers).filter((function(t,e){return t.length>0}))[0];break}}}return{oldLayer:e,oldLayerID:i}},i.prototype.getAllLayer=function(){return this._layers},i.prototype.moveLayer=function(e,i){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==i){0==e.indexOf("custom_")&&this._customLayers[e]&&delete this._customLayers[e];var r=this._order.indexOf(e);this._order.splice(r,1);var o=i?this._order.indexOf(i):this._order.length;i&&-1===o?this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.'))):(this._order.splice(o,0,e),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},i.prototype.removeLayer=function(e){this._checkLoaded();var i=this._layers[e];if(i){"sky"===i.type&&(this._sky=!1),i.setEventedParent(null),this._updateLayerCount(i,!1);var r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},i.prototype.getLayer=function(t){return this._layers[t]},i.prototype.hasLayer=function(t){return t in this._layers},i.prototype.hasLayerType=function(t){for(var e in this._layers)if(this._layers[e].type===t)return!0;return!1},i.prototype.setLayerZoomRange=function(e,i,r){this._checkLoaded();var o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===r||(null!=i&&(o.minzoom=i),null!=r&&(o.maxzoom=r),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},i.prototype.setFilter=function(e,i,r){void 0===r&&(r={}),this._checkLoaded();var o=this.getLayer(e);if(o){if(!t.deepEqual(o.filter,i))return null==i?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,"layers."+o.id+".filter",i,null,r)||(o.filter=t.clone$1(i),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},i.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},i.prototype.setLayoutProperty=function(e,i,r,o){void 0===o&&(o={}),this._checkLoaded();var n=this.getLayer(e);n?t.deepEqual(n.getLayoutProperty(i),r)||(n.setLayoutProperty(i,r,o),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},i.prototype.getLayoutProperty=function(e,i){var r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},i.prototype.setPaintProperty=function(e,i,r,o){void 0===o&&(o={}),this._checkLoaded();var n=this.getLayer(e);n?(i.indexOf("animate-enable")>0&&!0===r&&this.enableLayerAnimate(!0),t.deepEqual(n.getPaintProperty(i),r)||(n.setPaintProperty(i,r,o)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},i.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},i.prototype.setFeatureState=function(e,i){this._checkLoaded();var r=e.source,o=e.sourceLayer,n=this.getSource(r);if(void 0!==n){var a=n.type;if("geojson"===a&&o)this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));else if("vector"!==a||o){void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided.")));for(var s=0,l=this._getSourceCaches(r);s<l.length;s+=1)l[s].setFeatureState(o,e.id,i)}else this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},i.prototype.removeFeatureState=function(e,i){this._checkLoaded();var r=e.source,o=this.getSource(r);if(void 0!==o){var n=o.type,a="vector"===n?e.sourceLayer:void 0;if("vector"!==n||a)if(i&&"string"!=typeof e.id&&"number"!=typeof e.id)this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));else for(var s=0,l=this._getSourceCaches(r);s<l.length;s+=1)l[s].removeFeatureState(a,e.id,i);else this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},i.prototype.getFeatureState=function(e){this._checkLoaded();var i=e.source,r=e.sourceLayer,o=this.getSource(i);if(void 0!==o){if("vector"!==o.type||r)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(r,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")))},i.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},i.prototype.serialize=function(){var e={};for(var i in this._sourceCaches){var r=this._sourceCaches[i].getSource();e[r.id]||(e[r.id]=r.serialize())}return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:e,layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},i.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0;var e=this._getLayerSourceCache(t);t.source&&!this._updatedSources[t.source]&&e&&"raster"!==e.getSource().type&&(this._updatedSources[t.source]="reload",e.pause()),this._changed=!0},i.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,i=function(t){return"fill-extrusion"===e._layers[t].type},r={},o=[],n=this._order.length-1;n>=0;n--){var a=this._order[n];if(i(a)){r[a]=n;for(var s=0,l=t;s<l.length;s+=1){var u=l[s][a];if(u)for(var h=0,p=u;h<p.length;h+=1)o.push(p[h])}}}o.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var c=[],f=this._order.length-1;f>=0;f--){var d=this._order[f];if(i(d))for(var m=o.length-1;m>=0;m--){var y=o[m].feature;if(r[y.layer.id]<f)break;c.push(y),o.pop()}else for(var g=0,_=t;g<_.length;g+=1){var v=_[g][d];if(v)for(var x=0,b=v;x<b.length;x+=1)c.push(b[x].feature)}}return c},i.prototype.queryRenderedFeatures=function(e,i,r){var o=this;i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);var n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var a=0,s=i.layers;a<s.length;a+=1){var l=s[a],u=this._layers[l];if(!u)return this.fire(new t.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be queried for features."))),[];n[u.source]=!0}}var h=[];i.availableImages=this._availableImages;var p=i&&i.layers?i.layers.some((function(t){var e=o.getLayer(t);return e&&e.is3D()})):this.has3DLayers(),c=E.createFromScreenPoints(e,r);for(var f in this._sourceCaches){var d=this._sourceCaches[f].getSource().id;i.layers&&!n[d]||h.push(G(this._sourceCaches[f],this._layers,this._serializedLayers,c,i,r,p,!!this.map._showQueryGeometry))}return this.placement&&h.push(function(t,e,i,r,o,n,a){for(var s={},l=n.queryRenderedSymbols(r),u=[],h=0,p=Object.keys(l).map(Number);h<p.length;h+=1)u.push(a[p[h]]);u.sort(q);for(var c=function(){var i=d[f],r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,o.filter,o.layers,o.availableImages,t);for(var n in r){var a=s[n]=s[n]||[],u=r[n];u.sort((function(t,e){var r=i.featureSortOrder;if(r){var o=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-o}return e.featureIndex-t.featureIndex}));for(var h=0,p=u;h<p.length;h+=1)a.push(p[h])}},f=0,d=u;f<d.length;f+=1)c();var m=function(e){s[e].forEach((function(r){var o=r.feature,n=i(t[e]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=n}))};for(var y in s)m(y);return s}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),c.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)},i.prototype.querySourceFeatures=function(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);for(var r=[],o=0,n=this._getSourceCaches(e);o<n.length;o+=1)r=r.concat(Z(n[o],i));return r},i.prototype.addSourceType=function(t,e,r){return i.getSourceType(t)?r(new Error('A source type called "'+t+'" already exists.')):(i.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},r):r(null,null))},i.prototype.getLight=function(){return this.light.getLight()},i.prototype.setLight=function(e,i){void 0===i&&(i={}),this._checkLoaded();var r=this.light.getLight(),o=!1;for(var n in e)if(!t.deepEqual(e[n],r[n])){o=!0;break}if(o){var a={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}},i.prototype.getTerrain=function(){return this.terrain?this.terrain.get():null},i.prototype.setTerrain=function(e){if(this._checkLoaded(),!e)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if("object"==typeof e.source){var i="terrain-dem-src";this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})}if(!this._validate(t.validateStyle.terrain,"terrain",e)){if(this.terrain){var r=this.terrain,o=r.get();for(var n in e)if(!t.deepEqual(e[n],o[n])){r.set(e),this.stylesheet.terrain=e;var a={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};r.updateTransitions(a);break}}else this._createTerrain(e);this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}},i.prototype._createFog=function(e){var i=this.fog=new T(e);this.stylesheet.fog=e;var r={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};i.updateTransitions(r)},i.prototype._updateMarkersOpacity=function(){var t=this.map._markers.concat(this.map._texts,this.map._popup);0!==t.length&&this.map._requestDomTask((function(){for(var e=0,i=t;e<i.length;e+=1)i[e]._evaluateOpacity()}))},i.prototype.getFog=function(){return this.fog?this.fog.get():null},i.prototype.setFog=function(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){var i=this.fog,r=i.get();for(var o in e)if(!t.deepEqual(e[o],r[o])){i.set(e),this.stylesheet.fog=e;var n={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};i.updateTransitions(n);break}}else this._createFog(e);this._markersNeedUpdate=!0},i.prototype._updateDrapeFirstLayers=function(){var t,e,i=this;if(this.map._optimizeForTerrain&&this.terrain){var r=this._order.filter((function(t){return i.isLayerDraped(i._layers[t])})),o=this._order.filter((function(t){return!i.isLayerDraped(i._layers[t])}));this._drapedFirstOrder=[],(t=this._drapedFirstOrder).push.apply(t,r),(e=this._drapedFirstOrder).push.apply(e,o)}},i.prototype._createTerrain=function(e){var i=this.terrain=new x(e);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();var r={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};i.updateTransitions(r)},i.prototype._force3DLayerUpdate=function(){for(var t in this._layers){var e=this._layers[t];"fill-extrusion"===e.type&&this._updateLayer(e)}},i.prototype._validate=function(e,i,r,o,n){return void 0===n&&(n={}),(!n||!1!==n.validate)&&te(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:r,styleSpec:t.spec},o)))},i.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var i in this._sourceCaches)this._sourceCaches[i].clearTiles(),this._sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},i.prototype._clearSource=function(t){for(var e=0,i=this._getSourceCaches(t);e<i.length;e+=1)i[e].clearTiles()},i.prototype._reloadSource=function(t){for(var e=0,i=this._getSourceCaches(t);e<i.length;e+=1){var r=i[e];r.resume(),r.reload()}},i.prototype._updateSources=function(t){for(var e in this._sourceCaches)this._sourceCaches[e].update(t)},i.prototype._generateCollisionBoxes=function(){for(var t in this._sourceCaches){var e=this._sourceCaches[t];e.resume(),e.reload()}},i.prototype._updatePlacement=function(e,i,r,o,n){void 0===n&&(n=!1);for(var a=!1,s=!1,l={},u=0,h=this._order;u<h.length;u+=1){var p=this._layers[h[u]];if("symbol"===p.type){if(!l[p.source]){var c=this._getLayerSourceCache(p);if(!c)continue;l[p.source]=c.getRenderableIds(!0).map((function(t){return c.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var f=this.crossTileSymbolIndex.addLayer(p,l[p.source],e.center.lng);a=a||f}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n=n||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new t.Event("neworder")),(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new qt(e,this._order,n,i,r,o,this.placement,this.fog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(var d=0,m=this._order;d<m.length;d+=1){var y=this._layers[m[d]];"symbol"===y.type&&this.placement.updateLayerOpacities(y,l[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())},i.prototype._releaseSymbolFadeTiles=function(){for(var t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()},i.prototype.getImages=function(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();var r=function(t){t&&t.setDependencies(e.tileID.key,e.type,e.icons)};r(this._otherSourceCaches[e.source]),r(this._symbolSourceCaches[e.source])},i.prototype.getGlyphs=function(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)},i.prototype.getResource=function(e,i,r){return t.makeRequest(i,r)},i.prototype._getSourceCache=function(t){return this._otherSourceCaches[t]},i.prototype._getLayerSourceCache=function(t){return"symbol"===t.type?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]},i.prototype._getSourceCaches=function(t){var e=[];return this._otherSourceCaches[t]&&e.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&e.push(this._symbolSourceCaches[t]),e},i.prototype.has3DLayers=function(){return this._num3DLayers>0},i.prototype.hasSymbolLayers=function(){return this._numSymbolLayers>0},i.prototype.hasCircleLayers=function(){return this._numCircleLayers>0},Object.defineProperties(i.prototype,r),i}(t.Evented);ne.getSourceType=function(t){return j[t]},ne.setSourceType=function(t,e){j[t]=e},ne.registerForPluginStateChange=t.registerForPluginStateChange;var ae="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}\n#endif",se="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",le={},ue={};le=fe("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0),ue=fe("#ifdef FOG\nuniform float u_fog_temporal_offset;float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);return mix(color,u_fog_color.rgb,opacity);}vec3 fog_apply_from_vert(vec3 color,float fog_opac) {return mix(color,u_fog_color.rgb,fog_opac);}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb/=alpha;color.rgb=fog_apply(color.rgb,pos);color.rgb*=alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif","#ifdef FOG\nuniform mat4 u_fog_matrix;vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",!0);var he=fe("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),pe=ae,ce={background:fe("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:fe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:fe("varying vec3 v_data;varying float v_visibility;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define mediump float radius\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define highp vec4 stroke_color\n#pragma lkmap: define mediump float stroke_width\n#pragma lkmap: define lowp float stroke_opacity\nvoid main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize mediump float radius\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize highp vec4 stroke_color\n#pragma lkmap: initialize mediump float stroke_width\n#pragma lkmap: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define mediump float radius\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define highp vec4 stroke_color\n#pragma lkmap: define mediump float stroke_width\n#pragma lkmap: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize mediump float radius\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize highp vec4 stroke_color\n#pragma lkmap: initialize mediump float stroke_width\n#pragma lkmap: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);vec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:fe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:fe("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma lkmap: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma lkmap: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\ngl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma lkmap: define highp float weight\n#pragma lkmap: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma lkmap: initialize highp float weight\n#pragma lkmap: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec3 pos=vec3(floor(a_pos*0.5)+extrude,elevation(floor(a_pos*0.5)));gl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:fe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:fe("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=u_matrix*vec4(a_pos,elevation(a_pos),1.0);gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:fe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:fe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);}"),fill:fe("uniform float u_isWater;uniform float u_time;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float opacity\nfloat random(float x) {return fract(sin(x)*10000.);}float noise(vec2 p) {return random(p.x+p.y*10000.);}vec2 sw(vec2 p) { return vec2(floor(p.x),floor(p.y)); }vec2 se(vec2 p) { return vec2(ceil(p.x),floor(p.y)); }vec2 nw(vec2 p) { return vec2(floor(p.x),ceil(p.y)); }vec2 ne(vec2 p) { return vec2(ceil(p.x),ceil(p.y)); }float smoothNoise(vec2 p) {vec2 interp=smoothstep(0.,1.,fract(p));float s=mix(noise(sw(p)),noise(se(p)),interp.x);float n=mix(noise(nw(p)),noise(ne(p)),interp.x);return mix(s,n,interp.y);}float fractalNoise(vec2 p) {float x=0.;x+=smoothNoise(p      );x+=smoothNoise(p*2.)/2.;x+=smoothNoise(p*4.)/4.;x+=smoothNoise(p*8.)/8.;x+=smoothNoise(p*16.)/16.;x/=1.+1./2.+1./4.+1./8.+1./16.;return x;}float movingNoise(vec2 p) {float x=fractalNoise(p+u_time/5.);float y=fractalNoise(p-u_time/5.);return fractalNoise(p+vec2(x,y));}float nestedNoise(vec2 p) {float x=movingNoise(p);float y=movingNoise(p+100.);return movingNoise(p+vec2(x,y));}void main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float opacity\nvec4 out_color;if(u_isWater==1.0)\n{vec2 iResolution=vec2(1920,1048);vec2 uv=gl_FragCoord.xy/iResolution.xy;float n=nestedNoise(uv*6.);out_color=vec4(mix(vec3(.4,.6,1),vec3(color.rgb),n),opacity);}else{out_color=color;}\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:fe("varying vec2 v_pos;\n#pragma lkmap: define highp vec4 outline_color\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize highp vec4 outline_color\n#pragma lkmap: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma lkmap: define highp vec4 outline_color\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize highp vec4 outline_color\n#pragma lkmap: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:fe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:fe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:fe("varying vec4 v_color;varying vec4 v_color_top;varying vec3 v_normal;varying float v_point_height;uniform float u_isGradient;uniform float u_exclude;uniform float u_direction;\n#pragma lkmap: define highp float height\nvoid main() {\n#pragma lkmap: initialize highp float height\nvec4 color=v_color;if (v_normal.z > 0.9&&u_exclude>0.0) {color=v_color_top;}if(u_isGradient==1.0){if(u_direction==1.0){if((1.0-(1.2-(v_point_height/height))*0.85)>1.0)\n{color=vec4(color.rgb,1.0);}else{color=vec4(color.rgb,(1.0-(1.2-(v_point_height/height))*0.85));}}else{if((1.2-(v_point_height/height))*0.85>1.0)\n{color=vec4(color.rgb,1.0);}else{color=vec4(color.rgb,(1.2-(v_point_height/height))*0.85);}  \n}}\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;varying vec4 v_color;varying vec4 v_color_top;varying vec3 v_normal;varying float v_point_height;\n#pragma lkmap: define highp float base\n#pragma lkmap: define highp float height\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define highp vec4 roofcolor\nvoid main() {\n#pragma lkmap: initialize highp float base\n#pragma lkmap: initialize highp float height\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize highp vec4 roofcolor\nv_color_top=roofcolor;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));v_normal=normal;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);v_point_height=h;gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);v_point_height=pos.z;gl_Position=u_matrix*vec4(pos,1);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:fe("uniform vec2 u_texsize;uniform float u_fade;uniform float u_isTile;uniform sampler2D u_image;varying vec2 v_uv;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;varying vec4 v_color;varying vec3 v_normal;varying float v_exclude;varying vec4 v_color_top;\n#pragma lkmap: define lowp float base\n#pragma lkmap: define lowp float height\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\nvoid main() {\n#pragma lkmap: initialize lowp float base\n#pragma lkmap: initialize lowp float height\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);if(u_isTile>0.0){imagecoord=mod(v_uv,1.0); \n}vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);if(u_isTile>0.0){imagecoord_b=mod(v_uv,1.0); \n}vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;if (v_normal.z > 0.9&& v_exclude>0.0) {out_color=v_color_top;}\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform lowp float u_exclude;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;varying vec4 v_color;varying float v_exclude;varying vec3 v_normal;varying vec4 v_color_top;varying float v_height;varying vec2 v_uv;\n#pragma lkmap: define lowp float base\n#pragma lkmap: define lowp float height\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define highp vec4 roofcolor\nvoid main() {\n#pragma lkmap: initialize lowp float base\n#pragma lkmap: initialize lowp float height\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize highp vec4 roofcolor\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;v_color_top=roofcolor;v_normal=normal;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);v_height=h;v_uv=vec2(pos_nx.xy.x/base*height,h/height);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);\n#else\nvec3 p=vec3(pos_nx.xy,z);v_uv=vec2(pos_nx.xy.x/base,z/height);v_height=z;gl_Position=u_matrix*vec4(p,1);\n#endif\nfloat newt=mod(a_pos_normal_ed.xyz.x,4.0);z=(newt==2.0) ? base : z;float u=(newt==0.0) || (newt==1.0) ? 0.0 : 1.0;float v=(newt==0.0) || (newt==2.0) ? 0.0 : 1.0;u=(u==0.0) ? u : ceil(edgedistance/edgedistance);v=(v==0.0) ? v : ceil(height/height);v_uv=vec2(u,1.0-v);v_uv=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 ? vec2(-1.0,-1.0) : v_uv;vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;v_exclude=float(u_exclude);if (v_exclude > 0.0 && normal.z > 0.9) {v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;v_color.rgb+=clamp(color.rgb*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;}\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:fe("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:fe("uniform lowp float u_device_pixel_ratio;uniform vec4 u_aimate;uniform float u_time;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying float v_linesofar;varying float v_total_distance;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\nfloat calAnimateAlpha()\n{float total_dis=1.0;if(v_total_distance>0.1)\ntotal_dis=v_total_distance;float animateSpeed=u_time/u_aimate.y;float d_distance_ratio=v_linesofar/total_dis;float alpha=1.0-fract( mod(1.0-d_distance_ratio,u_aimate.z)*(1.0/u_aimate.z)+animateSpeed);alpha=(alpha+u_aimate.w-1.0)/u_aimate.w;alpha=smoothstep(0.,1.,alpha);return alpha;}void main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nif(u_aimate.x>0.5) {float  animate_alpha=calAnimateAlpha();gl_FragColor=out_color*(alpha*opacity)*animate_alpha;}else {gl_FragColor=out_color*(alpha*opacity);}\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;attribute float a_total_distance;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform highp float u_height;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying float v_linesofar;varying float v_total_distance;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define mediump float gapwidth\n#pragma lkmap: define lowp float offset\n#pragma lkmap: define mediump float width\nvoid main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump float gapwidth\n#pragma lkmap: initialize lowp float offset\n#pragma lkmap: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);vec4 position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\nv_linesofar=a_linesofar;v_total_distance=a_total_distance;gl_Position=u_matrix*vec4(pos,u_height,1.0)+projected_extrude;}"),lineGradient:fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define mediump float gapwidth\n#pragma lkmap: define lowp float offset\n#pragma lkmap: define mediump float width\nvoid main() {\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump float gapwidth\n#pragma lkmap: initialize lowp float offset\n#pragma lkmap: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:fe("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;uniform vec4 u_aimate;uniform float u_time;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;varying float v_total_distance;\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\nfloat calAnimateAlpha()\n{float total_dis=1.0;if(v_total_distance>0.1)\ntotal_dis=v_total_distance;float animateSpeed=u_time/u_aimate.y;float d_distance_ratio=v_linesofar/total_dis;float alpha=1.0-fract( mod(1.0-d_distance_ratio,u_aimate.z)*(1.0/u_aimate.z)+animateSpeed);alpha=(alpha+u_aimate.w-1.0)/u_aimate.w;alpha=smoothstep(0.,1.,alpha);return alpha;}void main() {\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\nvec4 out_color=color;if(u_aimate.x>0.5)\n{float  animate_alpha=calAnimateAlpha();gl_FragColor=out_color*(alpha*opacity)*animate_alpha;}else\n{gl_FragColor=out_color*(alpha*opacity);}\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;attribute float a_total_distance;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;varying float v_total_distance;\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp float offset\n#pragma lkmap: define mediump float gapwidth\n#pragma lkmap: define mediump float width\n#pragma lkmap: define lowp float floorwidth\n#pragma lkmap: define lowp vec4 pattern_from\n#pragma lkmap: define lowp vec4 pattern_to\n#pragma lkmap: define lowp float pixel_ratio_from\n#pragma lkmap: define lowp float pixel_ratio_to\nvoid main() {\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize lowp float offset\n#pragma lkmap: initialize mediump float gapwidth\n#pragma lkmap: initialize mediump float width\n#pragma lkmap: initialize lowp float floorwidth\n#pragma lkmap: initialize mediump vec4 pattern_from\n#pragma lkmap: initialize mediump vec4 pattern_to\n#pragma lkmap: initialize lowp float pixel_ratio_from\n#pragma lkmap: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;v_total_distance=a_total_distance;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),lineSDF:fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_mix;uniform vec3 u_scale;uniform vec4 u_aimate;uniform float u_time;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;varying float v_linesofar;varying float v_total_distance;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define mediump float width\n#pragma lkmap: define lowp float floorwidth\n#pragma lkmap: define lowp vec4 dash_from\n#pragma lkmap: define lowp vec4 dash_to\nfloat calAnimateAlpha()\n{float total_dis=1.0;if(v_total_distance>0.1)\ntotal_dis=v_total_distance;float animateSpeed=u_time/u_aimate.y;float d_distance_ratio=v_linesofar/total_dis;float alpha=1.0-fract( mod(1.0-d_distance_ratio,u_aimate.z)*(1.0/u_aimate.z)+animateSpeed);alpha=(alpha+u_aimate.w-1.0)/u_aimate.w;alpha=smoothstep(0.,1.,alpha);return alpha;}float calAnimateAlpha0()\n{float animateSpeed=u_time/u_aimate.y;float trailLength=u_aimate.w;float duration=0.2;float total_dis=1.0;if(v_total_distance>0.1)\ntotal_dis=v_total_distance;float d_distance_ratio=v_linesofar/total_dis;float start=fract(duration+animateSpeed);float end  =fract(duration+animateSpeed+trailLength);float animate_alpha=0.0;float inter_t;if( d_distance_ratio>start && d_distance_ratio<end ) {inter_t=(d_distance_ratio-start)/trailLength;animate_alpha=smoothstep(0.0,1.0,inter_t);}else if(d_distance_ratio> start && d_distance_ratio <trailLength+start ) {inter_t=(d_distance_ratio-start)/trailLength;animate_alpha=smoothstep(0.0,1.0,inter_t);}else if(d_distance_ratio< end && d_distance_ratio > end-trailLength) {inter_t=(end-d_distance_ratio)/trailLength;animate_alpha=smoothstep(1.0,0.0,inter_t);}return animate_alpha;}void main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump float width\n#pragma lkmap: initialize lowp float floorwidth\n#pragma lkmap: initialize mediump vec4 dash_from\n#pragma lkmap: initialize mediump vec4 dash_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);vec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nif(u_aimate.x>0.5)\n{float  animate_alpha=calAnimateAlpha();gl_FragColor=out_color*(alpha*opacity)*animate_alpha;}else\n{gl_FragColor=out_color*(alpha*opacity);}\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;attribute float a_total_distance;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;varying float v_linesofar;varying float v_total_distance;\n#pragma lkmap: define highp vec4 color\n#pragma lkmap: define lowp float blur\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define mediump float gapwidth\n#pragma lkmap: define lowp float offset\n#pragma lkmap: define mediump float width\n#pragma lkmap: define lowp float floorwidth\n#pragma lkmap: define lowp vec4 dash_from\n#pragma lkmap: define lowp vec4 dash_to\nvoid main() {\n#pragma lkmap: initialize highp vec4 color\n#pragma lkmap: initialize lowp float blur\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize mediump float gapwidth\n#pragma lkmap: initialize lowp float offset\n#pragma lkmap: initialize mediump float width\n#pragma lkmap: initialize lowp float floorwidth\n#pragma lkmap: initialize mediump vec4 dash_from\n#pragma lkmap: initialize mediump vec4 dash_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_total_distance=a_total_distance;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);v_width2=vec2(outset,inset);v_linesofar=a_linesofar;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:fe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:fe("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma lkmap: define lowp float opacity\nvoid main() {\n#pragma lkmap: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));}"),symbolSDF:fe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma lkmap: define highp vec4 fill_color\n#pragma lkmap: define highp vec4 halo_color\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp float halo_width\n#pragma lkmap: define lowp float halo_blur\nvoid main() {\n#pragma lkmap: initialize highp vec4 fill_color\n#pragma lkmap: initialize highp vec4 halo_color\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize lowp float halo_width\n#pragma lkmap: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma lkmap: define highp vec4 fill_color\n#pragma lkmap: define highp vec4 halo_color\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp float halo_width\n#pragma lkmap: define lowp float halo_blur\nvoid main() {\n#pragma lkmap: initialize highp vec4 fill_color\n#pragma lkmap: initialize highp vec4 halo_color\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize lowp float halo_width\n#pragma lkmap: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:fe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma lkmap: define highp vec4 fill_color\n#pragma lkmap: define highp vec4 halo_color\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp float halo_width\n#pragma lkmap: define lowp float halo_blur\nvoid main() {\n#pragma lkmap: initialize highp vec4 fill_color\n#pragma lkmap: initialize highp vec4 halo_color\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize lowp float halo_width\n#pragma lkmap: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma lkmap: define highp vec4 fill_color\n#pragma lkmap: define highp vec4 halo_color\n#pragma lkmap: define lowp float opacity\n#pragma lkmap: define lowp float halo_width\n#pragma lkmap: define lowp float halo_blur\nvoid main() {\n#pragma lkmap: initialize highp vec4 fill_color\n#pragma lkmap: initialize highp vec4 halo_color\n#pragma lkmap: initialize lowp float opacity\n#pragma lkmap: initialize lowp float halo_width\n#pragma lkmap: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrainRaster:fe("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef FOG\ncolor.rgb=fog_dither(fog_apply_from_vert(color.rgb,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n}"),terrainDepth:fe("#ifdef GL_ES\nprecision highp float;\n#endif\nvec4 pack_depth(float ndc_z) {float depth=ndc_z*0.5+0.5;const vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:fe("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",se),skyboxGradient:fe("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",se),skyboxGradientCapture:fe("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix;uniform mat3 u_matrix_3f;varying highp vec3 v_position;varying highp vec3 v_uv;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);v_uv=v_position;gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),skyboxCapture:fe("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;uniform lowp sampler2D u_color_ramp;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),skyboxIrradiance:fe("\nprecision highp int;varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;void main() {vec3 N=normalize(v_uv);vec3 up=vec3(0.0,1.0,0.0);vec3 right=normalize(cross(up,N));up=cross(N,right);const float deltaPhi=2.0*PI/180.0;const float deltaTheta=0.5*PI/64.0;const float TWO_PI=PI*2.0;const float HALF_PI=PI*0.5;vec3 color=vec3(0.0);float sampleCount=0.0;for (float phi=0.0; phi < TWO_PI; phi+=deltaPhi) {for (float theta=0.0; theta < HALF_PI; theta+=deltaTheta) {vec3 tempVec=cos(phi)*right+sin(phi)*up;vec3 sampleVector=cos(theta)*N+sin(theta)*tempVec;color+=textureCube(u_cubemap,sampleVector).rgb*cos(theta)*sin(theta);sampleCount++;}}gl_FragColor=vec4(PI*color/float(sampleCount),1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_uv;void main() {v_uv=a_pos_3f;gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),skyboxPreFiltered:fe("\nprecision highp int;varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform float u_roughness;const int numSamples=32;float random(vec2 co){float a=12.9898;float b=78.233;float c=43758.5453;float dt=dot(co.xy,vec2(a,b));float sn=mod(dt,3.14);return fract(sin(sn)*c);}float VanDerCorpus(int n,int base){float invBase=1.0/float(base);float denom  =1.0;float result =0.0;for(int i=0; i < 32;++i)\n{if(n > 0)\n{denom  =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n      =int(float(n)/2.0);}}return result;}vec2 HammersleyNoBitOps(int i,int N) {return vec2(float(i)/float(N),VanDerCorpus(i,2));}vec3 importanceSample_GGX(vec2 Xi,float roughness,vec3 normal) {float alpha=roughness*roughness;float phi=2.0*PI*Xi.x+random(normal.xz)*0.1;float cosTheta=sqrt((1.0-Xi.y)/(1.0+(alpha*alpha-1.0)*Xi.y));float sinTheta=sqrt(1.0-cosTheta*cosTheta);vec3 H=vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);vec3 up=abs(normal.z) < 0.999 ? vec3(0.0,0.0,1.0) : vec3(1.0,0.0,0.0);vec3 tangentX=normalize(cross(up,normal));vec3 tangentY=normalize(cross(normal,tangentX));return normalize(tangentX*H.x+tangentY*H.y+normal*H.z);}float D_GGX(float dotNH,float roughness) {float alpha=roughness*roughness;float alpha2=alpha*alpha;float denom=dotNH*dotNH*(alpha2-1.0)+1.0;return (alpha2)/(PI*denom*denom);}vec3 prefilterEnvMap(vec3 R,float roughness) {vec3 N=R;vec3 V=R;vec3 color=vec3(0.0);float totalWeight=0.0;float envMapDim=512.0;for(int i=0; i < numSamples; i++) {vec2 Xi=HammersleyNoBitOps(i,numSamples);vec3 H=importanceSample_GGX(Xi,roughness,N);vec3 L=2.0*dot(V,H)*H-V;float dotNL=clamp(dot(N,L),0.0,1.0);if(dotNL > 0.0) {float dotNH=clamp(dot(N,H),0.0,1.0);float dotVH=clamp(dot(V,H),0.0,1.0);float pdf=D_GGX(dotNH,roughness)*dotNH/(4.0*dotVH)+0.0001;float omegaS=1.0/(float(numSamples)*pdf);float omegaP=4.0*PI/(6.0*envMapDim*envMapDim);color+=textureCube(u_cubemap,L).rgb*dotNL;totalWeight+=dotNL;}}return (color/totalWeight);}void main() {vec3 N=normalize(v_uv);gl_FragColor=vec4(prefilterEnvMap(N,u_roughness),1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_uv;void main() {v_uv=a_pos_3f;gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),skyboxBrdf:fe("\nprecision highp int;varying lowp vec2 v_uv;float random(vec2 co)\n{float a=12.9898;float b=78.233;float c=43758.5453;float dt=dot(co.xy,vec2(a,b));float sn=mod(dt,3.14);return fract(sin(sn)*c);}float VanDerCorpus(int n,int base)\n{float invBase=1.0/float(base);float denom  =1.0;float result =0.0;for(int i=0; i < 32;++i)\n{if(n > 0)\n{denom  =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n      =int(float(n)/2.0);}}return result;}vec2 HammersleyNoBitOps(int i,int N)\n{return vec2(float(i)/float(N),VanDerCorpus(i,2));}vec3 importanceSample_GGX(vec2 Xi,float roughness,vec3 normal)\n{float alpha=roughness*roughness;float phi=2.0*PI*Xi.x+random(normal.xz)*0.1;float cosTheta=sqrt((1.0-Xi.y)/(1.0+(alpha*alpha-1.0)*Xi.y));float sinTheta=sqrt(1.0-cosTheta*cosTheta);vec3 H=vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);vec3 up=abs(normal.z) < 0.999 ? vec3(0.0,0.0,1.0) : vec3(1.0,0.0,0.0);vec3 tangentX=normalize(cross(up,normal));vec3 tangentY=normalize(cross(normal,tangentX));return normalize(tangentX*H.x+tangentY*H.y+normal*H.z);}float G_SchlicksmithGGX(float dotNL,float dotNV,float roughness)\n{float k=(roughness*roughness)/2.0;float GL=dotNL/(dotNL*(1.0-k)+k);float GV=dotNV/(dotNV*(1.0-k)+k);return GL*GV;}vec2 BRDF(float NoV,float roughness)\n{const int NUM_SAMPLES=1024;vec3 N=vec3(0.0,0.0,1.0);vec3 V=vec3(sqrt(1.0-NoV*NoV),0.0,NoV);vec2 LUT=vec2(0.0);float A=0.0;float B=0.0;for(int i=0; i < NUM_SAMPLES; i++) {vec2 Xi=HammersleyNoBitOps(i,NUM_SAMPLES);vec3 H=importanceSample_GGX(Xi,roughness,N);vec3 L=2.0*dot(V,H)*H-V;float dotNL=max(dot(N,L),0.0);float dotNV=max(dot(N,V),0.0);float dotVH=max(dot(V,H),0.0);float dotNH=max(dot(H,N),0.0);if (dotNL > 0.0) {float G=G_SchlicksmithGGX(dotNL,dotNV,roughness);float G_Vis=(G*dotVH)/(dotNH*dotNV);float Fc=pow(1.0-dotVH,5.0);A+=(1.0-Fc)*G_Vis;B+=Fc*G_Vis;}}A/=float(NUM_SAMPLES);B/=float(NUM_SAMPLES);return vec2(A,B);}void main() {gl_FragColor=vec4(1.0,0.0,0.0,1.0);}","attribute highp vec2 a_pos_2f;uniform mat3 u_matrix_3f;varying highp vec2 v_uv;void main() {v_uv=a_pos_2f;gl_Position=vec4(a_pos_2f*2.0-1.0,0.0,1.0);}"),modelColor:fe("uniform vec3 u_albedo;uniform float u_metallic;uniform float u_is_car;uniform float u_roughness;uniform float u_is_blend_light;uniform lowp samplerCube u_irradiance;uniform lowp samplerCube u_prefilter;uniform sampler2D u_brdf_lut;varying vec3 v_pos;varying vec3 v_cameraPos;varying vec3 v_normal;varying vec3 v_lightPos[4];varying vec3 v_lightIntensity[4];float DistributionGGX(vec3 N,vec3 H,float roughness)\n{float a=roughness*roughness;float a2=a*a;float NdotH=max(dot(N,H),0.0);float NdotH2=NdotH*NdotH;float nom  =a2;float denom=(NdotH2*(a2-1.0)+1.0);denom=PI*denom*denom;return nom/denom;}float GeometrySchlickGGX(float NdotV,float roughness)\n{float r=(roughness+1.0);float k=(r*r)/8.0;float nom  =NdotV;float denom=NdotV*(1.0-k)+k;return nom/denom;}float GeometrySmith(vec3 N,vec3 V,vec3 L,float roughness)\n{float NdotV=max(dot(N,V),0.0);float NdotL=max(dot(N,L),0.0);float ggx2=GeometrySchlickGGX(NdotV,roughness);float ggx1=GeometrySchlickGGX(NdotL,roughness);return ggx1*ggx2;}vec3 fresnelSchlick(float cosTheta,vec3 F0)\n{return F0+(1.0-F0)*pow(clamp(1.0-cosTheta,0.0,1.0),5.0);}vec3 fresnelSchlickRoughness(float cosTheta,vec3 F0,float roughness)\n{return F0+(max(vec3(1.0-roughness),F0)-F0)*pow(clamp(1.0-cosTheta,0.0,1.0),5.0);}void main() {vec3 lightPositions[3];vec3 lightColors[3];vec3 albedo;if (u_is_car > 0.0) {albedo=u_albedo;} else {albedo=pow(u_albedo.rgb,vec3(2.2));}float metallic =u_metallic;float roughness=1.0;float ao       =1.0;float isBlendLight=u_is_blend_light;lightPositions[0]=vec3(-0.2,-1.0,-0.6);lightColors[0]=vec3(15.0,15.0,15.0);vec3 N=normalize(v_normal);vec3 V=normalize(v_cameraPos-v_pos);vec3 R=reflect(-V,N);vec3 F0=vec3(0.04);F0=mix(F0,albedo,metallic);vec3 Lo=vec3(0.0);for(int i=0; i < 1;++i)\n{vec3 L=normalize(-lightPositions[i]);vec3 H=normalize(V+L);float attenuation=1.0;vec3 radiance=lightColors[i]*attenuation;float NDF=DistributionGGX(N,H,roughness);float G  =GeometrySmith(N,V,L,roughness);vec3 F   =fresnelSchlick(clamp(dot(H,V),0.0,1.0),F0);vec3 nominator   =NDF*G*F;float denominator=4.0*max(dot(N,V),0.0)*max(dot(N,L),0.0)+0.0001;vec3 specular=nominator/denominator;vec3 kS=F;vec3 kD=vec3(1.0)-kS;kD*=1.0-metallic;float NdotL=max(dot(N,L),0.0);Lo+=(kD*albedo/PI)*radiance*NdotL;}vec3 F=fresnelSchlickRoughness(max(dot(N,V),0.0),F0,roughness);vec3 kS=F;vec3 kD=1.0-kS;kD*=1.0-metallic;vec3 irradiance=textureCube(u_irradiance,N).rgb;vec3 diffuse     =irradiance*albedo;vec3 prefilteredColor=textureCube(u_prefilter,R).rgb*0.06;vec2 brdf =texture2D(u_brdf_lut,vec2(max(dot(N,V),0.0),roughness)).rg;vec3 specular=prefilteredColor*(F*brdf.x+brdf.y);vec3 ambient;if (u_is_car > 0.0) {ambient=vec3(3.0)*albedo*ao;} else {ambient=(kD*diffuse+specular)*ao;}vec3 color=ambient+Lo;color=color/(color+vec3(1.0));color=pow(color,vec3(1.0/2.2));\n#ifdef SKY\nif (isBlendLight < 0.0) {gl_FragColor=vec4(u_albedo.rgb,1.0);} else {gl_FragColor=vec4(color,1.0);}\n#else\ngl_FragColor=vec4(u_albedo.rgb,1.0);\n#endif\n}","uniform mat4 u_matrix;uniform mat4 u_model_mat;uniform highp float u_scale;uniform vec3 u_camera_pos;uniform vec3 u_light1_pos;uniform vec3 u_light2_pos;uniform vec3 u_light3_pos;uniform vec3 u_light4_pos;uniform vec3 u_light1_intensity;uniform vec3 u_light2_intensity;uniform vec3 u_light3_intensity;uniform vec3 u_light4_intensity;attribute vec3 a_pos3f;attribute vec3 a_normal3f;varying vec3 v_pos;varying vec3 v_cameraPos;varying vec3 v_normal;varying vec3 v_lightPos[4];varying vec3 v_lightIntensity[4];void main() {vec3 scaledPos=vec3(a_pos3f.x*u_scale,a_pos3f.y*u_scale,a_pos3f.z);gl_Position=u_matrix*u_model_mat*vec4(scaledPos,1);vec4 wPos=u_model_mat*vec4(scaledPos,1);v_pos=wPos.xyz/wPos.w;v_cameraPos=u_camera_pos;v_normal=a_normal3f;}"),modelTexture:fe("uniform float u_metallic;uniform float u_roughness;uniform float u_is_blend_light;uniform sampler2D u_image;uniform lowp samplerCube u_irradiance;uniform lowp samplerCube u_prefilter;uniform sampler2D u_brdf_lut;varying vec3 v_pos;varying vec3 v_cameraPos;varying vec3 v_normal;varying vec2 v_tex_coord;varying lowp vec3 v_uv;varying vec3 v_lightPos[4];varying vec3 v_lightIntensity[4];float DistributionGGX(vec3 N,vec3 H,float roughness) {float a=roughness*roughness;float a2=a*a;float NdotH=max(dot(N,H),0.0);float NdotH2=NdotH*NdotH;float nom=a2;float denom=(NdotH2*(a2-1.0)+1.0);denom=PI*denom*denom;return nom/denom;}float GeometrySchlickGGX(float NdotV,float roughness) {float r=(roughness+1.0);float k=(r*r)/8.0;float nom=NdotV;float denom=NdotV*(1.0-k)+k;return nom/denom;}float GeometrySmith(vec3 N,vec3 V,vec3 L,float roughness) {float NdotV=max(dot(N,V),0.0);float NdotL=max(dot(N,L),0.0);float ggx2=GeometrySchlickGGX(NdotV,roughness);float ggx1=GeometrySchlickGGX(NdotL,roughness);return ggx1*ggx2;}vec3 fresnelSchlick(float cosTheta,vec3 F0) {return F0+(1.0-F0)*pow(clamp(1.0-cosTheta,0.0,1.0),5.0);}vec3 fresnelSchlickRoughness(float cosTheta,vec3 F0,float roughness) {return F0+(max(vec3(1.0-roughness),F0)-F0)*pow(clamp(1.0-cosTheta,0.0,1.0),5.0);}void main() {vec3 lightPositions[3];vec3 lightColors[3];vec4 imageColor=texture2D(u_image,v_tex_coord);vec3 albedo=pow(texture2D(u_image,v_tex_coord).rgb,vec3(2.2));float metallic=u_metallic;float roughness=u_roughness;float isBlendLight=u_is_blend_light;float ao=1.0;lightPositions[0]=vec3(-0.2,-1.0,-0.6);lightColors[0]=vec3(40.0,40.0,40.0);vec3 N=normalize(v_normal);vec3 V=normalize(v_cameraPos-v_pos);vec3 R=reflect(-V,N);vec3 F0=vec3(0.04);F0=mix(F0,albedo,metallic);vec3 Lo=vec3(0.0);for(int i=0; i < 1;++i) {vec3 L=normalize(-lightPositions[i]);vec3 H=normalize(V+L);vec3 radiance=lightColors[i];float NDF=DistributionGGX(N,H,roughness);float G=GeometrySmith(N,V,L,roughness);vec3 F=fresnelSchlick(max(dot(H,V),0.0),F0);vec3 nominator=NDF*G*F;float denominator=4.0*max(dot(N,V),0.0)*max(dot(N,L),0.0)+0.0001;vec3 specular=nominator/denominator;vec3 kS=F;vec3 kD=vec3(1.0)-kS;kD*=1.0-metallic;float NdotL=max(dot(N,L),0.0);Lo+=(kD*albedo/PI)*radiance*NdotL;}vec3 F=fresnelSchlickRoughness(max(dot(N,V),0.0),F0,roughness);vec3 kS=F;vec3 kD=1.0-kS;kD*=1.0-metallic;vec3 irradiance=textureCube(u_irradiance,N).rgb;vec3 diffuse=irradiance*albedo;vec3 prefilteredColor=textureCube(u_prefilter,R).rgb*0.06;vec2 brdf=texture2D(u_brdf_lut,vec2(max(dot(N,V),0.0),roughness)).rg;vec3 specular=prefilteredColor*(F*brdf.x+brdf.y);vec3 ambient=(kD*diffuse+specular)*ao;vec3 color=ambient+Lo;color=color/(color+vec3(1.0));color=pow(color,vec3(1.0/2.2));\n#ifdef SKY\nif (isBlendLight < 0.0) {gl_FragColor=vec4(texture2D(u_image,v_tex_coord).rgb,1.0);} else {gl_FragColor=vec4(color,1.0);}\n#else\ngl_FragColor=vec4(texture2D(u_image,v_tex_coord).rgb,1.0);\n#endif\n}","uniform mat4 u_matrix;uniform mat4 u_model_mat;uniform highp float u_scale;attribute highp vec3 a_pos_3f;uniform vec3 u_camera_pos;uniform vec3 u_light1_pos;uniform vec3 u_light2_pos;uniform vec3 u_light3_pos;uniform vec3 u_light4_pos;uniform vec3 u_light1_intensity;uniform vec3 u_light2_intensity;uniform vec3 u_light3_intensity;uniform vec3 u_light4_intensity;attribute vec3 a_pos3f;attribute vec3 a_normal3f;attribute vec2 a_texture2f;varying vec3 v_pos;varying vec3 v_cameraPos;varying vec3 v_normal;varying vec2 v_tex_coord;varying highp vec3 v_uv;varying vec3 v_lightPos[4];varying vec3 v_lightIntensity[4];highp mat3 transpose(in highp mat3 inMatrix) {highp vec3 i0=inMatrix[0];highp vec3 i1=inMatrix[1];highp vec3 i2=inMatrix[2];highp mat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),vec3(i0.y,i1.y,i2.y),vec3(i0.z,i1.z,i2.z)\n);return outMatrix;}float det(mat2 matrix) {return matrix[0].x*matrix[1].y-matrix[0].y*matrix[1].x;}mat3 inverse1(mat3 matrix) {vec3 row0=matrix[0];vec3 row1=matrix[1];vec3 row2=matrix[2];vec3 minors0=vec3(\ndet(mat2(row1.y,row1.z,row2.y,row2.z)),det(mat2(row1.z,row1.x,row2.z,row2.x)),det(mat2(row1.x,row1.y,row2.x,row2.y))\n);vec3 minors1=vec3(\ndet(mat2(row2.y,row2.z,row0.y,row0.z)),det(mat2(row2.z,row2.x,row0.z,row0.x)),det(mat2(row2.x,row2.y,row0.x,row0.y))\n);vec3 minors2=vec3(\ndet(mat2(row0.y,row0.z,row1.y,row1.z)),det(mat2(row0.z,row0.x,row1.z,row1.x)),det(mat2(row0.x,row0.y,row1.x,row1.y))\n);mat3 adj=transpose(mat3(minors0,minors1,minors2));return (1.0/dot(row0,minors0))*adj;}void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec3 scaledPos=vec3(a_pos3f.x*u_scale,a_pos3f.y*u_scale,a_pos3f.z);gl_Position=u_matrix*u_model_mat*vec4(scaledPos,1);vec4 wPos=u_model_mat*vec4(scaledPos,1);v_pos=wPos.xyz/wPos.w;v_cameraPos=u_camera_pos;v_normal=a_normal3f;v_tex_coord=a_texture2f;}"),modelTranslucent:fe("uniform sampler2D u_image;varying vec2 v_tex_coord;void main() {vec4 color;color=texture2D(u_image,v_tex_coord);if (color.a < 0.01)\n{discard;}gl_FragColor=color;}","uniform mat4 u_matrix;uniform mat4 u_model_mat;uniform highp float u_scale;attribute highp vec3 a_pos_3f;uniform vec3 u_camera_pos;attribute vec3 a_pos3f;attribute vec3 a_normal3f;attribute vec2 a_texture2f;varying vec3 v_pos;varying vec3 v_cameraPos;varying vec3 v_normal;varying vec2 v_tex_coord;void main() {vec3 scaledPos=vec3(a_pos3f.x*u_scale,a_pos3f.y*u_scale,a_pos3f.z);gl_Position=u_matrix*u_model_mat*vec4(scaledPos,1);vec4 wPos=u_model_mat*vec4(scaledPos,1);v_pos=wPos.xyz/wPos.w;v_cameraPos=u_camera_pos;v_normal=a_normal3f;v_tex_coord=a_texture2f;}")};function fe(t,e,i){var r=/#pragma lkmap: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,n=e.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),a=t.match(o),s=e.match(o),l=ae.match(o),u=s?s.concat(a):a;i||(le.staticUniforms&&(u=le.staticUniforms.concat(u)),ue.staticUniforms&&(u=ue.staticUniforms.concat(u))),u&&(u=u.concat(l));var h={};return{fragmentSource:t=t.replace(r,(function(t,e,i,r,o){return h[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+i+" "+r+" "+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n    "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,i,r,o){var n="float"===r?"vec2":"vec4",a=o.match(/color/)?"color":n;return h[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+i+" "+n+" a_"+o+";\nvarying "+i+" "+r+" "+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+o+" = a_"+o+";\n#else\n    "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+o+" = unpack_mix_"+a+"(a_"+o+", u_"+o+"_t);\n#else\n    "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+i+" "+n+" a_"+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+i+" "+r+" "+o+" = a_"+o+";\n#else\n    "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+i+" "+r+" "+o+" = unpack_mix_"+a+"(a_"+o+", u_"+o+"_t);\n#else\n    "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n"})),staticAttributes:n,staticUniforms:u}}var de=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function me(e,i,r,o,n,a,s){var l=e.context,u=l.gl,h=r.fbo;if(h){e.prepareDrawTile(i);var p=e.useProgram("hillshade");l.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,h.colorAttachment.get());var c=function(e,i,r,o){var n=r.paint.get("hillshade-shadow-color"),a=r.paint.get("hillshade-highlight-color"),s=r.paint.get("hillshade-accent-color"),l=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(l-=e.transform.angle);var u,h,p,c=!e.options.moving;return{u_matrix:o||e.transform.calculateProjMatrix(i.tileID.toUnwrapped(),c),u_image:0,u_latrange:(u=i.tileID,h=Math.pow(2,u.canonical.z),p=u.canonical.y,[new t.MercatorCoordinate(0,p/h).toLngLat().lat,new t.MercatorCoordinate(0,(p+1)/h).toLngLat().lat]),u_light:[r.paint.get("hillshade-exaggeration"),l],u_shadow:n,u_highlight:a,u_accent:s}}(e,r,o,e.terrain?i.projMatrix:null);e.prepareDrawProgram(l,p,i.toUnwrapped()),p.draw(l,u.TRIANGLES,n,a,s,t.CullFaceMode.disabled,c,o.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function ye(e,i,r){if(i.needsDEMTextureUpload){var o=e.context,n=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(r.stride);var a=r.getPixels();i.demTexture?i.demTexture.update(a,{premultiply:!1}):i.demTexture=new t.Texture(o,a,n.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}}function ge(e,i,r,o,n,a){var s=e.context,l=s.gl;if(i.dem){var u=i.dem;if(s.activeTexture.set(l.TEXTURE1),ye(e,i,u),i.demTexture){i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);var h=u.dim;s.activeTexture.set(l.TEXTURE0);var p=i.fbo;if(!p){var c=new t.Texture(s,{width:h,height:h,data:null},l.RGBA);c.bind(l.LINEAR,l.CLAMP_TO_EDGE),(p=i.fbo=s.createFramebuffer(h,h,!0)).colorAttachment.set(c.texture)}s.bindFramebuffer.set(p.framebuffer),s.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,o,n,a,t.CullFaceMode.disabled,function(e,i){var r=i.stride,o=t.create();return t.ortho(o,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(o,o,[0,-t.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.unpackVector}}(i.tileID,u),r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}}de.prototype.bind=function(t,e,i,r,o,n,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==r.length,u=0;!l&&u<r.length;u++)this.boundPaintVertexBuffers[u]!==r[u]&&(l=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||l||this.boundIndexBuffer!==o||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s?this.freshBind(e,i,r,o,n,a,s):(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),o&&o.dynamicDraw&&o.bind(),s&&s.bind())},de.prototype.freshBind=function(t,e,i,r,o,n,a){var s=t.numAttributes,l=this.context,u=l.gl;this.vao&&this.destroy(),this.vao=u.isWebGL2?u.createVertexArray():l.extVertexArrayObject.createVertexArrayOES(),l.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=a,e.enableAttributes(u,t);for(var h=0,p=i;h<p.length;h+=1)p[h].enableAttributes(u,t);n&&n.enableAttributes(u,t),a&&a.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,o);for(var c=0,f=i;c<f.length;c+=1){var d=f[c];d.bind(),d.setVertexAttribPointers(u,t,o)}n&&(n.bind(),n.setVertexAttribPointers(u,t,o)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,t,o)),l.currentNumAttributes=s},de.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject?this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao):this.context.gl.deleteVertexArray(this.vao),this.vao=null)};var _e=function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image0:new t.Uniform1i(e,i.u_image0),u_skirt_height:new t.Uniform1f(e,i.u_skirt_height)}},ve=function(t,e){return{u_matrix:t,u_image0:0,u_skirt_height:e}},xe=function(){this.operations={}};xe.prototype.newMorphing=function(t,e,i,r,o){if(t in this.operations){var n=this.operations[t];n.to.tileID.key!==i.tileID.key&&(n.queued=i)}else this.operations[t]={startTime:r,phase:0,duration:o,from:e,to:i,queued:null}},xe.prototype.getMorphValuesForProxy=function(t){if(!(t in this.operations))return null;var e=this.operations[t];return{from:e.from,to:e.to,phase:e.phase}},xe.prototype.update=function(t){for(var e in this.operations){var i=this.operations[e];for(i.phase=(t-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,t)){delete this.operations[e];break}}},xe.prototype._nextOp=function(t,e){return!!t.queued&&(t.from=t.to,t.to=t.queued,t.queued=null,t.phase=0,t.startTime=e,!0)},xe.prototype._validOp=function(t){return t.from.hasData()&&t.to.hasData()};var be=new xe,we={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"},ke=function(t){return{u_matrix:t}};function Te(e,i,r,o,n){if(n>0){var a=t.exported.now(),s=(a-e.timeAdded)/n,l=i?(a-i.timeAdded)/n:-1,u=r.getSource(),h=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),c=p&&e.refreshedUponExpiration?1:t.clamp(p?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-c}:{opacity:c,mix:0}}return{opacity:1,mix:0}}var Ie=function(e){function i(t){var i=N("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new I(K(),null),t.style);e.call(this,"proxy",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.update=function(e,i,r){var o=this;if(!e.freezeTileCoverage){this.transform=e;var n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((function(i,r){if(i[r.key]="",!o._tiles[r.key]){var n=new t.Tile(r,o._source.tileSize*r.overscaleFactor(),e.tileZoom);n.state="loaded",o._tiles[r.key]=n}return i}),{});for(var a in this._tiles)a in n||(this.freeFBO(a),this._tiles[a].state="unloaded",delete this._tiles[a])}},i.prototype.freeFBO=function(t){var e,i=this.proxyCachedFBO[t];if(void 0!==i){var r=Object.values(i);(e=this.renderCachePool).push.apply(e,r),delete this.proxyCachedFBO[t]}},i.prototype.deallocRenderCache=function(){this.renderCache.forEach((function(t){return t.fb.destroy()})),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}},i}(t.SourceCache),Se=function(t){function e(e,i,r){t.call(this,e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=i,this.projMatrix=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.OverscaledTileID),Ee=function(e){function i(i,r){e.call(this),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};var o=function(){var e=new t.StructArrayLayout4i8,i=new t.StructArrayLayout3ui6,r=131;e.reserve(17161),i.reserve(33800);for(var o=t.EXTENT/128,n=t.EXTENT+o/2,a=n+o,s=-o;s<a;s+=o)for(var l=-o;l<a;l+=o){var u=l<0||l>n||s<0||s>n?24575:0,h=t.clamp(Math.round(l),0,t.EXTENT),p=t.clamp(Math.round(s),0,t.EXTENT);e.emplaceBack(h+u,p,h,p)}for(var c=function(t,e){var o=e*r+t;i.emplaceBack(o+1,o,o+r),i.emplaceBack(o+r,o+r+1,o+1)},f=1;f<129;f++)for(var d=1;d<129;d++)c(d,f);return[0,129].forEach((function(t){for(var e=0;e<130;e++)c(e,t),c(t,e)})),[e,i,32768]}(),n=o[0],a=o[1],s=o[2],l=i.context;this.gridBuffer=l.createVertexBuffer(n,R.members),this.gridIndexBuffer=l.createIndexBuffer(a),this.gridSegments=t.SegmentVector.simpleSegment(0,0,n.length,a.length),this.gridNoSkirtSegments=t.SegmentVector.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Ie(r.map),this.orthoMatrix=t.create(),t.ortho(this.orthoMatrix,0,t.EXTENT,0,t.EXTENT,0,1);var u=l.gl;this._overlapStencilMode=new t.StencilMode({func:u.GEQUAL,mask:255},0,255,u.KEEP,u.KEEP,u.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={style:{configurable:!0},visibleDemTiles:{configurable:!0},drapeBufferSize:{configurable:!0},useVertexMorphing:{configurable:!0},emptyDEMTexture:{configurable:!0}};return r.style.set=function(t){t.on("data",this._onStyleDataEvent.bind(this)),t.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=t,this._checkRenderCacheEfficiency()},i.prototype.update=function(e,i,r){var o=this;if(e&&e.terrain){this._style!==e&&(this.style=e),this.enabled=!0;var n=e.terrain.properties;this.sourceCache=e._getSourceCache(n.get("source")),this._exaggeration=n.get("exaggeration");var a=function(){o.sourceCache.used&&t.warnOnce("Raster DEM source '"+o.sourceCache.id+"' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.");var e=o.sourceCache.getSource().tileSize/128,r=o.proxySourceCache.getSource().tileSize;o.sourceCache.update(i,e*r,!0),o._findCoveringTileCache[o.sourceCache.id]={}};this.sourceCache.usedForTerrain||(this._findCoveringTileCache[this.sourceCache.id]={},this.sourceCache.usedForTerrain=!0,a(),this._initializing=!0),a(),i.updateElevation(!r),this._findCoveringTileCache[this.proxySourceCache.id]={},this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()},i.prototype._checkRenderCacheEfficiency=function(){var e=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==e.efficiency&&t.warnOnce("Terrain render cache efficiency is not optimal ("+e.efficiency+"%) and performance\n                may be affected negatively, consider placing all background, fill and line layers before layer\n                with id '"+e.firstUndrapedLayer+"' or create a map using optimizeForTerrain: true option.")},i.prototype._onStyleDataEvent=function(t){t.coord&&"source"===t.dataType?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):"style"===t.dataType&&(this._invalidateRenderCache=!0)},i.prototype._disable=function(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(var t in this._style._sourceCaches)this._style._sourceCaches[t].usedForTerrain=!1},i.prototype.destroy=function(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((function(t){return t.fb.destroy()})),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)},i.prototype._source=function(){return this.enabled?this.sourceCache:null},i.prototype.exaggeration=function(){return this._exaggeration},r.visibleDemTiles.get=function(){return this._visibleDemTiles},r.drapeBufferSize.get=function(){var t=2*this.proxySourceCache.getSource().tileSize;return[t,t]},r.useVertexMorphing.set=function(t){this._useVertexMorphing=t},i.prototype.updateTileBinding=function(e){var i=this;if(this.enabled){this.prevTerrainTileForTile=this.terrainTileForTile;var r=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);var n=this.painter.options;this.renderCached=(n.zooming||n.moving||n.rotating||!!this.forceRenderCached)&&!this._invalidateRenderCache,this._invalidateRenderCache=!1;var a,s,l,u,h=this.proxyCoords=r.getIds().map((function(t){var e=r.getTileByID(t).tileID;return e.projMatrix=o.calculateProjMatrix(e.toUnwrapped()),e}));a=h,l=(s=this.painter).transform.pointCoordinate(s.transform.getCameraPoint()),u=new t.pointGeometry(l.x,l.y),a.sort((function(e,i){if(i.overscaledZ-e.overscaledZ)return i.overscaledZ-e.overscaledZ;var r=new t.pointGeometry(e.canonical.x+(1<<e.canonical.z)*e.wrap,e.canonical.y),o=new t.pointGeometry(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),n=u.mult(1<<e.canonical.z);return n.x-=.5,n.y-=.5,n.distSqr(r)-n.distSqr(o)})),this._previousZoom=o.zoom;var p=this.proxyToSource||{};this.proxyToSource={},h.forEach((function(t){i.proxyToSource[t.key]={}})),this.terrainTileForTile={};var c=this._style._sourceCaches;for(var f in c){var d=c[f];if(d.used&&(d!==this.sourceCache&&(this._findCoveringTileCache[d.id]={}),this._setupProxiedCoordsForOrtho(d,e[f],p),!d.usedForTerrain)){var m=e[f];d.getSource().reparseOverscaled&&this._assignTerrainTiles(m)}}this.proxiedCoords[r.id]=h.map((function(t){return new Se(t,t.key,i.orthoMatrix)})),this._assignTerrainTiles(h),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1,this._updateTimestamp=t.exported.now();var y={};this._visibleDemTiles=[];for(var g=0,_=this.proxyCoords;g<_.length;g+=1){var v=this.terrainTileForTile[_[g].key];if(v){var x=v.tileID.key;x in y||(this._visibleDemTiles.push(v),y[x]=x)}}}},i.prototype._assignTerrainTiles=function(t){var e=this;this._initializing||t.forEach((function(t){if(!e.terrainTileForTile[t.key]){var i=e._findTileCoveringTileID(t,e.sourceCache);i&&(e.terrainTileForTile[t.key]=i)}}))},i.prototype._prepareDEMTextures=function(){var t=this.painter.context,e=t.gl;for(var i in this.terrainTileForTile){var r=this.terrainTileForTile[i],o=r.dem;!o||r.demTexture&&!r.needsDEMTextureUpload||(t.activeTexture.set(e.TEXTURE1),ye(this.painter,r,o))}},i.prototype._prepareDemTileUniforms=function(t,e,i,r){if(!e||null==e.demTexture)return!1;var o=t.tileID.canonical,n=Math.pow(2,e.tileID.canonical.z-o.z),a=r||"";return i["u_dem_tl"+a]=[o.x*n%1,o.y*n%1],i["u_dem_scale"+a]=n,!0},r.emptyDEMTexture.get=function(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()},i.prototype._getLoadedAreaMinimum=function(){var t=0,e=this._visibleDemTiles.reduce((function(e,i){if(!i.dem)return e;var r=i.dem.tree.minimums[0];return r>0&&t++,e+r}),0);return t?e/t:0},i.prototype._updateEmptyDEMTexture=function(){var e=this.painter.context,i=e.gl;e.activeTexture.set(i.TEXTURE2);var r=this._getLoadedAreaMinimum(),o={width:1,height:1,data:new Uint8Array(t.DEMData.pack(r,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;var n=this._emptyDEMTexture;return n?n.update(o,{premultiply:!1}):n=this._emptyDEMTexture=new t.Texture(e,o,i.RGBA,{premultiply:!1}),n},i.prototype.setupElevationDraw=function(e,i,r){var o,n=this.painter.context,a=n.gl,s=(o=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:t.DEMData.getUnpackVector(o),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();var l=null,u=null,h=1;if(r&&r.morphing&&this._useVertexMorphing){var p=r.morphing.srcDemTile,c=r.morphing.dstDemTile;h=r.morphing.phase,p&&c&&(this._prepareDemTileUniforms(e,p,s,"_prev")&&(u=p),this._prepareDemTileUniforms(e,c,s)&&(l=c))}if(u&&l?(n.activeTexture.set(a.TEXTURE2),l.demTexture.bind(a.NEAREST,a.CLAMP_TO_EDGE,a.NEAREST),n.activeTexture.set(a.TEXTURE4),u.demTexture.bind(a.NEAREST,a.CLAMP_TO_EDGE,a.NEAREST),s.u_dem_lerp=h):(l=this.terrainTileForTile[e.tileID.key],n.activeTexture.set(a.TEXTURE2),(this._prepareDemTileUniforms(e,l,s)?l.demTexture:this.emptyDEMTexture).bind(a.NEAREST,a.CLAMP_TO_EDGE,a.NEAREST)),r&&r.useDepthForOcclusion&&(n.activeTexture.set(a.TEXTURE3),this._depthTexture.bind(a.NEAREST,a.CLAMP_TO_EDGE,a.NEAREST),s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height]),r&&r.useMeterToDem&&l){var f=(1<<l.tileID.canonical.z)*t.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=f}r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(n,s)},i.prototype.renderToBackBuffer=function(e){var i=this.painter,r=this.painter.context;0!==e.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),this.renderingToTexture=!1,function(e,i,r,o,n){var a,s,l=e.context,u=l.gl,h=e.options.showTerrainWireframe?2:0,p=function(t,i){if(s!==t){var r=[we[t]];i&&r.push(we[h]),a=e.useProgram("terrainRaster",null,r),s=t}},c=e.colorModeForRenderPass(),f=new t.DepthMode(u.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);be.update(n);var d=e.transform,m=6*Math.pow(1.5,22-d.zoom)*i.exaggeration();(h?[!1,!0]:[!1]).forEach((function(h){s=-1;for(var y,g,_,v,x=h?u.LINES:u.TRIANGLES,b=h?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments],w=b[0],k=b[1],T=0,I=o;T<I.length;T+=1){var S=I[T],E=r.getTile(S),A=t.StencilMode.disabled,P=i.prevTerrainTileForTile[S.key],M=i.terrainTileForTile[S.key];v=M,null!=(_=P)&&null!=v&&_.hasData()&&v.hasData()&&null!=_.demTexture&&null!=v.demTexture&&_.tileID.key!==v.tileID.key&&be.newMorphing(S.key,P,M,n,250),l.activeTexture.set(u.TEXTURE0),E.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST);var L=be.getMorphValuesForProxy(S.key),C=L?1:0,D=void 0;L&&(D={morphing:{srcDemTile:L.from,dstDemTile:L.to,phase:t.easeCubicInOut(L.phase)}});var z=ve(S.projMatrix,(g=1<<(y=S.canonical).z,(d.renderWorldCopies||0!==y.x&&y.x!==g-1)&&0!==y.y&&y.y!==g-1?m:m/10));p(C,h),i.setupElevationDraw(E,a,D),e.prepareDrawProgram(l,a,S.toUnwrapped()),a.draw(l,x,f,A,c,t.CullFaceMode.backCCW,z,"terrain_raster",i.gridBuffer,w,k)}}))}(i,this,this.proxySourceCache,e,this._updateTimestamp),this.renderingToTexture=!0,e.splice(0,e.length))},i.prototype.renderBatch=function(e){if(0===this._drapedRenderBatches.length)return e+1;this.renderingToTexture=!0;for(var i=this.painter,r=this.painter.context,o=this.proxySourceCache,n=this.proxiedCoords[o.id],a=this._drapedRenderBatches.shift(),s=[],l=i.style.order,u=0,h=0,p=n;h<p.length;h+=1){var c=p[h],f=o.getTileByID(c.proxyTileKey),d=o.proxyCachedFBO[c.key]?o.proxyCachedFBO[c.key][e]:void 0,m=void 0!==d?o.renderCache[d]:this.pool[u++],y=void 0!==d;if(f.texture=m.tex,!y||m.dirty){r.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(r.clear({color:t.Color.transparent}),m.dirty=!1);for(var g=void 0,_=a.start;_<=a.end;++_){var v=i.style._layers[l[_]];if(!v.isHidden(i.transform.zoom)){var x=i.style._getLayerSourceCache(v),b=x?this.proxyToSource[c.key][x.id]:[c];if(b){var w=b;r.viewport.set([0,0,m.fb.width,m.fb.height]),g!==(x?x.id:null)&&(this._setupStencil(m,b,v,x),g=x?x.id:null),i.renderLayer(i,x,v,w)}}}this.renderedToTile?(m.dirty=!0,s.push(f.tileID)):y||--u,5===u&&(u=0,this.renderToBackBuffer(s))}else s.push(f.tileID)}return this.renderToBackBuffer(s),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),a.end+1},i.prototype.postRender=function(){},i.prototype.renderCacheEfficiency=function(t){var e=t.order.length;if(0===e)return{efficiency:100};for(var i,r=0,o=0,n=!1,a=0;a<e;++a){var s=t._layers[t.order[a]];this._style.isLayerDraped(s)?(n&&++r,++o):n||(n=!0,i=s.id)}return 0===o?{efficiency:100}:{efficiency:100*(1-r/o),firstUndrapedLayer:i}},i.prototype.getMinElevationBelowMSL=function(){var t=0;return this._visibleDemTiles.filter((function(t){return t.dem})).forEach((function(e){t=Math.min(t,e.dem.tree.minimums[0])})),0===t?t:(t-30)*this._exaggeration},i.prototype.raycast=function(t,e,i){if(!this._visibleDemTiles)return null;var r=this._visibleDemTiles.filter((function(t){return t.dem})).map((function(r){var o=r.tileID,n=Math.pow(2,o.overscaledZ),a=o.canonical,s=a.x,l=a.y,u=s/n,h=(s+1)/n,p=l/n,c=(l+1)/n;return{minx:u,miny:p,maxx:h,maxy:c,t:r.dem.tree.raycastRoot(u,p,h,c,t,e,i),tile:r}}));r.sort((function(t,e){return(null!==t.t?t.t:Number.MAX_VALUE)-(null!==e.t?e.t:Number.MAX_VALUE)}));for(var o=0,n=r;o<n.length;o+=1){var a=n[o];if(null==a.t)return null;var s=a.tile.dem.tree.raycast(a.minx,a.miny,a.maxx,a.maxy,t,e,i);if(null!=s)return s}return null},i.prototype._createFBO=function(){var e=this.painter.context,i=e.gl,r=this.drapeBufferSize;e.activeTexture.set(i.TEXTURE0);var o=new t.Texture(e,{width:r[0],height:r[1],data:null},i.RGBA);o.bind(i.LINEAR,i.CLAMP_TO_EDGE);var n=e.createFramebuffer(r[0],r[1],!1);return n.colorAttachment.set(o.texture),n.depthAttachment=new t.DepthStencilAttachment(e,n.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=e.createRenderbuffer(e.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,n.depthAttachment.set(this._sharedDepthStencil),e.clear({stencil:0})):n.depthAttachment.set(this._sharedDepthStencil),e.extTextureFilterAnisotropic&&!e.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax),{fb:n,tex:o,dirty:!1}},i.prototype._initFBOPool=function(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())},i.prototype._shouldDisableRenderCache=function(){var t=this;if(!this.renderCached)return!0;if(this._style.light&&this._style.light.hasTransition())return!0;for(var e in this._style._sourceCaches)if(this._style._sourceCaches[e].hasTransition())return!0;return this._style.order.some((function(e){var i=t._style._layers[e],r=i.isHidden(t.painter.transform.zoom),o=i.getCrossfadeParameters(),n=!!o&&1!==o.t,a=i.hasTransition();return"custom"!==i.type&&!r&&(n||a)}))},i.prototype._clearRasterFadeFromRenderCache=function(){var t=!1;for(var e in this._style._sourceCaches)if(this._style._sourceCaches[e]._source instanceof D){t=!0;break}if(t)for(var i=0;i<this._style.order.length;++i){var r=this._style._layers[this._style.order[i]],o=r.isHidden(this.painter.transform.zoom),n=this._style._getLayerSourceCache(r);if("raster"===r.type&&!o&&n)for(var a=r.paint.get("raster-fade-duration"),s=0,l=this.proxyCoords;s<l.length;s+=1){var u=this.proxyToSource[l[s].key][n.id];if(u)for(var h=0,p=u;h<p.length;h+=1){var c=p[h],f=Te(n.getTile(c),n.findLoadedParent(c,0),n,this.painter.transform,a);(1!==f.opacity||0!==f.mix)&&this._clearRenderCacheForTile(n.id,c)}}}},i.prototype._setupDrapedRenderBatches=function(){var t=this._style.order,e=t.length;if(0!==e){for(var i,r=[],o=0,n=this._style._layers[t[o]];!this._style.isLayerDraped(n)&&n.isHidden(this.painter.transform.zoom)&&++o<e;)n=this._style._layers[t[o]];for(;o<e;++o){var a=this._style._layers[t[o]];a.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(a)?void 0===i&&(i=o):void 0!==i&&(r.push({start:i,end:o-1}),i=void 0))}void 0!==i&&r.push({start:i,end:o-1}),this._drapedRenderBatches=r}},i.prototype._setupRenderCache=function(t){var e,i=this.proxySourceCache;if(this._shouldDisableRenderCache()){if(i.renderCache.length>i.renderCachePool.length){var r=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(var o=0;o<r.length;++o){var n=Object.values(r[o]);(e=i.renderCachePool).push.apply(e,n)}}}else{this._clearRasterFadeFromRenderCache();for(var a=this.proxyCoords,s=this._tilesDirty,l=a.length-1;l>=0;l--){var u=a[l];if(i.getTileByID(u.key),void 0!==i.proxyCachedFBO[u.key]){var h=t[u.key],p=this.proxyToSource[u.key],c=0,f=function(t){var e=p[t],i=h[t];if(!i||i.length!==e.length||e.some((function(e,r){return e!==i[r]||s[t]&&s[t].hasOwnProperty(e.key)})))return c=-1,"break";++c};for(var d in p)if("break"===f(d))break;for(var m in i.proxyCachedFBO[u.key])i.renderCache[i.proxyCachedFBO[u.key][m]].dirty=c<0||c!==Object.values(h).length}}var y=[].concat(this._drapedRenderBatches);y.sort((function(t,e){return e.end-e.start-(t.end-t.start)}));for(var g=0,_=y;g<_.length;g+=1)for(var v=_[g],x=0,b=a;x<b.length;x+=1){var w=b[x];if(!i.proxyCachedFBO[w.key]){var k=i.renderCachePool.pop();void 0===k&&i.renderCache.length<50&&(k=i.renderCache.length,i.renderCache.push(this._createFBO())),void 0!==k&&(i.proxyCachedFBO[w.key]={},i.proxyCachedFBO[w.key][v.start]=k,i.renderCache[k].dirty=!0)}}this._tilesDirty={}}},i.prototype._setupStencil=function(t,e,i,r){if(r&&this._sourceTilesOverlap[r.id]){var o=this.painter.context,n=o.gl;if(e.length<=1)this._overlapStencilType=!1;else{var a;if(i.isTileClipped())a=e.length,this._overlapStencilMode.test={func:n.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(e[0].overscaledZ>e[e.length-1].overscaledZ))return void(this._overlapStencilType=!1);a=1,this._overlapStencilMode.test={func:n.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+a>255&&(o.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=a,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(e,this._overlapStencilMode.ref)}}else this._overlapStencilType&&(this._overlapStencilType=!1)},i.prototype.stencilModeForRTTOverlap=function(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):t.StencilMode.disabled},i.prototype._renderTileClippingMasks=function(e,i){var r=this.painter,o=this.painter.context,n=o.gl;r._tileClippingMaskIDs={},o.setColorMode(t.ColorMode.disabled),o.setDepthMode(t.DepthMode.disabled);for(var a=r.useProgram("clippingMask"),s=0,l=e;s<l.length;s+=1){var u=l[s],h=r._tileClippingMaskIDs[u.key]=--i;a.draw(o,n.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:n.ALWAYS,mask:0},h,255,n.KEEP,n.KEEP,n.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ke(u.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}},i.prototype.pointCoordinate=function(e){var i=this.painter.transform;if(e.x<0||e.x>i.width||e.y<0||e.y>i.height)return null;var r=[e.x,e.y,1,1];t.transformMat4$1(r,r,i.pixelMatrixInverse),t.scale$1(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;var o=i._camera.position,n=t.mercatorZfromAltitude(1,i.center.lat),a=[o[0],o[1],o[2]/n,0],s=t.subtract([],r.slice(0,3),a);t.normalize(s,s);var l=this.raycast(a,s,this._exaggeration);return null!==l&&l?(t.scaleAndAdd(a,a,s,l),a[3]=a[2],a[2]*=n,a):null},i.prototype.drawDepth=function(){var e=this.painter,i=e.context,r=this.proxySourceCache,o=Math.ceil(e.width),n=Math.ceil(e.height);if(!this._depthFBO||this._depthFBO.width===o&&this._depthFBO.height===n||(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){var a=i.gl,s=i.createFramebuffer(o,n,!0);i.activeTexture.set(a.TEXTURE0);var l=new t.Texture(i,{width:o,height:n,data:null},a.RGBA);l.bind(a.NEAREST,a.CLAMP_TO_EDGE),s.colorAttachment.set(l.texture);var u=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,o,n);s.depthAttachment.set(u),this._depthFBO=s,this._depthTexture=l}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,o,n]),function(e,i,r,o){var n=e.context,a=n.gl;n.clear({depth:1});for(var s=e.useProgram("terrainDepth"),l=new t.DepthMode(a.LESS,t.DepthMode.ReadWrite,e.depthRangeFor3D),u=0,h=o;u<h.length;u+=1){var p=h[u],c=r.getTile(p),f=ve(p.projMatrix,0);i.setupElevationDraw(c,s),s.draw(n,a.TRIANGLES,l,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.backCCW,f,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(e,this,r,this.proxyCoords)},i.prototype._setupProxiedCoordsForOrtho=function(t,e,i){if(t.getSource()instanceof B)return this._setupProxiedCoordsForImageSource(t,e,i);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};for(var r=this.proxiedCoords[t.id]=[],o=this.proxyCoords,n=0;n<o.length;n++){var a=o[n],s=this._findTileCoveringTileID(a,t);if(s){var l=this._createProxiedId(a,s,i[a.key]&&i[a.key][t.id]);r.push(l),this.proxyToSource[a.key][t.id]=[l]}}for(var u=!1,h=0;h<e.length;h++){var p=t.getTile(e[h]);if(p&&p.hasData()){var c=this._findTileCoveringTileID(p.tileID,this.proxySourceCache);if(c&&c.tileID.canonical.z!==p.tileID.canonical.z){var f=this.proxyToSource[c.tileID.key][t.id],d=this._createProxiedId(c.tileID,p,i[c.tileID.key]&&i[c.tileID.key][t.id]);f?f.splice(f.length-1,0,d):this.proxyToSource[c.tileID.key][t.id]=[d],r.push(d),u=!0}}}this._sourceTilesOverlap[t.id]=u},i.prototype._setupProxiedCoordsForImageSource=function(e,i,r){if(e.getSource().loaded())for(var o,n,a,s,l,u,h,p=this.proxiedCoords[e.id]=[],c=this.proxyCoords,f=e.getSource(),d=new t.pointGeometry(f.tileID.x,f.tileID.y)._div(1<<f.tileID.z),m=f.coordinates.map(t.MercatorCoordinate.fromLngLat).reduce((function(t,e){return t.min.x=Math.min(t.min.x,e.x-d.x),t.min.y=Math.min(t.min.y,e.y-d.y),t.max.x=Math.max(t.max.x,e.x-d.x),t.max.y=Math.max(t.max.y,e.y-d.y),t}),{min:new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new t.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),y=0;y<c.length;y++)for(var g=c[y],_=0;_<i.length;_++){var v=e.getTile(i[_]);if(v&&v.hasData()&&(s=(o=g).canonical.y/(1<<o.canonical.z),h=(n=v.tileID).canonical.y/(1<<n.canonical.z),!((a=o.wrap+o.canonical.x/(1<<o.canonical.z))+(l=t.EXTENT/(1<<o.canonical.z))<(u=n.wrap+n.canonical.x/(1<<n.canonical.z))+m.min.x||a>u+m.max.x||s+l<h+m.min.y||s>h+m.max.y))){var x=this._createProxiedId(g,v,r[g.key]&&r[g.key][e.id]),b=this.proxyToSource[g.key][e.id];b?b.push(x):this.proxyToSource[g.key][e.id]=[x],p.push(x)}}},i.prototype._createProxiedId=function(e,i,r){var o=this.orthoMatrix;if(r){var n=r.find((function(t){return t.key===i.tileID.key}));if(n)return n}if(i.tileID.key!==e.key){var a,s,l,u=e.canonical.z-i.tileID.canonical.z;o=t.create();var h=i.tileID.wrap-e.wrap<<e.overscaledZ;u>0?(s=(a=t.EXTENT>>u)*((i.tileID.canonical.x<<u)-e.canonical.x+h),l=a*((i.tileID.canonical.y<<u)-e.canonical.y)):(a=t.EXTENT<<-u,s=t.EXTENT*(i.tileID.canonical.x-(e.canonical.x+h<<-u)),l=t.EXTENT*(i.tileID.canonical.y-(e.canonical.y<<-u))),t.ortho(o,0,a,0,a,0,1),t.translate(o,o,[s,l,0])}return new Se(i.tileID,e.key,o)},i.prototype._findTileCoveringTileID=function(e,i){var r=i.getTile(e);if(r&&r.hasData())return r;var o=this._findCoveringTileCache[i.id],n=o[e.key];if((r=n?i.getTileByID(n):null)&&r.hasData()||null===n)return r;var a=r?r.tileID:e,s=a.overscaledZ,l=i.getSource().minzoom,u=[];if(!n){var h=i.getSource().maxzoom;if(e.canonical.z>=h){var p=e.canonical.z-h;i.getSource().reparseOverscaled?(s=Math.max(e.canonical.z+2,i.transform.tileZoom),a=new t.OverscaledTileID(s,e.wrap,h,e.canonical.x>>p,e.canonical.y>>p)):0!==p&&(a=new t.OverscaledTileID(s=h,e.wrap,h,e.canonical.x>>p,e.canonical.y>>p))}a.key!==e.key&&(u.push(a.key),r=i.getTile(a))}var c=function(t){u.forEach((function(e){o[e]=t})),u.length=0};for(s-=1;s>=l&&(!r||!r.hasData());s--){r&&c(r.tileID.key);var f=a.calculateScaledKey(s);if((r=i.getTileByID(f))&&r.hasData())break;var d=o[f];if(null===d)break;void 0===d?u.push(f):r=i.getTileByID(d)}return c(r?r.tileID.key:null),r&&r.hasData()?r:null},i.prototype.findDEMTileFor=function(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null},i.prototype.prepareDrawTile=function(t){this.renderedToTile=!0},i.prototype._clearRenderCacheForTile=function(t,e){var i=this._tilesDirty[t];i||(i=this._tilesDirty[t]={}),i[e.key]=!0},i.prototype.getWirefameBuffer=function(){if(!this.wireframeSegments){var e=function(){var e,i,r,o=new t.StructArrayLayout2ui4,n=131;for(i=1;i<129;i++){for(e=1;e<129;e++)o.emplaceBack(r=i*n+e,r+1),o.emplaceBack(r,r+n),o.emplaceBack(r+1,r+n),128===i&&o.emplaceBack(r+n,r+n+1);o.emplaceBack(r+1,r+1+n)}return o}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(e),this.wireframeSegments=t.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,e.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]},Object.defineProperties(i.prototype,r),i}(t.Elevation);function Ae(t){for(var e=[],i=0;i<t.length;i++)if(null!==t[i]){var r=t[i].split(" ");e.push(r.pop())}return e}var Pe=function(e,i,r,o,n,a){var s=e.gl;this.program=s.createProgram();for(var l=Ae(r.staticAttributes),u=o?o.getBinderAttributes():[],h=l.concat(u),p=r.staticUniforms?Ae(r.staticUniforms):[],c=o?o.getBinderUniforms():[],f=[],d=0,m=p.concat(c);d<m.length;d+=1){var y=m[d];f.indexOf(y)<0&&f.push(y)}var g=o?o.defines():[],_=(g=g.concat(a.map((function(t){return"#define "+t})))).concat(he.fragmentSource,pe,ue.fragmentSource,r.fragmentSource).join("\n"),v=g.concat(he.vertexSource,pe,ue.vertexSource,le.vertexSource,r.vertexSource).join("\n"),x=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())this.failedToCreate=!0;else{s.shaderSource(x,_),s.compileShader(x),s.attachShader(this.program,x);var b=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())this.failedToCreate=!0;else{s.shaderSource(b,v),s.compileShader(b),s.attachShader(this.program,b),this.attributes={};var w={};this.numAttributes=h.length;for(var k=0;k<this.numAttributes;k++)h[k]&&(s.bindAttribLocation(this.program,k,h[k]),this.attributes[h[k]]=k);s.linkProgram(this.program),s.deleteShader(b),s.deleteShader(x);for(var T=0;T<f.length;T++){var I=f[T];if(I&&!w[I]){var S=s.getUniformLocation(this.program,I);S&&(w[I]=S)}}this.fixedUniforms=n(e,w),this.binderUniforms=o?o.getUniforms(e,w):[],-1!==a.indexOf("TERRAIN")&&(this.terrainUniforms=function(e,i){return{u_dem:new t.Uniform1i(e,i.u_dem),u_dem_prev:new t.Uniform1i(e,i.u_dem_prev),u_dem_unpack:new t.Uniform4f(e,i.u_dem_unpack),u_dem_tl:new t.Uniform2f(e,i.u_dem_tl),u_dem_scale:new t.Uniform1f(e,i.u_dem_scale),u_dem_tl_prev:new t.Uniform2f(e,i.u_dem_tl_prev),u_dem_scale_prev:new t.Uniform1f(e,i.u_dem_scale_prev),u_dem_size:new t.Uniform1f(e,i.u_dem_size),u_dem_lerp:new t.Uniform1f(e,i.u_dem_lerp),u_exaggeration:new t.Uniform1f(e,i.u_exaggeration),u_depth:new t.Uniform1i(e,i.u_depth),u_depth_size_inv:new t.Uniform2f(e,i.u_depth_size_inv),u_meter_to_dem:new t.Uniform1f(e,i.u_meter_to_dem),u_label_plane_matrix_inv:new t.UniformMatrix4f(e,i.u_label_plane_matrix_inv)}}(e,w)),-1!==a.indexOf("FOG")&&(this.fogUniforms=function(e,i){return{u_fog_matrix:new t.UniformMatrix4f(e,i.u_fog_matrix),u_fog_range:new t.Uniform2f(e,i.u_fog_range),u_fog_color:new t.Uniform4f(e,i.u_fog_color),u_fog_horizon_blend:new t.Uniform1f(e,i.u_fog_horizon_blend),u_fog_temporal_offset:new t.Uniform1f(e,i.u_fog_temporal_offset)}}(e,w))}}};function Me(t,e,i){var r=1/S(i,1,e.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),n=i.tileSize*Math.pow(2,e.transform.tileZoom)/o,a=n*(i.tileID.canonical.x+i.tileID.wrap*o),s=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}Pe.cacheKey=function(t,e,i){for(var r=""+t+(i?i.cacheKey:""),o=0,n=e;o<n.length;o+=1)r+="/"+n[o];return r},Pe.prototype.setTerrainUniformValues=function(t,e){if(this.terrainUniforms){var i=this.terrainUniforms;if(!this.failedToCreate)for(var r in t.program.set(this.program),e)i[r].set(e[r])}},Pe.prototype.setFogUniformValues=function(t,e){if(this.fogUniforms){var i=this.fogUniforms;if(!this.failedToCreate)for(var r in t.program.set(this.program),e)i[r].location&&i[r].set(e[r])}},Pe.prototype.draw=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f,d,m){var y,g=t.gl;if(!this.failedToCreate){for(var _ in t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(o),t.setCullFace(n),this.fixedUniforms)this.fixedUniforms[_].set(a[_]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:c});for(var v=(y={},y[g.LINES]=2,y[g.TRIANGLES]=3,y[g.LINE_STRIP]=1,y)[e],x=0,b=h.get();x<b.length;x+=1){var w=b[x],k=w.vaos||(w.vaos={});(k[s]||(k[s]=new de)).bind(t,this,l,f?f.getPaintVertexBuffers():[],u,w.vertexOffset,d,m),g.drawElements(e,w.primitiveLength*v,g.UNSIGNED_SHORT,w.primitiveOffset*v*2)}}};var Le=function(e,i,r,o,n,a,s,l){var u=i.style.light,h=u.properties.get("position"),p=[h.x,h.y,h.z],c=t.create$1();"viewport"===u.properties.get("anchor")&&(t.fromRotation(c,-i.transform.angle),t.transformMat3(p,p,c));var f=u.properties.get("color");return{u_matrix:e,u_lightpos:p,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[f.r,f.g,f.b],u_vertical_gradient:+r,u_opacity:o,u_exclude:n,u_isGradient:a,u_direction:s,u_isTile:l}},Ce=function(e,i,r,o,n,a,s,l,u,h){return t.extend(Le(e,i,r,o,l,1,1,h),Me(a,i,s),{u_height_factor:-Math.pow(2,n.overscaledZ)/s.tileSize/8})},De=function(t,e,i){return{u_matrix:t,u_time:e,u_isWater:i}},ze=function(e,i,r,o){return t.extend(De(e),Me(r,i,o))},Oe=function(t,e){return{u_matrix:t,u_world:e}},Re=function(e,i,r,o,n){return t.extend(ze(e,i,r,o),{u_world:n})},Be=function(e,i,r,o){var n,a=e.transform;if("map"===o.paint.get("circle-pitch-alignment")){var s=S(r,1,a.zoom);n=[s,s]}else n=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:e.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:t.exported.devicePixelRatio,u_extrude_scale:n}},Fe=function(t){var e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e},Ue=function(e,i,r){var o=t.EXTENT/r.tileSize;return{u_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},je=function(t,e,i){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_viewport_size:[i.width,i.height]}},Ne=function(t,e,i){return void 0===i&&(i=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}},Ve=function(t,e,i,r){return{u_matrix:t,u_extrude_scale:S(e,1,i),u_intensity:r}},Ge=function(e,i,r,o,n,a){var s=e.transform;return{u_matrix:He(e,i,r,o),u_ratio:1/S(i,1,s.zoom),u_height:r.paint.get("line-height").value.value,u_device_pixel_ratio:t.exported.devicePixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_aimate:n,u_time:a}},Ze=function(e,i,r,o,n){return t.extend(Ge(e,i,r,o),{u_image:0,u_image_height:n})},qe=function(e,i,r,o,n,a,s){var l=e.transform,u=We(i,l);return{u_matrix:He(e,i,r,n),u_texsize:i.imageAtlasTexture.size,u_ratio:1/S(i,1,l.zoom),u_height:r.paint.get("line-height").value.value,u_device_pixel_ratio:t.exported.devicePixelRatio,u_image:0,u_scale:[u,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_aimate:a,u_time:s}},Xe=function(e,i,r,o,n,a,s){var l=We(i,e.transform);return t.extend(Ge(e,i,r,n),{u_texsize:i.lineAtlasTexture.size,u_scale:[l,o.fromScale,o.toScale],u_image:0,u_mix:o.t,u_aimate:a,u_time:s})};function We(t,e){return 1/S(t,1,e.tileZoom)}function He(t,e,i,r){return t.translatePosMatrix(r||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}var Ye=function(t,e,i,r,o){return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(a=o.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(n=o.paint.get("raster-contrast"),n>0?1/(1-n):1+n),u_spin_weights:Ke(o.paint.get("raster-hue-rotate"))};var n,a};function Ke(t){t*=Math.PI/180;var e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}var Je,Qe=function(t,e,i,r,o,n,a,s,l,u){var h=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:u,u_texture:0}},$e=function(e,i,r,o,n,a,s,l,u,h,p){var c=n.transform,f=c.cameraToCenterDistance,d=c._pitch;return t.extend(Qe(e,i,r,o,n,a,s,l,u,h),{u_gamma_scale:o?f*Math.cos(n.terrain?0:d):1,u_device_pixel_ratio:t.exported.devicePixelRatio,u_is_halo:+p})},ti=function(t,e,i){return{u_matrix:t,u_opacity:e,u_color:i}},ei=function(e,i,r,o,n,a){return t.extend(function(t,e,i,r){var o=i.imageManager.getPattern(t.from.toString()),n=i.imageManager.getPattern(t.to.toString()),a=i.imageManager.getPixelSize(),s=a.width,l=a.height,u=Math.pow(2,r.tileID.overscaledZ),h=r.tileSize*Math.pow(2,i.transform.tileZoom)/u,p=h*(r.tileID.canonical.x+r.tileID.wrap*u),c=h*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/S(r,1,i.transform.tileZoom),u_pixel_coord_upper:[p>>16,c>>16],u_pixel_coord_lower:[65535&p,65535&c]}}(o,a,r,n),{u_matrix:e,u_opacity:i})},ii=function(t,e,i,r,o,n,a,s,l,u,h,p,c,f){return{u_matrix:t,u_model_mat:e,u_scale:i,u_camera_pos:[r[0],r[1],r[2]],u_light1_pos:[s[0],s[1],s[2]],u_light2_pos:[s[3],s[4],s[5]],u_light3_pos:[s[6],s[7],s[8]],u_light4_pos:[s[9],s[10],s[11]],u_light1_intensity:[l[0],l[1],l[2]],u_light2_intensity:[l[3],l[4],l[5]],u_light3_intensity:[l[6],l[7],l[8]],u_light4_intensity:[l[9],l[10],l[11]],u_albedo:[o[0],o[1],o[2]],u_metallic:n,u_roughness:a,u_irradiance:u,u_prefilter:h,u_brdf_lut:p,u_is_car:c||-1,u_is_blend_light:f}},ri=function(t,e,i,r,o,n,a,s,l,u,h,p,c){return{u_matrix:t,u_model_mat:e,u_scale:i,u_image:r,u_camera_pos:[o[0],o[1],o[2]],u_light1_pos:[s[0],s[1],s[2]],u_light2_pos:[s[3],s[4],s[5]],u_light3_pos:[s[6],s[7],s[8]],u_light4_pos:[s[9],s[10],s[11]],u_light1_intensity:[l[0],l[1],l[2]],u_light2_intensity:[l[3],l[4],l[5]],u_light3_intensity:[l[6],l[7],l[8]],u_light4_intensity:[l[9],l[10],l[11]],u_metallic:n,u_roughness:a,u_irradiance:u,u_prefilter:h,u_brdf_lut:p,u_is_blend_light:c}},oi={fillExtrusion:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity),u_exclude:new t.Uniform1f(e,i.u_exclude),u_isGradient:new t.Uniform1f(e,i.u_isGradient),u_direction:new t.Uniform1f(e,i.u_direction)}},fillExtrusionPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity),u_exclude:new t.Uniform1f(e,i.u_exclude),u_isTile:new t.Uniform1f(e,i.u_isTile)}},fill:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_time:new t.Uniform1f(e,i.u_time),u_isWater:new t.Uniform1f(e,i.u_isWater)}},fillPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},fillOutline:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}},fillOutlinePattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},circle:function(e,i){return{u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},collisionBox:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale)}},collisionCircle:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}},debug:function(e,i){return{u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}},clippingMask:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmap:function(e,i){return{u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmapTexture:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}},hillshade:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}},hillshadePrepare:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}},line:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_height:new t.Uniform1f(e,i.u_height),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_aimate:new t.Uniform4f(e,i.u_aimate),u_time:new t.Uniform1f(e,i.u_time)}},lineGradient:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_height:new t.Uniform1f(e,i.u_height),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}},linePattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_height:new t.Uniform1f(e,i.u_height),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_aimate:new t.Uniform4f(e,i.u_aimate),u_time:new t.Uniform1f(e,i.u_time)}},lineSDF:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_height:new t.Uniform1f(e,i.u_height),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_scale:new t.Uniform3f(e,i.u_scale),u_mix:new t.Uniform1f(e,i.u_mix),u_aimate:new t.Uniform4f(e,i.u_aimate),u_time:new t.Uniform1f(e,i.u_time)}},raster:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}},symbolIcon:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}},symbolSDF:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},symbolTextAndIcon:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},background:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}},backgroundPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}},terrainRaster:_e,terrainDepth:_e,skybox:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_sun_direction:new t.Uniform3f(e,i.u_sun_direction),u_cubemap:new t.Uniform1i(e,i.u_cubemap),u_opacity:new t.Uniform1f(e,i.u_opacity),u_temporal_offset:new t.Uniform1f(e,i.u_temporal_offset)}},skyboxGradient:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_center_direction:new t.Uniform3f(e,i.u_center_direction),u_radius:new t.Uniform1f(e,i.u_radius),u_opacity:new t.Uniform1f(e,i.u_opacity),u_temporal_offset:new t.Uniform1f(e,i.u_temporal_offset)}},skyboxGradientCapture:function(e,i){return{u_matrix_3f:new t.UniformMatrix3f(e,i.u_matrix_3f),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_center_direction:new t.Uniform3f(e,i.u_center_direction),u_radius:new t.Uniform1f(e,i.u_radius),u_opacity:new t.Uniform1f(e,i.u_opacity),u_temporal_offset:new t.Uniform1f(e,i.u_temporal_offset)}},skyboxCapture:function(e,i){return{u_matrix_3f:new t.UniformMatrix3f(e,i.u_matrix_3f),u_sun_direction:new t.Uniform3f(e,i.u_sun_direction),u_sun_intensity:new t.Uniform1f(e,i.u_sun_intensity),u_color_tint_r:new t.Uniform4f(e,i.u_color_tint_r),u_color_tint_m:new t.Uniform4f(e,i.u_color_tint_m),u_luminance:new t.Uniform1f(e,i.u_luminance),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp)}},skyboxIrradiance:function(e,i){return{u_matrix_3f:new t.UniformMatrix3f(e,i.u_matrix_3f)}},skyboxPreFiltered:function(e,i){return{u_matrix_3f:new t.UniformMatrix3f(e,i.u_matrix_3f),u_roughness:new t.Uniform1f(e,i.u_roughness)}},skyboxBrdf:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},modelColor:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_model_mat:new t.UniformMatrix4f(e,i.u_model_mat),u_scale:new t.Uniform1f(e,i.u_scale),u_is_car:new t.Uniform1f(e,i.u_is_car),u_is_blend_light:new t.Uniform1f(e,i.u_is_blend_light),u_camera_pos:new t.Uniform3f(e,i.u_camera_pos),u_light1_pos:new t.Uniform3f(e,i.u_light1_pos),u_light2_pos:new t.Uniform3f(e,i.u_light2_pos),u_light3_pos:new t.Uniform3f(e,i.u_light3_pos),u_light4_pos:new t.Uniform3f(e,i.u_light4_pos),u_light1_intensity:new t.Uniform3f(e,i.u_light1_intensity),u_light2_intensity:new t.Uniform3f(e,i.u_light2_intensity),u_light3_intensity:new t.Uniform3f(e,i.u_light3_intensity),u_light4_intensity:new t.Uniform3f(e,i.u_light4_intensity),u_albedo:new t.Uniform3f(e,i.u_albedo),u_metallic:new t.Uniform1f(e,i.u_metallic),u_roughness:new t.Uniform1f(e,i.u_roughness),u_irradiance:new t.Uniform1i(e,i.u_irradiance),u_prefilter:new t.Uniform1i(e,i.u_prefilter),u_brdf_lut:new t.Uniform1i(e,i.u_brdf_lut)}},modelTexture:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_model_mat:new t.UniformMatrix4f(e,i.u_model_mat),u_scale:new t.Uniform1f(e,i.u_scale),u_image:new t.Uniform1i(e,i.u_image),u_brdf_lut:new t.Uniform1i(e,i.u_brdf_lut),u_irradiance:new t.Uniform1i(e,i.u_irradiance),u_prefilter:new t.Uniform1i(e,i.u_prefilter),u_camera_pos:new t.Uniform3f(e,i.u_camera_pos),u_light1_pos:new t.Uniform3f(e,i.u_light1_pos),u_light2_pos:new t.Uniform3f(e,i.u_light2_pos),u_light3_pos:new t.Uniform3f(e,i.u_light3_pos),u_light4_pos:new t.Uniform3f(e,i.u_light4_pos),u_light1_intensity:new t.Uniform3f(e,i.u_light1_intensity),u_light2_intensity:new t.Uniform3f(e,i.u_light2_intensity),u_light3_intensity:new t.Uniform3f(e,i.u_light3_intensity),u_light4_intensity:new t.Uniform3f(e,i.u_light4_intensity),u_metallic:new t.Uniform1f(e,i.u_metallic),u_roughness:new t.Uniform1f(e,i.u_roughness),u_is_blend_light:new t.Uniform1f(e,i.u_is_blend_light)}},modelTranslucent:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_model_mat:new t.UniformMatrix4f(e,i.u_model_mat),u_scale:new t.Uniform1f(e,i.u_scale),u_image:new t.Uniform1i(e,i.u_image),u_brdf_lut:new t.Uniform1i(e,i.u_brdf_lut),u_irradiance:new t.Uniform1i(e,i.u_irradiance),u_prefilter:new t.Uniform1i(e,i.u_prefilter),u_camera_pos:new t.Uniform3f(e,i.u_camera_pos),u_light1_pos:new t.Uniform3f(e,i.u_light1_pos),u_light2_pos:new t.Uniform3f(e,i.u_light2_pos),u_light3_pos:new t.Uniform3f(e,i.u_light3_pos),u_light4_pos:new t.Uniform3f(e,i.u_light4_pos),u_light1_intensity:new t.Uniform3f(e,i.u_light1_intensity),u_light2_intensity:new t.Uniform3f(e,i.u_light2_intensity),u_light3_intensity:new t.Uniform3f(e,i.u_light3_intensity),u_light4_intensity:new t.Uniform3f(e,i.u_light4_intensity),u_metallic:new t.Uniform1f(e,i.u_metallic),u_roughness:new t.Uniform1f(e,i.u_roughness)}}};function ni(e,i,r,o,n,a,s){for(var l=e.context,u=l.gl,h=e.useProgram("collisionBox"),p=[],c=0,f=0,d=0;d<o.length;d++){var m=o[d],y=i.getTile(m),g=y.getBucket(r);if(g){var _=m.projMatrix;0===n[0]&&0===n[1]||(_=e.translatePosMatrix(m.projMatrix,y,n,a));var v=s?g.textCollisionBox:g.iconCollisionBox,x=g.collisionCircleArray;if(x.length>0){var b=t.create(),w=_;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),p.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=c+=x.length/4}v&&(e.terrain&&e.terrain.setupElevationDraw(y,h),h.draw(l,u.LINES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,Ue(_,e.transform,y),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,v.collisionVertexBuffer,v.collisionVertexBufferExt))}}if(s&&p.length){var k=e.useProgram("collisionCircle"),T=new t.StructArrayLayout2f1f2i16;T.resize(4*c),T._trim();for(var I=0,S=0,E=p;S<E.length;S+=1)for(var A=E[S],P=0;P<A.circleArray.length/4;P++){var M=4*P,L=A.circleArray[M+0],C=A.circleArray[M+1],D=A.circleArray[M+2],z=A.circleArray[M+3];T.emplace(I++,L,C,D,z,0),T.emplace(I++,L,C,D,z,1),T.emplace(I++,L,C,D,z,2),T.emplace(I++,L,C,D,z,3)}(!Je||Je.length<2*c)&&(Je=function(e){var i=2*e,r=new t.StructArrayLayout3ui6;r.resize(i),r._trim();for(var o=0;o<i;o++){var n=6*o;r.uint16[n+0]=4*o+0,r.uint16[n+1]=4*o+1,r.uint16[n+2]=4*o+2,r.uint16[n+3]=4*o+2,r.uint16[n+4]=4*o+3,r.uint16[n+5]=4*o+0}return r}(c));for(var O=l.createIndexBuffer(Je,!0),R=l.createVertexBuffer(T,t.collisionCircleLayout.members,!0),B=0,F=p;B<F.length;B+=1){var U=F[B],j=je(U.transform,U.invTransform,e.transform);k.draw(l,u.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,j,r.id,R,O,t.SegmentVector.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,e.transform.zoom,null,null,null)}R.destroy(),O.destroy()}}var ai=t.identity(new Float32Array(16));function si(e,i,r,o,n,a){var s=t.getAnchorAlignment(e),l=-(s.horizontalAlign-.5)*i,u=-(s.verticalAlign-.5)*r,h=t.evaluateVariableOffset(e,o);return new t.pointGeometry((l/n+h[0])*a,(u/n+h[1])*a)}function li(e,i,r,o,n,a,s,l,u,h,p,c){for(var f=e.context,d=f.gl,m=e.transform,y="map"===l,g="map"===u,_=y&&"point"!==r.layout.get("symbol-placement"),v=y&&!g&&!_,x=void 0!==r.layout.get("symbol-sort-key").constantOr(1),b=!1,w=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),k=r.layout.get("text-variable-anchor"),T=[],I=e.terrain&&g?["PITCH_WITH_MAP_TERRAIN"]:null,E=function(){var o=P[A],l=i.getTile(o),u=l.getBucket(r);if(u){var p=n?u.text:u.icon;if(p&&p.segments.get().length){var c=p.programConfigurations.get(r.id),f=n||u.sdfIcons,w=n?u.textSizeData:u.iconSizeData,E=g||0!==m.pitch,M=e.useProgram(function(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}(f,n,u),c,I),L=t.evaluateSizeForZoom(w,m.zoom),C=void 0,D=[0,0],z=void 0,O=void 0,R=null,B=void 0;if(n)z=l.glyphAtlasTexture,O=d.LINEAR,C=l.glyphAtlasTexture.size,u.iconsInText&&(D=l.imageAtlasTexture.size,R=l.imageAtlasTexture,B=E||e.options.rotating||e.options.zooming||"composite"===w.kind||"camera"===w.kind?d.LINEAR:d.NEAREST);else{var F=1!==r.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;z=l.imageAtlasTexture,O=f||e.options.rotating||e.options.zooming||F||E?d.LINEAR:d.NEAREST,C=l.imageAtlasTexture.size}var U=S(l,1,e.transform.zoom),j=ht(o.projMatrix,g,y,e.transform,U),N=e.terrain&&g&&_?t.invert(new Float32Array(16),j):ai,V=pt(o.projMatrix,g,y,e.transform,U),G=k&&u.hasTextData(),Z="none"!==r.layout.get("icon-text-fit")&&G&&u.hasIconData();if(_){var q=m.elevation;!function(e,i,r,o,n,a,s,l,u){var h=o?e.textSizeData:e.iconSizeData,p=t.evaluateSizeForZoom(h,r.transform.zoom),c=[256/r.width*2+1,256/r.height*2+1],f=o?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();for(var d=e.lineVertexArray,m=o?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=r.transform.width/r.transform.height,g=!1,_=0;_<m.length;_++){var v=m.get(_);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!g)bt(v.numGlyphs,f);else{g=!1;var x=u?u({x:v.anchorX,y:v.anchorY}):0,b=[v.anchorX,v.anchorY,x,1];if(t.transformMat4$1(b,b,i),dt(b,c)){var w=ft(r.transform.cameraToCenterDistance,b[3]),k=t.evaluateSizeForFeature(h,p,v),T=s?k/w:k*w,I=new t.pointGeometry(v.anchorX,v.anchorY),S=ct(I,n,x);if(S.signedDistanceFromCamera<=0)bt(v.numGlyphs,f);else{var E=S.point,A={},P=s?null:u,M=gt(v,T,!1,l,i,n,a,e.glyphOffsetArray,d,f,E,I,A,y,P);g=M.useVertical,P&&M.needsFlipping&&(A={}),(M.notEnoughRoom||g||M.needsFlipping&&gt(v,T,!0,l,i,n,a,e.glyphOffsetArray,d,f,E,I,A,y,P).notEnoughRoom)&&bt(v.numGlyphs,f)}}else bt(v.numGlyphs,f)}}o?e.text.dynamicLayoutVertexBuffer.updateData(f):e.icon.dynamicLayoutVertexBuffer.updateData(f)}(u,o.projMatrix,e,n,j,V,g,h,q?function(t){return q.getAtTileOffset(o,t.x,t.y)}:null)}var X,W=e.translatePosMatrix(o.projMatrix,l,a,s),H=_||n&&k||Z?ai:j,Y=e.translatePosMatrix(V,l,a,s,!0),K=f&&0!==r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1);X=f?u.iconsInText?function(e,i,r,o,n,a,s,l,u,h){return t.extend($e(e,i,r,o,n,a,s,l,!0,u,!0),{u_texsize_icon:h,u_texture_icon:1})}(w.kind,L,v,g,e,W,H,Y,C,D):$e(w.kind,L,v,g,e,W,H,Y,n,C,!0):Qe(w.kind,L,v,g,e,W,H,Y,n,C);var J={program:M,buffers:p,uniformValues:X,atlasTexture:z,atlasTextureIcon:R,atlasInterpolation:O,atlasInterpolationIcon:B,isSDF:f,hasHalo:K,tile:l,labelPlaneMatrixInv:N};if(x&&u.canOverlap){b=!0;for(var Q=0,$=p.segments.get();Q<$.length;Q+=1){var tt=$[Q];T.push({segments:new t.SegmentVector([tt]),sortKey:tt.sortKey,state:J})}}else T.push({segments:p.segments,sortKey:0,state:J})}}},A=0,P=o;A<P.length;A+=1)E();b&&T.sort((function(t,e){return t.sortKey-e.sortKey}));for(var M=0,L=T;M<L.length;M+=1){var C=L[M],D=C.state;if(e.terrain&&e.terrain.setupElevationDraw(D.tile,D.program,{useDepthForOcclusion:!0,labelPlaneMatrixInv:D.labelPlaneMatrixInv}),f.activeTexture.set(d.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,d.CLAMP_TO_EDGE),D.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),D.isSDF){var z=D.uniformValues;D.hasHalo&&(z.u_is_halo=1,ui(D.buffers,C.segments,r,e,D.program,w,p,c,z)),z.u_is_halo=0}ui(D.buffers,C.segments,r,e,D.program,w,p,c,D.uniformValues)}}function ui(e,i,r,o,n,a,s,l,u){var h=o.context;n.draw(h,h.gl.TRIANGLES,a,s,l,t.CullFaceMode.disabled,u,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,o.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function hi(e,i,r,o,n,a,s){var l,u,h,p,c,f=e.context.gl,d=r.paint.get("fill-pattern"),m=d&&d.constantOr(1),y=r.getCrossfadeParameters();s?(u=m&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=f.LINES):(u=m?"fillPattern":"fill",l=f.TRIANGLES);for(var g=0,_=o;g<_.length;g+=1){var v=_[g],x=i.getTile(v);if(!m||x.patternsLoaded()){var b=x.getBucket(r);if(b){e.prepareDrawTile(v);var w=b.programConfigurations.get(r.id),k=e.useProgram(u,w);m&&(e.context.activeTexture.set(f.TEXTURE0),x.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),w.updatePaintBuffers(y));var T=d.constantOr(null);if(T&&x.imageAtlas){var I=x.imageAtlas,S=I.patternPositions[T.to.toString()],E=I.patternPositions[T.from.toString()];S&&E&&w.setConstantPatternPositions(S,E)}var A,P=e.translatePosMatrix(v.projMatrix,x,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),M=e.clock.getElapsedTime();if(A=r.paint.get("fill-water-enable")?1:0,r.paint.get("fill-animate-enable"),s){p=b.indexBuffer2,c=b.segments2;var L=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[f.drawingBufferWidth,f.drawingBufferHeight];h="fillOutlinePattern"===u&&m?Re(P,e,y,x,L):Oe(P,L)}else p=b.indexBuffer,c=b.segments,h=m?ze(P,e,y,x):De(P,M,A);e.prepareDrawProgram(e.context,k,v.toUnwrapped()),k.draw(e.context,l,n,e.stencilModeForClipping(v),a,t.CullFaceMode.disabled,h,r.id,b.layoutVertexBuffer,p,c,r.paint,e.transform.zoom,w)}}}}function pi(e,i,r,o,n,a,s){var l=e.context,u=l.gl,h=r.paint.get("fill-extrusion-pattern"),p=h.constantOr(1),c=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),d=0;switch(r.paint.get("fill-extrusion-exclude")){case"none":default:d=0;break;case"top":d=1}var m=0;switch(r.paint.get("fill-extrusion-direction")){case"up":default:m=0;break;case"down":m=1}var y=r.paint.get("fill-extrusion-isGradient");y=y?1:0;var g=r.paint.get("fill-extrusion-isTile");g=g?1:0;for(var _=0,v=o;_<v.length;_+=1){var x=v[_],b=i.getTile(x),w=b.getBucket(r);if(w){var k=w.programConfigurations.get(r.id),T=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",k);if(e.terrain){var I=e.terrain;if(!w.enableTerrain)continue;if(I.setupElevationDraw(b,T,{useMeterToDem:!0}),ci(l,i,x,w,r,I),!w.centroidVertexBuffer){var S=T.attributes.a_centroid_pos;void 0!==S&&u.vertexAttrib2f(S,0,0)}}p&&(e.context.activeTexture.set(u.TEXTURE0),b.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),k.updatePaintBuffers(c));var E=h.constantOr(null);if(E&&b.imageAtlas){var A=b.imageAtlas,P=A.patternPositions[E.to.toString()],M=A.patternPositions[E.from.toString()];P&&M&&k.setConstantPatternPositions(P,M)}var L=e.translatePosMatrix(x.projMatrix,b,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),C=r.paint.get("fill-extrusion-vertical-gradient"),D=p?Ce(L,e,C,f,x,c,b,d,0,g):Le(L,e,C,f,d,y,m);e.prepareDrawProgram(l,T,x.toUnwrapped()),i.map.VirtualSpace&&i.map.VirtualSpace.isDrawBuildings&&i.map.VirtualSpace.DrawBuild.loadModel({image:b.imageAtlas,bucket:w,uniformValues:D,center:x.canonical}),i.map.VirtualSpace&&i.map.VirtualSpace.isDrawBuildings||T.draw(l,l.gl.TRIANGLES,n,a,s,t.CullFaceMode.backCCW,D,r.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,r.paint,e.transform.zoom,k,e.terrain?w.centroidVertexBuffer:null)}}}function ci(e,i,r,o,n,a){for(var s,l,u,h=[function(e){var i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new t.OverscaledTileID(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},function(e){var i=e.canonical.x+1,r=e.wrap;return i===1<<e.canonical.z&&(i=0,r++),new t.OverscaledTileID(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},function(e){return new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1)},function(e){return new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)}],p=function(t){var e,r,o,a=i.getSource().maxzoom,s=function(t){var e=i.getTileByID(t);if(e&&e.hasData())return e.getBucket(n)};return(t.overscaledZ===t.canonical.z||t.overscaledZ>=a)&&(e=s(t.key)),t.overscaledZ>=a&&(r=s(t.calculateScaledKey(t.overscaledZ+1))),t.overscaledZ>a&&(o=s(t.calculateScaledKey(t.overscaledZ-1))),e||r||o},c=[0,0,0],f=function(e,i){return c[0]=Math.min(e.min.y,i.min.y),c[1]=Math.max(e.max.y,i.max.y),c[2]=t.EXTENT-i.min.x>e.max.x?i.min.x-t.EXTENT:e.max.x,c},d=function(e,i){return c[0]=Math.min(e.min.x,i.min.x),c[1]=Math.max(e.max.x,i.max.x),c[2]=t.EXTENT-i.min.y>e.max.y?i.min.y-t.EXTENT:e.max.y,c},m=[function(t,e){return f(t,e)},function(t,e){return f(e,t)},function(t,e){return d(t,e)},function(t,e){return d(e,t)}],y=new t.pointGeometry(0,0),g=function(e,i,o,n,h){var p=[[n?o:e,n?e:o,0],[n?o:i,n?i:o,0]],c=h<0?t.EXTENT+h:h,f=[n?c:(e+i)/2,n?(e+i)/2:c,0];return 0===o&&h<0||0!==o&&h>0?a.getForTilePoints(u,[f],!0,l):p.push(f),a.getForTilePoints(r,p,!0,s),Math.max(p[0][2],p[1][2],f[2])/a.exaggeration()},_=0;_<4;_++){var v=o.borders[_];if(0===v.length&&(o.borderDone[_]=!0),!o.borderDone[_]){var x=u=h[_](r),b=p(x);if(b&&b.enableTerrain&&(l=a.findDEMTileFor(x))&&l.dem){if(!s){var w=a.findDEMTileFor(r);if(!w||!w.dem)return;s=w}for(var k=(_<2?1:5)-_,T=b.borders[k],I=0,S=0;S<v.length;S++){for(var E=o.featuresOnBorder[v[S]],A=E.borders[_],P=void 0;I<T.length&&!((P=b.featuresOnBorder[T[I]]).borders[k][1]>A[0]+3);)b.borderDone[k]||b.encodeCentroid(void 0,P,!1),I++;if(P&&I<T.length){for(var M=I,L=0;!(P.borders[k][0]>A[1]-3)&&(L++,++I!==T.length);)P=b.featuresOnBorder[T[I]];if(P=b.featuresOnBorder[T[M]],E.intersectsCount()>1||P.intersectsCount()>1||1!==L){1!==L&&(I=M),o.encodeCentroid(void 0,E,!1),b.borderDone[k]||b.encodeCentroid(void 0,P,!1);continue}var C=m[_](E,P),D=_%2?t.EXTENT-1:0;y.x=g(C[0],Math.min(t.EXTENT-1,C[1]),D,_<2,C[2]),y.y=0,o.encodeCentroid(y,E,!1),b.borderDone[k]||b.encodeCentroid(y,P,!1)}else o.encodeCentroid(void 0,E,!1)}o.borderDone[_]=o.needsCentroidUpdate=!0,b.borderDone[k]||(b.borderDone[k]=b.needsCentroidUpdate=!0)}}}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(e)}var fi=new t.Color(1,0,0,1),di=new t.Color(0,1,0,1),mi=new t.Color(0,0,1,1),yi=new t.Color(1,0,1,1),gi=new t.Color(0,1,1,1);function _i(t,e,i,r){xi(t,0,e+i/2,t.transform.width,i,r)}function vi(t,e,i,r){xi(t,e-i/2,0,i,t.transform.height,r)}function xi(e,i,r,o,n,a){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.exported.devicePixelRatio,r*t.exported.devicePixelRatio,o*t.exported.devicePixelRatio,n*t.exported.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function bi(e,i,r){var o=e.context,n=o.gl,a=r.projMatrix,s=e.useProgram("debug"),l=i.getTileByID(r.key);e.terrain&&e.terrain.setupElevationDraw(l,s);var u=t.DepthMode.disabled,h=t.StencilMode.disabled,p=e.colorModeForRenderPass(),c="$debug";o.activeTexture.set(n.TEXTURE0),e.emptyTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE),s.draw(o,n.LINE_STRIP,u,h,p,t.CullFaceMode.disabled,Ne(a,t.Color.red),c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var f=l.latestRawTileData,d=Math.floor((f&&f.byteLength||0)/1024),m=i.getTile(r).tileSize,y=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=" => "+r.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var i=t.debugOverlayCanvas,r=t.context.gl,o=t.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(e,5,5),o.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,g+" "+d+"kb"),s.draw(o,n.TRIANGLES,u,h,t.ColorMode.alphaBlended,t.CullFaceMode.disabled,Ne(a,t.Color.transparent,y),c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var wi=t.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},{name:"a_pos_2f",components:2,type:"Float32"}]).members;function ki(t,e,i,r){t.emplaceBack(e,i,r)}var Ti=function(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,ki(this.vertexArray,-1,-1,1),ki(this.vertexArray,1,-1,1),ki(this.vertexArray,-1,1,1),ki(this.vertexArray,1,1,1),ki(this.vertexArray,-1,-1,-1),ki(this.vertexArray,1,-1,-1),ki(this.vertexArray,-1,1,-1),ki(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=e.createVertexBuffer(this.vertexArray,wi),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,36,12)};function Ii(t,e,i){t.emplaceBack(e,i)}var Si=function(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,Ii(this.vertexArray,0,0),Ii(this.vertexArray,2,0),Ii(this.vertexArray,0,2),this.indices.emplaceBack(0,1,2),this.vertexBuffer=e.createVertexBuffer(this.vertexArray,wi),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,3,1)};function Ei(e,i,r,o){var n=e.context,a=n.gl,s=e.useProgram("skyboxGradientCapture"),l=r.paint.get("sky-opacity"),u=e.frameCounter/1e3%1;r.skyboxGeometry||(r.skyboxGeometry=new Ti(n)),n.activeTexture.set(a.TEXTURE0);var h=r.colorRampTexture;h||(h=r.colorRampTexture=new t.Texture(n,r.colorRamp,a.RGBA)),h.bind(a.LINEAR,a.CLAMP_TO_EDGE);var p=function(e,i,r,o,n){return{u_matrix_3f:e,u_color_ramp:0,u_center_direction:i,u_radius:t.degToRad(r),u_opacity:o,u_temporal_offset:n}}(t.fromMat4([],i),r.getCenter(e,!1),r.paint.get("sky-gradient-radius"),l,u);e.prepareDrawProgram(n,s),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+o,r.skyboxTexture,0),s.draw(n,a.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.backCW,p,"skyboxGradientCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}function Ai(e,i,r,o,n,a){var s=e.gl,l=i.paint.get("sky-atmosphere-color"),u=i.paint.get("sky-atmosphere-halo-color"),h=i.paint.get("sky-atmosphere-sun-intensity"),p=function(t,e,i,r,o){return{u_matrix_3f:t,u_sun_direction:e,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[o.r,o.g,o.b,o.a],u_luminance:5e-5,u_color_ramp:0}}(t.fromMat4([],o),n,h,l,u);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,i.skyboxTexture,0),r.draw(e,s.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,p,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}function Pi(e,i,r,o){var n=e.context,a=n.gl,s=i.skyboxIrradiance;if(!s){s=i.skyboxIrradiance=n.createFramebuffer(r,o,!1),i.skyboxIrradianceTexture=n.gl.createTexture(),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxIrradianceTexture),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR);for(var l=0;l<6;++l)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,a.RGBA,r,o,0,a.RGBA,a.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,r,o]),i.getCenter(e,!0);var u=e.useProgram("skyboxIrradiance"),h=new Float64Array(16);t.identity(h),t.rotateY(h,h,.5*-Math.PI),Mi(n,i,u,h,0,0),t.identity(h),t.rotateY(h,h,.5*Math.PI),Mi(n,i,u,h,0,1),t.identity(h),t.rotateX(h,h,.5*-Math.PI),Mi(n,i,u,h,0,2),t.identity(h),t.rotateX(h,h,.5*Math.PI),Mi(n,i,u,h,0,3),t.identity(h),Mi(n,i,u,h,0,4),t.identity(h),t.rotateY(h,h,Math.PI),Mi(n,i,u,h,0,5),n.viewport.set([0,0,e.width,e.height])}function Mi(e,i,r,o,n,a){var s=e.gl,l={u_matrix_3f:t.fromMat4([],o)};s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,i.skyboxIrradianceTexture,0),e.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture),r.draw(e,s.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,l,"skyboxIrradiance",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}function Li(e,i,r,o){var n=e.context,a=n.gl,s=i.skyboxPreFiltered;if(!s){s=i.skyboxPreFiltered=n.createFramebuffer(r,o,!1),i.skyboxPreFilteredTexture=n.gl.createTexture(),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxPreFilteredTexture),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR);for(var l=0;l<6;++l)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,a.RGBA,r,o,0,a.RGBA,a.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,r,o]),i.getCenter(e,!0);var u=e.useProgram("skyboxPreFiltered"),h=new Float64Array(16);t.identity(h),t.rotateY(h,h,.5*-Math.PI),Ci(n,i,u,h,0,0),t.identity(h),t.rotateY(h,h,.5*Math.PI),Ci(n,i,u,h,0,1),t.identity(h),t.rotateX(h,h,.5*-Math.PI),Ci(n,i,u,h,0,2),t.identity(h),t.rotateX(h,h,.5*Math.PI),Ci(n,i,u,h,0,3),t.identity(h),Ci(n,i,u,h,0,4),t.identity(h),t.rotateY(h,h,Math.PI),Ci(n,i,u,h,0,5),n.viewport.set([0,0,e.width,e.height])}function Ci(e,i,r,o,n,a){var s=e.gl,l={u_matrix_3f:t.fromMat4([],o),u_roughness:.857143};s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,i.skyboxPreFilteredTexture,0),e.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture),r.draw(e,s.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,l,"skyboxPreFiltered",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}function Di(e,i,r,o){var n=e.context,a=n.gl,s=e.transform,l=i.skyboxBrdf;l||(l=i.skyboxBrdf=n.createFramebuffer(r,o,!1),i.skyboxBrdfGeometry=new Si(n),i.skyboxBrdfTexture=n.gl.createTexture(),a.bindTexture(a.TEXTURE_2D,i.skyboxBrdfTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,r,o,0,a.RGBA,a.UNSIGNED_BYTE,null)),n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,r,o]);var u=e.useProgram("skyboxBrdf"),h={u_matrix:s.skyboxMatrix};a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i.skyboxBrdfTexture,0),u.draw(n,a.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,h,"skyboxBrdf",i.skyboxBrdfGeometry.vertexBuffer,i.skyboxBrdfGeometry.indexBuffer,i.skyboxBrdfGeometry.segment),n.viewport.set([0,0,e.width,e.height])}var zi=function(t){void 0===t&&(t=!0),this.startTime=0,this.oldTime=0,this.running=!1,this.elapsedTime=0,this.autoStart=t};zi.prototype.start=function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},zi.prototype.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},zi.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},zi.prototype.getDelta=function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t};var Oi={symbol:function(e,i,r,o,n){if("translucent"===e.renderPass){var a=t.StencilMode.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,i,r,o,n,a,s){for(var l=i.transform,u="map"===n,h="map"===a,p=function(){var e=f[c],n=o.getTile(e),a=n.getBucket(r);if(a&&a.text&&a.text.segments.get().length){var p=t.evaluateSizeForZoom(a.textSizeData,l.zoom),d=S(n,1,i.transform.zoom),m=ht(e.projMatrix,h,u,i.transform,d),y="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();if(p){var g=Math.pow(2,l.zoom-n.tileID.overscaledZ),_=l.elevation;!function(e,i,r,o,n,a,s,l,u,h,p,c){var f=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,y={};d.clear();for(var g=0;g<f.length;g++){var _=f.get(g),v=_.hidden||!_.crossTileID||e.allowVerticalPlacement&&!_.placedOrientation?null:o[_.crossTileID];if(v){var x=new t.pointGeometry(_.anchorX,_.anchorY),b=c(x),w=ct(x,r?l:s,b),k=ft(a.cameraToCenterDistance,w.signedDistanceFromCamera),T=n.evaluateSizeForFeature(e.textSizeData,h,_)*k/t.ONE_EM;r&&(T*=e.tilePixelRatio/u);for(var I=si(v.anchor,v.width,v.height,v.textOffset,v.textScale,T),S=r?ct(x.add(I),s,b).point:w.point.add(i?I.rotate(-a.angle):I),E=e.allowVerticalPlacement&&_.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,A=0;A<_.numGlyphs;A++)t.addDynamicAttributes(d,S,E);p&&_.associatedIconIndex>=0&&(y[_.associatedIconIndex]={shiftedAnchor:S,angle:E})}else bt(_.numGlyphs,d)}if(p){m.clear();for(var P=e.icon.placedSymbolArray,M=0;M<P.length;M++){var L=P.get(M);if(L.hidden)bt(L.numGlyphs,m);else{var C=y[M];if(C)for(var D=0;D<L.numGlyphs;D++)t.addDynamicAttributes(m,C.shiftedAnchor,C.angle);else bt(L.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(d)}(a,u,h,s,t.symbolSize,l,m,e.projMatrix,g,p,y,_?function(t){return _.getAtTileOffset(e,t.x,t.y)}:function(t){return 0})}}},c=0,f=e;c<f.length;c+=1)p()}(o,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),n),0!==r.paint.get("icon-opacity").constantOr(1)&&li(e,i,r,o,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),a,s),0!==r.paint.get("text-opacity").constantOr(1)&&li(e,i,r,o,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),a,s),i.map.showCollisionBoxes&&(ni(e,i,r,o,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),ni(e,i,r,o,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(e,i,r,o){if("translucent"===e.renderPass){var n=r.paint.get("circle-opacity"),a=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0!==n.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var u=e.context,h=u.gl,p=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),c=t.StencilMode.disabled,f=e.colorModeForRenderPass(),d=[],m=0;m<o.length;m++){var y=o[m],g=i.getTile(y),_=g.getBucket(r);if(_){var v=_.programConfigurations.get(r.id),x=Fe(r),b={programConfiguration:v,program:e.useProgram("circle",v,x),layoutVertexBuffer:_.layoutVertexBuffer,indexBuffer:_.indexBuffer,uniformValues:Be(e,y,g,r),tile:g};if(l)for(var w=0,k=_.segments.get();w<k.length;w+=1){var T=k[w];d.push({segments:new t.SegmentVector([T]),sortKey:T.sortKey,state:b})}else d.push({segments:_.segments,sortKey:0,state:b})}}l&&d.sort((function(t,e){return t.sortKey-e.sortKey}));for(var I=0,S=d;I<S.length;I+=1){var E=S[I],A=E.state,P=A.programConfiguration,M=A.program,L=A.layoutVertexBuffer,C=A.indexBuffer,D=A.uniformValues,z=A.tile,O=E.segments;e.terrain&&e.terrain.setupElevationDraw(z,M,{useDepthForOcclusion:!0}),e.prepareDrawProgram(u,M,z.tileID.toUnwrapped()),M.draw(u,h.TRIANGLES,p,c,f,t.CullFaceMode.disabled,D,r.id,L,C,O,r.paint,e.transform.zoom,P)}}}},heatmap:function(e,i,r,o){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var n=e.context,a=n.gl,s=t.StencilMode.disabled,l=new t.ColorMode([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){var r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var o=i.heatmapFbo;if(o)r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer);else{var n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),o=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,r){var o=t.gl;o.texImage2D(o.TEXTURE_2D,0,t.gl.isWebGL2?o.RGBA16F:o.RGBA,e.width/4,e.height/4,0,o.RGBA,t.gl.isWebGL2?o.HALF_FLOAT:t.extTextureHalfFloat.HALF_FLOAT_OES,null),r.colorAttachment.set(i)}(t,e,n,o)}}(n,e,r),n.clear({color:t.Color.transparent});for(var u=0;u<o.length;u++){var h=o[u];if(!i.hasRenderableParent(h)){var p=i.getTile(h),c=p.getBucket(r);if(c){var f=c.programConfigurations.get(r.id),d=e.useProgram("heatmap",f),m=e.transform.zoom;e.terrain&&e.terrain.setupElevationDraw(p,d),e.prepareDrawProgram(n,d,h.toUnwrapped()),d.draw(n,a.TRIANGLES,t.DepthMode.disabled,s,l,t.CullFaceMode.disabled,Ve(h.projMatrix,p,m,r.paint.get("heatmap-intensity")),r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,e.transform.zoom,f)}}}n.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){var r=e.context,o=r.gl,n=i.heatmapFbo;if(n){r.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,n.colorAttachment.get()),r.activeTexture.set(o.TEXTURE1);var a=i.colorRampTexture;a||(a=i.colorRampTexture=new t.Texture(r,i.colorRamp,o.RGBA)),a.bind(o.LINEAR,o.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,o.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,function(e,i){var r=t.create();t.ortho(r,0,e.width,e.height,0,0,1);var o=e.context.gl;return{u_matrix:r,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}}(e,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}}(e,r))},line:function(e,i,r,o){if("translucent"===e.renderPass){var n=r.paint.get("line-opacity"),a=r.paint.get("line-width");if(0!==n.constantOr(1)&&0!==a.constantOr(1))for(var s=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),l=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),h=u.constantOr(1),p=r.layout.get("line-cap"),c=r.paint.get("line-pattern"),f=c.constantOr(1),d=r.paint.get("line-gradient"),m=r.getCrossfadeParameters(),y=f?"linePattern":h?"lineSDF":d?"lineGradient":"line",g=r.paint.get("line-animate-enable")?1:0,_=r.paint.get("line-animate-duration"),v=r.paint.get("line-animate-interval"),x=r.paint.get("line-animate-trailLength"),b=e.clock.getElapsedTime(),w=[g,_,v,x],k=e.context,T=k.gl,I=0,S=o;I<S.length;I+=1){var E=S[I],A=i.getTile(E);if(!f||A.patternsLoaded()){var P=A.getBucket(r);if(P){var M=e.stencilModeForClipping(E);0!=r.paint.get("line-height").value.value&&(s=new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D),M=t.StencilMode.disabled),e.prepareDrawTile(E);var L=P.programConfigurations.get(r.id),C=e.useProgram(y,L),D=c.constantOr(null);if(D&&A.imageAtlas){var z=A.imageAtlas,O=z.patternPositions[D.to.toString()],R=z.patternPositions[D.from.toString()];O&&R&&L.setConstantPatternPositions(O,R)}var B=u.constantOr(null),F=p.constantOr(null);if(!f&&B&&F&&A.lineAtlas){var U=A.lineAtlas,j=U.getDash(B.to,F),N=U.getDash(B.from,F);j&&N&&L.setConstantPatternPositions(j,N)}var V=e.terrain?E.projMatrix:null,G=f?qe(e,A,r,m,V,w,b):h?Xe(e,A,r,m,V,w,b):d?Ze(e,A,r,V,P.lineClipsArray.length):Ge(e,A,r,V,w,b);if(f)k.activeTexture.set(T.TEXTURE0),A.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),L.updatePaintBuffers(m);else if(h)k.activeTexture.set(T.TEXTURE0),A.lineAtlasTexture.bind(T.LINEAR,T.REPEAT),L.updatePaintBuffers(m);else if(d){var Z=P.gradients[r.id],q=Z.texture;if(r.gradientVersion!==Z.version){var X=256;if(r.stepInterpolant){var W=i.getSource().maxzoom,H=E.canonical.z===W?Math.ceil(1<<e.transform.maxZoom-E.canonical.z):1;X=t.clamp(t.nextPowerOfTwo(P.maxLineLength/t.EXTENT*1024*H),256,k.maxTextureSize)}Z.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:X,image:Z.gradient||void 0,clips:P.lineClipsArray}),Z.texture?Z.texture.update(Z.gradient):Z.texture=new t.Texture(k,Z.gradient,T.RGBA),Z.version=r.gradientVersion,q=Z.texture}k.activeTexture.set(T.TEXTURE0),q.bind(r.stepInterpolant?T.NEAREST:T.LINEAR,T.CLAMP_TO_EDGE)}e.prepareDrawProgram(k,C,E.toUnwrapped()),C.draw(k,T.TRIANGLES,s,M,l,t.CullFaceMode.disabled,G,r.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,r.paint,e.transform.zoom,L,P.layoutVertexBuffer2)}}}}},fill:function(e,i,r,o){var n=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===n.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){var h=e.depthModeForSublayer(1,"opaque"===e.renderPass?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly);hi(e,i,r,o,h,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){var p=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,t.DepthMode.ReadOnly);hi(e,i,r,o,p,s,!0)}}},"fill-extrusion":function(e,i,r,o){var n=r.paint.get("fill-extrusion-opacity");if(0!==n&&"translucent"===e.renderPass){var a=new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);if(1!==n||r.paint.get("fill-extrusion-pattern").constantOr(1))pi(e,i,r,o,a,t.StencilMode.disabled,t.ColorMode.disabled),pi(e,i,r,o,a,e.stencilModeFor3D(),e.colorModeForRenderPass());else{var s=e.colorModeForRenderPass();pi(e,i,r,o,a,t.StencilMode.disabled,s)}}},hillshade:function(e,i,r,o){if("offscreen"===e.renderPass||"translucent"===e.renderPass){for(var n=e.context,a=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),s=e.colorModeForRenderPass(),l=e.terrain&&e.terrain.renderingToTexture,u="translucent"!==e.renderPass||l?[{},o]:e.stencilConfigForOverlap(o),h=u[0],p=0,c=u[1];p<c.length;p+=1){var f=c[p],d=i.getTile(f);if(d.needsHillshadePrepare&&"offscreen"===e.renderPass)ge(e,d,r,a,t.StencilMode.disabled,s);else if("translucent"===e.renderPass){var m=l&&e.terrain?e.terrain.stencilModeForRTTOverlap(f):h[f.overscaledZ];me(e,f,d,r,a,m,s)}}n.viewport.set([0,0,e.width,e.height])}},raster:function(e,i,r,o,n,a){if("translucent"===e.renderPass&&0!==r.paint.get("raster-opacity")&&o.length)for(var s=e.context,l=s.gl,u=i.getSource(),h=e.useProgram("raster"),p=e.colorModeForRenderPass(),c=e.terrain&&e.terrain.renderingToTexture,f=u instanceof B||c?[{},o]:e.stencilConfigForOverlap(o),d=f[0],m=f[1],y=m[m.length-1].overscaledZ,g=!e.options.moving,_=0,v=m;_<v.length;_+=1){var x=v[_],b=c?t.DepthMode.disabled:e.depthModeForSublayer(x.overscaledZ-y,1===r.paint.get("raster-opacity")?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly,l.LESS),w=x.toUnwrapped(),k=i.getTile(x);if(!c||k&&k.hasData()){var T=c?x.projMatrix:e.transform.calculateProjMatrix(w,g),I=e.terrain&&c?e.terrain.stencilModeForRTTOverlap(x):d[x.overscaledZ],S=a?0:r.paint.get("raster-fade-duration");k.registerFadeDuration(S);var E=i.findLoadedParent(x,0),A=Te(k,E,i,e.transform,S);e.terrain&&e.terrain.prepareDrawTile(x);var P=void 0,M=void 0,L="nearest"===r.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;s.activeTexture.set(l.TEXTURE0),k.texture.bind(L,l.CLAMP_TO_EDGE,l.LINEAR_MIPMAP_NEAREST),s.activeTexture.set(l.TEXTURE1),E?(E.texture.bind(L,l.CLAMP_TO_EDGE,l.LINEAR_MIPMAP_NEAREST),P=Math.pow(2,E.tileID.overscaledZ-k.tileID.overscaledZ),M=[k.tileID.canonical.x*P%1,k.tileID.canonical.y*P%1]):k.texture.bind(L,l.CLAMP_TO_EDGE,l.LINEAR_MIPMAP_NEAREST);var C=Ye(T,M||[0,0],P||1,A,r);e.prepareDrawProgram(s,h,w),u instanceof B?h.draw(s,l.TRIANGLES,b,t.StencilMode.disabled,p,t.CullFaceMode.disabled,C,r.id,u.boundsBuffer,e.quadTriangleIndexBuffer,u.boundsSegments):h.draw(s,l.TRIANGLES,b,I,p,t.CullFaceMode.disabled,C,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}},background:function(e,i,r,o){var n=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(0!==a){var s=e.context,l=s.gl,u=e.transform,h=u.tileSize,p=r.paint.get("background-pattern");if(!e.isPatternMissing(p)){var c=1===n.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass===c){var f=t.StencilMode.disabled,d=e.depthModeForSublayer(0,"opaque"===c?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly),m=e.colorModeForRenderPass(),y=e.useProgram(p?"backgroundPattern":"background"),g=o||u.coveringTiles({tileSize:h});p&&(s.activeTexture.set(l.TEXTURE0),e.imageManager.bind(e.context));for(var _=r.getCrossfadeParameters(),v=0,x=g;v<x.length;v+=1){var b=x[v],w=b.toUnwrapped(),k=o?b.projMatrix:e.transform.calculateProjMatrix(w);e.prepareDrawTile(b);var T=p?ei(k,a,e,p,{tileID:b,tileSize:h},_):ti(k,a,n);e.prepareDrawProgram(s,y,w),y.draw(s,l.TRIANGLES,d,f,m,t.CullFaceMode.disabled,T,r.id,e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments)}}}}},sky:function(e,i,r){var o=r.paint.get("sky-opacity");if(0!==o){var n=e.context,a=r.paint.get("sky-type"),s=new t.DepthMode(n.gl.LEQUAL,t.DepthMode.ReadOnly,[0,1]),l=e.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===e.renderPass?r.needsSkyboxCapture(e)&&(function(e,i){var r=e.context,o=r.gl,n=i.skyboxFbo;if(!n){n=i.skyboxFbo=r.createFramebuffer(32,32,!1),i.skyboxGeometry=new Ti(r),i.skyboxTexture=r.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,i.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(var a=0;a<6;++a)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}r.bindFramebuffer.set(n.framebuffer),r.viewport.set([0,0,32,32]);var s=i.getCenter(e,!0),l=e.useProgram("skyboxCapture"),u=new Float64Array(16);t.identity(u),t.rotateY(u,u,.5*-Math.PI),Ai(r,i,l,u,s,0),t.identity(u),t.rotateY(u,u,.5*Math.PI),Ai(r,i,l,u,s,1),t.identity(u),t.rotateX(u,u,.5*-Math.PI),Ai(r,i,l,u,s,2),t.identity(u),t.rotateX(u,u,.5*Math.PI),Ai(r,i,l,u,s,3),t.identity(u),Ai(r,i,l,u,s,4),t.identity(u),t.rotateY(u,u,Math.PI),Ai(r,i,l,u,s,5),r.viewport.set([0,0,e.width,e.height])}(e,r),Pi(e,r,64,64),Li(e,r,512,512),r.skyboxBrdfTexture||Di(e,r,512,512),r.markSkyboxValid(e)):"sky"===e.renderPass&&function(e,i,r,o,n){var a=e.context,s=a.gl,l=e.transform,u=e.useProgram("skybox");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);var h=function(t,e,i,r,o){return{u_matrix:t,u_sun_direction:e,u_cubemap:0,u_opacity:r,u_temporal_offset:o}}(l.skyboxMatrix,i.getCenter(e,!1),0,o,n);e.prepareDrawProgram(a,u),u.draw(a,s.TRIANGLES,r,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,h,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(e,r,s,o,l):"gradient"===a&&("offscreen"===e.renderPass?r.needsSkyboxGradientCapture(e)&&(function(e,i){var r=e.context,o=r.gl,n=i.skyboxFbo;if(!n){n=i.skyboxFbo=r.createFramebuffer(32,32,!1),i.skyboxGeometry=new Ti(r),i.skyboxTexture=r.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,i.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(var a=0;a<6;++a)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}r.bindFramebuffer.set(n.framebuffer),r.viewport.set([0,0,32,32]),i.getCenter(e,!0);var s=new Float64Array(16);t.identity(s),t.rotateY(s,s,.5*-Math.PI),Ei(e,s,i,0),t.identity(s),t.rotateY(s,s,.5*Math.PI),Ei(e,s,i,1),t.identity(s),t.rotateX(s,s,.5*-Math.PI),Ei(e,s,i,2),t.identity(s),t.rotateX(s,s,.5*Math.PI),Ei(e,s,i,3),t.identity(s),Ei(e,s,i,4),t.identity(s),t.rotateY(s,s,Math.PI),Ei(e,s,i,5),r.viewport.set([0,0,e.width,e.height])}(e,r),Pi(e,r,64,64),Li(e,r,512,512),r.skyboxBrdfTexture||Di(e,r,512,512),r.markSkyboxValid(e),r.setSkyGradientDirty(!1)):"sky"===e.renderPass&&function(e,i,r,o,n){var a=e.context,s=a.gl,l=e.transform,u=e.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Ti(a)),a.activeTexture.set(s.TEXTURE0);var h=i.colorRampTexture;h||(h=i.colorRampTexture=new t.Texture(a,i.colorRamp,s.RGBA)),h.bind(s.LINEAR,s.CLAMP_TO_EDGE);var p=function(e,i,r,o,n){return{u_matrix:e,u_color_ramp:0,u_center_direction:i,u_radius:t.degToRad(r),u_opacity:o,u_temporal_offset:n}}(l.skyboxMatrix,i.getCenter(e,!1),i.paint.get("sky-gradient-radius"),o,n);e.prepareDrawProgram(a,u),u.draw(a,s.TRIANGLES,r,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,p,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(e,r,s,o,l))}},debug:function(t,e,i){for(var r=0;r<i.length;r++)bi(t,e,i[r])},custom:function(e,i,r){var o=e.context,n=r.implementation;if("offscreen"===e.renderPass){var a=n.prerender;a&&(e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),a.call(n,o.gl,e.transform.customLayerMatrix(),e.transform.customLayerMercatorMatrix(),e.transform.customLayerClipMatrix()),o.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),o.setStencilMode(t.StencilMode.disabled);var s="3d"===n.renderingMode?new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,[0,1]):e.depthModeForSublayer(0,t.DepthMode.ReadOnly);o.setDepthMode(s),n.render(o.gl,e.transform.customLayerMatrix(),e.transform.customLayerMercatorMatrix(),e.transform.customLayerClipMatrix()),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}},model:function(e,i,r,o){var n=r.paint.get("model-blend-light"),a=e.context,s=e.style.map,l=null;s&&s.style._sky&&(l=s.getLayer("LK_SKY_layer"));var u,h,p,c=new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D),f=t.StencilMode.disabled,d=e.colorModeForRenderPass(),m=-1;n&&n.value.value&&(m=1);for(var y=0;y<o.length;y++){var g=o[y],_=i.getTile(g).getBucket(r);if(_){var v=_.programConfig.get(r.id),x=e.useProgram("modelColor",v),b=_.programTextureConfig.get(r.id),w=e.useProgram("modelTexture",b),k=e.useProgram("modelTranslucent",b),T=new Float64Array(16);t.translate(T,e.transform.projMatrix,[e.transform.point.x,e.transform.point.y,0]);var I=g.canonical,S=e.transform.worldSize/e.transform.zoomScale(I.z),E=I.x+Math.pow(2,I.z)*g.wrap,A=t.create();t.translate(A,A,[E*S-e.transform.point.x,I.y*S-e.transform.point.y,0]),t.scale(A,A,[S/t.EXTENT,S/t.EXTENT,1]);var P=e.transform.pitch,M=e.transform.bearing*Math.PI/180,L=P*Math.PI/180,C=Math.sin(M),D=Math.cos(M),z=100;0!==P&&(z=1/Math.tan(L));var O=1e3/Math.sqrt(C*C+D*D+z*z),R=new Float32Array([C*O,D*O,z*O]),B=new Float32Array([0,0,1e4,-1e3,0,1e3,0,1e3,1e3,0,-1e3,1e3]),F=new Float32Array([50,50,50,10,10,10,10,10,10,10,10,10]),U=6.69836,j=a.gl;if(x.failedToCreate)return;if(w.failedToCreate)return;if(k.failedToCreate)return;if("translucent"===e.renderPass){var N=_.transparentSegments.get();for(var V in _.preRender(e.renderPass),N){var G=N[V];if(G.hasColor){a.program.set(x.program),a.setDepthMode(c),a.setStencilMode(f),a.setColorMode(d),a.setCullFace(t.CullFaceMode.backCW);var Z=ii(T,A,U,R,G.albedo,G.metallic,G.roughness,B,F);for(var q in x.fixedUniforms)x.fixedUniforms[q].set(Z[q]);v&&v.setUniforms(a,x.binderUniforms,r.paint,{zoom:e.transform.zoom});var X=G.vaos||(G.vaos={});(X[r.id]||(X[r.id]=new de)).bind(a,x,G.layoutVertexBuffer,[],G.indexBuffer,G.vertexOffset),j.drawElements(a.gl.TRIANGLES,3*G.primitiveLength,j.UNSIGNED_SHORT,3*G.primitiveOffset*2)}else{if(void 0===G.segmentTexture){void 0!==G.segmentImage&&(a.activeTexture.set(j.TEXTURE0),G.segmentTexture=new t.Texture(a,G.segmentImage,j.RGBA,{useMipmap:!0}));continue}a.program.set(k.program),a.setDepthMode(c),a.setStencilMode(f),a.setColorMode(d),a.setCullFace(t.CullFaceMode.backCW),a.activeTexture.set(j.TEXTURE0),G.segmentTexture.bind(j.LINEAR,j.REPEAT,j.NEAREST_MIPMAP_LINEAR),l&&(a.activeTexture.set(j.TEXTURE1),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxIrradianceTexture),a.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxPreFilteredTexture),a.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,l.skyboxBrdfTexture));var W={u_matrix:T,u_model_mat:A,u_scale:U,u_image:0,u_camera_pos:[(u=R)[0],u[1],u[2]],u_light1_pos:[(h=B)[0],h[1],h[2]],u_light2_pos:[h[3],h[4],h[5]],u_light3_pos:[h[6],h[7],h[8]],u_light4_pos:[h[9],h[10],h[11]],u_light1_intensity:[(p=F)[0],p[1],p[2]],u_light2_intensity:[p[3],p[4],p[5]],u_light3_intensity:[p[6],p[7],p[8]],u_light4_intensity:[p[9],p[10],p[11]],u_metallic:G.metallic,u_roughness:G.roughness,u_irradiance:1,u_prefilter:2,u_brdf_lut:3};for(var H in k.fixedUniforms)k.fixedUniforms[H].set(W[H]);b&&b.setUniforms(a,k.binderUniforms,r.paint,{zoom:e.transform.zoom});var Y=G.vaos||(G.vaos={});(Y[r.id]||(Y[r.id]=new de)).bind(a,k,G.layoutVertexBuffer,[],G.indexBuffer,G.vertexOffset),j.drawElements(a.gl.TRIANGLES,3*G.primitiveLength,j.UNSIGNED_SHORT,3*G.primitiveOffset*2)}}}else if("translucent"!==e.renderPass){var K=_.opaqueSegments.get();for(var J in _.preRender(e.renderPass),K){var Q=K[J];if(Q.hasColor){a.program.set(x.program),a.setDepthMode(c),a.setStencilMode(f),a.setColorMode(d),a.setCullFace(t.CullFaceMode.backCW),l&&(a.activeTexture.set(j.TEXTURE1),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxIrradianceTexture),a.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxPreFilteredTexture),a.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,l.skyboxBrdfTexture));var $=ii(T,A,U,R,Q.albedo,Q.metallic,Q.roughness,B,F,1,2,3,0,m);for(var tt in x.fixedUniforms)x.fixedUniforms[tt].set($[tt]);v&&v.setUniforms(a,x.binderUniforms,r.paint,{zoom:e.transform.zoom});var et=Q.vaos||(Q.vaos={});(et[r.id]||(et[r.id]=new de)).bind(a,x,Q.layoutVertexBuffer,[],Q.indexBuffer,Q.vertexOffset),j.drawElements(a.gl.TRIANGLES,3*Q.primitiveLength,j.UNSIGNED_SHORT,3*Q.primitiveOffset*2)}else{if(!Q.loadedTexture)continue;if(void 0===Q.segmentTexture){void 0!==Q.segmentImage&&(a.activeTexture.set(j.TEXTURE0),Q.segmentTexture=new t.Texture(a,Q.segmentImage,j.RGB,{useMipmap:!0}));continue}a.program.set(w.program),a.setDepthMode(c),a.setStencilMode(f),a.setColorMode(d),a.setCullFace(t.CullFaceMode.backCW),a.activeTexture.set(j.TEXTURE0),Q.segmentTexture.bind(j.LINEAR,j.REPEAT,j.NEAREST_MIPMAP_LINEAR),l&&(a.activeTexture.set(j.TEXTURE1),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxIrradianceTexture),a.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_CUBE_MAP,l.skyboxPreFilteredTexture),a.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,l.skyboxBrdfTexture));var it=ri(T,A,U,0,R,Q.metallic,Q.roughness,B,F,1,2,3,m);for(var rt in w.fixedUniforms)w.fixedUniforms[rt].set(it[rt]);b&&b.setUniforms(a,w.binderUniforms,r.paint,{zoom:e.transform.zoom});var ot=Q.vaos||(Q.vaos={});(ot[r.id]||(ot[r.id]=new de)).bind(a,w,Q.layoutVertexBuffer,[],Q.indexBuffer,Q.vertexOffset),j.drawElements(a.gl.TRIANGLES,3*Q.primitiveLength,j.UNSIGNED_SHORT,3*Q.primitiveOffset*2)}}}}}}},Ri=function(e,i){this.context=new t.Context(e),this.transform=i,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.clock=new zi,this.sceneMgr=null,this.numSublayers=t.SourceCache.maxUnderzooming+t.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Kt,this.gpuTimers={},this.frameCounter=0,this._flyPathList=[]},Bi={terrain:{configurable:!0}};Ri.prototype.updateTerrain=function(t,e){var i=!!t&&!!t.terrain;if(i||this._terrain&&this._terrain.enabled){this._terrain||(this._terrain=new Ee(this,t));var r=this._terrain;this.transform.elevation=i?r:null,r.update(t,this.transform,e)}},Ri.prototype._updateFog=function(t){var e=t.fog;if(!e||e.getOpacity(this.transform.pitch)<1||e.properties.get("horizon-blend")<.03)this.transform.fogCullDistSq=null;else{var i=e.getFovAdjustedRange(this.transform._fov),r=i[0],o=r+.78*(i[1]-r);this.transform.fogCullDistSq=o*o}},Bi.terrain.get=function(){return this._terrain&&this._terrain.enabled?this._terrain:null},Ri.prototype.SetSceneMgr=function(t){this.sceneMgr=t},Ri.prototype.SetFlyPath=function(t){this._flyPathList.push(t)},Ri.prototype.resize=function(e,i){if(this.width=e*t.exported.devicePixelRatio,this.height=i*t.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var r=0,o=this.style.order;r<o.length;r+=1)this.style._layers[o[r]].resize()},Ri.prototype.setup=function(){var e=this.context,i=new t.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,t.posAttributes.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,t.posAttributes.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var o=new t.StructArrayLayout4i8;o.emplaceBack(0,0,0,0),o.emplaceBack(t.EXTENT,0,t.EXTENT,0),o.emplaceBack(0,t.EXTENT,0,t.EXTENT),o.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(o,R.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(n,t.posAttributes.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA),this.identityMat=t.create();var l=this.context.gl;this.stencilClearMode=new t.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(t.window.performance.now())},Ri.prototype.clearStencil=function(){var e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var r=t.create();t.ortho(r,0,this.width,this.height,0,0,1),t.scale(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,t.DepthMode.disabled,this.stencilClearMode,t.ColorMode.disabled,t.CullFaceMode.disabled,ke(r),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},Ri.prototype._renderTileClippingMasks=function(e,i,r){if(i&&this.currentStencilSource!==i.id&&e.isTileClipped()&&r&&r.length){this.currentStencilSource=i.id;var o=this.context,n=o.gl;this.nextStencilID+r.length>256&&this.clearStencil(),o.setColorMode(t.ColorMode.disabled),o.setDepthMode(t.DepthMode.disabled);var a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var s=0,l=r;s<l.length;s+=1){var u=l[s],h=this._tileClippingMaskIDs[u.key]=this.nextStencilID++;a.draw(o,n.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:n.ALWAYS,mask:0},h,255,n.KEEP,n.KEEP,n.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ke(u.projMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},Ri.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var e=this.nextStencilID++,i=this.context.gl;return new t.StencilMode({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)},Ri.prototype.stencilModeForClipping=function(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);var i=this.context.gl;return new t.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)},Ri.prototype.stencilConfigForOverlap=function(e){var i,r=this.context.gl,o=e.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),n=o[o.length-1].overscaledZ,a=o[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var s={},l=0;l<a;l++)s[l+n]=new t.StencilMode({func:r.GEQUAL,mask:255},l+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=a,[s,o]}return[(i={},i[n]=t.StencilMode.disabled,i),o]},Ri.prototype.colorModeForRenderPass=function(){var e=this.context.gl;if(this._showOverdrawInspector){var i=1/8;return new t.ColorMode([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?t.ColorMode.unblended:t.ColorMode.alphaBlended},Ri.prototype.depthModeForSublayer=function(e,i,r){if(!this.opaquePassEnabledForLayer())return t.DepthMode.disabled;var o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new t.DepthMode(r||this.context.gl.LEQUAL,i,[o,o])},Ri.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},Ri.prototype.render=function(e,i){var r=this;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,e._textureManager.upload(this.context),this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame(),this.clock.getElapsedTime();var o=this.style.order,n=this.style._sourceCaches;for(var a in n){var s=n[a];s.used&&s.prepare(this.context)}this.sceneMgr&&"UpdateScene"in this.sceneMgr&&this.sceneMgr.UpdateScene(this);var l={},u={},h={};for(var p in n){var c=n[p];l[p]=c.getVisibleCoordinates(),u[p]=l[p].slice().reverse(),h[p]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var f=0;f<o.length;f++)if(this.style._layers[o[f]].is3D()){this.opaquePassCutoff=f;break}if(this.terrain&&(this.terrain.updateTileBinding(h),this.opaquePassCutoff=0),t.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";for(var d=0,m=o;d<m.length;d+=1){var y=this.style._layers[m[d]],g=e._getLayerSourceCache(y);if(y.hasOffscreenPass()&&!y.isHidden(this.transform.zoom)){var _=g?u[g.id]:void 0;("custom"===y.type||y.isSky()||_&&_.length)&&this.renderLayer(this,g,y,_)}}null!==this.sceneMgr&&this.sceneMgr.RenderScene(this),this.depthRangeFor3D=[0,1-(e.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);var v=t.Color.transparent;if(this.style.fog&&(v=this.style.fog.properties.get("color")),this.context.clear({color:i.showOverdrawInspector?t.Color.black:v,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){var x=this.style._layers[o[this.currentLayer]],b=e._getLayerSourceCache(x);if(!x.isSky()&&!x.isModel()){var w=b?u[b.id]:void 0;this._renderTileClippingMasks(x,b,w),this.renderLayer(this,b,x,w)}}for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){var k=this.style._layers[o[this.currentLayer]],T=e._getLayerSourceCache(k);if(k.isModel()){var I=T?u[T.id]:void 0;this._renderTileClippingMasks(k,T,I),this.renderLayer(this,T,k,I)}}if(null!==this.sceneMgr&&this.sceneMgr.RenderScene(this),this._flyPathList.forEach((function(t){t&&"naviRunning"in t&&t.naviRunning&&t.UpdateNavi()})),this.renderPass="sky",this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){var S=this.style._layers[o[this.currentLayer]],E=e._getLayerSourceCache(S);S.isSky()&&this.renderLayer(this,E,S,E?u[E.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<o.length;){var A=this.style._layers[o[this.currentLayer]],P=e._getLayerSourceCache(A);if(A.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(A)){if(A.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer)}else{var M=P?("symbol"===A.type?h:u)[P.id]:void 0;this._renderTileClippingMasks(A,P,P?l[P.id]:void 0),this.renderLayer(this,P,A,M),++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),null!==this.sceneMgr&&this.sceneMgr.RenderScene(this),this.options.showTileBoundaries||this.options.showQueryGeometry){var L=null;t.values(this.style._layers).forEach((function(t){var i=e._getLayerSourceCache(t);i&&!t.isHidden(r.transform.zoom)&&(!L||L.getSource().maxzoom<i.getSource().maxzoom)&&(L=i)})),L&&this.options.showTileBoundaries&&Oi.debug(this,L,L.getVisibleCoordinates())}this.options.showPadding&&function(t){var e=t.transform.padding;_i(t,t.transform.height-(e.top||0),3,fi),_i(t,e.bottom||0,3,di),vi(t,e.left||0,3,mi),vi(t,t.transform.width-(e.right||0),3,yi);var i=t.transform.centerPoint;!function(t,e,i,r){xi(t,e-1,i-10,2,20,r),xi(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,gi)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%t.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(t.window.performance.now()),this.saveCanvasCopy())}},Ri.prototype.renderLayer=function(t,e,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),Oi[i.type](t,e,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())},Ri.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}},Ri.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},Ri.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},Ri.prototype.queryGpuTimers=function(t){var e={};for(var i in t){var r=t[i],o=this.context.extTimerQuery,n=o.getQueryObjectEXT(r.query,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(r.query),e[i]=n}return e},Ri.prototype.translatePosMatrix=function(e,i,r,o,n){if(!r[0]&&!r[1])return e;var a=n?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(a){var s=Math.sin(a),l=Math.cos(a);r=[r[0]*l-r[1]*s,r[0]*s+r[1]*l]}var u=[n?r[0]:S(i,r[0],this.transform.zoom),n?r[1]:S(i,r[1],this.transform.zoom),0],h=new Float32Array(16);return t.translate(h,e,u),h},Ri.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},Ri.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},Ri.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i},Ri.prototype.currentGlobalDefines=function(){var t=this.terrain&&this.terrain.renderingToTexture,e=this.style&&this.style.fog,i=this.style&&this.style._sky,r=[];return this.terrain&&!this.terrain.renderingToTexture&&r.push("TERRAIN"),e&&!t&&0!==e.getOpacity(this.transform.pitch)&&r.push("FOG"),i&&r.push("SKY"),t&&r.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&r.push("OVERDRAW_INSPECTOR"),r},Ri.prototype.useProgram=function(t,e,i){this.cache=this.cache||{};var r=i||[],o=this.currentGlobalDefines().concat(r),n=Pe.cacheKey(t,o,e);return this.cache[n]||(this.cache[n]=new Pe(this.context,t,ce[t],e,oi[t],o)),this.cache[n]},Ri.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},Ri.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},Ri.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},Ri.prototype.destroy=function(){this._terrain&&this._terrain.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()},Ri.prototype.prepareDrawTile=function(t){this.terrain&&this.terrain.prepareDrawTile(t)},Ri.prototype.prepareDrawProgram=function(t,e,i){if(!this.terrain||!this.terrain.renderingToTexture){var r=this.style.fog;if(r){var o=r.getOpacity(this.transform.pitch);0!==o&&e.setFogUniformValues(t,function(t,e,i,r){var o=e.properties.get("color"),n=t.frameCounter/1e3%1,a=[o.r/o.a,o.g/o.a,o.b/o.a,r];return{u_fog_matrix:i?t.transform.calculateFogTileMatrix(i):t.identityMat,u_fog_range:e.getFovAdjustedRange(t.transform._fov),u_fog_color:a,u_fog_horizon_blend:e.properties.get("horizon-blend"),u_fog_temporal_offset:n}}(this,r,i,o))}}},Ri.prototype.setTileLoadedFlag=function(t){this.tileLoaded=t},Ri.prototype.saveCanvasCopy=function(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1},Ri.prototype.canvasCopy=function(){var t=this.context.gl,e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),e},Ri.prototype.getCanvasCopiesAndTimestamps=function(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}},Ri.prototype.averageElevationNeedsEasing=function(){if(!this.transform._elevation)return!1;var t=this.style&&this.style.fog;return!!t&&0!==t.getOpacity(this.transform.pitch)},Object.defineProperties(Ri.prototype,Bi);var Fi=function(t,e,i,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r};function Ui(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function ji(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]}function Ni(e,i){var r=Ui(e,3);t.fromQuat(e,i),ji(e,3,r)}function Vi(t,e){ji(t,3,[e[0],e[1],e[2],1])}function Gi(e,i){var r=t.identity$1([]);return t.rotateZ$1(r,r,-i),t.rotateX$1(r,r,-e),r}function Zi(e,i){var r=[e[0],e[1],0],o=[i[0],i[1],0];if(t.length(r)>=1e-15){var n=t.normalize([],r);t.scale$2(o,n,t.dot(o,n)),i[0]=o[0],i[1]=o[1]}var a=t.cross([],i,e);if(t.len(a)<1e-15)return null;var s=Math.atan2(-a[1],a[0]);return Gi(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),s)}Fi.prototype.interpolate=function(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,r)),this},Fi.prototype.getCenter=function(e,i){var r=t.clamp((this.left+e-this.right)/2,0,e),o=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(r,o)},Fi.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},Fi.prototype.clone=function(){return new Fi(this.top,this.bottom,this.left,this.right)},Fi.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var qi=function(t,e){this.position=t,this.orientation=e},Xi={position:{configurable:!0}};Xi.position.get=function(){return this._position},Xi.position.set=function(e){this._position=this._renderWorldCopies?function(e){if(e){var i=Array.isArray(e)?new t.MercatorCoordinate(e[0],e[1],e[2]):e;return i.x=t.wrap(i.x,0,1),i}}(e):e},qi.prototype.lookAtPoint=function(e,i){if(this.orientation=null,this.position){var r=this._elevation?this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(e)):0,o=this.position,n=t.MercatorCoordinate.fromLngLat(e,r),a=[n.x-o.x,n.y-o.y,n.z-o.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Zi(a,i)}},qi.prototype.setPitchBearing=function(e,i){this.orientation=Gi(t.degToRad(e),t.degToRad(-i))},Object.defineProperties(qi.prototype,Xi);var Wi=function(e,i){this._transform=t.identity([]),this._orientation=t.identity$1([]),i&&(this._orientation=i,Ni(this._transform,this._orientation)),e&&Vi(this._transform,e)},Hi={mercatorPosition:{configurable:!0},position:{configurable:!0},orientation:{configurable:!0}};Hi.mercatorPosition.get=function(){var e=this.position;return new t.MercatorCoordinate(e[0],e[1],e[2])},Hi.position.get=function(){var t=Ui(this._transform,3);return[t[0],t[1],t[2]]},Hi.position.set=function(t){Vi(this._transform,t)},Hi.orientation.get=function(){return this._orientation},Hi.orientation.set=function(t){this._orientation=t,Ni(this._transform,this._orientation)},Wi.prototype.getPitchBearing=function(){var t=this.forward(),e=this.right();return{bearing:Math.atan2(-e[1],e[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}},Wi.prototype.setPitchBearing=function(t,e){this._orientation=Gi(t,e),Ni(this._transform,this._orientation)},Wi.prototype.forward=function(){var t=Ui(this._transform,2);return[-t[0],-t[1],-t[2]]},Wi.prototype.up=function(){var t=Ui(this._transform,1);return[-t[0],-t[1],-t[2]]},Wi.prototype.right=function(){var t=Ui(this._transform,0);return[t[0],t[1],t[2]]},Wi.prototype.getCameraToWorld=function(e,i){var r=new Float64Array(16);return t.invert(r,this.getWorldToCamera(e,i)),r},Wi.prototype.getWorldToCameraPosition=function(e,i,r){var o=this.position;t.scale$2(o,o,-e);var n=new Float64Array(16);return t.fromScaling(n,[r,r,r]),t.translate(n,n,o),n[10]*=i,n},Wi.prototype.getWorldToCamera=function(e,i){var r=new Float64Array(16),o=new Float64Array(4),n=this.position;return t.conjugate(o,this._orientation),t.scale$2(n,n,-e),t.fromQuat(r,o),t.translate(r,r,n),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r},Wi.prototype.getCameraToClipPerspective=function(e,i,r,o){var n=new Float64Array(16);return t.perspective(n,e,i,r,o),n},Wi.prototype.getDistanceToElevation=function(e){var i=0===e?0:t.mercatorZfromAltitude(e,this.position[1]),r=this.forward();return(i-this.position[2])/r[2]},Wi.prototype.clone=function(){return new Wi([].concat(this.position),[].concat(this.orientation))},Object.defineProperties(Wi.prototype,Hi);var Yi=function(e,i,r,o,n){this.tileSize=512,this._isTrackModeUpdate=!1,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===n||n,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==o?60:o,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.9652516631899266,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Fi,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._camera=new Wi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this.pointCoordinate3DCallBacks=[],this._horizonShift=.1},Ki={elevation:{configurable:!0},minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},cameraWorldSize:{configurable:!0},pixelsPerMeter:{configurable:!0},cameraPixelsPerMeter:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},averageElevation:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},fovAboveCenter:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};Yi.prototype.clone=function(t){void 0===t&&(t={pitch:!0,angle:!0});var e=new Yi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._cameraZoom=this._cameraZoom,t&&t.angle&&(e.angle=this.angle),e._fov=this._fov,t&&t.pitch&&(e._pitch=this._pitch),e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e},Ki.elevation.get=function(){return this._elevation},Ki.elevation.set=function(t){this._elevation!==t&&(this._elevation=t,t?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())},Yi.prototype.updateElevation=function(t){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),t&&this._constrainCameraAltitude(),this._calcMatrices()},Ki.minZoom.get=function(){return this._minZoom},Ki.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Ki.maxZoom.get=function(){return this._maxZoom},Ki.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Ki.minPitch.get=function(){return this._minPitch},Ki.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Ki.maxPitch.get=function(){return this._maxPitch},Ki.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Ki.renderWorldCopies.get=function(){return this._renderWorldCopies},Ki.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Ki.worldSize.get=function(){return this.tileSize*this.scale},Ki.cameraWorldSize.get=function(){var t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))},Ki.pixelsPerMeter.get=function(){return t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize},Ki.cameraPixelsPerMeter.get=function(){return t.mercatorZfromAltitude(1,this.center.lat)*this.cameraWorldSize},Ki.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Ki.size.get=function(){return new t.pointGeometry(this.width,this.height)},Ki.bearing.get=function(){return-this.angle/Math.PI*180},Ki.bearing.set=function(e){var i,r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=(i=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i),function(t,e,i){var r=e[0],o=e[1],n=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=r*l+n*s,t[1]=o*l+a*s,t[2]=r*-s+n*l,t[3]=o*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))},Ki.pitch.get=function(){return this._pitch/Math.PI*180},Ki.pitch.set=function(e){var i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},Ki.fov.get=function(){return this._fov/Math.PI*180},Ki.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Ki.averageElevation.get=function(){return this._averageElevation},Ki.averageElevation.set=function(t){this._averageElevation=t,this._calcFogMatrices()},Ki.zoom.get=function(){return this._zoom},Ki.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._setZoom(e),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())},Yi.prototype._setZoom=function(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom},Yi.prototype._updateCenterElevation=function(){if(!this._elevation)return!1;var e=this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(this.center),-1);return-1===e?(this._cameraZoom=null,!1):(this._centerAltitude=e,!0)},Yi.prototype._updateCameraOnTerrain=function(){var e=this.cameraToCenterDistance/this.worldSize,i=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat);this._cameraZoom=this._zoomFromMercatorZ(i+e)},Yi.prototype.sampleAverageElevation=function(){if(!this._elevation)return 0;for(var e=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop(),o=0,n=0,a=0;a<i.length;a++){var s=new t.pointGeometry(i[a][0]*this.width,r+i[a][1]*(this.height-r)),l=e.pointCoordinate(s);if(l){var u=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);o+=l[3]*u,n+=u}}return 0===n?NaN:o/n},Ki.center.get=function(){return this._center},Ki.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&!this._isTrackModeUpdate&&("ground"===this.cameraElevationReference?this._updateCenterElevation()?this._updateCameraOnTerrain():this._cameraZoom=null:this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())},Yi.prototype._updateZoomFromElevation=function(){if(null!=this._cameraZoom&&this._elevation){var e=this._cameraZoom,i=this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(this.center)),r=t.mercatorZfromAltitude(i,this.center.lat),o=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),a=Math.max(o-r,n);this._setZoom(this._zoomFromMercatorZ(a))}},Yi.prototype._getLngLatElevation=function(e){var i=t.MercatorCoordinate.fromLngLat(e);return this._elevation.getAtPointOrZero(i)},Ki.padding.get=function(){return this._edgeInsets.toJSON()},Ki.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Yi.prototype.computeZoomRelativeTo=function(e){var i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude())),r=t.length(t.sub([],this._camera.position,e.z<this._camera.position[2]?[i.x,i.y,i.z]:[e.x,e.y,e.z]));return t.clamp(this._zoomFromMercatorZ(r),this._minZoom,this._maxZoom)},Yi.prototype.setFreeCameraOptions=function(e){if(this.height&&(e.position||e.orientation)){this._updateCameraState();var i=!1;if(e.orientation&&!t.exactEquals(e.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(e.orientation)),e.position){var r=[e.position.x,e.position.y,e.position.z];t.exactEquals$1(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}},Yi.prototype.getFreeCameraOptions=function(){this._updateCameraState();var e=this._camera.position,i=new qi;return i.position=new t.MercatorCoordinate(e[0],e[1],e[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this._renderWorldCopies,i},Yi.prototype._setCameraOrientation=function(e){if(!t.length$1(e))return!1;t.normalize$1(e,e);var i=t.transformQuat([],[0,0,-1],e),r=t.transformQuat([],[0,-1,0],e);if(r[2]<0)return!1;var o=Zi(i,r);return!!o&&(this._camera.orientation=o,!0)},Yi.prototype._setCameraPosition=function(e){var i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;e[2]=t.clamp(e[2],o/r,o/i),this._camera.position=e},Ki.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},Ki.fovAboveCenter.get=function(){return this._fov*(.5+this.centerOffset.y/this.height)},Yi.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},Yi.prototype.interpolatePadding=function(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()},Yi.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},Yi.prototype.getVisibleUnwrappedCoordinates=function(e){var i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var r=this.pointCoordinate(new t.pointGeometry(0,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,0)),n=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),a=this.pointCoordinate(new t.pointGeometry(0,this.height)),s=Math.floor(Math.min(r.x,o.x,n.x,a.x)),l=Math.floor(Math.max(r.x,o.x,n.x,a.x)),u=s-1;u<=l+1;u++)0!==u&&i.push(new t.UnwrappedTileID(u,e));return i},Yi.prototype.coveringTiles=function(e){var i=this,r=this.coveringZoomLevel(e),o=r,n=this.elevation&&!e.isTerrainDEM;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var a=t.MercatorCoordinate.fromLngLat(this.center),s=1<<r,l=[s*a.x,s*a.y,0],u=t.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),h=this.pointCoordinate(this.getCameraPoint()),p=s*t.mercatorZfromAltitude(1,this.center.lat),c=this._camera.position[2]/t.mercatorZfromAltitude(1,this.center.lat),f=[s*h.x,s*h.y,c],d=this.cameraToCenterDistance/e.tileSize*(e.roundZoom?1:.502),m=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation?r:0,y=e.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,g=e.isTerrainDEM?-y:this._elevation?this._elevation.getMinElevationBelowMSL():0,_=function(e){return{aabb:new t.Aabb([e*s,0,g],[(e+1)*s,s,y]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}},v=[],x=[],b=r,w=e.reparseOverscaled?o:r,k=function(t){if(i._elevation&&t.tileID){var e=i._elevation.getMinMaxForTile(t.tileID),r=t.aabb;e?(r.min[2]=e.min,r.max[2]=e.max,r.center[2]=(r.min[2]+r.max[2])/2):(t.shouldSplit=S(t),t.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=i._centerAltitude))}},T=function(t){return t*t},I=T((c-this._centerAltitude)*p),S=function(t){if(t.zoom<m)return!0;if(t.zoom===b)return!1;if(null!=t.shouldSplit)return t.shouldSplit;var e=t.aabb.distanceX(f),i=t.aabb.distanceY(f),r=I;n&&(r=T(t.aabb.distanceZ(f)*p));var o=e*e+i*i+r,a=T((1<<b-t.zoom)*d*function(t,e){if(e*T(.707)<t)return 1;var i=Math.sqrt(e/t);return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)}(Math.max(r,I),o));return o<a};if(this._renderWorldCopies)for(var E=1;E<=3;E++)v.push(_(-E)),v.push(_(E));for(v.push(_(0));v.length>0;){var A=v.pop(),P=A.x,M=A.y,L=A.fullyVisible;if(!L){var C=A.aabb.intersects(u);if(0===C)continue;L=2===C}if(A.zoom!==b&&S(A))for(var D=0;D<4;D++){var z=(P<<1)+D%2,O=(M<<1)+(D>>1),R={aabb:A.aabb.quadrant(D),zoom:A.zoom+1,x:z,y:O,wrap:A.wrap,fullyVisible:L,tileID:void 0,shouldSplit:void 0};n&&(R.tileID=new t.OverscaledTileID(A.zoom+1===b?w:A.zoom+1,A.wrap,A.zoom+1,z,O),k(R)),v.push(R)}else{var B=A.zoom===b?w:A.zoom;if(e.minzoom&&e.minzoom>B)continue;var F=l[0]-(.5+P+(A.wrap<<A.zoom))*(1<<r-A.zoom),U=l[1]-.5-M,j=A.tileID?A.tileID:new t.OverscaledTileID(B,A.wrap,A.zoom,P,M);x.push({tileID:j,distanceSq:F*F+U*U})}}if(this.fogCullDistSq){var N=this.fogCullDistSq;x.splice.apply(x,[0,x.length].concat(x.filter((function(e){var r=[0,0,0,1],o=[t.EXTENT,t.EXTENT,0,1],a=i.calculateFogTileMatrix(e.tileID.toUnwrapped());t.transformMat4$1(r,r,a),t.transformMat4$1(o,o,a);var s=t.getAABBPointSquareDist(r,o);if(0===s)return!0;var l=!1,u=i.horizonLineFromTop();if(s>N&&0!==u){var h,p=i.calculateProjMatrix(e.tileID.toUnwrapped());n&&i._elevation&&(h=i._elevation.getMinMaxForTile(e.tileID)),h||(h={min:g,max:y});var c=t.furthestTileCorner(i.bearing),f=[c[0]*t.EXTENT,c[1]*t.EXTENT,h.max];t.transformMat4(f,f,p),l=(1-f[1])*i.height*.5<u}return s<N||l}))))}return x.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},Yi.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Ki.unmodified.get=function(){return this._unmodified},Yi.prototype.zoomScale=function(t){return Math.pow(2,t)},Yi.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Yi.prototype.project=function(e){var i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)},Yi.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Ki.point.get=function(){return this.project(this.center)},Yi.prototype.setLocationAtPoint=function(e,i){var r=this.pointCoordinate(i),o=this.pointCoordinate(this.centerPoint),n=this.locationCoordinate(e),a=new t.MercatorCoordinate(n.x-(r.x-o.x),n.y-(r.y-o.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},Yi.prototype.setLocation=function(t){this.center=this.coordinateLocation(t),this._renderWorldCopies&&(this.center=this.center.wrap())},Yi.prototype.locationPoint=function(t){return this._coordinatePoint(this.locationCoordinate(t),!1)},Yi.prototype.locationPoint3D=function(t){return this._coordinatePoint(this.locationCoordinate(t),!0)},Yi.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Yi.prototype.pointLocation3D=function(t){return this.coordinateLocation(this.pointCoordinate3D(t))},Yi.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},Yi.prototype.locationCoordinateAltitude=function(e,i){return t.MercatorCoordinate.fromLngLat(e,i)},Yi.prototype.coordinateLocation=function(t){return t.toLngLat()},Yi.prototype.pointRayIntersection=function(e,i){var r=null!=i?i:this._centerAltitude,o=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4$1(o,o,this.pixelMatrixInverse),t.transformMat4$1(n,n,this.pixelMatrixInverse);var a=n[3];t.scale$1(o,o,1/o[3]),t.scale$1(n,n,1/a);var s=o[2],l=n[2];return{p0:o,p1:n,t:s===l?0:(r-s)/(l-s)}},Yi.prototype.screenPointToMercatorRay=function(e){var i=[e.x,e.y,0,1],r=[e.x,e.y,1,1];return t.transformMat4$1(i,i,this.pixelMatrixInverse),t.transformMat4$1(r,r,this.pixelMatrixInverse),t.scale$1(i,i,1/i[3]),t.scale$1(r,r,1/r[3]),i[2]=t.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,r[2]=t.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,t.scale$1(i,i,1/this.worldSize),t.scale$1(r,r,1/this.worldSize),new t.Ray([i[0],i[1],i[2]],t.normalize([],t.sub([],r,i)))},Yi.prototype.rayIntersectionCoordinate=function(e){var i=e.p0,r=e.p1,o=e.t,n=t.mercatorZfromAltitude(i[2],this._center.lat),a=t.mercatorZfromAltitude(r[2],this._center.lat);return new t.MercatorCoordinate(t.number(i[0],r[0],o)/this.worldSize,t.number(i[1],r[1],o)/this.worldSize,t.number(n,a,o))},Yi.prototype.pointCoordinate=function(e){var i=this.horizonLineFromTop(!1),r=new t.pointGeometry(e.x,Math.max(i,e.y));return this.rayIntersectionCoordinate(this.pointRayIntersection(r))},Yi.prototype.pointCoordinate3D=function(e){if(this.pointCoordinate3DCallBacks&&this.pointCoordinate3DCallBacks.length>0)for(var i=0;i<this.pointCoordinate3DCallBacks.length;++i){var r=this.pointCoordinate3DCallBacks[i](e);if(r)return r}if(!this.elevation)return this.pointCoordinate(e);var o=this.elevation,n=this.elevation.pointCoordinate(e);if(n)return new t.MercatorCoordinate(n[0],n[1],n[2]);var a=0,s=this.horizonLineFromTop();if(e.y>s)return this.pointCoordinate(e);for(var l=.02*s,u=e.clone(),h=0;h<10&&s-a>l;h++){u.y=t.number(a,s,.66);var p=o.pointCoordinate(u);p?(s=u.y,n=p):a=u.y}return n?new t.MercatorCoordinate(n[0],n[1],n[2]):this.pointCoordinate(e)},Yi.prototype.isPointAboveHorizon=function(t){if(this.elevation)return!this.elevation.pointCoordinate(t);var e=this.horizonLineFromTop();return t.y<e},Yi.prototype._coordinatePoint=function(e,i,r){void 0===r&&(r=!0);var o=i&&this.elevation?this.elevation.getAtPointOrZero(e,this._centerAltitude):this._centerAltitude,n=[e.x*this.worldSize,e.y*this.worldSize,r?o+e.toAltitude():e.toAltitude(),1];return t.transformMat4$1(n,n,this.pixelMatrix),n[3]>0?new t.pointGeometry(n[0]/n[3],n[1]/n[3]):new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)},Yi.prototype.getBounds=function(){return this._terrainEnabled()?this._getBounds3D():new t.LngLatBounds(this.pointLocation(new t.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom)),this.pointLocation(new t.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top)))},Yi.prototype._getBounds3D=function(){var e=this,i=this.elevation,r=i.visibleDemTiles.reduce((function(t,e){if(e.dem){var i=e.dem.tree;t.min=Math.min(t.min,i.minimums[0]),t.max=Math.max(t.max,i.maximums[0])}return t}),{min:Number.MAX_VALUE,max:0});r.min*=i.exaggeration(),r.max*=i.exaggeration();var o=this.horizonLineFromTop();return[new t.pointGeometry(0,o),new t.pointGeometry(this.width,o),new t.pointGeometry(this.width,this.height),new t.pointGeometry(0,this.height)].reduce((function(t,i){return t.extend(e.coordinateLocation(e.rayIntersectionCoordinate(e.pointRayIntersection(i,r.min)))).extend(e.coordinateLocation(e.rayIntersectionCoordinate(e.pointRayIntersection(i,r.max))))}),new t.LngLatBounds)},Yi.prototype.horizonLineFromTop=function(t){void 0===t&&(t=!0);var e=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-.97*e;return t?Math.max(0,i):i},Yi.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},Yi.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},Yi.prototype.calculatePosMatrix=function(e,i){var r=e.canonical,o=i/this.zoomScale(r.z),n=r.x+Math.pow(2,r.z)*e.wrap,a=t.identity(new Float64Array(16));return t.translate(a,a,[n*o,r.y*o,0]),t.scale(a,a,[o/t.EXTENT,o/t.EXTENT,1]),a},Yi.prototype.calculateFogTileMatrix=function(e){var i=e.key,r=this._fogTileMatrixCache;if(r[i])return r[i];var o=this.calculatePosMatrix(e,this.cameraWorldSize);return t.multiply(o,this.worldToFogMatrix,o),r[i]=new Float32Array(o),r[i]},Yi.prototype.calculateProjMatrix=function(e,i){void 0===i&&(i=!1);var r=e.key,o=i?this._alignedProjMatrixCache:this._projMatrixCache;if(o[r])return o[r];var n=this.calculatePosMatrix(e,this.worldSize);return t.multiply(n,i?this.alignedProjMatrix:this.projMatrix,n),o[r]=new Float32Array(n),o[r]},Yi.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},Yi.prototype.customLayerMercatorMatrix=function(){return this.customMercatorMatrix.slice()},Yi.prototype.customLayerClipMatrix=function(){return this.cameraToClip.slice()},Yi.prototype.recenterOnTerrain=function(){if(this._elevation){var e=this._elevation;this._updateCameraState();var i=this._camera.position,r=this._camera.forward();if(!(i[2]<=0||r[2]>=0)){var o=t.mercatorZfromAltitude(1,this._center.lat);i[2]/=o,r[2]/=o,t.normalize(r,r);var n=e.raycast(i,r,e.exaggeration());if(n){var a=t.scaleAndAdd([],i,r,n),s=new t.MercatorCoordinate(a[0],a[1],t.mercatorZfromAltitude(a[2],t.latFromMercatorY(a[1]))),l=this._camera.position,u=s.z+t.length([s.x-l[0],s.y-l[1],s.z-l[2]]);this._cameraZoom=this._zoomFromMercatorZ(u),this._centerAltitude=s.toAltitude(),this._center=s.toLngLat(),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}}},Yi.prototype._constrainCameraAltitude=function(){if(this._elevation){var e=this._elevation;this._updateCameraState();var i=e.getAtPointOrZero(this._camera.mercatorPosition),r=this._minimumHeightOverTerrain()*Math.cos(t.degToRad(this._maxPitch)),o=t.mercatorZfromAltitude(i,this._center.lat),n=this._camera.position[2]-o;if(n<r){var a=t.MercatorCoordinate.fromLngLat(this._center,this._centerAltitude),s=this._camera.mercatorPosition,l=[a.x-s.x,a.y-s.y,a.z-s.z],u=t.length(l);l[2]-=r-n;var h=t.length(l);if(0===h)return;t.scale$2(l,l,u/h),this._camera.position=[a.x-l[0],a.y-l[1],a.z-l[2]],this._camera.orientation=Zi(l,this._camera.up()),this._updateStateFromCamera()}}},Yi.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,i,r,o,n=-90,a=90,s=-180,l=180,u=this.size,h=this._unmodified;if(this.latRange){var p=this.latRange;n=t.mercatorYfromLat(p[1])*this.worldSize,e=(a=t.mercatorYfromLat(p[0])*this.worldSize)-n<u.y?u.y/(a-n):0}if(this.lngRange){var c=this.lngRange;s=t.mercatorXfromLng(c[0])*this.worldSize,i=(l=t.mercatorXfromLng(c[1])*this.worldSize)-s<u.x?u.x/(l-s):0}var f=this.point,d=Math.max(i||0,e||0);if(d)return this.center=this.unproject(new t.pointGeometry(i?(l+s)/2:f.x,e?(a+n)/2:f.y)),this.zoom+=this.scaleZoom(d),this._unmodified=h,void(this._constraining=!1);if(this.latRange){var m=f.y,y=u.y/2;m-y<n&&(o=n+y),m+y>a&&(o=a-y)}if(this.lngRange){var g=f.x,_=u.x/2;g-_<s&&(r=s+_),g+_>l&&(r=l-_)}void 0===r&&void 0===o||(this.center=this.unproject(new t.pointGeometry(void 0!==r?r:f.x,void 0!==o?o:f.y))),this._constrainCameraAltitude(),this._unmodified=h,this._constraining=!1}},Yi.prototype._minZoomForBounds=function(){var e=this,i=function(t,i){return Math.log2(t/(e.tileSize*Math.abs(i[1]-i[0])))},r=0;if(this.latRange){var o=this.latRange;r=i(this.height,[t.mercatorYfromLat(o[0]),t.mercatorYfromLat(o[1])])}var n=0;if(this.lngRange){var a=this.lngRange;n=i(this.width,[t.mercatorXfromLng(a[0]),t.mercatorXfromLng(a[1])])}return Math.max(r,n)},Yi.prototype._maxCameraBoundsDistance=function(){return this._mercatorZfromZoom(this._minZoomForBounds())},Yi.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var i=this.pixelsPerMeter;this._updateCameraState();var r=Math.PI/2+this._pitch,o=this.fovAboveCenter,n=this.elevation?this.elevation.getMinElevationBelowMSL()*i:0,a=(this._camera.position[2]*this.worldSize-n)/Math.cos(this._pitch),s=Math.sin(o)*a/Math.sin(t.clamp(Math.PI-r-o,.01,Math.PI-.01)),l=this.point,u=l.x,h=l.y,p=Math.cos(Math.PI/2-this._pitch)*s+a,c=Math.min(1.01*p,a*(1/this._horizonShift)),f=this._camera.getWorldToCamera(this.worldSize,i),d=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,1,c);d[8]=2*-e.x/this.width,d[9]=2*e.y/this.height;var m=t.mul([],d,f);this.mercatorMatrix=t.scale([],m,[this.worldSize,this.worldSize,this.worldSize/i]),this.customMercatorMatrix=t.scale([],f,[this.worldSize,this.worldSize,this.worldSize/i]),this.cameraToClip=d,this.projMatrix=m,this.invProjMatrix=t.invert(new Float64Array(16),this.projMatrix);var y=new Float32Array(16);t.identity(y),t.scale(y,y,[1,-1,1]),t.rotateX(y,y,this._pitch),t.rotateZ(y,y,this.angle);var g=t.perspective(new Float32Array(16),this._fov,this.width/this.height,1,c),_=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;g[8]=2*-e.x/this.width,g[9]=2*(e.y+_)/this.height,this.skyboxMatrix=t.multiply(y,g,y);var v=this.width%2/2,x=this.height%2/2,b=Math.cos(this.angle),w=Math.sin(this.angle),k=u-Math.round(u)+b*v+w*x,T=h-Math.round(h)+b*x+w*v,I=new Float64Array(m);if(t.translate(I,I,[k>.5?k-1:k,T>.5?T-1:T,0]),this.alignedProjMatrix=I,m=t.create(),t.scale(m,m,[this.width/2,-this.height/2,1]),t.translate(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=t.create(),t.scale(m,m,[1,-1,1]),t.translate(m,m,[-1,-1,0]),t.scale(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),!(m=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._projMatrixCache={},this._alignedProjMatrixCache={}}},Yi.prototype._calcFogMatrices=function(){this._fogTileMatrixCache={};var e=this.cameraWorldSize,i=this.cameraPixelsPerMeter,r=this._camera.position,o=1/this.height,n=[e,e,i];t.scale$2(n,n,o),t.scale$2(r,r,-1),t.multiply$1(r,r,n);var a=t.create();t.translate(a,a,r),t.scale(a,a,n),this.mercatorFogMatrix=a,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,i,o)},Yi.prototype._updateCameraState=function(){if(this.height){this._camera.setPitchBearing(this._pitch,this.angle);var e=this._camera.forward(),i=this.cameraToCenterDistance,r=this.point,o=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)-t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),n=this.cameraToCenterDistance/o;this._camera.position=[r.x/this.worldSize-e[0]*i/n,r.y/this.worldSize-e[1]*i/n,t.mercatorZfromAltitude(this._centerAltitude,this._center.lat)+-e[2]*i/n]}},Yi.prototype._translateCameraConstrained=function(e){var i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=e[2],o=1;r>0&&(o=Math.min((i-this._camera.position[2])/r,1)),this._camera.position=t.scaleAndAdd([],this._camera.position,e,o),this._updateStateFromCamera()},Yi.prototype._updateStateFromCamera=function(){var e=this._camera.position,i=this._camera.forward(),r=this._camera.getPitchBearing(),o=r.pitch,n=r.bearing,a=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(t.degToRad(this._maxPitch)),l=Math.max((e[2]-a)/Math.cos(o),s),u=this._zoomFromMercatorZ(l);t.scaleAndAdd(e,e,i,l),this._pitch=t.clamp(o,t.degToRad(this.minPitch),t.degToRad(this.maxPitch)),this.angle=t.wrap(n,-Math.PI,Math.PI),this._setZoom(t.clamp(u,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=new t.MercatorCoordinate(e[0],e[1],e[2]).toLngLat(),this._unmodified=!1,this._constrain(),this._calcMatrices()},Yi.prototype._worldSizeFromZoom=function(t){return Math.pow(2,t)*this.tileSize},Yi.prototype._mercatorZfromZoom=function(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)},Yi.prototype._minimumHeightOverTerrain=function(){var t=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+(this.maxDrapeOverZoom||2),this._maxZoom);return this._mercatorZfromZoom(t)},Yi.prototype._zoomFromMercatorZ=function(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))},Yi.prototype._terrainEnabled=function(){return!!this._elevation},Yi.prototype.isHorizonVisibleForPoints=function(e,i){for(var r=Math.min(e.x,i.x),o=Math.max(e.x,i.x),n=Math.min(e.y,i.y),a=Math.max(e.y,i.y),s=[new t.pointGeometry(r,n),new t.pointGeometry(o,a),new t.pointGeometry(r,a),new t.pointGeometry(o,n)],l=this._renderWorldCopies?-3:0,u=this._renderWorldCopies?4:1,h=0,p=s;h<p.length;h+=1){var c=this.pointRayIntersection(p[h]);if(c.t<0)return!0;var f=this.rayIntersectionCoordinate(c);if(f.x<l||f.y<0||f.x>u||f.y>1)return!0}return!1},Yi.prototype.isHorizonVisible=function(){return this.pitch+t.radToDeg(this.fovAboveCenter)>88||this.isHorizonVisibleForPoints(new t.pointGeometry(0,0),new t.pointGeometry(this.width,this.height))},Yi.prototype.zoomDeltaToMovement=function(e,i){var r=t.length(t.sub([],this._camera.position,e)),o=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(o)},Yi.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))},Object.defineProperties(Yi.prototype,Ki);var Ji=function(e){var i,r,o,n;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(i=this._updateHashUnthrottled.bind(this),r=!1,o=null,n=function(){o=null,r&&(i(),o=setTimeout(n,300),r=!1)},function(){return r=!0,o||n(),o})};Ji.prototype.setMap=function(t){this.addTo(t)},Ji.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Ji.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Ji.prototype.getHashString=function(e){var i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,o=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,o),a=Math.round(i.lng*n)/n,s=Math.round(i.lat*n)/n,l=this._map.getBearing(),u=this._map.getPitch(),h="";if(h+=e?"/"+a+"/"+s+"/"+r:r+"/"+s+"/"+a,(l||u)&&(h+="/"+Math.round(10*l)/10),u&&(h+="/"+Math.round(u)),this._hashName){var p=this._hashName,c=!1,f=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===p?(c=!0,e+"="+h):t})).filter((function(t){return t}));return c||f.push(p+"="+h),"#"+f.join("&")}return"#"+h},Ji.prototype._getCurrentHash=function(){var e,i=this,r=t.window.location.hash.replace("#","");return this._hashName?(r.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===i._hashName&&(e=t)})),(e&&e[1]||"").split("/")):r.split("/")},Ji.prototype._onHashChange=function(){var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},Ji.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());t.window.history.replaceState(t.window.history.state,null,e)};var Qi={linearity:.3,easing:t.bezier(0,0,.3,1)},$i=t.extend({deceleration:2500,maxSpeed:1400},Qi),tr=t.extend({deceleration:20,maxSpeed:1400},Qi),er=t.extend({deceleration:1e3,maxSpeed:360},Qi),ir=t.extend({deceleration:1e3,maxSpeed:90},Qi),rr=function(t){this._map=t,this.clear()};function or(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function nr(e,i,r){var o=r.maxSpeed,n=r.linearity,a=r.deceleration,s=t.clamp(e*n/(i/1e3),-o,o),l=Math.abs(s)/(a*n);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}rr.prototype.clear=function(){this._inertiaBuffer=[]},rr.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})},rr.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,i=t.exported.now();e.length>0&&i-e[0].time>160;)e.shift()},rr.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0},r=0,o=this._inertiaBuffer;r<o.length;r+=1){var n=o[r].settings;i.zoom+=n.zoomDelta||0,i.bearing+=n.bearingDelta||0,i.pitch+=n.pitchDelta||0,n.panDelta&&i.pan._add(n.panDelta),n.around&&(i.around=n.around),n.pinchAround&&(i.pinchAround=n.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){var l=nr(i.pan.mag(),a,t.extend({},$i,e||{}));s.offset=i.pan.mult(l.amount/i.pan.mag()),s.center=this._map.transform.center,or(s,l)}if(i.zoom){var u=nr(i.zoom,a,tr);s.zoom=this._map.transform.zoom+u.amount,or(s,u)}if(i.bearing){var h=nr(i.bearing,a,er);s.bearing=this._map.transform.bearing+t.clamp(h.amount,-179,179),or(s,h)}if(i.pitch){var p=nr(i.pitch,a,ir);s.pitch=this._map.transform.pitch+p.amount,or(s,p)}if(s.zoom||s.bearing){var c=void 0===i.pinchAround?i.around:i.pinchAround;s.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var ar=function(e){function i(i,r,o,n){void 0===n&&(n={});var s=a.mousePos(r.getCanvasContainer(),o),l=r.unproject(s);e.call(this,i,t.extend({point:s,lngLat:l,originalEvent:o},n)),this._defaultPrevented=!1,this.target=r}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,r),i}(t.Event),sr=function(e){function i(i,r,o){var n="touchend"===i?o.changedTouches:o.touches,s=a.touchPos(r.getCanvasContainer(),n),l=s.map((function(t){return r.unproject(t)})),u=s.reduce((function(t,e,i,r){return t.add(e.div(r.length))}),new t.pointGeometry(0,0)),h=r.unproject(u);e.call(this,i,{points:s,point:u,lngLats:l,lngLat:h,originalEvent:o}),this._defaultPrevented=!1}e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i;var r={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,r),i}(t.Event),lr=function(t){function e(e,i,r){t.call(this,e,{originalEvent:r}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,i),e}(t.Event),ur=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};ur.prototype.reset=function(){delete this._mousedownPos},ur.prototype.wheel=function(t){return this._firePreventable(new lr(t.type,this._map,t))},ur.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new ar(t.type,this._map,t))},ur.prototype.mouseup=function(t){this._map.fire(new ar(t.type,this._map,t))},ur.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new ar(t.type,this._map,t))},ur.prototype.dblclick=function(t){return this._firePreventable(new ar(t.type,this._map,t))},ur.prototype.mouseover=function(t){this._map.fire(new ar(t.type,this._map,t))},ur.prototype.mouseout=function(t){this._map.fire(new ar(t.type,this._map,t))},ur.prototype.touchstart=function(t){return this._firePreventable(new sr(t.type,this._map,t))},ur.prototype.touchmove=function(t){this._map.fire(new sr(t.type,this._map,t))},ur.prototype.touchend=function(t){this._map.fire(new sr(t.type,this._map,t))},ur.prototype.touchcancel=function(t){this._map.fire(new sr(t.type,this._map,t))},ur.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},ur.prototype.isEnabled=function(){return!0},ur.prototype.isActive=function(){return!1},ur.prototype.enable=function(){},ur.prototype.disable=function(){};var hr=function(t){this._map=t};hr.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},hr.prototype.mousemove=function(t){this._map.fire(new ar(t.type,this._map,t))},hr.prototype.mousedown=function(){this._delayContextMenu=!0},hr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ar("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},hr.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new ar(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},hr.prototype.isEnabled=function(){return!0},hr.prototype.isActive=function(){return!1},hr.prototype.enable=function(){},hr.prototype.disable=function(){};var pr=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function cr(t,e){for(var i={},r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}pr.prototype.isEnabled=function(){return!!this._enabled},pr.prototype.isActive=function(){return!!this._active},pr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},pr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},pr.prototype.mousedown=function(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(a.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)},pr.prototype.mousemoveWindow=function(t,e){var i=this;if(this._active){var r=e;if(!(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)){var o=this._startPos;this._lastPos=r,this._box||(this._box=a.create("div","lkmap-boxzoom",this._container),this._container.classList.add("lkmap-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(o.x,r.x),s=Math.max(o.x,r.x),l=Math.min(o.y,r.y),u=Math.max(o.y,r.y);this._map._requestDomTask((function(){i._box&&(a.setTransform(i._box,"translate("+n+"px,"+l+"px)"),i._box.style.width=s-n+"px",i._box.style.height=u-l+"px")}))}}},pr.prototype.mouseupWindow=function(e,i){var r=this;if(this._active&&0===e.button){var o=this._startPos,n=i;if(this.reset(),a.suppressClick(),o.x!==n.x||o.y!==n.y){if(this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),this._map._options.hasOwnProperty("boxZoomIsZoom")&&!1===this._map._options.boxZoomIsZoom)return;return{cameraAnimation:function(t){return t.fitScreenCoordinates(o,n,r._map.getBearing(),{linear:!1})}}}this._fireEvent("boxzoomcancel",e)}},pr.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},pr.prototype.reset=function(){this._active=!1,this._container.classList.remove("lkmap-crosshair"),this._box&&(a.remove(this._box),this._box=null),a.enableDrag(),delete this._startPos,delete this._lastPos},pr.prototype._fireEvent=function(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))};var fr=function(t){this.reset(),this.numTouches=t.numTouches};fr.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},fr.prototype.touchstart=function(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){for(var i=new t.pointGeometry(0,0),r=0,o=e;r<o.length;r+=1)i._add(o[r]);return i.div(e.length)}(i),this.touches=cr(r,i)))},fr.prototype.touchmove=function(t,e,i){if(!this.aborted&&this.centroid){var r=cr(i,e);for(var o in this.touches){var n=r[o];(!n||n.dist(this.touches[o])>30)&&(this.aborted=!0)}}},fr.prototype.touchend=function(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}};var dr=function(t){this.singleTap=new fr(t),this.numTaps=t.numTaps,this.reset()};dr.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},dr.prototype.touchstart=function(t,e,i){this.singleTap.touchstart(t,e,i)},dr.prototype.touchmove=function(t,e,i){this.singleTap.touchmove(t,e,i)},dr.prototype.touchend=function(t,e,i){var r=this.singleTap.touchend(t,e,i);if(r){var o=t.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(o&&n||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}};var mr=function(){this._zoomIn=new dr({numTouches:1,numTaps:2}),this._zoomOut=new dr({numTouches:2,numTaps:1}),this.reset()};mr.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},mr.prototype.touchstart=function(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)},mr.prototype.touchmove=function(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)},mr.prototype.touchend=function(t,e,i){var r=this,o=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i);return o?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(o)},{originalEvent:t})}}):n?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(n)},{originalEvent:t})}}):void 0},mr.prototype.touchcancel=function(){this.reset()},mr.prototype.enable=function(){this._enabled=!0},mr.prototype.disable=function(){this._enabled=!1,this.reset()},mr.prototype.isEnabled=function(){return this._enabled},mr.prototype.isActive=function(){return this._active};var yr={0:1,2:2},gr=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};gr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},gr.prototype._correctButton=function(t,e){return!1},gr.prototype._move=function(t,e){return{}},gr.prototype.mousedown=function(t,e){if(!this._lastPoint){var i=a.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}},gr.prototype.mousemoveWindow=function(t,e){var i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){var i=yr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(i,e)},gr.prototype.mouseupWindow=function(t){this._lastPoint&&a.mouseButton(t)===this._eventButton&&(this._moved&&a.suppressClick(),this.reset())},gr.prototype.enable=function(){this._enabled=!0},gr.prototype.disable=function(){this._enabled=!1,this.reset()},gr.prototype.isEnabled=function(){return this._enabled},gr.prototype.isActive=function(){return this._active};var _r=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.mousedown=function(e,i){t.prototype.mousedown.call(this,e,i),this._lastPoint&&(this._active=!0)},e.prototype._correctButton=function(t,e){return 0===e&&!t.ctrlKey},e.prototype._move=function(t,e){return{around:e,panDelta:e.sub(t)}},e}(gr),vr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(gr),xr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(gr),br=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};br.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.pointGeometry(0,0)},br.prototype.touchstart=function(t,e,i){return this._calculateTransform(t,e,i)},br.prototype.touchmove=function(t,e,i){if(this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)},br.prototype.touchend=function(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()},br.prototype.touchcancel=function(){this.reset()},br.prototype._calculateTransform=function(e,i,r){r.length>0&&(this._active=!0);var o=cr(r,i),n=new t.pointGeometry(0,0),a=new t.pointGeometry(0,0),s=0;for(var l in o){var u=o[l],h=this._touches[l];h&&(n._add(u),a._add(u.sub(h)),s++,o[l]=u)}if(this._touches=o,!(s<this._minTouches)&&a.mag()){var p=a.div(s);if(this._sum._add(p),!(this._sum.mag()<this._clickTolerance))return{around:n.div(s),panDelta:p}}},br.prototype.enable=function(){this._enabled=!0},br.prototype.disable=function(){this._enabled=!1,this.reset()},br.prototype.isEnabled=function(){return this._enabled},br.prototype.isActive=function(){return this._active};var wr=function(){this.reset()};function kr(t,e,i){for(var r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Tr(t,e){return Math.log(t/e)/Math.LN2}wr.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},wr.prototype._start=function(t){},wr.prototype._move=function(t,e,i){return{}},wr.prototype.touchstart=function(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))},wr.prototype.touchmove=function(t,e,i){if(this._firstTwoTouches){t.preventDefault();var r=this._firstTwoTouches,o=r[1],n=kr(i,e,r[0]),a=kr(i,e,o);if(n&&a){var s=this._aroundCenter?null:n.add(a).div(2);return this._move([n,a],s,t)}}},wr.prototype.touchend=function(t,e,i){if(this._firstTwoTouches){var r=this._firstTwoTouches,o=r[1],n=kr(i,e,r[0]),s=kr(i,e,o);n&&s||(this._active&&a.suppressClick(),this.reset())}},wr.prototype.touchcancel=function(){this.reset()},wr.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},wr.prototype.disable=function(){this._enabled=!1,this.reset()},wr.prototype.isEnabled=function(){return this._enabled},wr.prototype.isActive=function(){return this._active};var Ir=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._distance,delete this._startDistance},e.prototype._start=function(t){this._startDistance=this._distance=t[0].dist(t[1])},e.prototype._move=function(t,e){var i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Tr(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Tr(this._distance,i),pinchAround:e}},e}(wr);function Sr(t,e){return 180*t.angleWith(e)/Math.PI}var Er=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},e.prototype._start=function(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])},e.prototype._move=function(t,e){var i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Sr(this._vector,i),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,i=Sr(t,this._startVector);return Math.abs(i)<e},e}(wr);function Ar(t){return Math.abs(t.y)>Math.abs(t.x)}var Pr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,Ar(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,i){var r=t[0].sub(this._lastPoints[0]),o=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,o,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+o.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,i){if(void 0!==this._valid)return this._valid;var r=t.mag()>=2,o=e.mag()>=2;if(r||o){if(!r||!o)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var n=t.y>0==e.y>0;return Ar(t)&&Ar(e)&&n}},e}(wr),Mr={panStep:100,bearingStep:15,pitchStep:10},Lr=function(){var t=Mr;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function Cr(t){return t*(2-t)}Lr.prototype.reset=function(){this._active=!1},Lr.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var i=0,r=0,o=0,n=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,o=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Cr,zoom:i?Math.round(l)+i*(t.shiftKey?2:1):l,bearing:s.getBearing()+r*e._bearingStep,pitch:s.getPitch()+o*e._pitchStep,offset:[-n*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},Lr.prototype.enable=function(){this._enabled=!0},Lr.prototype.disable=function(){this._enabled=!1,this.reset()},Lr.prototype.isEnabled=function(){return this._enabled},Lr.prototype.isActive=function(){return this._active},Lr.prototype.disableRotation=function(){this._rotationDisabled=!0},Lr.prototype.enableRotation=function(){this._rotationDisabled=!1};var Dr=4.000244140625,zr=1/450,Or=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=zr,t.bindAll(["_onTimeout"],this)};Or.prototype.setZoomRate=function(t){this._defaultZoomRate=t},Or.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},Or.prototype.isEnabled=function(){return!!this._enabled},Or.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},Or.prototype.isZooming=function(){return!!this._zooming},Or.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},Or.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Or.prototype.wheel=function(e){if(this.isEnabled()){var i=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=t.exported.now(),o=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Dr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}},Or.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},Or.prototype._start=function(t){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var e=a.mousePos(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:e,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},Or.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform,r=function(){var t=i.zoom;return i._terrainEnabled()&&(t=i.computeZoomRelativeTo(e._aroundCoord)),i.enableCollision&&i.collisionZoom<=t&&(t=i.collisionZoom),t};if(0!==this._delta){var o="wheel"===this._type&&Math.abs(this._delta)>Dr?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==n&&(n=1/n);var a=r(),s=Math.pow(2,a),l="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(l*n))),"wheel"===this._type&&(this._startZoom=r(),this._easing=this._smoothOutEasing(200)),this._delta=0}var u,h="number"==typeof this._targetZoom?this._targetZoom:r(),p=this._startZoom,c=this._easing,f=!1;if("wheel"===this._type&&p&&c){var d=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),m=c(d);u=t.number(p,h,m),d<1?this._frameId||(this._frameId=!0):f=!0}else u=h,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:u-r(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}},Or.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var r=this._prevEase,o=(t.exported.now()-r.start)/r.duration,n=r.easing(o+.01)-r.easing(o),a=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-a*a);i=t.bezier(a,s,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i},Or.prototype.reset=function(){this._active=!1};var Rr=function(t,e){this._clickZoom=t,this._tapZoom=e};Rr.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Rr.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Rr.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Rr.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var Br=function(){this.reset()};Br.prototype.reset=function(){this._active=!1},Br.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}},Br.prototype.enable=function(){this._enabled=!0},Br.prototype.disable=function(){this._enabled=!1,this.reset()},Br.prototype.isEnabled=function(){return this._enabled},Br.prototype.isActive=function(){return this._active};var Fr=function(){this._tap=new dr({numTouches:1,numTaps:1}),this.reset()};Fr.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},Fr.prototype.touchstart=function(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))},Fr.prototype.touchmove=function(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var r=e[0],o=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(t,e,i)},Fr.prototype.touchend=function(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)},Fr.prototype.touchcancel=function(){this.reset()},Fr.prototype.enable=function(){this._enabled=!0},Fr.prototype.disable=function(){this._enabled=!1,this.reset()},Fr.prototype.isEnabled=function(){return this._enabled},Fr.prototype.isActive=function(){return this._active};var Ur=function(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i};Ur.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("lkmap-touch-drag-pan")},Ur.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("lkmap-touch-drag-pan")},Ur.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},Ur.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var jr=function(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i};jr.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},jr.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},jr.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},jr.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var Nr=function(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0};Nr.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("lkmap-touch-zoom-rotate")},Nr.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("lkmap-touch-zoom-rotate")},Nr.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},Nr.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},Nr.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Nr.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()},Nr.prototype.disableTouchZoom=function(){this._touchZoom.disable()},Nr.prototype.enableTouchZoom=function(){this._touchZoom.enable()},Nr.prototype.isEnabledTouchZoom=function(){return this._touchZoom.isEnabled()},Nr.prototype.disableTouchRotate=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Nr.prototype.enableTouchRotate=function(){this._rotationDisabled=!1,this._touchRotate.enable()},Nr.prototype.isEnabledTouchRotate=function(){return this._touchRotate.isEnabled()};var Vr=function(t){return t.zoom||t.drag||t.pitch||t.rotate},Gr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event),Zr=function(){this.constants=[1,1,.01],this.radius=0};function qr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}Zr.prototype.setup=function(e,i){var r=t.sub([],i,e);this.radius=t.length(r[2]<0?t.div([],r,this.constants):[r[0],r[1],0])},Zr.prototype.projectRay=function(e){t.div(e,e,this.constants),t.normalize(e,e),t.mul$1(e,e,this.constants);var i=t.scale$2([],e,this.radius);if(i[2]>0){var r=t.scale$2([],[0,0,1],t.dot(i,[0,0,1])),o=t.scale$2([],t.normalize([],[i[0],i[1],0]),this.radius),n=t.add([],i,t.scale$2([],t.sub([],t.add([],o,r),i),2));i[0]=n[0],i[1]=n[1]}return i};var Xr=function(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rr(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Zr,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);var r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,n=this._listeners;o<n.length;o+=1){var s=n[o],l=s[0];a.addEventListener(l,s[1],l===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};Xr.prototype.destroy=function(){for(var e=0,i=this._listeners;e<i.length;e+=1){var r=i[e],o=r[0];a.removeEventListener(o,r[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,r[2])}},Xr.prototype._addDefaultHandlers=function(t){var e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new ur(e,t));var r=e.boxZoom=new pr(e,t);this._add("boxZoom",r);var o=new mr,n=new Br;e.doubleClickZoom=new Rr(n,o),this._add("tapZoom",o),this._add("clickZoom",n);var a=new Fr;this._add("tapDragZoom",a);var s=e.touchPitch=new Pr;this._add("touchPitch",s);var l=new vr(t),u=new xr(t);e.dragRotate=new jr(t,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var h=new _r(t),p=new br(t);e.dragPan=new Ur(i,h,p),this._add("mousePan",h),this._add("touchPan",p,["touchZoom","touchRotate"]);var c=new Er,f=new Ir;e.touchZoomRotate=new Nr(i,f,c,a),this._add("touchRotate",c,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new hr(e));var d=e.scrollZoom=new Or(e,this);this._add("scrollZoom",d,["mousePan"]);var m=e.keyboard=new Lr;this._add("keyboard",m);for(var y=0,g=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];y<g.length;y+=1){var _=g[y];t.interactive&&t[_]&&e[_].enable(t[_])}},Xr.prototype._add=function(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e},Xr.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,i=this._handlers;e<i.length;e+=1)i[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},Xr.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},Xr.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},Xr.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},Xr.prototype.isMoving=function(){return Boolean(Vr(this._eventsInProgress))||this.isZooming()},Xr.prototype._blockedByActive=function(t,e,i){for(var r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1},Xr.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},Xr.prototype._getMapTouches=function(t){for(var e=[],i=0,r=t;i<r.length;i+=1){var o=r[i];this._el.contains(o.target)&&e.push(o)}return e},Xr.prototype.handleEvent=function(t,e){if("blur"!==t.type){this._updatingCamera=!0;for(var i="renderFrame"===t.type,r=i?void 0:t,o={needsRenderFrame:!1},n={},s={},l=t.touches?this._getMapTouches(t.touches):void 0,u=l?a.touchPos(this._el,l):i?void 0:a.mousePos(this._el,t),h=0,p=this._handlers;h<p.length;h+=1){var c=p[h],f=c.handlerName,d=c.handler,m=c.allowed;if(d.isEnabled()){var y=void 0;this._blockedByActive(s,m,f)?d.reset():d[e||t.type]&&(y=d[e||t.type](t,u,l),this.mergeHandlerResult(o,n,y,f,r),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||d.isActive())&&(s[f]=d)}}var g={};for(var _ in this._previousActiveHandlers)s[_]||(g[_]=r);this._previousActiveHandlers=s,(Object.keys(g).length||qr(o))&&(this._changes.push([o,n,g]),this._triggerRenderFrame()),(Object.keys(s).length||qr(o))&&this._map._stop(!0),this._updatingCamera=!1;var v=o.cameraAnimation;v&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],v(this._map))}else this.stop(!0)},Xr.prototype.mergeHandlerResult=function(e,i,r,o,n){if(r){t.extend(e,r);var a={handlerName:o,originalEvent:r.originalEvent||n};void 0!==r.zoomDelta&&(i.zoom=a),void 0!==r.panDelta&&(i.drag=a),void 0!==r.pitchDelta&&(i.pitch=a),void 0!==r.bearingDelta&&(i.rotate=a)}},Xr.prototype._applyChanges=function(){for(var e={},i={},r={},o=0,n=this._changes;o<n.length;o+=1){var a=n[o],s=a[0],l=a[1],u=a[2];s.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(e.around=s.around),void 0!==s.aroundCoord&&(e.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(e.pinchAround=s.pinchAround),s.noInertia&&(e.noInertia=s.noInertia),t.extend(i,l),t.extend(r,u)}this._updateMapTransform(e,i,r),this._changes=[]},Xr.prototype._updateMapTransform=function(e,i,r){var o,n=this,a=this._map,s=a.transform,l=function(t){return[t.x,t.y,t.z]};if((o=n._eventsInProgress.drag)&&!n._handlersById[o.handlerName].isActive()&&!qr(e)){var u=s.zoom;s.cameraElevationReference="sea",s.recenterOnTerrain(),s.cameraElevationReference="ground",u!==s.zoom&&this._map._update(!0)}if(!qr(e))return this._fireEvents(i,r,!0);var h=e.panDelta,p=e.zoomDelta,c=e.bearingDelta,f=e.pitchDelta,d=e.around,m=e.aroundCoord,y=e.pinchAround;void 0!==y&&(d=y),function(t){return i[t]&&!n._eventsInProgress[t]}("drag")&&d&&(this._dragOrigin=l(s.pointCoordinate3D(d)),this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",a._stop(!0),d=d||a.transform.centerPoint,c&&(s.bearing+=c),f&&(s.pitch+=f),s._updateCameraState();var g=[0,0,0];if(h){var _=s.screenPointToMercatorRay(d),v=s.screenPointToMercatorRay(d.sub(h)),x=this._trackingEllipsoid.projectRay(_.dir),b=this._trackingEllipsoid.projectRay(v.dir);g[0]=b[0]-x[0],g[1]=b[1]-x[1]}var w=s.zoom,k=[0,0,0];if(p){var T=l(m||s.pointCoordinate3D(d)),I={dir:t.normalize([],t.sub([],T,s._camera.position))},S=s.screenPointToMercatorRay(s.centerPoint);if(I.dir[2]<0){var E=t.altitudeFromMercatorZ(T[2],T[1]),A=s.rayIntersectionCoordinate(s.pointRayIntersection(s.centerPoint,E)),P=s.zoomDeltaToMovement(l(A),p)*(S.dir[2]/I.dir[2]);t.scale$2(k,I.dir,P)}else if(s._terrainEnabled()){var M=s.zoomDeltaToMovement(T,p);t.scale$2(k,I.dir,M)}}var L=t.add(g,g,k);s._translateCameraConstrained(L),p&&Math.abs(s.zoom-w)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,r,!0)},Xr.prototype._fireEvents=function(e,i,r){var o=this,n=Vr(this._eventsInProgress),a=Vr(e),s={};for(var l in e)this._eventsInProgress[l]||(s[l+"start"]=e[l].originalEvent),this._eventsInProgress[l]=e[l];for(var u in!n&&a&&this._fireEvent("movestart",a.originalEvent),s)this._fireEvent(u,s[u]);for(var h in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(h,e[h].originalEvent);var p,c={};for(var f in this._eventsInProgress){var d=this._eventsInProgress[f],m=d.handlerName,y=d.originalEvent;this._handlersById[m].isActive()||(delete this._eventsInProgress[f],c[f+"end"]=p=i[m]||y)}for(var g in c)this._fireEvent(g,c[g]);var _=Vr(this._eventsInProgress);if(r&&(n||a)&&!_){this._updatingCamera=!0;var v=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-o._bearingSnap<t&&t<o._bearingSnap};v?(x(v.bearing||this._map.getBearing())&&(v.bearing=0),this._map.easeTo(v,{originalEvent:p})):(this._map.fire(new t.Event("moveend",{originalEvent:p})),x(this._map.getBearing())&&(!this._map.painter._flyPath||this._map.painter._flyPath&&!this._map.painter._flyPath.naviRunning)&&this._map.resetNorth()),this._updatingCamera=!1}},Xr.prototype._fireEvent=function(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))},Xr.prototype._requestFrame=function(){var t=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(e){delete t._frameId,t.handleEvent(new Gr("renderFrame",{timeStamp:e})),t._applyChanges()}))},Xr.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var Wr=function(e){function i(i,r){e.call(this),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},i.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},i.prototype.panBy=function(e,i,r){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),r)},i.prototype.panTo=function(e,i,r){return this.easeTo(t.extend({center:e},i),r)},i.prototype.getZoom=function(){return this.transform.zoom},i.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},i.prototype.zoomTo=function(e,i,r){return this.easeTo(t.extend({zoom:e},i),r)},i.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},i.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},i.prototype.getBearing=function(){return this.transform.bearing},i.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},i.prototype.getPadding=function(){return this.transform.padding},i.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},i.prototype.rotateTo=function(e,i,r){return this.easeTo(t.extend({bearing:e},i),r)},i.prototype.resetNorth=function(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this},i.prototype.resetNorthPitch=function(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this},i.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},i.prototype.getPitch=function(){return this.transform.pitch},i.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},i.prototype.cameraForBounds=function(e,i){e=t.LngLatBounds.convert(e);var r=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,i)},i.prototype._extendCameraOptions=function(e){var i={top:0,bottom:0,right:0,left:0};if("number"==typeof(e=t.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},e)).padding){var r=e.padding;e.padding={top:r,bottom:r,right:r,left:r}}return e.padding=t.extend(i,e.padding),e},i.prototype._cameraForBoxAndBearing=function(e,i,r,o){var n=this._extendCameraOptions(o),a=this.transform,s=a.padding,l=a.project(t.LngLat.convert(e)),u=a.project(t.LngLat.convert(i)),h=l.rotate(-t.degToRad(r)),p=u.rotate(-t.degToRad(r)),c=new t.pointGeometry(Math.max(h.x,p.x),Math.max(h.y,p.y)),f=new t.pointGeometry(Math.min(h.x,p.x),Math.min(h.y,p.y)),d=c.sub(f),m=(a.width-(s.left+s.right+n.padding.left+n.padding.right))/d.x,y=(a.height-(s.top+s.bottom+n.padding.top+n.padding.bottom))/d.y;if(!(y<0||m<0)){var g=Math.min(a.scaleZoom(a.scale*Math.min(m,y)),n.maxZoom),_="number"==typeof n.offset.x?new t.pointGeometry(n.offset.x,n.offset.y):t.pointGeometry.convert(n.offset),v=new t.pointGeometry((n.padding.left-n.padding.right)/2,(n.padding.top-n.padding.bottom)/2).rotate(r*Math.PI/180),x=_.add(v).mult(a.scale/a.zoomScale(g));return{center:a.unproject(l.add(u).div(2).sub(x)),zoom:g,bearing:r}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},i.prototype._cameraForBox=function(e,i,r,o,n){var a=this._extendCameraOptions(n);r=r||0,o=o||0,e=t.LngLat.convert(e),i=t.LngLat.convert(i);var s=this.transform.clone();s.padding=a.padding;var l=this.getFreeCameraOptions(),u=new t.LngLat(.5*(e.lng+i.lng),.5*(e.lat+i.lat)),h=.5*(r+o);if(!(s._camera.position[2]<t.mercatorZfromAltitude(h,u.lat))){l.lookAtPoint(u),s.setFreeCameraOptions(l);var p,c,f=t.MercatorCoordinate.fromLngLat(e),d=t.MercatorCoordinate.fromLngLat(i),m=s.pointRayIntersection(s.centerPoint,h),y=[(p=s.rayIntersectionCoordinate(m)).x,p.y,p.z],g=s.screenPointToMercatorRay(s.centerPoint),_=0;do{var v=Math.floor(s.zoom),x=1<<v,b=Math.min(x*f.x,x*d.x),w=Math.min(x*f.y,x*d.y),k=Math.max(x*f.x,x*d.x),T=Math.max(x*f.y,x*d.y),I=new t.Aabb([b,w,r],[k,T,o]),S=t.Frustum.fromInvProjectionMatrix(s.invProjMatrix,s.worldSize,v);if(2!==I.intersects(S)){c&&(s._camera.position=t.scaleAndAdd([],s._camera.position,g.dir,-c),s._updateStateFromCamera());break}var E=t.sub([],s._camera.position,y);c=.5*t.length(E),s._camera.position=t.scaleAndAdd([],s._camera.position,g.dir,c);try{s._updateStateFromCamera()}catch(e){return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}}while(++_<10);return{center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},i.prototype.fitBounds=function(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)},i.prototype._raycastElevationBox=function(e,i){var r=this.transform.elevation;if(r){var o=new t.pointGeometry(e.x,i.y),n=new t.pointGeometry(i.x,e.y),a=r.pointCoordinate(e);if(a){var s=r.pointCoordinate(i);if(s){var l=r.pointCoordinate(o);if(l){var u=r.pointCoordinate(n);if(u){var h=new t.MercatorCoordinate(a[0],a[1]).toLngLat(),p=new t.MercatorCoordinate(s[0],s[1]).toLngLat(),c=new t.MercatorCoordinate(l[0],l[1]).toLngLat(),f=new t.MercatorCoordinate(u[0],u[1]).toLngLat(),d=Math.min(h.lng,Math.min(p.lng,Math.min(c.lng,f.lng))),m=Math.min(h.lat,Math.min(p.lat,Math.min(c.lat,f.lat))),y=Math.max(h.lng,Math.max(p.lng,Math.max(c.lng,f.lng))),g=Math.max(h.lat,Math.max(p.lat,Math.max(c.lat,f.lat))),_=Math.min(a[3],Math.min(s[3],Math.min(l[3],u[3]))),v=Math.max(a[3],Math.max(s[3],Math.max(l[3],u[3])));return{minLngLat:new t.LngLat(d,m),maxLngLat:new t.LngLat(y,g),minAltitude:_,maxAltitude:v}}}}}}},i.prototype.fitScreenCoordinates=function(e,i,r,o,n){var a,s,l,u,h=t.pointGeometry.convert(e),p=t.pointGeometry.convert(i),c=this._raycastElevationBox(h,p);if(c)a=c.minLngLat,s=c.maxLngLat,l=c.minAltitude,u=c.maxAltitude;else{if(this.transform.isHorizonVisibleForPoints(h,p))return this;a=this.transform.pointLocation(h),s=this.transform.pointLocation(p)}return this._fitInternal(0===this.transform.pitch?this._cameraForBoxAndBearing(this.transform.pointLocation(t.pointGeometry.convert(e)),this.transform.pointLocation(t.pointGeometry.convert(i)),r,o):this._cameraForBox(a,s,l,u,o),o,n)},i.prototype._fitInternal=function(e,i,r){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this},i.prototype.jumpTo=function(e,i){this.stop();var r=this.transform,o=!1,n=!1,a=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(o=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(n=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),o&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),n&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))},i.prototype.getFreeCameraOptions=function(){return this.transform.getFreeCameraOptions()},i.prototype.setFreeCameraOptions=function(e,i){this.stop();var r=this.transform,o=r.zoom,n=r.pitch,a=r.bearing;r.setFreeCameraOptions(e);var s=o!==r.zoom,l=n!==r.pitch,u=a!==r.bearing;return this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),s&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),u&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),l&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i)),this},i.prototype.easeTo=function(e,i){var r=this;this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);var o=this.transform,n=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="zoom"in e?+e.zoom:n,h="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,c="padding"in e?e.padding:o.padding,f=t.pointGeometry.convert(e.offset),d=o.centerPoint.add(f),m=o.pointLocation(d),y=t.LngLat.convert(e.center||m);this._normalizeCenter(y);var g,_,v=o.project(m),x=o.project(y).sub(v),b=o.zoomScale(u-n);e.around&&(g=t.LngLat.convert(e.around),_=o.locationPoint(g));var w={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||u!==n,this._rotating=this._rotating||a!==h,this._pitching=this._pitching||p!==s,this._padding=!o.isPaddingEqual(c),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,w),this._ease((function(e){if(r._zooming&&(o.zoom=t.number(n,u,e)),r._rotating&&(o.bearing=t.number(a,h,e)),r._pitching&&(o.pitch=t.number(s,p,e)),r._padding&&(o.interpolatePadding(l,c,e),d=o.centerPoint.add(f)),g)o.setLocationAtPoint(g,_);else{var m=o.zoomScale(o.zoom-n),y=u>n?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),k=o.unproject(v.add(x.mult(e*w)).mult(m));o.setLocationAtPoint(o.renderWorldCopies?k.wrap():k,d)}r._fireMoveEvents(i)}),(function(t){o.recenterOnTerrain(),r._afterEase(i,t)}),e),this},i.prototype._prepareEase=function(e,i,r){void 0===r&&(r={}),this._moving=!0,this.transform.cameraElevationReference="sea",i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))},i.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},i.prototype._afterEase=function(e,i){if(!this._easeId||!i||this._easeId!==i){delete this._easeId,this.transform.cameraElevationReference="ground";var r=this._zooming,o=this._rotating,n=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),o&&this.fire(new t.Event("rotateend",e)),n&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},i.prototype.flyTo=function(e,i){var r=this;if(!e.essential&&t.exported.prefersReducedMotion){var o=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var n=this.transform,a=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),h="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):a,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,c="pitch"in e?+e.pitch:l,f="padding"in e?e.padding:n.padding,d=n.zoomScale(h-a),m=t.pointGeometry.convert(e.offset),y=n.centerPoint.add(m),g=n.pointLocation(y),_=t.LngLat.convert(e.center||g);this._normalizeCenter(_);var v=n.project(g),x=n.project(_).sub(v),b=e.curve,w=Math.max(n.width,n.height),k=w/d,T=x.mag();if("minZoom"in e){var I=t.clamp(Math.min(e.minZoom,a,h),n.minZoom,n.maxZoom),S=w/n.zoomScale(I-a);b=Math.sqrt(S/T*2)}var E=b*b;function A(t){var e=(k*k-w*w+(t?-1:1)*E*E*T*T)/(2*(t?k:w)*E*T);return Math.log(Math.sqrt(e*e+1)-e)}function P(t){return(Math.exp(t)-Math.exp(-t))/2}function M(t){return(Math.exp(t)+Math.exp(-t))/2}var L=A(0),C=function(t){return M(L)/M(L+b*t)},D=function(t){return w*((M(L)*(P(e=L+b*t)/M(e))-P(L))/E)/T;var e},z=(A(1)-L)/b;if(Math.abs(T)<1e-6||!isFinite(z)){if(Math.abs(w-k)<1e-6)return this.easeTo(e,i);var O=k<w?-1:1;z=Math.abs(Math.log(k/w))/b,D=function(){return 0},C=function(t){return Math.exp(O*b*t)}}return e.duration="duration"in e?+e.duration:1e3*z/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==p,this._pitching=c!==l,this._padding=!n.isPaddingEqual(f),this._prepareEase(i,!1),this._ease((function(e){var o=e*z,d=1/C(o);n.zoom=1===e?h:a+n.scaleZoom(d),r._rotating&&(n.bearing=t.number(s,p,e)),r._pitching&&(n.pitch=t.number(l,c,e)),r._padding&&(n.interpolatePadding(u,f,e),y=n.centerPoint.add(m));var g=1===e?_:n.unproject(v.add(x.mult(D(o))).mult(d));n.setLocationAtPoint(n.renderWorldCopies?g.wrap():g,y),n._updateCenterElevation(),r._fireMoveEvents(i)}),(function(){return r._afterEase(i)}),e),this},i.prototype.isEasing=function(){return!!this._easeFrameId},i.prototype.stop=function(){return this._stop()},i.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,e)}if(!t){var r=this.handlers;r&&r.stop(!1)}return this},i.prototype._ease=function(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},i.prototype._renderFrameCallback=function(){var e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},i.prototype._normalizeBearing=function(e,i){e=t.wrap(e,-180,180);var r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e},i.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}},i}(t.Evented),Hr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Hr.prototype.onAdd=function(t){this._map=t,this._container=a.create("div","lkmap-ctrl");var e=a.create("a","lkmap-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://lbs.luokuang.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Hr.prototype.onRemove=function(){a.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Hr.prototype.getDefaultPosition=function(){return"bottom-left"},Hr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Hr.prototype._logoRequired=function(){if(!this._map.style)return!0;var t=this._map.style._sourceCaches;if(0===Object.entries(t).length)return!0;for(var e in t){var i=t[e].getSource();if(i.hasOwnProperty("lkmap_logo")&&!i.lkmap_logo)return!1}return!0},Hr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("lkmap-compact"):e.classList.remove("lkmap-compact")}};var Yr=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};function Kr(e,i,r){if(e=new t.LngLat(e.lng,e.lat),i){var o=new t.LngLat(e.lng-360,e.lat),n=new t.LngLat(e.lng+360,e.lat),a=360*Math.ceil(Math.abs(e.lng-r.center.lng)/360),s=r.locationPoint(e).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint(o).distSqr(i)<s&&(l||Math.abs(o.lng-r.center.lng)<a)?e=o:r.locationPoint(n).distSqr(i)<s&&(l||Math.abs(n.lng-r.center.lng)<a)&&(e=n)}for(;Math.abs(e.lng-r.center.lng)>180;){var u=r.locationPoint(e);if(u.x>=0&&u.y>=0&&u.x<=r.width&&u.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}Yr.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},Yr.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,r=e?this._queue.concat(e):this._queue;i<r.length;i+=1){var o=r[i];if(o.id===t)return void(o.cancelled=!0)}},Yr.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var i=0,r=e;i<r.length;i+=1){var o=r[i];if(!o.cancelled&&(o.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},Yr.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var Jr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-center":"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-center":"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)","middle-left":"translate(0,-50%)","middle-right":"translate(-100%,-50%)"};function Qr(t,e,i){var r=t.classList;for(var o in Jr)r.remove("lkmap-"+i+"-anchor-"+o);r.add("lkmap-"+i+"-anchor-"+e)}var $r={center:"translate(-50%,-50%)",top:"translate(-50%,-100%)","top-center":"translate(-50%,-100%)","top-left":"translate(-100%, -100%)","top-right":"translate(0,-100%)",bottom:"translate(-50%,0)","bottom-center":"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",left:"translate(-100%,-50%)",right:"translate(0,-50%)","middle-left":"translate(-100%,-50%)","middle-right":"translate(0,-50%)"},to={closeButton:!0,closeOnClick:!1,focusAfterOpen:!0,className:"",height:0,heightBuffer:0,heightAnchorElevation:!0,rotation:0,iconRotation:0,maxWidth:"1000px",isCustom:!1,anchor:"bottom",iconAnchor:"center",autoMove:!0,showShadow:!1,offset:[0,0],extData:null,visible:!0,bubble:!0,pitchAlignment:"auto",rotationAlignment:"auto",followFogOpacity:!0,zIndex:150},eo=function(e){function r(r,o){var n=this;if(e.call(this),(r instanceof t.window.HTMLElement||o)&&(r=t.extend({element:r},o)),r.offset&&(r.offset.x||0==r.offset.x)&&(r.offset=[r.offset.x,r.offset.y]),r=t.extend(Object.create(to),r),this.type="marker",this._animationType=null,this.id="custom_marker_"+t.getRandomId(),r.extData&&(this.extData=r.extData),r.content?"string"==typeof r.content?(r.element=document.createElement("div"),r.element.innerHTML=r.content):r.element=r.content:r.icon&&("string"==typeof r.icon?(this._icon=null,i?(this._icon=new i.Icon({image:r.icon}),r.element=this._icon.getElement()):(this._icon=this.createIcon(this.options.icon),r.element=this._icon)):r.icon&&r.icon.options&&(this._icon=new i.Icon(r.icon.options),r.element=this._icon.getElement())),this.options=r,t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer","on","off","_setTransformOrigin","_eventCallbackFun","_addMarkerEvent","setMap","setIcon","setAnimation","getAnimation","show","hide","setCursor","getMap","setExtData","getExtData","setzIndex","getzIndex","getId","_setLabelFun","setBubble","getBubble","getHeightBuffer","setHeightBuffer","setHeightAnchorElevation","_evaluateOpacity"],this),this._eventAll=[],this._eventArr=["click","dblclick","contextmenu","mousemove","mouseover","mouseout","mousedown","mouseup","touchstart","touchmove","touchend"],this._otherEvent={},this._bubbleEvent={click:null,dblclick:null,contextmenu:null,mousemove:null,mouseover:null,mouseout:null,mousedown:null,mouseup:null,mouseup:null,mouseup:null,mouseup:null},this._bubble=this.options.bubble,this._anchor=r&&r.anchor||"center",this._iconAnchor=r&&r.iconAnchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._height=r&&r.height||0,this._heightBuffer=r&&r.heightBuffer||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&(r.rotation||r.angle)||0,this._iconRotation=r&&r.iconRotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,this._visible=r&&r.visible,this._cursor=r&&r.cursor,this._title=r&&r.title,this._zIndex=parseInt(r.zIndex)||150,this._timeout=null,this._interval=null,this._heightAnchorElevation=this.options.heightAnchorElevation,this._element=a.create("div"),r&&r.element){if(this.options.content)"string"==typeof this.options.content?(this._element=a.create("div"),this._element.innerHTML=this.options.content):this._element.appendChild(this.options.contentn);else if(this._element.appendChild(r.element),this._icon&&0!=this._iconRotation){var s="rotateZ("+this._iconRotation+"deg)",l=this._element.children;for(var u in 1==this._element.children.length&&this._icon&&(l=this._element.children[0].children),l)"img"!=l[u].localName&&"marker-img-box"!=l[u].className||(a.setTransform(l[u],""+s),this._setTransformOrigin(l[u],this._iconAnchor))}this._offset=t.pointGeometry.convert(r&&r.offset||[0,0])}else{this._defaultMarker=!0;var h=this.createIcon("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAABACAYAAABVy1Q8AAAKSklEQVRogd2ae3BU1R3HP+fcfWQ3u3koBEEwLSBREEOSjlqgYsv4aKutjxZ1rLV/2LG+BhGr1jp1tD6qVOu0Yx2LKDOOqK3WlhktneKzirxBkhBQEorkIRAg2c2+772nf9zdZLPZJHtvFuj0O3Pn7p695/G5v8c959yF/zMJh7+ny4VAaACSigUaM56vBtc3EcxBMQNBNUqWIwgACkUEzB5gH4LPUWwH/T0+u3EfPR8YgIkyFKhMPypP3yOVjzbgEUCkR1B2jptZr51B0rwBTVwJTEEN29cwLQqALzDVXylhJY3X7KZ3k46ZVAw0VjBYvoGPUCYE0guB2R5mvlEHnodAXzj8/bIpAQjXO5D8Fc1XbaOvMYmZYBSwQWW5gx/uuwABpbPc1Kycjve0+zFTV49g+bFJCJDuV0l88Qi7frKHSHOKwabP7bj/u8g5D2q2/+xyKXwNE5jz/q0ke+4DY7TYK46EpnBXPMKnF/yR0MYDoAQDg89rreGABsoDlYqzr5iGeuZJzMOXHYtxjyrvhNVsm7uU2O429NBIUEqQH8YqKz1do/a5Boy656Fv5uhJ8VhJgSxvRm6+ke03bSXyuTHww9AYEkO/Cwtm9jsXojyvQCp4nEY+soQnhIxdy/aL1hL93AATcqBk9uX9h79SUPtsA8q76n8GBkAly1Alq5i6sh4tkCkdZBQ5pFACZ14yFbNhOSTLjuNwC5OZKqd89nL8M6YyOKkJsIaf7XISf30V3heeQIVnHeehFi796FnUrnucQP14crwsy0JC4JvuYc6HN2Mc/v6JSwCFSEDq0BWc/cHP8E1zp6cbIv0LGiAQmmTW6hoC9dtRhhyxPTvKTazFvE/CZRBbN4cdP/wMZZiASrucEPhqvJSfe29RYEwgpawDcLutA7LKzTH3AkrXKF1wL/4Z3oyVBOAGIanb0IB38seoMfRkAobCF5BMPEkyvlIycZxk4jgNgK5ug85uk0NHTboOm8QjJmhicBTYlZCQ2jeXrXO3opTpAiEoPaMEb/UDqJTzhnWF2yuYVePm23NLuPYiP7OnufNeumNPilX/jLLmkzg723RSSQUuh76oTHBPfQB/zSIiu+MC4Sqhbu1MPKdvsT31BytGDMXJFZIfX+rnFzeUMb6ysFt+8KjJoy+GeOmtKEd609ZywiUE6Lvq2XJxi0TpEve0HzmCATBgQpXGY7eV89QdFQXDAFRVSp6+s4JHby+narwGurMhoBRoNdehdCnx12gI7QpHDaUUFZWSx28r56eXlzocDdx0eSm/ubWM8krRn0jsS16J/3RNY8aK6XhP/aXttY0BXo/g9kWlLL1u7LOjuhkejoYMNrekMHTsJwohKimteUnin73AUWbTFXUzPSy+JjD6tQVq8dVBas/0gO4klk3w1y2QCDHHdmUTfGWSy+aXcMrJmv3Oh9Gk8RqXzvPiK5POnlNCzJEgp9uumFJ8daLGooU+B72OrEULfXxloubMSmjTJUKrdtLxpPEa06e4nFQdUTXVbiaN0xxuV4hqCaLCVh0Fwg2nTSieq+Xq1PEauHAAJSskQvht1VHg9kpbzxu7qjpJ4PY6aF+IUomDmZQApDx2ywtNpicM9t1OSlARu7WSSZPuHmP0Cx2q+6gilTKdTIMiEmWGbFWRoJLQfrAY8//8au82UUkHFZUZlmB0OOr0gEHXoeJbqfOgTsfBdLu2LWS0S5S+x3avLth3QOf192K2q46m19+L88UB3cpydqWMVglms+2KmiB0xOTND+L09hXP9Xr6TN78ME7oaHopYVem3iQJrf8o/UrDnjTY1Jhkxeqo/brDaMXqKJsbk85WsEJAeP2/JfuX7UGJQ7YbcAn6wiZPvtLH2o0JByMYrLUbEzz1Sh99YdPZ6lWJQ7Qva5VEmgzQ33Y0Co+gs0PnlmU9rFkfd9QEwJr1cW5Z1kNnhw4ep0tx/S0iTYaG0LxUnHcEb/X1tp9kApCCI4cMPm5M4vHAWdPcuAu8w7GEYvnfI9z3TIi2vWkYR0twCeEN99D9RrsAUU6w1s9Z//oHZqLWQXPWfUgofGWC784v4TtzS7j4vBJrkplHXd0Ga9bHeXtdnLc+ihMLKfA6hAGQni00XnIpfdtiAigHNGb+bSFl5/4ZNYZnSwpImVRUadTNcDNtsouJ4zTGVVhR3t1j0tVt0Nqus+2zFD0HDXBLyL85VJiEBuFPrqL5yvdJv4krAyEprfVR++6rGNHzx9C8JV1BAstyPvD5LaBY1IQYliW8ON+6ypbm+5BPv3U1kR1xUKaGdX8EqS8V7qq9BOuvG5OVAKSw4sFjbTnrKdBTWKnVmy4vxuRWeuDAqps5uHI/1hrXlJkPIAw6fr8V4Xp5bFuZuZ1i7Z5rFLVZ0EDwMh1PbwNh/ccBTA1rkmHdSqNXEd3dQtX1X8OMTipm90WXVrmJ3TfcR3j9EfqNkgsEENvVg2zfTeUPLsSMFW9Lp5hyn/Ql+29ezJevNTPwSrIfKJNbB15JRpo68FZ14D/ne6jEGPJpsaVAlikOr1zM/mXvYva/Y81YSGWAst9TCkxTEmvZS8W5R3GfttBanJxoKAUyAPFt99N2z19IHDHIgSENlP1acuCc6jGJNLYQbAjjnbIAleDEQSnQghBreojWJSuJtMQZgMk+q9zckw0mSXbpRBqbCNaH8E6+4MRYSoEWgGjzg7QueYHwlsz03sxzqIy7ZSAU2bEEgmRnisinTQQbQninXHB8LZW2TLT5QVoXr0jDZLuZCWRcr99CQ91t4GwBJrtSRBp3EqzvPX5QGZimB2ld8iLhzX3pH7JjJ28M5f6TROV8T7tfZ5LIjp0E68N4Jy84tu7X72a/pvWOF9IwmbFlrJJ5mKqsY0jKzgbJ/qzSUKmBmDpWiaLfzR6yYmZzZpstY5m8IJnKuRYaTgPAlvs1EWyI4J18fnGh+mEepnXJ84Q3Z2Im2zKDkkAuWKFA2RIku3SijY0E6yJ4Jp9fHPdLu1ms+WHa7lxuwajsGMl2s7ww+YBGGpUiO2EkOlNEmhoJNkTxnjpGqEzM7HyE1juXE94USY8xM3id4S0zSPksNBpU5hor+0WbGgnUjQFKgVZqwbQt/ZMVM/0wuVbJBzMIKjspFAKVY00lSHSliDbtINAQwzPpG7b/6yBLIdbyKG1LnyO0KZp+dZcdL0NS83AwpJPCcBD5oPJco9KWat5OsC6JZ9L8gqGkH2I7H6PtrmcJb4rlgSnYMmQlhVEGPKRSfqhEp060ZRvB+iSeU+ajRvnTgfRBrOUx2u56htDG+Agwg2YCI8HkAxojVIdOdOdWgg06nlPmDQtlwfym2DDDAY0VyiDasplAnYFn4lAo6YPozsfZe/cfCG1MFhNmJKBCoIapk4aK79pIoF7hqZrXv+kiSyDWsoz//Px3hDYkc7KZo5ixAzRGqHaT6O4NBBpMPBPmIVwQ2/UEe+99it71+igw2UAFwxQClA+i0AeNILHfING6kfKvC4zedey9+7f0fpTKeWgWDQbgv1Ewns2zn2wTAAAAAElFTkSuQmCC");this._element.appendChild(h),this._offset=t.pointGeometry.convert(r&&r.offset||[0,0])}this._element.classList.add("lkmap-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),this._element.addEventListener("focus",(function(){var t=n._map.getContainer();t.scrollTop=0,t.scrollLeft=0})),Qr(this._element,this._anchor,"marker"),0!=this._iconRotation&&this._updateIconRotationAnchor(),this._popup=null,this.init()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.updateIcon=function(e){this._element.innerHTML="",this._element.appendChild(e),this._offset=t.pointGeometry.convert(this.options&&this.options.offset||[0,0]),this._element.classList.add("lkmap-marker"),this._popup=null,this.setIconAnchor(this._iconAnchor),this.setIconRotation(this._iconRotation),this.addTo(this._map)},r.prototype.getHeightBuffer=function(){return this._heightBuffer},r.prototype.setHeightBuffer=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._heightBuffer=t)},r.prototype.setContent=function(e){this._element.innerHTML="",this.options.content=e,"string"==typeof e?(this._element=a.create("div"),this._element.innerHTML=e):this._element.appendChild(e),this._offset=t.pointGeometry.convert(this.options&&this.options.offset||[0,0]),this._element.classList.add("lkmap-marker"),this._popup=null,this.addTo(this._map),this.options.label&&this.options.label.content&&this.setLabel(this.options.label)},r.prototype.getContent=function(){return this.options.content},r.prototype.addTo=function(t){return this.remove(),this._map=t,this._map.on("move",this._update),this._map.on("moveend",this._update),this._map.on("updateTerrain",this._update),this._map.on("remove",this._clearFadeTimer),this.setDraggable(this._draggable),this._update(),this._map.getMarkersContainer().appendChild(this._element),this._map._markers.push(this),this._map.on("click",this._onMapClick),this._popup&&this._popup.open(this._map),this},r.prototype.setAnchor=function(t){void 0===t&&(t=""),""!=t&&(this.options.anchor=this._anchor=t&&t||"center",this._update())},r.prototype.setIconAnchor=function(t){void 0===t&&(t=""),""!=t&&(this.options.iconAnchor=this._iconAnchor=t&&t||"center",this._updateIconRotationAnchor())},r.prototype._updateIconRotationAnchor=function(){var t=this._element.children;this._element.children.length>0&&0==this._element.children[0].className.indexOf("lkmap-marker-icon")&&(t=this._element.children[0]),this._element.children.length>0&&0==this._element.children[0].className.indexOf("lkmapMarker")&&(t=this._element.children[0].children[0]);var e="rotateZ("+this._iconRotation+"deg)";this._setTransformOrigin(t,this._iconAnchor),a.setTransform(t,""+e)},r.prototype.setLabel=function(e){if(void 0===e&&(e={}),!(!1 in e)){if(this.options.label=e=t.extend({direction:"top"},e),this._labelOptions){var i=Object.keys(e);for(var r in i)i.hasOwnProperty(r)&&(this._labelOptions[i[r]]=e[i[r]])}else this._labelOptions=e;"{}"!=JSON.stringify(e)&&(this._direction=e&&e.direction||"center",this._textContentDom&&this._textContentDom.remove(),this._textContentDom=a.create("div"),this._textContentDom.className="LKmap-label-content",this._labelContainerDom=a.create("div"),this._labelContainerDom.className="label-content-container",this._labelContainerDom.innerHTML=e.content,this._textContentDom.appendChild(this._labelContainerDom),this._element.appendChild(this._textContentDom),this._labelTranslate=this.getLabelTranslate(),this._labelOptions.offset&&(this._labelTranslate.x+=this._labelOptions.offset.x,this._labelTranslate.y+=this._labelOptions.offset.y),this._labelOptions.style&&this.setLabelStyle(this._labelOptions.style),a.setTransform(this._labelContainerDom,$r[this._direction]+" translate("+this._labelTranslate.x+"px, "+this._labelTranslate.y+"px)"),function(t,e,i){var r=t.classList;for(var o in $r)r.remove("lkmap-"+i+"-anchor-"+o);r.add("lkmap-"+i+"-anchor-"+e)}(this._element,this._direction,"marker"))}},r.prototype.setLabelStyle=function(t){for(var e in void 0===t&&(t={}),t)t.hasOwnProperty(e)&&(this._labelContainerDom.style[e]=(this.toHump(e),t[e]))},r.prototype.toHump=function(t){return t.replace(/\-(\w)/g,(function(t,e){return e.toUpperCase()}))},r.prototype.setLabelAnchor=function(t){void 0===t&&(t=""),""!=t&&(this._labelOptions.direction=t&&t||"center",this.setLabel(this._labelOptions))},r.prototype.getLabel=function(){return this._labelOptions},r.prototype.getOffset=function(){return this._offset},r.prototype.getHeight=function(){return this._height},r.prototype.setHeight=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._height=this.options.height=t,this._update())},r.prototype.removeLabel=function(){this._textContentDom&&(this._textContentDom.remove(),this._textContentDom=null,this._labelOptions=null)},r.prototype.setLabelContent=function(t){this._labelContainerDom.innerHTML=t},r.prototype.getLabelOffset=function(){return this._labelOffset},r.prototype.getLabelTranslate=function(){this._labelOffset={x:0,y:0};var t=this._element.offsetHeight,e=this._element.offsetWidth;switch(this._direction){case"center":this._labelOffset.x=0,this._labelOffset.y=0;break;case"top":case"top-center":this._labelOffset.y="-"+t/2;break;case"bottom":case"bottom-center":this._labelOffset.y=t/2;break;case"left":case"middle-left":this._labelOffset.x="-"+e/2;break;case"right":case"middle-right":this._labelOffset.x=e/2;break;case"top-left":this._labelOffset.y="-"+t/2,this._labelOffset.x="-"+e/2;break;case"top-right":this._labelOffset.x=e/2,this._labelOffset.y="-"+t/2;break;case"bottom-left":this._labelOffset.y=t/2,this._labelOffset.x="-"+e/2;break;case"bottom-right":this._labelOffset.x=e/2,this._labelOffset.y=t/2}return this._labelOptions.offset&&this._labelOptions.offset.left&&(this._labelOffset.x=this._labelOptions.offset.left?parseInt(this._labelOffset.x,10)+this._labelOptions.offset.left:parseInt(this._labelOffset.x,10)+this._labelOptions.offset[0]),this._labelOptions.offset&&this._labelOptions.offset.top&&(this._labelOffset.y=this._labelOptions.offset.top?parseInt(this._labelOffset.y,10)+this._labelOptions.offset.top:parseInt(this._labelOffset.y,10)+this._labelOptions.offset[1]),this._labelOffset.x=parseInt(this._labelOffset.x),this._labelOffset.y=parseInt(this._labelOffset.y),this._labelOffset},r.prototype.setTitle=function(t){void 0===t&&(t=""),this._title=t,this.options.title=t,this._element.setAttribute("title",t)},r.prototype.getTitle=function(){return this._title},r.prototype.remove=function(){var t=this;return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("updateTerrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._markers=this._map._markers.filter((function(e){return e.id!==t.id})),delete this._map),this._clearFadeTimer(),a.remove(this._element),this._popup&&this._popup.remove(),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},r.prototype.getElement=function(){return this._element},r.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){var e=13.5,i=Math.sqrt(Math.pow(e,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-center":[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-center":[0,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[e,-24.6],right:[-13.5,-24.6],"middle-left":[e,-24.6],"middle-right":[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},r.prototype.on=function(t,e){void 0===e&&(e=null);var i=this;i._eventArr.indexOf(t)>=0?(i._eventAll.push(t),i._addMarkerEvent(t,e)):e&&(i._otherEvent[t]=e,i.onBack(t,i._markerOtherEvent))},r.prototype._markerOtherEvent=function(t){var e=this,r={};r.target=e,r.layer=e,r.mouse={lngLat:e._map.containerToLngLat(new i.Pixel(t.x,t.y)),point:new i.Pixel(t.x,t.y),type:t.type},r.originalEvent=t,r.lngLat=e._lngLat,r.point=e._map.lngLatToContainer(r.mouse.lngLat),r.type=t.type,e._otherEvent[t.type]&&e._otherEvent[t.type](r)},r.prototype.off=function(t,e){var i=this;i._map&&(i._eventArr.indexOf(t)>=0?(i._eventAll.splice(t,1),i._bubbleEvent[t]&&(i._bubbleEvent[t]=null),i._element.dispatchEvent?i._element.removeEventListener(t,i._eventCallbackFun):i._element.detachEvent("on"+t,i._eventCallbackFun)):i._otherEvent[t]&&(i.offBack(t,i._markerOtherEvent),delete i._otherEvent[t]))},r.prototype._addMarkerEvent=function(t,e){var i=this;i._bubbleEvent[t]=e,i._element.dispatchEvent?i._element.addEventListener(t,i._eventCallbackFun):i._element.attachEvent("on"+t,i._eventCallbackFun)},r.prototype._eventCallbackFun=function(e){var r=this;if("click"==e.type||"dblclick"==e.type){if(t.window.markerClicked)return void(t.window.markerClicked=!1);if(t.window.markerClicked=!0,setTimeout((function(){t.window.markerClicked=!1}),500),r._bubbleEvent[e.type]){var o={};o.target=r,o.layer=r,o.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},o.originalEvent=e,o.lngLat=o.mouse.lngLat,o.point=o.mouse.point,o.type=o.mouse.type,r._bubbleEvent[e.type](o)}}else if(r._bubbleEvent[e.type]){var n={};n.target=r,n.layer=r,n.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},n.originalEvent=e,n.lngLat=n.mouse.lngLat,n.point=n.mouse.point,n.type=n.mouse.type,r._bubbleEvent[e.type](n)}},r.prototype._onKeyPress=function(t){var e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},r.prototype._onMapClick=function(t){var e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},r.prototype.getPopup=function(){return this._popup},r.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},r.prototype._evaluateOpacity=function(){if(this._map&&this.options.followFogOpacity&&this._map._options.fog){var t=this._pos?this._pos.sub(this._transformedOffset()):null;if(this._withinScreenBounds(t)){var e=this._map.unproject(t),i=!1;if(this._map.getTerrain()){var r=this._map.getFreeCameraOptions();if(r.position){var o=r.position.toLngLat();i=o.distanceTo(e)<.9*o.distanceTo(this._lngLat)}}var n=(1-this._map._queryFogOpacity(e))*(i?.2:1);this._element.style.opacity=""+n,this._popup&&this._popup._setOpacity(""+n),this._fadeTimer=null}else this._clearFadeTimer()}},r.prototype._clearFadeTimer=function(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)},r.prototype._withinScreenBounds=function(t){if(!this._map)return!1;var e=this._map.transform;return!!t&&t.x>=0&&t.x<e.width&&t.y>=0&&t.y<e.height},r.prototype.setHeightAnchorElevation=function(t){this._heightAnchorElevation=!!t,this.options.heightAnchorElevation=this._heightAnchorElevation,this._update()},r.prototype._update=function(e){if(this._map&&(!e||"move"!=e.type&&"moveend"!=e.type||!this._map||!this._map._sceneMgr||!this._map._sceneMgr._tracked||this._map._sceneMgr._tracked.id!=this.id)){if(this._map.transform.renderWorldCopies&&(this._lngLat=Kr(this._lngLat,this._pos,this._map.transform)),this._element.style.willChange="transform",this._height&&0!==this._height){var i=t.LngLat.convert(this._lngLat),r=new t.MercatorCoordinate(t.mercatorXfromLng(i.lng),t.mercatorYfromLat(i.lat),t.mercatorZfromAltitude(this._height,i.lat));this._pos=this._map.transform._coordinatePoint(r,!0,this._heightAnchorElevation)._add(this._transformedOffset())}else this._pos=this._map.project(this._lngLat)._add(this._transformedOffset());e&&"moveend"!==e.type||(this._pos=this._pos.round()),this._element.style.display=this._visible?"block":"none",this._element.style.zIndex=this._zIndex;var o="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?o="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(o="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n="rotateX("+this._map.getPitch()+"deg)"),0!=this._rotation&&this._setTransformOrigin(this._element,this._anchor),this._setBubble(),this._cursor&&(this._element.style.cursor=this._cursor),this._textContentDom&&(this._textContentDom.style.zIndex=this._zIndex+1),this._evaluateOpacity(),this._element&&this._pos&&this._anchor&&a.setTransform(this._element,Jr[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+n+" "+o),this._element.style.willChange=null}},r.prototype._setBubble=function(){this._bubble?(a.removeEventListener(this._element,"mousemove",this._stopPropagation),a.removeEventListener(this._element,"mouseover",this._stopPropagation),a.removeEventListener(this._element,"mouseout",this._stopPropagation),a.removeEventListener(this._element,"mousedown",this._stopPropagation),a.removeEventListener(this._element,"mouseup",this._stopPropagation),a.removeEventListener(this._element,"contextmenu",this._stopPropagation),a.removeEventListener(this._element,"touchstart",this._stopPropagation),a.removeEventListener(this._element,"touchmove",this._stopPropagation),a.removeEventListener(this._element,"touchend",this._stopPropagation),a.removeEventListener(this._element,"dblclick",this._stopPropagation),a.removeEventListener(this._element,"click",this._stopPropagation)):(a.addEventListener(this._element,"mousemove",this._stopPropagation),a.addEventListener(this._element,"mouseover",this._stopPropagation),a.addEventListener(this._element,"mouseout",this._stopPropagation),a.addEventListener(this._element,"mousedown",this._stopPropagation),a.addEventListener(this._element,"mouseup",this._stopPropagation),a.addEventListener(this._element,"contextmenu",this._stopPropagation),a.addEventListener(this._element,"touchstart",this._stopPropagation),a.addEventListener(this._element,"touchmove",this._stopPropagation),a.addEventListener(this._element,"touchend",this._stopPropagation),a.addEventListener(this._element,"dblclick",this._stopPropagation),a.addEventListener(this._element,"click",this._stopPropagation))},r.prototype.setBubble=function(t){void 0===t&&(t=!1),this._bubble=this.options.bubble=t,this._setBubble()},r.prototype.getBubble=function(){return this._bubble},r.prototype._stopPropagation=function(t){t.preventDefault(),t.stopPropagation()},r.prototype._setTransformOrigin=function(t,e){if(t){var i="";switch(e){case"left":case"middle-left":i="0% 50%";break;case"top-left":i="0% 0%";break;case"bottom-left":i="0% 100%";break;case"right":case"middle-right":i="100% 50%";break;case"top-right":i="100% 0%";break;case"bottom-right":i="100% 100%";break;case"bottom":case"bottom-center":i="50% 100%";break;case"top":case"top-center":i="50% 0%";break;case"center":i="50% 50%"}t.style["transform-origin"]=i,t.style["-ms-transform-origin"]=i,t.style["-webkit-transform-origin"]=i,t.style["-moz-transform-origin"]=i,t.style["-o-transform-origin"]=i}},r.prototype._transformedOffset=function(){if(!this._defaultMarker||!this._map)return this._offset;var t=this._map.transform,e=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&e._rotate(t.angle),"map"===this._pitchAlignment&&(e.y*=Math.cos(t._pitch)),e},r.prototype.getOffset=function(){return this._offset},r.prototype.setOffset=function(e){return this.options.offset=this._offset=t.pointGeometry.convert(e||[0,0]),this._update(),this},r.prototype._onMove=function(e){if(!this._isDragging){var i=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},r.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},r.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},r.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},r.prototype.isDraggable=function(){return this._draggable},r.prototype.setRotation=function(t){return this.options.rotation=this._rotation=t||0,this._update(),this},r.prototype.setIconRotation=function(t){return this.options.iconRotation=this._iconRotation=t||0,this._updateIconRotationAnchor(),this},r.prototype.getRotation=function(){return this._rotation},r.prototype.getIconRotation=function(){return this._iconRotation},r.prototype.setRotationAlignment=function(t){return this._rotationAlignment=this.options.rotationAlignment=t||"auto","auto"==this.options.pitchAlignment&&(this._pitchAlignment=this._rotationAlignment),this._update(),this},r.prototype.getRotationAlignment=function(){return this._rotationAlignment},r.prototype.setPitchAlignment=function(t){return this._pitchAlignment=this.options.pitchAlignment="auto"!==t?t:this._rotationAlignment,this._update(),this},r.prototype.getPitchAlignment=function(){return this._pitchAlignment},r.prototype.getId=function(){return this.id},r.prototype.setzIndex=function(t){this._zIndex=this.options.zIndex=parseInt(t),this._update()},r.prototype.getzIndex=function(){return this.options.zIndex},r.prototype.setIcon=function(t){void 0===t&&(t=null),t&&(this.options.icon=t,"string"==typeof t?(this._icon=i?new i.Icon({image:this.options.icon}):this.createIcon(),this.updateIcon(this._icon.getElement())):(this._icon=new i.Icon(t.options),this.updateIcon(this._icon.getElement())),this.options.label&&this.options.label.content&&this.setLabel(this.options.label))},r.prototype.getIcon=function(){return this._icon},r.prototype.setExtData=function(t){this.extData=this.options.extData=t},r.prototype.getExtData=function(){return this.extData||this.options.extData},r.prototype.init=function(){this.setMarkerLngLat(this.options.position),this.options.popup&&this.setPopup(this.options.popup),this.options.map&&this.setMap(this.options.map)},r.prototype.setMap=function(t){var e=this;t?(this._map=t,this._map._loaded?(this.addTo(t),this._setLabelFun()):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e.addTo(t),e._setLabelFun())}),10))):this._map&&this.remove()},r.prototype._setLabelFun=function(){"label"in this.options&&this.setLabel(this.options.label),"title"in this.options&&this.setTitle(this.options.title),"animation"in this.options&&this.setAnimation(this.options.animation)},r.prototype.getMap=function(){return this._map},r.prototype.getAnchor=function(){return this._anchor},r.prototype.getIconAnchor=function(){return this._iconAnchor},r.prototype.getLabelAnchor=function(){var t="";return this._labelOptions&&(t=this._labelOptions.direction),t},r.prototype.setMarkerLngLat=function(t){if(t){var e=t.lng,i=t.lat;e&&i&&this.setLngLat([e,i]),this.setLngLat(t)}},r.prototype.setPosition=function(t){this.setMarkerLngLat(t),this._map&&this._map._sceneMgr&&this._map._sceneMgr._tracked&&this._map._sceneMgr._tracked.id==this.id&&this._map.triggerRepaint()},r.prototype.getPosition=function(){return this.getLngLat()},r.prototype.setAnimation=function(t){var e=this;if(void 0===t&&(t="LKMAP_ANIMATION_NONE"),""!=t&&this.getElement().children[0])switch(this._animationType=t,t){case"LKMAP_ANIMATION_NONE":default:this._element.children[0].classList.remove("markerKeyframesImgAnimation"),this._element.children[0].classList.remove("markerKeyframesAnimationDrop");break;case"LKMAP_ANIMATION_BOUNCE":this._element.children[0].classList.remove("markerKeyframesAnimationDrop"),this._element.children[0].classList.add("markerKeyframesImgAnimation");break;case"LKMAP_ANIMATION_DROP":this._element.children[0].classList.remove("markerKeyframesImgAnimation"),this._element.children[0].classList.add("markerKeyframesAnimationDrop"),"LKMAP_ANIMATION_DROP"==this.options.animation&&(this._element.children[0].style.display="none",setTimeout((function(){e._element.children[0].style.display="block"}),10))}},r.prototype.getAnimation=function(){return this._animationType},r.prototype.show=function(){this._visible=this.options.visible=!0,this.getElement().style.display="block"},r.prototype.hide=function(){this._visible=this.options.visible=!1,this.getElement().style.display="none"},r.prototype.setCursor=function(t){this.options.cursor=t,this._cursor=t,this.getElement().style.cursor=this._cursor},r.prototype.createIcon=function(t){var e=document.createElement("div");e.className="lkmapMarker",e.style["background-size"]="cover",e.style.width="26px",e.style.height="32px";var i=document.createElement("div");return i.className="lkmap-marker-icon",e.appendChild(i),this.createImg(e,i,t)},r.prototype.createImg=function(t,e,i){var r=document.createElement("img");r.className="marker-img",r.src=i,r.style.width="26px",r.style.height="32px",r.style.display="block",e.appendChild(r);var o=document.createElement("div");return o.className="marker-img-box",o.style.width="100%",o.style.height="100%",e.appendChild(o),t},r}(t.Evented),io=function(t){this.jumpTo(t)};io.prototype.getValue=function(e){if(e<=this._startTime)return this._start;if(e>=this._endTime)return this._end;var i=t.easeCubicInOut((e-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i},io.prototype.isEasing=function(t){return t>=this._startTime&&t<=this._endTime},io.prototype.jumpTo=function(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t},io.prototype.easeTo=function(t,e,i){this._start=this.getValue(e),this._end=t,this._startTime=e,this._endTime=e+i};var ro={extend:function(t){var e,i,r,o,n=arguments;for(i=1,r=arguments.length;i<r;i++)for(e in o=n[i])t[e]=o[e];return t},ajax:function(t,e){e||(e={});var i=e.success,r=e.error;try{var o=!1!==e.async,n=e.type||"GET";n=n.toUpperCase();var a,s=e.contentType||"application/json;charset=UTF-8",l=e.data||null,u=e.dataType||"json";if((a=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")).onload=function(){i&&i(a.response)},a.onerror=function(){r&&r()},"GET"===n||"DELETE"===n){if(l&&l instanceof Object){var h="";for(var p in l)h=h+p+"="+l[p]+"&";if(h){h=h.slice(0,-1);var c=t.indexOf("?");t=-1===c?t+"?"+h:t+"&"+h}}l=null}if(a.open(n,t,o),a.responseType=u,a.setRequestHeader("Content-Type",s),e.authorization&&a.setRequestHeader("authorization",e.authorization),e.token&&a.setRequestHeader("accesstoken",e.token),"POST"===n)if("application/json;charset=UTF-8"===s)l=JSON.stringify(l);else if(l&&l instanceof Object){var f,d=[],m=e.data;for(var y in m)m.hasOwnProperty(y)&&"function"!=typeof m[y]&&(f=m[y].toString(),y=encodeURIComponent(y),f=encodeURIComponent(f),d.push(y+"="+f));l=d.join("&")}return a.send(l),a}catch(t){r&&r()}},isIntersect:function(t,e){return!(!t||!e||e.maxX<t.minX||e.minX>t.maxX||e.maxY<t.minY||e.minY>t.maxY)},throttle:function(t,e,i){var r,o,n,a;return a=function(){r=!1,o&&(n.apply(i,o),o=!1)},n=function(){r?o=arguments:(t.apply(i,arguments),setTimeout(a,e),r=!0)},n},setSign:function(t,e,i,r,o){var n=this.objKeySort({grant_type:t||"password",username:e||"",timestamp:r,nonce:o,credentials:i||"default"}),a="";for(var s in n)a+=s+n[s];return a+"D41D8CD98F00B204E9800998ECF8427E"},getObj:function(t){var e=t.split("&"),i={};return e.map((function(t){var e=t.split("=");i[e[0]]=e[1]})),i},getServerSecretkey:function(t){var e="string"==typeof t,i=null,r="",o=t;if(e&&(i=t.split("?"),o=this.getObj(i[1])),o.rc=this.randomWord(16),o.rt=(new Date).getTime(),o.resid="02",o.from="lkmapsdk_js",Object.keys(o).sort().map((function(t){r+=t+o[t]})),r+=o.ak+this.hexCCTS("4434314438434439384630304232303445393830303939384543463834323745"),r=(r=this.m(r)).toUpperCase(),o.sign=r,e){var n=i[0]+"?";return Object.keys(o).sort().map((function(t){n+=t+"="+o[t]+"&"})),n=n.substr(0,n.length-1)}return o},strTHCC:function(t){if(""===t)return"";var e=[];e.push("0x");for(var i=0;i<t.length;i++)e.push(t.charCodeAt(i).toString(16));return e.join("")},hexCCTS:function(t){var e,i=("0x"+t).trim(),r="0x"===i.substr(0,2).toLowerCase()?i.substr(2):i,o=r.length;if(o%2!=0)return alert("Illegal Format ASCII Code!"),"";for(var n=[],a=0;a<o;a+=2)e=parseInt(r.substr(a,2),16),n.push(String.fromCharCode(e));return n.join("")},getM:function(t){return this.m(t).toUpperCase()},randomWord:function(t){t=t||10;for(var e="",i=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"],r=0;r<t;r++)e+=i[Math.round(Math.random()*(i.length-1))];return e},objKeySort:function(t){for(var e=Object.keys(t).sort(),i={},r=0;r<e.length;r++)i[e[r]]=t[e[r]];return i},m:function(t){var e=function(t,e){return t<<e|t>>>32-e},i=function(t,e){var i,r,o,n,a;return o=2147483648&t,n=2147483648&e,a=(1073741823&t)+(1073741823&e),(i=1073741824&t)&(r=1073741824&e)?2147483648^a^o^n:i|r?1073741824&a?3221225472^a^o^n:1073741824^a^o^n:a^o^n},r=function(t,r,o,n,a,s,l){return t=i(t,i(i(function(t,e,i){return t&e|~t&i}(r,o,n),a),l)),i(e(t,s),r)},o=function(t,r,o,n,a,s,l){return t=i(t,i(i(function(t,e,i){return t&i|e&~i}(r,o,n),a),l)),i(e(t,s),r)},n=function(t,r,o,n,a,s,l){return t=i(t,i(i(function(t,e,i){return t^e^i}(r,o,n),a),l)),i(e(t,s),r)},a=function(t,r,o,n,a,s,l){return t=i(t,i(i(function(t,e,i){return e^(t|~i)}(r,o,n),a),l)),i(e(t,s),r)},s=function(t){var e,i="",r="";for(e=0;e<=3;e++)i+=(r="0"+(t>>>8*e&255).toString(16)).substr(r.length-2,2);return i};return function(t){var e,l,u,h,p,c,f,d,m,y=Array();for(t=function(t){t=t.toString().replace(/\x0d\x0a/g,"\n");for(var e="",i=0;i<t.length;i++){var r=t.charCodeAt(i);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t),y=function(t){for(var e,i=t.length,r=i+8,o=16*((r-r%64)/64+1),n=Array(o-1),a=0,s=0;s<i;)a=s%4*8,n[e=(s-s%4)/4]=n[e]|t.charCodeAt(s)<<a,s++;return n[e=(s-s%4)/4]=n[e]|128<<(a=s%4*8),n[o-2]=i<<3,n[o-1]=i>>>29,n}(t),c=1732584193,f=4023233417,d=2562383102,m=271733878,e=0;e<y.length;e+=16)l=c,u=f,h=d,p=m,c=r(c,f,d,m,y[e+0],7,3614090360),m=r(m,c,f,d,y[e+1],12,3905402710),d=r(d,m,c,f,y[e+2],17,606105819),f=r(f,d,m,c,y[e+3],22,3250441966),c=r(c,f,d,m,y[e+4],7,4118548399),m=r(m,c,f,d,y[e+5],12,1200080426),d=r(d,m,c,f,y[e+6],17,2821735955),f=r(f,d,m,c,y[e+7],22,4249261313),c=r(c,f,d,m,y[e+8],7,1770035416),m=r(m,c,f,d,y[e+9],12,2336552879),d=r(d,m,c,f,y[e+10],17,4294925233),f=r(f,d,m,c,y[e+11],22,2304563134),c=r(c,f,d,m,y[e+12],7,1804603682),m=r(m,c,f,d,y[e+13],12,4254626195),d=r(d,m,c,f,y[e+14],17,2792965006),f=r(f,d,m,c,y[e+15],22,1236535329),c=o(c,f,d,m,y[e+1],5,4129170786),m=o(m,c,f,d,y[e+6],9,3225465664),d=o(d,m,c,f,y[e+11],14,643717713),f=o(f,d,m,c,y[e+0],20,3921069994),c=o(c,f,d,m,y[e+5],5,3593408605),m=o(m,c,f,d,y[e+10],9,38016083),d=o(d,m,c,f,y[e+15],14,3634488961),f=o(f,d,m,c,y[e+4],20,3889429448),c=o(c,f,d,m,y[e+9],5,568446438),m=o(m,c,f,d,y[e+14],9,3275163606),d=o(d,m,c,f,y[e+3],14,4107603335),f=o(f,d,m,c,y[e+8],20,1163531501),c=o(c,f,d,m,y[e+13],5,2850285829),m=o(m,c,f,d,y[e+2],9,4243563512),d=o(d,m,c,f,y[e+7],14,1735328473),f=o(f,d,m,c,y[e+12],20,2368359562),c=n(c,f,d,m,y[e+5],4,4294588738),m=n(m,c,f,d,y[e+8],11,2272392833),d=n(d,m,c,f,y[e+11],16,1839030562),f=n(f,d,m,c,y[e+14],23,4259657740),c=n(c,f,d,m,y[e+1],4,2763975236),m=n(m,c,f,d,y[e+4],11,1272893353),d=n(d,m,c,f,y[e+7],16,4139469664),f=n(f,d,m,c,y[e+10],23,3200236656),c=n(c,f,d,m,y[e+13],4,681279174),m=n(m,c,f,d,y[e+0],11,3936430074),d=n(d,m,c,f,y[e+3],16,3572445317),f=n(f,d,m,c,y[e+6],23,76029189),c=n(c,f,d,m,y[e+9],4,3654602809),m=n(m,c,f,d,y[e+12],11,3873151461),d=n(d,m,c,f,y[e+15],16,530742520),f=n(f,d,m,c,y[e+2],23,3299628645),c=a(c,f,d,m,y[e+0],6,4096336452),m=a(m,c,f,d,y[e+7],10,1126891415),d=a(d,m,c,f,y[e+14],15,2878612391),f=a(f,d,m,c,y[e+5],21,4237533241),c=a(c,f,d,m,y[e+12],6,1700485571),m=a(m,c,f,d,y[e+3],10,2399980690),d=a(d,m,c,f,y[e+10],15,4293915773),f=a(f,d,m,c,y[e+1],21,2240044497),c=a(c,f,d,m,y[e+8],6,1873313359),m=a(m,c,f,d,y[e+15],10,4264355552),d=a(d,m,c,f,y[e+6],15,2734768916),f=a(f,d,m,c,y[e+13],21,1309151649),c=a(c,f,d,m,y[e+4],6,4149444226),m=a(m,c,f,d,y[e+11],10,3174756917),d=a(d,m,c,f,y[e+2],15,718787259),f=a(f,d,m,c,y[e+9],21,3951481745),c=i(c,l),f=i(f,u),d=i(d,h),m=i(m,p);return(s(c)+s(f)+s(d)+s(m)).toLowerCase()}(t)}},oo=eval;function no(){this.supportLocalStorage="localStorage"in window&&window.Storage&&window.localStorage&&window.localStorage instanceof Storage,this.localStorage=window.localStorage}no.prototype={constructor:no,init:function(){},set:function(t,e){var i="_LKMap_"+t;this.localStorage.removeItem(i),this.localStorage.setItem(i,e)},check:function(t){var e=!1;return this.localStorage["_LKMap_"+t]&&(e=!0),e},get:function(t){return this.localStorage.getItem("_LKMap_"+t)},remove:function(t){this.localStorage.removeItem("_LKMap_"+t)}};var ao=new no,so={num:0,Request:{INITIAL:-1,WAITING:0,COMPLETED:1},pluginsArr:{LKmap:[],Scale:[],GeoJSONClusterer:[],MarkerClusterer:[],CircleClusterer:[],MoreClusterer:[],OverView:[],MassMarks:[],PlaceSearch:[],POIDetail:[],Autocomplete:[],Geocoder:[],AlongSearch:[],TruckDriving:[],TruckDriving_v2:[],Driving:[],Driving_v2:[],PolyEditor:[],RectangleEditor:[],CurveEditor:[],EllipseEditor:[],CircleEditor:[],SkyLayer:[],TripleSpatialLayer:[],TextSearch:[],AnalysisSearch:[],AroundSearch:[],RectangSearch:[],MassClusterer:[]},scriptPluginsArr:{MouseTool:[],ToolBar:[],Compare:[],ControlBar:[],FullScreen:[],ModelLayer:[],VirtualSpace:[],Map3DTilesLayer:[]},preLoaded:{},Config:t.config,Module:{_modules:{},_arrMdls:[],_tempModules:[]},load:function(t){if(this.num++,4!=this.num){var e=[];for(var i in this.Module._arrMdls)this.Module._modules[this.Module._arrMdls[i]]._status!=this.Request.COMPLETED&&e.push(this.Module._arrMdls[i]);this.Module._arrMdls.length=0,e.length>0?this.request(e,t):t&&"function"==typeof t&&t()}},checkArrMdls:function(t){for(var e=0;e<this.Module._arrMdls.length;e++)if(this.Module._arrMdls[e]==t)return;this.Module._arrMdls.push(t)},run:function(t,e){var i=this.current(t);try{oo(e)}catch(e){return}i._status=this.Request.COMPLETED;for(var r=0,o=i._callbacks.length;r<o;r++)i._callbacks[r]();i._callbacks.length=0},check:function(t,e){var i=this;setTimeout((function(){for(var r in t)i.Module._modules[t[r]]._status!=i.Request.COMPLETED&&(i.current(t[r]),i.Module._arrMdls.push(t[r]));i.Module._arrMdls.length>0?i.load(e):e&&"function"==typeof e&&e()}),1)},current:function(t){return this.Module._modules[t]||(this.Module._modules[t]={},this.Module._modules[t]._status=this.Request.INITIAL,this.Module._modules[t]._callbacks=[]),this.Module._modules[t]},remove:function(t){this.current(t)},checkCodesStatus:function(t,e){this.current(t),this.Module._tempModules.push({moduleName:t,moduleCode:e}),this.evalAllCode()},evalAllCode:function(){var t=this.Module._tempModules;for(var e in t)"LKmap"==t[e].moduleName&&window.LKmap||this.run(t[e].moduleName,t[e].moduleCode)},request:function(e,i){var r=this,o=[],n=[];for(var a in e)r.pluginsArr[e[a]]&&o.push(e[a]),r.scriptPluginsArr[e[a]]&&n.push(e[a]);if(0!=o.length||0!=n.length){if(o.length>0)if(ao.supportLocalStorage){var s=ao.get("pluginVersion");if(ao.check("pluginVersion")&&s==t.config.pluginVersion){var l=[];for(var a in o)if(ao.check(o[a])){if(window.LKMap&&window.LKMap[o[a]])continue;_runLKCode(o[a],ao.get(o[a]))}else l.push(o[a]);l.length>0&&n.length>0?r.addScript(l,"loading",i,2):l.length>0?r.addScript(l,"synchronization",i,2):0==n.length&&i&&i()}else Object.keys(this.pluginsArr).forEach((function(t){ao.remove(t)})),Object.keys(this.scriptPluginsArr).forEach((function(t){ao.remove(t)})),ao.set("pluginVersion",t.config.pluginVersion),r.addScript(o,n.length>0?"loading":"synchronization",i,2)}else r.addScript(o,n.length>0?"loading":"synchronization",i,2);if(n.length>0){var u=[],h=ao.get("pluginVersion");if(ao.check("pluginVersion")&&h==t.config.pluginVersion)for(var a in n)window.LKMap&&window.LKMap[n[a]]||u.push(n[a]);else u=n;u.length>0?r.addScript(u,"success",i,4):i&&i()}}},addScript:function(e,i,r,o){void 0===o&&(o=4);var n=e.join(","),a=t.config.WEB_API+"/maps?ak="+t.config.key+"&plugins="+n+"&type="+o;t.config.userVersion&&(a+="&version="+t.config.userVersion);var s=this,l=function(t,e){void 0===e&&(e=null);var i=document.createElement("script");if(e&&"object"==typeof e)for(var r in e)i[r]=e[r];return i}(0,{type:"text/javascript"});l.charset="utf-8",l.src=a,"synchronization"==i?l.addEventListener?l.addEventListener("load",(function(t){var i=t.target;i.parentNode.removeChild(i),s.check(e,r)}),!1):l.attachEvent&&l.attachEvent("onreadystatechange",(function(t){var i=window.event.srcElement;!i||"loaded"!=i.readyState&&"complete"!=i.readyState||(i.parentNode.removeChild(i),s.check(e,r))})):"success"==i?l.addEventListener?l.addEventListener("load",(function(t){var e=t.target;e.parentNode.removeChild(e),r&&r()}),!1):l.attachEvent&&l.attachEvent("onreadystatechange",(function(t){var e=window.event.srcElement;!e||"loaded"!=e.readyState&&"complete"!=e.readyState||(e.parentNode.removeChild(e),r&&r())})):l.addEventListener?l.addEventListener("load",(function(t){var e=t.target;e.parentNode.removeChild(e)}),!1):l.attachEvent&&l.attachEvent("onreadystatechange",(function(t){var e=window.event.srcElement;!e||"loaded"!=e.readyState&&"complete"!=e.readyState||e.parentNode.removeChild(e)})),setTimeout((function(){document.getElementsByTagName("head")[0].appendChild(l),l=null}),1)}};window._runLKCode=function(t,e){ao.supportLocalStorage&&ao.set(t,e),so.checkCodesStatus(t,e)};var lo={floorCenterIndex:2,maxFloor:5,position:"right-center",defaultFloor:"top",showButton:!0,showAllBg:!0,offset:[0,0]},uo=function(e,i){i=t.extend({},lo,i),this._map=e,this.options=i,this._piid=[],this._indoorList={},this._defaultFloor=i.defaultFloor||"top",this._timeout=null,this._element=a.create("div"),this._element.className="lkmap-ctrl lkmap-indoor-floor",this._floorListBox=null,this._plus=null,this._minus=null,this._floorBtnList=[],this._activePiid=null,this._oldActiveData={},this._maxFloor=i.maxFloor||3,this._floorCenterIndex=null!=i.floorCenterIndex?i.floorCenterIndex:1,this._position=i.position||"right-center",this._showButton=i.showButton,this._showAllBg=i.showAllBg,this._offset=t.pointGeometry.convert(i&&i.offset||[0,0]),this._layerId=["2103","2104","2105","2106","2107","2108","2109","210A","210B","210C","210D"],t.bindAll(["init","_settingsIndoorFilter","_getIndoorData","_getActivePiid","_update","setNamec","_creatDom","getDefaultPosition","onAdd","clickFloorBtnEvent","plusEvent","minusEvent","_updateScrollTop","_updateBtnStyle","_setBtnDisplay"],this)};uo.prototype.init=function(){this._getIndoorData("init"),this._getActivePiid("init")},uo.prototype._update=function(){this._getIndoorData(),this._getActivePiid()},uo.prototype._getIndoorData=function(t){var e=this;void 0===t&&(t="");var i=this._map.querySourceFeatures("indoor",{sourceLayer:"parkinginfo"}),r={};i=i.reduce((function(t,e){return!r[e.properties.piid]&&(r[e.properties.piid]=t.push(e)),t}),[]),this._piid=i.map((function(t){return t.properties.piid}));var o=this._map.querySourceFeatures("indoor",{sourceLayer:"parkingbg"});this._piid.forEach((function(t){if(!e._indoorList.hasOwnProperty(t)){var r={info:{},bg:{},namecArray:[],floorArray:[],pbgidArray:[],activeData:{namec:null,floor:null,pbgid:null}};r.info=i.filter((function(e){return e.properties.piid==t}))[0];var n={},a=(o=o.reduce((function(t,e){return!n[e.properties.namec]&&(n[e.properties.namec]=t.push(e)),t}),[])).filter((function(e){return e.properties.piid==t&&e.properties.namec.length<=2}));if(a.sort((function(t,e){return parseInt(e.properties.floor)-parseInt(t.properties.floor)})),a.forEach((function(t,e){r.bg[t.properties.namec]=t,r.namecArray.push(t.properties.namec),r.pbgidArray.push(t.properties.pbgid),r.floorArray.push(parseInt(t.properties.floor))})),r.namecArray.length>0)if("number"==typeof e._defaultFloor){var s=0;r.floorArray.indexOf(e._defaultFloor)>-1&&(s=r.floorArray.indexOf(e._defaultFloor)),r.activeData.floor=r.floorArray[s],r.activeData.namec=r.namecArray[s],r.activeData.pbgid=r.pbgidArray[s]}else"string"==typeof e._defaultFloor&&("bottom"==e._defaultFloor?(r.activeData.floor=r.floorArray[r.namecArray.length-1],r.activeData.namec=r.namecArray[r.namecArray.length-1],r.activeData.pbgid=r.pbgidArray[r.pbgidArray.length-1]):(r.activeData.floor=r.floorArray[0],r.activeData.namec=r.namecArray[0],r.activeData.pbgid=r.pbgidArray[0]));e._indoorList[t]=r}})),"init"==t&&0==this._piid.length&&(this._map.off("move",this._update),this._map.off("moveend",this._update))},uo.prototype._getActivePiid=function(){if(this._piid&&0!=this._piid.length){if(this._mapCenter=this._map.transform.center,0!=this._offset[0]||0!=this._offset[1]){var e=this._map.lngLatToContainer(this._mapCenter).add(this._offset);this._mapCenter=this._map.containerToLngLat(e)}for(var i=t.point(this._mapCenter.toArray()),r=!1,o=!0,n=0;n<this._piid.length;n++){var a=this._indoorList[this._piid[n]].info.properties,s=t.polygon([[[a.minlon,a.minlat],[a.minlon,a.maxlat],[a.maxlon,a.maxlat],[a.maxlon,a.minlat],[a.minlon,a.minlat]]]);if(r=t.booleanPointInPolygon(i,s)){this._activePiid&&this._activePiid==this._piid[n]?o=!1:(o=!0,this._activePiid=this._piid[n],this._showButton&&this._creatDom());break}}r?(this._showButton&&this._map.transform.zoom>=17?(this._setBtnDisplay(!0),this._updateScrollTop()):this._setBtnDisplay(!1),this._settingsIndoorFilter(o)):(this._activePiid=null,this._showButton&&(this._removeDom(),this._setBtnDisplay(!1)))}},uo.prototype._removeDom=function(){var t=this;this._plus&&(this._plus.removeEventListener("click",this.plusEvent,!1),this._plus.removeEventListener("click",this.plusEvent,!1)),this._minus&&(this._minus.removeEventListener("click",this.minusEvent,!1),this._minus.removeEventListener("click",this.minusEvent,!1)),this._floorBtnList.forEach((function(e){e.removeEventListener("click",t.clickFloorBtnEvent,!1)})),this._floorBtnList=[],this._element.innerHTML=""},uo.prototype.setNamec=function(t){t&&(this._indoorList[this._activePiid].activeData.namec=t,this._indoorList[this._activePiid].activeData.floor=this._indoorList[this._activePiid].bg[t].properties.floor,this._indoorList[this._activePiid].activeData.pbgid=this._indoorList[this._activePiid].bg[t].properties.pbgid,this._settingsIndoorFilter(),this._updateBtnStyle())},uo.prototype._updateBtnStyle=function(){var t=this._indoorList[this._activePiid],e=t.namecArray.indexOf(t.activeData.namec);this._floorBtnList.forEach((function(t,i){t.parentElement.classList.remove("selected"),i==e&&t.parentElement.classList.add("selected")})),this._checkPlusMinusStyle(e)},uo.prototype._settingsIndoorFilter=function(t){var e=this;if(void 0===t&&(t=!0),t){var i=["any"],r=["any"];this._piid.forEach((function(t){var o=e._indoorList[t].activeData.pbgid;i.push(["==","pbgid",o]),r.push(["all",["==","piid",t],["==","pbgid",o]])})),this._layerId.forEach((function(t){e._map.setFilter(t,i)})),this._map.setFilter("2102",this._showAllBg?null:r)}},uo.prototype._creatDom=function(){var t=this,e=this._indoorList[this._activePiid].namecArray,i=a.create("div","floor-box");e.length>this._maxFloor&&(this._plus=a.create("div","floor-btn floor-plus",i),this._plus.addEventListener("click",this.plusEvent.bind(this),!1)),this._floorListBox=a.create("div","floor-list-box",i),this._floorListBox.style.maxHeight=37*this._maxFloor+"px";var r=a.create("ul","floor-list",this._floorListBox);e.length<=this._maxFloor?i.style.padding="5px 0":this._floorListBox.style.margin="10px 0",e.length>this._maxFloor&&(this._minus=a.create("div","floor-btn floor-minus",i),this._minus.addEventListener("click",this.minusEvent.bind(this),!1)),this._floorBtnList=[],e.forEach((function(e){var i=a.create("li","floor-list-item",r),o=a.create("div","floor-btn floor-nonas",i);o.innerHTML=e,t._floorBtnList.push(o),o.addEventListener("click",t.clickFloorBtnEvent.bind(t),!1)})),this._element.innerHTML="",this._element.appendChild(i),this._map.addControl(this),this._updateBtnStyle()},uo.prototype.getDefaultPosition=function(){return this._position},uo.prototype.onAdd=function(t){return this._element},uo.prototype.clickFloorBtnEvent=function(t){var e=t.target.innerHTML;e.length>0&&this.setNamec(e)},uo.prototype.plusEvent=function(t){var e=this._indoorList[this._activePiid],i=e.namecArray,r=i.indexOf(e.activeData.namec)-1;r<0||(this._floorBtnList.forEach((function(t,e){t.parentElement.classList.remove("selected"),e==r&&t.parentElement.classList.add("selected")})),this.setNamec(i[r]),this._checkPlusMinusStyle(r),this._updateScrollTop())},uo.prototype.minusEvent=function(t){if(this._activePiid){var e=this._indoorList[this._activePiid],i=e.namecArray,r=i.indexOf(e.activeData.namec)+1;r>=i.length||(this._floorBtnList.forEach((function(t,e){t.parentElement.classList.remove("selected"),e==r&&t.parentElement.classList.add("selected")})),this.setNamec(i[r]),this._checkPlusMinusStyle(r),this._updateScrollTop())}},uo.prototype._checkPlusMinusStyle=function(t){if(this._plus&&this._minus){var e=this._indoorList[this._activePiid].namecArray;t<=0?(this._plus.classList.add("forbid"),this._minus.classList.remove("forbid")):t>=e.length-1?(this._minus.classList.add("forbid"),this._plus.classList.remove("forbid")):(this._plus.classList.remove("forbid"),this._minus.classList.remove("forbid"))}},uo.prototype._updateScrollTop=function(){if(this._activePiid){var t=this._indoorList[this._activePiid],e=t.namecArray;if(!(e.length<=this._maxFloor)){var i=e.indexOf(t.activeData.namec);this._floorListBox.scrollTop=this._floorCenterIndex>=this._maxFloor?37*i:i>this._floorCenterIndex?37*(i-this._floorCenterIndex):0}}},uo.prototype._setBtnDisplay=function(t){void 0===t&&(t=!0),this._element.style.display=t?"block":"none"};var ho=function(e){var i=this;this.map=e,this.dbName="LK_VS_DB",this.version=parseInt(window.LKMap.version.replace(/\./g,"")),1==window.LKMap.version.split(".")[2].length&&(this.version*=10),this.versionStoreName="LK_VS_DB_STORE",t.bindAll(["openDB","addData","getData","getDataByKey","cursorGetData","getDataByIndex","cursorGetDataByIndex","updateDB","deleteDB","deleteDBAll","closeDB","readAll","clearStore","updataVersion","getVersion","cursorDeleteDataByIndex","deleteVersion"],this),this.openDB(this.dbName,this.version).then((function(t){i.db=t,i.updataVersion("sdk_version",i.version)})).catch((function(t){"error"==t.type&&(i.deleteDBAll(),i.openDB(i.dbName,i.version).then((function(t){i.db=t,i.updataVersion("sdk_version",i.version)})))}))};ho.prototype.updataVersion=function(t,e){var i=this;this.getData(this.versionStoreName,t).then((function(r){r?i.updateDB(i.versionStoreName,{id:t,data:e}):i.addData(i.versionStoreName,{id:t,data:e})}))},ho.prototype.getVersion=function(t){var e=this;return new Promise((function(i,r){var o=e.db.transaction([e.versionStoreName]).objectStore(e.versionStoreName).get(t);o.onerror=function(t){r(t)},o.onsuccess=function(t){i(o.result)}}))},ho.prototype.deleteVersion=function(t){return this.deleteDB(this.versionStoreName,t)},ho.prototype.openDB=function(t,e){var i=this;return new Promise((function(r,o){var n,a=(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.shimIndexedDB).open(t,e);a.onsuccess=function(t){(n=t.target.result).onerror=function(t){},n.onversionchange=function(t){n.close()},r(n)},a.onerror=function(t){o(t)},a.onupgradeneeded=function(t){if((n=t.target.result).objectStoreNames.contains(i.versionStoreName)||n.createObjectStore(i.versionStoreName,{keyPath:"id"}),n.objectStoreNames.contains("vs_sky")||n.createObjectStore("vs_sky",{keyPath:"id"}),n.objectStoreNames.contains("vs_modelLayer")||n.createObjectStore("vs_modelLayer",{keyPath:"id"}),n.objectStoreNames.contains("vs_TripleSpatialLayer")||n.createObjectStore("vs_TripleSpatialLayer",{keyPath:"id"}),n.objectStoreNames.contains("vs_Map3DTiles_b3dm")&&n.deleteObjectStore("vs_Map3DTiles_b3dm"),!n.objectStoreNames.contains("vs_Map3DTiles_b3dm_data")){var e=n.createObjectStore("vs_Map3DTiles_b3dm_data",{autoIncrement:!0});e.createIndex("id,url,version",["id","url","version"],{unique:!1}),e.createIndex("id,version",["id","version"],{unique:!1})}if(!n.objectStoreNames.contains("vs_Map3DTiles_b3dm_texture")){var r=n.createObjectStore("vs_Map3DTiles_b3dm_texture",{autoIncrement:!0});r.createIndex("id,url,version",["id","url","version"],{unique:!1}),r.createIndex("id,version",["id","version"],{unique:!1})}}}))},ho.prototype.addData=function(t,e){var i=this;return new Promise((function(r,o){if(i.db){var n=i.db.transaction([t],"readwrite").objectStore(t).add(e);n.onsuccess=function(t){r({code:0,msg:"成功",event:t})},n.onerror=function(t){throw new Error(t.target.error)}}})).catch((function(t){}))},ho.prototype.getData=function(t,e){var i=this;return new Promise((function(r,o){var n=i.db.transaction([t]).objectStore(t).get(e);n.onerror=function(t){o(t)},n.onsuccess=function(t){r(n.result)}}))},ho.prototype.cursorGetData=function(t){var e=[],i=this.db.transaction(t,"readwrite").objectStore(t).openCursor();return new Promise((function(t,r){i.onsuccess=function(i){var r=i.target.result;r?(e.push(r.value),r.continue()):t(e)},i.onerror=function(t){r(t)}}))},ho.prototype.getDataByIndex=function(t,e,i){var r=this.db.transaction(t,"readwrite").objectStore(t).index(e).get(i);return new Promise((function(t,e){r.onerror=function(t){e(t)},r.onsuccess=function(e){t(e.target.result)}}))},ho.prototype.cursorGetDataByIndex=function(t,e,i){var r=[],o=this.db.transaction(t,"readwrite").objectStore(t).index(e).openCursor(IDBKeyRange.only(i));return new Promise((function(t,e){o.onsuccess=function(e){var i=e.target.result;i?(r.push(i.value),i.continue()):t(r)},o.onerror=function(t){e(t)}}))},ho.prototype.cursorDeleteDataByIndex=function(t,e,i){var r=this.db.transaction(t,"readwrite").objectStore(t).index(e).openCursor(IDBKeyRange.only(i));return new Promise((function(t,e){r.onsuccess=function(e){var i=e.target.result;i?(i.delete(),i.continue()):t({code:0,msg:"删除成功"})},r.onerror=function(t){e(t)}}))},ho.prototype.updateDB=function(t,e){var i=this.db.transaction([t],"readwrite").objectStore(t).put(e);return new Promise((function(t,e){i.onsuccess=function(e){t(e)},i.onerror=function(e){t(e)}}))},ho.prototype.deleteDB=function(t,e){var i=this.db.transaction([t],"readwrite").objectStore(t).delete(e);return new Promise((function(t,e){i.onsuccess=function(e){t(e)},i.onerror=function(e){t(e)}}))},ho.prototype.readAll=function(t,e){var i=this.db.transaction([t],"readwrite").objectStore(t),r=[];i.openCursor().onsuccess=function(t){var i=t.target.result;i?(r.push(i.key),i.continue()):e&&e(r)}},ho.prototype.clearStore=function(t){var e=this.db.transaction([t],"readwrite").objectStore(t);return new Promise((function(t,i){e.openCursor().onsuccess=function(e){var i=e.target.result;i&&(i.delete(),i.continue()),t(e)}}))},ho.prototype.deleteDBAll=function(){var t=window.indexedDB.deleteDatabase(this.dbName);return new Promise((function(e,i){t.onerror=function(t){},t.onsuccess=function(t){}}))},ho.prototype.closeDB=function(){this.db.close()};var po={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"lkmap logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},co=function(){this.X=0,this.Y=0};co.prototype.Size=function(){return Math.sqrt(this.X*this.X+this.Y*this.Y)},co.AngleBetween=function(t,e){return 180*co.RadBetween(t,e)/Math.PI},co.RadBetween=function(t,e){return Math.atan2(t.X*e.Y-t.Y*e.X,t.X*e.X+t.Y*e.Y)},co.MakeVector2=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=new co;return i.X=t,i.Y=e,i};var fo=function(){this.modelData=void 0};fo.prototype.parseModel=function(e,i,r){var o=this;t.parse(e,t.GLBLoader).then((function(e){o.modelData=new t.GLTFScenegraph(e),i(o)})).catch((function(t){r(t)}))};var mo=function(){this.X=0,this.Y=0,this.Z=0,this.W=1};mo.MakeQuat=function(t,e,i,r){return{X:t,Y:e,Z:i,W:r}};var yo=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.X=t,this.Y=e,this.Z=i};yo.prototype.Multiply=function(t){return yo.MakeVector3(this.X*t,this.Y*t,this.Z*t)},yo.prototype.Subtract=function(t){return yo.MakeVector3(this.X-t.X,this.Y-t.Y,this.Z-t.Z)},yo.prototype.Normalize=function(){var t=this.X*this.X+this.Y*this.Y+this.Z*this.Z;if(t>0){var e=1/Math.sqrt(t);this.X*=e,this.Y*=e,this.Z*=e}},yo.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.X=t[e],this.Y=t[e+1],this.Z=t[e+2],this},yo.prototype.ToLngLat=function(){return new t.LngLat(this.X,this.Y)},yo.prototype.ToVec3=function(){var e=t.create$2();return t.set(e,this.X,this.Y,this.Z),e},yo.prototype.set=function(t,e,i){return void 0===i&&(i=this.Z),this.X=t,this.Y=e,this.Z=i,this},yo.prototype.setScalar=function(t){return this.X=t,this.Y=t,this.X=t,this},yo.prototype.copy=function(t){return this.X=t.X,this.Y=t.Y,this.Z=t.Z,this},yo.prototype.applyMatrix4=function(t){var e=this.X,i=this.Y,r=this.Z,o=t[3]*e+t[7]*i+t[11]*r+t[15];return this.X=(t[0]*e+t[4]*i+t[8]*r+t[12])/(o=o||1),this.Y=(t[1]*e+t[5]*i+t[9]*r+t[13])/o,this.Z=(t[2]*e+t[6]*i+t[10]*r+t[14])/o,this},yo.prototype.min=function(t){return this.X=Math.min(this.X,t.X),this.Y=Math.min(this.Y,t.Y),this.Z=Math.min(this.Z,t.Z),this},yo.prototype.max=function(t){return this.X=Math.max(this.X,t.X),this.Y=Math.max(this.Y,t.Y),this.Z=Math.max(this.Z,t.Z),this},yo.FromLngLat=function(t){return yo.MakeVector3(t.lng,t.lat,0)},yo.FromMercator=function(t){return yo.MakeVector3(t.x,t.y,t.z)},yo.MakeVector3=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0);var r=new yo;return r.X=t,r.Y=e,r.Z=i,r},yo.MakeVector3One=function(){var t=new yo;return t.X=1,t.Y=1,t.Z=1,t};var go=function(t,e){void 0===t&&(t=new yo(1/0,1/0,1/0)),void 0===e&&(e=new yo(-1/0,-1/0,-1/0)),this.min=t,this.max=e};go.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},go.prototype.setFromArray=function(t){for(var e=1/0,i=1/0,r=1/0,o=-1/0,n=-1/0,a=-1/0,s=0,l=t.length;s<l;s+=3){var u=t[s],h=t[s+1],p=t[s+2];u<e&&(e=u),h<i&&(i=h),p<r&&(r=p),u>o&&(o=u),h>n&&(n=h),p>a&&(a=p)}return this.min.set(e,i,r),this.max.set(o,n,a),this},go.prototype.setFromBufferAttribute=function(t){for(var e=1/0,i=1/0,r=1/0,o=-1/0,n=-1/0,a=-1/0,s=0,l=t.count;s<l;s++){var u=t.getX(s),h=t.getY(s),p=t.getZ(s);u<e&&(e=u),h<i&&(i=h),p<r&&(r=p),u>o&&(o=u),h>n&&(n=h),p>a&&(a=p)}return this.min.set(e,i,r),this.max.set(o,n,a),this},go.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},go.prototype.setFromCenterAndSize=function(t,e){var i=vo.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},go.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},go.prototype.clone=function(){return(new this.constructor).copy(this)},go.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},go.prototype.makeEmpty=function(){return this.min.X=this.min.Y=this.min.Z=1/0,this.max.X=this.max.Y=this.max.Z=-1/0,this},go.prototype.isEmpty=function(){return this.max.X<this.min.X||this.max.Y<this.min.Y||this.max.Z<this.min.Z},go.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},go.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},go.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},go.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},go.prototype.containsPoint=function(t){return!(t.X<this.min.X||t.X>this.max.X||t.Y<this.min.Y||t.Y>this.max.Y||t.Z<this.min.Z||t.Z>this.max.Z)},go.prototype.containsBox=function(t){return this.min.X<=t.min.X&&t.max.X<=this.max.X&&this.min.Y<=t.min.Y&&t.max.Y<=this.max.Y&&this.min.Z<=t.min.Z&&t.max.Z<=this.max.Z},go.prototype.getParameter=function(t,e){return e.set((t.X-this.min.X)/(this.max.X-this.min.X),(t.Y-this.min.Y)/(this.max.Y-this.min.Y),(t.Z-this.min.Z)/(this.max.Z-this.min.Z))},go.prototype.intersectsBox=function(t){return!(t.max.X<this.min.X||t.min.X>this.max.X||t.max.Y<this.min.Y||t.min.Y>this.max.Y||t.max.Z<this.min.Z||t.min.Z>this.max.Z)},go.prototype.intersectsSphere=function(t){return this.clampPoint(t.center,vo),vo.distanceToSquared(t.center)<=t.radius*t.radius},go.prototype.intersectsPlane=function(t){var e,i;return t.normal.X>0?(e=t.normal.X*this.min.X,i=t.normal.X*this.max.X):(e=t.normal.X*this.max.X,i=t.normal.X*this.min.X),t.normal.Y>0?(e+=t.normal.Y*this.min.Y,i+=t.normal.Y*this.max.Y):(e+=t.normal.Y*this.max.Y,i+=t.normal.Y*this.min.Y),t.normal.Z>0?(e+=t.normal.Z*this.min.Z,i+=t.normal.Z*this.max.Z):(e+=t.normal.Z*this.max.Z,i+=t.normal.Z*this.min.Z),e<=-t.constant&&i>=-t.constant},go.prototype.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(So),Eo.subVectors(this.max,So),xo.subVectors(t.a,So),bo.subVectors(t.b,So),wo.subVectors(t.c,So),ko.subVectors(bo,xo),To.subVectors(wo,bo),Io.subVectors(xo,wo);var e=[0,-ko.Z,ko.Y,0,-To.Z,To.Y,0,-Io.Z,Io.Y,ko.Z,0,-ko.X,To.Z,0,-To.X,Io.Z,0,-Io.X,-ko.Y,ko.X,0,-To.Y,To.X,0,-Io.Y,Io.X,0];return!!Mo(e,xo,bo,wo,Eo)&&!!Mo(e=[1,0,0,0,1,0,0,0,1],xo,bo,wo,Eo)&&(Ao.crossVectors(ko,To),Mo(e=[_trianglenormal.X,_trianglenormal.Y,_trianglenormal.Z],xo,bo,wo,Eo))},go.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},go.prototype.distanceToPoint=function(t){return vo.copy(t).clamp(this.min,this.max).sub(t).length()},go.prototype.getBoundingSphere=function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(vo).length(),t},go.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},go.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},go.prototype.applyMatrix4=function(t){return this.isEmpty()||(_o[0].set(this.min.X,this.min.Y,this.min.Z).applyMatrix4(t),_o[1].set(this.min.X,this.min.Y,this.max.Z).applyMatrix4(t),_o[2].set(this.min.X,this.max.Y,this.min.Z).applyMatrix4(t),_o[3].set(this.min.X,this.max.Y,this.max.Z).applyMatrix4(t),_o[4].set(this.max.X,this.min.Y,this.min.Z).applyMatrix4(t),_o[5].set(this.max.X,this.min.Y,this.max.Z).applyMatrix4(t),_o[6].set(this.max.X,this.max.Y,this.min.Z).applyMatrix4(t),_o[7].set(this.max.X,this.max.Y,this.max.Z).applyMatrix4(t),this.setFromPoints(_o)),this},go.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},go.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},go.prototype.isBox3=!0;var _o=[new yo,new yo,new yo,new yo,new yo,new yo,new yo,new yo],vo=new yo;new go;var xo=new yo,bo=new yo,wo=new yo,ko=new yo,To=new yo,Io=new yo,So=new yo,Eo=new yo,Ao=new yo,Po=new yo;function Mo(t,e,i,r,o){for(var n=0,a=t.length-3;n<=a;n+=3){Po.fromArray(t,n);var s=o.x*Math.abs(Po.x)+o.y*Math.abs(Po.y)+o.z*Math.abs(Po.z),l=e.dot(Po),u=i.dot(Po),h=r.dot(Po);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>s)return!1}return!0}var Lo=function(){this.lkTypeName="SceneObject",this.lkTypeArray=[],this.box3d=new go};Lo.prototype.GetTypeName=function(){return this.lkTypeName},Lo.prototype.SetTypeName=function(t){this.lkTypeArray.push(this.lkTypeName),this.lkTypeName=t},Lo.prototype.IsType=function(t){return this.lkTypeName===t},Lo.prototype.IsSubTypeOf=function(t){if(this.lkTypeName===t)return!0;for(var e in this.lkTypeArray)if(this.lkTypeArray[e]===t)return!0;return!1};var Co=function(){this.bufferSize=0,this.elementCount=0,this.bufferData=void 0},Do=function(t){function e(){t.call(this),this.SetTypeName("SceneMaterial"),this.materialName=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Lo),zo=function(e){function i(){e.call(this),this.SetTypeName("SceneSegment"),this.indexBufferData=new Co,this.vertexBufferData=new Co,this.indexOffset=0,this.indexCount=0,this.bUploaded=!1,this.bDataInited=!1,this.segmentMaterial=void 0}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.DoUpload=function(t){},i.prototype.Upload=function(e){if(this.bDataInited&&!this.bUploaded&&void 0!==this.indexBufferData.bufferData){var i=new t.StructArrayLayout3ui6,r=this.indexBufferData.bufferData.byteOffset;i.arrayBuffer=this.indexBufferData.bufferData.buffer.slice(r,r+this.indexBufferData.bufferData.length),i._refreshViews(),this.indexBuffer=e.context.createIndexBuffer(i),this.segment=t.SegmentVector.simpleSegment(this.indexOffset,0,this.vertexBufferData.elementCount,this.indexCount/3),this.DoUpload(e),this.bUploaded=!0}},i}(Lo),Oo=function(t){function e(){t.call(this),this.SetTypeName("SceneMesh"),this.meshSegments=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.AddSegment=function(t){this.meshSegments.push(t)},e.prototype.Upload=function(t){for(var e in this.meshSegments)this.meshSegments[e].Upload(t)},e}(Lo),Ro=function(e){function i(){e.call(this),this.SetTypeName("SceneNode"),this.children=[],this.nodeMeshes=[],this.nodeQuat=new mo,this.nodeLocation=new yo,this.nodeScale=yo.MakeVector3One(),this.nodeName="",this.nodeMatrix=new Float64Array(16),t.identity(this.nodeMatrix)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.AddMesh=function(t){this.nodeMeshes.push(t)},i.prototype.AddChildNode=function(t){this.children.push(t)},i.prototype.Upload=function(t){for(var e in this.nodeMeshes)this.nodeMeshes[e].Upload(t);for(var i in this.children)this.children[i].Upload(t)},i.prototype.UpdateMatrix=function(){var e=t.create$3();t.set$1(e,this.nodeQuat.X,this.nodeQuat.Y,this.nodeQuat.Z,this.nodeQuat.W);var i=t.create$2();t.set(i,this.nodeLocation.X,this.nodeLocation.Y,this.nodeLocation.Z);var r=t.create$2();t.set(r,this.nodeScale.X,this.nodeScale.Y,this.nodeScale.Z),t.fromRotationTranslationScale(this.nodeMatrix,e,i,r)},i}(Lo),Bo=function(e){function i(){e.call(this),this.SetTypeName("SceneImage"),this.imageName="",this.image=void 0,this.bUploaded=!1,this.texture=void 0}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.Upload=function(e){if(!this.bUploaded&&null!=this.image){var i=e.context.gl;e.context.activeTexture.set(i.TEXTURE0),this.texture=new t.Texture(e.context,this.image,i.RGB),this.bUploaded=!0}return this.bUploaded},i}(Lo),Fo=function(){this.renderBuffers=[],this.newlyBuffers=[],this.projectMat=new Float64Array(16),this.viewMat=new Float64Array(16),this.projectViewMat=new Float64Array(16),this.modelMat=new Float64Array(16),t.identity(this.modelMat),this.modelMatQueue=[],this.heightScale=1,this._box3d=new go};Fo.prototype.InitRenderTree=function(){},Fo.prototype.Render=function(t){for(var e in this.IdentityModelMat(),this.renderBuffers)this.renderBuffers[e].Render(t,this)},Fo.prototype.IdentityModelMat=function(){this.modelMatQueue=[],t.identity(this.modelMat)},Fo.prototype.PopModelMat=function(){var e=this.modelMatQueue.pop();null!=e?this.modelMat=e:t.identity(this.modelMat)},Fo.prototype.PushModelMat=function(e){var i=new Float64Array(16);t.copy(i,this.modelMat),this.modelMatQueue.push(i),t.multiply(this.modelMat,this.modelMat,e)},Fo.prototype.UpdateBox=function(t){for(var e in this._box3d.makeEmpty(),this.renderBuffers){var i=this.renderBuffers[e];i.updateBox(t,this),this._box3d.union(i.box3d)}},Fo.prototype.UpdateMatrixes2=function(e){var i=e.transform,r=Math.PI/2+i._pitch,o=i._fov*(.5+i.centerOffset.y/i.height),n=Math.sin(o)*i.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-o,.01,Math.PI-.01)),a=1.01*(Math.cos(Math.PI/2-i._pitch)*n+i.cameraToCenterDistance),s=i.height/50,l=new Float64Array(16);t.perspective(l,i._fov,i.width/i.height,s,a),this.projectMat=l;var u=new Float64Array(16);t.identity(u),t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-i.cameraToCenterDistance]),t.rotateX(u,u,i._pitch),t.rotateZ(u,u,i.angle),this.viewMat=u;var h=new Float64Array(16);t.identity(h),t.multiply(h,this.projectMat,this.viewMat),this.projectViewMat=h},Fo.prototype.UpdateMatrixes=function(t){this.projectViewMat=t.transform.mercatorMatrix},Fo.prototype.UpdateRenderTree=function(t){if(this.UpdateMatrixes(t),this.newlyBuffers.length>0){for(var e in this.newlyBuffers)this.renderBuffers.push(this.newlyBuffers[e]);this.newlyBuffers=[]}for(var i in this.renderBuffers)this.renderBuffers[i].Upload(t)},Fo.prototype.AddRenderBuffer=function(t){this.newlyBuffers.push(t)},Fo.prototype.RemoveRenderBuffer=function(t){for(var e=-1,i=0;i<this.renderBuffers.length;++i)if(this.renderBuffers[i]===t){e=i;break}-1!=e&&this.renderBuffers.splice(e,1),e=-1;for(var r=0;r<this.newlyBuffers.length;++r)if(this.newlyBuffers[r]===t){e=r;break}-1!=e&&this.renderBuffers.splice(e,1)};var Uo=function(t){function e(){t.call(this),this.SetTypeName("SceneRenderBuffer"),this.bInited=!1,this.bUploaded=!1,this.bNodeUploaded=!1,this.rootNode=new Ro,this.rootNode.nodeName="BufferRootNode",this.meshes={},this.materials={},this.images={}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.Upload=function(t){if(this.bInited&&!this.bUploaded){this.bNodeUploaded||(this.rootNode.Upload(t),this.bNodeUploaded=!0);var e=!0;for(var i in this.images)this.images[i].Upload(t)||(e=!1);e&&(this.bUploaded=!0)}},e.prototype.Render=function(t,e){},e}(Lo),jo=function(){this.X=0,this.Y=0,this.Z=0,this.W=0};jo.MakeVector4=function(t,e,i,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),{X:t,Y:e,Z:i,W:r}},jo.GetArray=function(t){var e=new Float32Array(4);return e[0]=t.X,e[1]=t.Y,e[2]=t.Z,e[3]=t.W,e};var No=function(t){function e(){t.call(this),this.SetTypeName("SceneMaterialPBR"),this.bHasTexture=!1,this.bHasAlpha=!1,this.bGenShadow=!1,this.bAcceptShadow=!1,this.alpha=1,this.albedo=new jo,this.metallic=0,this.roughness=0,this.albedoImage=void 0,this.albedoTexture=void 0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Do),Vo=function(e){function i(){e.call(this),this.SetTypeName("SceneSegmentPBR")}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.DoUpload=function(e){if(this.vertexBufferData.bufferData){var i=new t.StructArrayLayout8f32,r=this.vertexBufferData.bufferData.byteOffset;i.arrayBuffer=this.vertexBufferData.bufferData.buffer.slice(r,r+this.vertexBufferData.bufferData.length),i._refreshViews(),this.vertexBuffer=e.context.createVertexBuffer(i,t.members)}},i}(zo),Go=function(e){function i(){e.call(this),this.SetTypeName("SceneRenderBufferPBR")}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.RenderSegment=function(e,i,r,o){if(o.bHasAlpha){if("opaque"===e.renderPass)return}else if("translucent"===e.renderPass)return;var n=e.useProgram("modelColor"),a=e.transform.pitch,s=e.transform.bearing*Math.PI/180,l=a*Math.PI/180,u=Math.sin(s),h=Math.cos(s),p=100;0!==a&&(p=1/Math.tan(l));var c=1e3/Math.sqrt(u*u+h*h+p*p),f=new Float32Array([u*c,h*c,p*c]),d=new Float32Array([0,0,1e4,-1e3,0,1e3,0,1e3,1e3,0,-1e3,1e3]),m=new Float32Array([50,50,50,10,10,10,10,10,10,10,10,10]),y=e.context,g=y.gl,_=e.style.map,v=null;_&&_.style._sky&&(v=_.getLayer("LK_SKY_layer"));var x=new t.DepthMode(g.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D),b=t.StencilMode.disabled,w=e.colorModeForRenderPass(),k=t.CullFaceMode.frontCCW,T=t.multiply([],i.projectViewMat,i.modelMat),I=t.create();t.identity(I),v&&(y.activeTexture.set(g.TEXTURE1),g.bindTexture(g.TEXTURE_CUBE_MAP,v.skyboxIrradianceTexture),y.activeTexture.set(g.TEXTURE2),g.bindTexture(g.TEXTURE_CUBE_MAP,v.skyboxPreFilteredTexture),y.activeTexture.set(g.TEXTURE3),g.bindTexture(g.TEXTURE_2D,v.skyboxBrdfTexture));var S=ii(T,I,1,f,jo.GetArray(o.albedo),o.metallic,o.roughness,d,m,1,2,3,1);n.draw(y,g.TRIANGLES,x,b,w,k,S,"SceneRenderBufferPBR",r.vertexBuffer,r.indexBuffer,r.segment)},i.prototype.RenderPBRNode=function(t,e,i){if(e.PushModelMat(i.nodeMatrix),"offscreen"!==t.renderPass){if("opaque"===t.renderPass||"translucent"===t.renderPass)for(var r in i.nodeMeshes){var o=i.nodeMeshes[r];for(var n in o.meshSegments){var a=o.meshSegments[n];a.IsSubTypeOf("SceneSegmentPBR")&&void 0!==a.segmentMaterial&&a.segmentMaterial.IsSubTypeOf("SceneMaterialPBR")&&this.RenderSegment(t,e,a,a.segmentMaterial)}}for(var s in i.children)this.RenderPBRNode(t,e,i.children[s]);e.PopModelMat()}},i.prototype.getLngLatBounds=function(){return new t.LngLatBounds},i.prototype.updateBoxNode=function(t,e,i){for(var r in e.PushModelMat(i.nodeMatrix),i.box3d.makeEmpty(),i.nodeMeshes){var o=i.nodeMeshes[r];for(var n in o.box3d.makeEmpty(),o.meshSegments)o.box3d.union(o.meshSegments[n].box3d);o.box3d.applyMatrix4(e.modelMat),i.box3d.union(o.box3d)}for(var a in i.children)this.updateBoxNode(t,e,i.children[a]),i.box3d.union(i.children[a].box3d);e.PopModelMat(),this.box3d.union(i.box3d)},i.prototype.updateBox=function(t,e,i){this.box3d.makeEmpty(),this.updateBoxNode(t,e,this.rootNode)},i.prototype.Render=function(t,i){e.prototype.Render.call(this,t,i),this.RenderPBRNode(t,i,this.rootNode)},i}(Uo);function Zo(t,e){var i=1;return"VEC2"===e?i=2:"VEC3"===e?i=3:"VEC4"===e&&(i=4),qo(t)*i}function qo(t){return 5120===t||5121===t?1:5122===t||5123===t?2:5124===t||5125===t||5126===t?4:5130===t?8:2}function Xo(t,e,i,r){var o=r.getBufferView(t),n=r.gltf.binChunks[o.buffer];return new Float32Array(n.arrayBuffer,(o.byteOffset||0)+n.byteOffset+e,i/4)}function Wo(e,i,r,o){var n=i.materials[r];if(void 0===n){var a=e.getMaterial(r),s=new No;if(s.materialName=a.name,o.segmentMaterial=s,"BLEND"===a.alphaMode&&(s.bHasAlpha=!0),void 0!==a.pbrMetallicRoughness){if(void 0!==a.pbrMetallicRoughness.baseColorTexture){s.bHasTexture=!0;var l=a.pbrMetallicRoughness.baseColorTexture.index,u=i.images[l];if(void 0!==u)s.albedoImage=u;else{var h=e.getTexture(l),p=e.getImage(h.source),c=e.getBufferView(p.bufferView),f=e.getBuffer(c.buffer),d=e.gltf.binChunks[c.buffer];if((u=new Bo).imageName=p.name,i.images[l]=u,f.byteLength===d.byteLength){var m=new Uint8Array(d.arrayBuffer,c.byteOffset+d.byteOffset,c.byteLength);t.ImageLoader.parse(m).then((function(t){u.image=t})).catch((function(t){}))}}}else if(void 0!==a.pbrMetallicRoughness.baseColorFactor){var y=a.pbrMetallicRoughness.baseColorFactor;s.albedo=jo.MakeVector4(y[0],y[1],y[2],y[3])}else s.albedo=jo.MakeVector4(1,0,0,1);s.roughness=void 0!==a.pbrMetallicRoughness.roughnessFactor?a.pbrMetallicRoughness.roughnessFactor:.5,s.metallic=void 0!==a.pbrMetallicRoughness.metallic?a.pbrMetallicRoughness.metallic:.5}else s.albedo=jo.MakeVector4(1,0,0,1),s.metallic=.92,s.roughness=.1}else o.segmentMaterial=n}function Ho(t,e,i,r){var o=t.getAccessor(i),n=o.count,a=qo(o.componentType),s=function(t,e,i,r){var o=r.getBufferView(t),n=r.gltf.binChunks[o.buffer];return new Uint8Array(n.arrayBuffer,(o.byteOffset||0)+n.byteOffset+e,i)}(o.bufferView,void 0===o.byteOffset?0:o.byteOffset,n*a,t);r.indexBufferData.bufferData=s,r.indexBufferData.bufferSize=s.byteLength,r.indexBufferData.elementCount=n,r.indexCount=n}function Yo(t,e,i,r){if(void 0!==i.POSITION){var o=!1,n=!1;void 0===i.NORMAL&&(o=!0),void 0===i.TEXCOORD_0&&(n=!0);var a=t.getAccessor(i.POSITION);r.box3d.set((new yo).fromArray(a.min),(new yo).fromArray(a.max));var s=Zo(a.componentType,a.type),l=a.count,u=Xo(a.bufferView,void 0===a.byteOffset?0:a.byteOffset,l*s,t),h=void 0;if(!o){var p=t.getAccessor(i.NORMAL),c=Zo(p.componentType,p.type);h=Xo(p.bufferView,void 0===p.byteOffset?0:p.byteOffset,l*c,t)}var f=void 0;if(!n){var d=t.getAccessor(i.TEXCOORD_0),m=Zo(d.componentType,d.type);f=Xo(d.bufferView,void 0===d.byteOffset?0:d.byteOffset,l*m,t)}for(var y=new Float32Array(8*l),g=0;g<l;g++)y[8*g]=u[3*g],y[8*g+1]=u[3*g+1],y[8*g+2]=u[3*g+2],void 0!==h?(y[8*g+3]=h[3*g],y[8*g+4]=h[3*g+1],y[8*g+5]=h[3*g+2]):(y[8*g+3]=0,y[8*g+4]=0,y[8*g+5]=1),null!=f?(y[8*g+6]=f[2*g],y[8*g+7]=f[2*g+1]):(y[8*g+6]=0,y[8*g+7]=0);var _=32*l;r.vertexBufferData.bufferData=new Uint8Array(y.buffer),r.vertexBufferData.bufferSize=_,r.vertexBufferData.elementCount=l}}function Ko(t,e,i,r){var o=t.getNode(i),n=new Ro;if(r.AddChildNode(n),void 0!==o.name&&(n.nodeName=o.name),void 0!==o.rotation&&(n.nodeQuat=mo.MakeQuat(o.rotation[0],o.rotation[1],o.rotation[2],o.rotation[3])),void 0!==o.translation&&(n.nodeLocation=yo.MakeVector3(o.translation[0],o.translation[1],o.translation[2])),void 0!==o.scale&&(n.nodeScale=yo.MakeVector3(o.scale[0],o.scale[1],o.scale[2])),n.UpdateMatrix(),void 0!==o.mesh&&function(t,e,i,r){var o=e.meshes[i];if(void 0===o){var n=t.getMesh(i);for(var a in o=new Oo,r.AddMesh(o),e.meshes[i]=o,n.primitives){var s=new Vo;o.AddSegment(s);var l=n.primitives[a];Wo(t,e,l.material,s),Ho(t,0,l.indices,s),Yo(t,0,l.attributes,s),s.bDataInited=!0}}else r.AddMesh(o)}(t,e,o.mesh,n),void 0!==o.children)for(var a in o.children)Ko(t,e,o.children[a],n)}var Jo=function(t,e){void 0===t&&(t=36),void 0===e&&(e=36),this.width=t,this.height=e,this.init()};Jo.prototype.init=function(){return{width:this.width,height:this.height}},Jo.prototype.getWidth=function(){return this.width},Jo.prototype.getHeight=function(){return this.height},Jo.prototype.equals=function(t){var e=!1;return t.width==this.width&&t.height==this.height&&(e=!0),e},Jo.prototype.toString=function(){return this.width+","+this.height};var Qo=function(t){function e(e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.x=e,this.y=i,t.call(this,e,i),this.init()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.init=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.equals=function(t){var e=!1;return t.x==this.x&&t.y==this.y&&(e=!0),e},e.prototype.toString=function(){return this.x+","+this.y},e}(t.pointGeometry),$o=function(t,e){if(t instanceof Array?(this.southwest={lng:t[0],lat:t[1]},this.northeast={lng:e[0],lat:e[1]},this._sw={lng:t[0],lat:t[1]},this._ne={lng:e[0],lat:e[1]}):(this.southwest=t,this.northeast=e,this._sw=t,this._ne=e),i)return new i.LngLatBounds(this.southwest,this.northeast)};$o.prototype.getSouthWest=function(){return this.southwest},$o.prototype.getNorthEast=function(){return this.northeast},$o.prototype.toString=function(){return this.southwest.lng+","+this.southwest.lat+";"+this.northeast.lng+","+this.northeast.lat},$o.prototype.getCenter=function(){return{lng:(this.southwest.lng+this.northeast.lng)/2,lat:(this.southwest.lat+this.northeast.lat)/2}};var tn=function(t){this.options=t,this.size=t.size||{width:36,height:36},this.image=t.image||"",this.imageSize=t.imageSize,this.imageOffset=t.imageOffset,this.init()};tn.prototype.init=function(){this.createDiv(),this.options.style&&this.setStyle(this.options.style)},tn.prototype.createDiv=function(){return this.element=document.createElement("div"),this.element.className="lkmapMarker",this.element.style["background-size"]="cover",this.element.style.width=this.size.width+"px",this.element.style.height=this.size.height+"px",this._iconDom=this.createImg(),this.element.appendChild(this._iconDom),this.element},tn.prototype.getElement=function(){var t=this.createDiv();return this.options.style&&this.setStyle(this.options.style),t},tn.prototype.setStyle=function(t){if(t&&!(t instanceof Array)||Object.keys(t).length<0)for(var e in t)this._iconDom.style[e]=t[e]},tn.prototype.getImageSize=function(){return this.imageSize},tn.prototype.setImageSize=function(t){this.imageSize=this.options.imageSize=imageSize,this.elementImg.style.width=this.imageSize.width+"px",this.elementImg.style.height=this.imageSize.height+"px"},tn.prototype.getSize=function(){return this.size},tn.prototype.setSize=function(t){this.size=this.options.sieze=t,this.element.style.width=this.size.width+"px",this.element.style.height=this.size.height+"px",this.imageSize||(this.elementImg.style.width=this.size.width+"px",this.elementImg.style.height=this.size.height+"px")},tn.prototype.setImageOffset=function(t){void 0===t&&(t={x:0,y:0}),this.imageOffset=this.options.imageOffset=t,this.elementImg.style.left=this.imageOffset.x+"px",this.elementImg.style.top=this.imageOffset.y+"px",this.imageBox.style.top=this.imageOffset.y+"px",this.imageBox.style.left=this.imageOffset.x+"px"},tn.prototype.getImageOffset=function(){return this.options.imageOffset},tn.prototype.createImg=function(){var t=document.createElement("div");return t.className="lkmap-marker-icon",this.elementImg=document.createElement("img"),this.imageBox=document.createElement("div"),this.imageBox.className="marker-img-box",this.imageBox.style.width="100%",this.imageBox.style.height="100%",this.elementImg.className="marker-img",this.elementImg.src=this.image,this.imageSize&&this.imageSize.width&&(this.elementImg.style.width=this.imageSize.width+"px"),this.imageSize&&this.imageSize.height&&(this.elementImg.style.height=this.imageSize.height+"px"),this.imageOffset&&this.imageOffset.x&&(this.elementImg.style.left=this.imageOffset.x+"px",this.imageBox.style.left=this.imageOffset.x+"px"),this.imageOffset&&this.imageOffset.y&&(this.elementImg.style.top=this.imageOffset.y+"px",this.imageBox.style.top=this.imageOffset.y+"px"),this.elementImg.style.display="block",this.elementImg.style.marginLeft="-1px",t.appendChild(this.elementImg),t.appendChild(this.imageBox),t},tn.prototype.setOptions=function(t){t.image&&this.setImage(t.image),t.imageSize&&this.setSize(t.imageSize),t.size&&this.setSize(t.size),t.imageOffset&&this.setImageOffset(t.imageOffset)},tn.prototype.getOptions=function(){return this.options},tn.prototype.setImage=function(t){void 0===t&&(t=""),this.image=this.options.image=t,this.elementImg.src=this.image},tn.prototype.getImage=function(){return this.options.image};var en={center:[116.39636259768668,39.907768102373495],strokeColor:"#0037e4",strokeOpacity:1,strokeWeight:0,strokeImage:"",fillColor:"#0037e4",fillOpacity:1,fillImage:"",visible:!0,strokeStyle:"solid",strokeDasharray:[2,2],zIndex:50,beforeId:""},rn=function(e,i){this.options=t.extend(Object.create(en),e),this.id=null,this.geojson={},this.type="polygon",e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),this._layers={one:"",two:""},t.bindAll(["setMap","on","off","show","hide","setOptions","getOptions","getId","getPath","setPath","getBounds","getArea","_addLayer","_addFillImage","setFillImage","_addStrokeImage","setStrokeImage","_creatLineGeoJson","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","_setMapCheck"],this),this._timeout=null,this._interval=null,this.init()};rn.prototype.init=function(){this.createGeojson()},rn.prototype.setExtData=function(t){this.extData=this.options.extData=t},rn.prototype.getExtData=function(){return this.extData||this.options.extData},rn.prototype.getPath=function(t){return void 0===t&&(t=null),"all"==t?this.getLngLat():this.options.path},rn.prototype.setPath=function(e){if(e instanceof Array){this.options.path=e;var i=[[this.options.path]];if(1==e.length||2==e.length){var r=t.multiPolygon(i=[this.options.path]),o=t.flatten(r);this.geojson.source.data=o,this._map.getSource(this.id)&&this._map.getSource(this.id).setData(this.geojson.source.data),this.options.strokeWeight>0&&this._map.getSource(this.id)&&(this.lineGeojson.source=this.geojson.source,this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data))}else r=t.multiPolygon(i),o=t.flatten(r),this.geojson.source.data=o,this._map.getSource(this.id)&&this._map.getSource(this.id).setData(this.geojson.source.data),this.options.strokeWeight>0&&(this.lineGeojson.source={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}},this._map.getSource(this.lineGeojson.id)&&this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data))}},rn.prototype.getLngLat=function(){return 1==this.options.path.length?this.options.path[0]:2==this.options.path.length?this.options.path[0].concat(this.options.path[1]):this.options.path},rn.prototype.getBounds=function(){return this.getNewBounds(this.getLngLat())},rn.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},rn.prototype.isPointInRing=function(e,i){var r;r=t.point(e instanceof Array?e:[e.lng,e.lat]);var o=t.polygon([i]);return t.booleanPointInPolygon(r,o)},rn.prototype.getArea=function(){return this.ringArea()},rn.prototype.ringArea=function(){var e=this.options.path;if(1==e.length){var i=t.polygon(e),r=t.area$1(i);return Math.round(r)}if(2==e.length){var o=t.polygon([e[0]]),n=t.area$1(o),a=Math.round(n),s=t.polygon([e[1]]),l=t.area$1(s),u=Math.round(l);return a>u?a-u:u-a}return i=t.polygon([e]),r=t.area$1(i),Math.round(r)},rn.prototype.getNewBounds=function(t){var e=200,i=200,r=0,o=0;for(var n in t)t[n][0]>r&&(r=t[n][0]),t[n][0]<e&&(e=t[n][0]),t[n][1]>o&&(o=t[n][1]),t[n][1]<i&&(i=t[n][1]);return new $o([e,i],[r,o])},rn.prototype.createGeojson=function(){var e=[[this.options.path]];1!=this.options.path.length&&2!=this.options.path.length||(e=[this.options.path]);var i=t.multiPolygon(e),r=t.flatten(i);this.type="polygon",this.id=this.geojson.id="custom_polygon_"+t.getRandomId(),this.geojson.type="fill",this.geojson.source={type:"geojson",data:r},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"fill-color":this.options.fillColor,"fill-opacity":this.options.fillOpacity,"fill-antialias":!0},this._creatLineGeoJson(),this._map&&this.setMap(this._map,this.options.beforeId)},rn.prototype._creatLineGeoJson=function(){this.lineBorderSource=JSON.parse(JSON.stringify(this.geojson.source)),this.options.path.length>2&&2==this.options.path[1].length&&(this.lineBorderSource={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:this.lineBorderSource.data.features[0].geometry.coordinates[0]}}}),this.lineGeojson={id:"custom_polygon_border_"+t.getRandomId(),type:"line",source:this.lineBorderSource,layout:{visibility:this.options.visible?"visible":"none"},paint:{"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity}},"dashed"==this.options.strokeStyle&&(this.lineGeojson.paint["line-dasharray"]=this.options.strokeDasharray)},rn.prototype.getId=function(){return this.id},rn.prototype.remove=function(){this._map&&(this._map.getLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id),this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this._layers={one:"",two:""})},rn.prototype._addFillImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.fillImage&&(this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,r){t||(i._map.addImage(i.fillImageName,r),i.geojson.paint["fill-pattern"]=i.fillImageName,""==e&&i._addLayer())})))},rn.prototype.setFillImage=function(e){var i=this;e?(this.options.fillImage=e,this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,e){t||(i._map.addImage(i.fillImageName,e),i._map.setPaintProperty(i.id,"fill-pattern",i.fillImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.id,"fill-pattern",null)},rn.prototype._addStrokeImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.strokeImage&&(this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,r){t||(i._map.addImage(i.strokeImageName,r),i.lineGeojson.paint["line-pattern"]=i.strokeImageName,""==e&&i._addLayer())})))},rn.prototype.setStrokeImage=function(e){var i=this;e?(this.options.strokeImage=e,this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.lineGeojson.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.lineGeojson.id,"line-pattern",null)},rn.prototype.setMap=function(t,e){var i=this;void 0===e&&(e=""),t?(e&&(this.options.beforeId=e),this._map=t,this._map._loaded?this._setMapCheck():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i._setMapCheck())}),10))):this._map&&this.remove()},rn.prototype._setMapCheck=function(){""==this.options.fillImage&&""==this.options.strokeImage?this._addLayer():""!=this.options.fillImage&&""!=this.options.strokeImage?(this._addFillImage("add"),this._addStrokeImage()):""!=this.options.fillImage?this._addFillImage():""!=this.options.strokeImage&&this._addStrokeImage()},rn.prototype._addLayer=function(){this._layers={one:this.id,two:this.lineGeojson.id},this._map.addLayer(this,this.options.beforeId,this.options.zIndex),this._map.addLayer(this.lineGeojson,this.options.beforeId,this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},rn.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},rn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},rn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},rn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},rn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},rn.prototype.setOptions=function(t){(t.fillImage||""==t.fillImage)&&this.setFillImage(t.fillImage),(t.strokeImage||""==t.strokeImage)&&this.setStrokeImage(t.strokeImage),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var e={fillColor:"fill-color",fillOpacity:"fill-opacity"},i=Object.keys(e),r={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity"},o=Object.keys(r),n=this._map.getLayer(this.id);for(var a in t)this.options[a]=t[a],n&&(i.indexOf(a)>=0&&this._map.setPaintProperty(this.id,e[a],t[a]),o.indexOf(a)>=0&&this._map.setPaintProperty(this.lineGeojson.id,r[a],t[a]));n&&("dashed"==t.strokeStyle?this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",null),t.path&&this.setPath(t.path),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor(t.cursor)),t.map&&this.setMap(t.map)},rn.prototype.getOptions=function(){return this.options},rn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},rn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},rn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},rn.prototype.getzIndex=function(){return this.options.zIndex};var on={id:"",model:"https://maph.luokuang.com/api/Map/gltf/supercar.glb",position:[116.39751541617153,39.90768542687843],height:0,vehicleHeight:0,visible:!0,layer:null,extData:null,rotation:0,deltaRotation:0,relativeScale:1,relativeMode:!1},nn=function(e){function i(i,r){e.call(this),this.options=t.extend(Object.create(on),r),this.type="Model",t.bindAll(["_update","_onMove","_onUp","_addDragHandler","setPosition","setCarPosition","setHeight","fillRenderBuffer","SetTypeName","_update","IsModelReady","getPosition","show","hide","remove","getHeight","setRotation","getRotation","Render2","setExtData","getExtData","Render"],this),0==this.options.id.length&&(this.options.id="LKCar_"+t.getRandomId()),this._layer=this.options.layer?this.options.layer:null,this._models=this.options.models?this.options.models:[],this.extData=this.options.extData?this.options.extData:null,this._map=i,this.id=this.options.id,this.SetTypeName("Model"),this.tracked=!1,this.carPosition=new yo,this.carFront=new yo(0,-1,0),this.relativeScale=this.options.relativeScale?this.options.relativeScale:1,this.setRotation(this.options.rotation),this.carScale=1,this.carBaseScale=.24,this.carBaseHeight=.2,this.carBaseYaw=-6*Math.PI/180,this.carMatrix=new Float64Array(16),t.identity(this.carMatrix),this.carVisable=!1,this.status=0,"string"!=typeof r.model?this.fillRenderBuffer(r.model):"string"==typeof r.model&&(this.url=r.model),this.setPosition(this.options.position),this.setHeight(this.options.height),this.options.visible?this.show():this.hide(),this.relativeMode=!!this.options.relativeMode&&this.options.relativeMode}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.setExtData=function(t){this.extData=this.options.extData=t},i.prototype.getExtData=function(){return this.extData||this.options.extData},i.prototype._update=function(){this._map.triggerRepaint()},i.prototype.IsModelReady=function(){return 1===this.status},i.prototype.fillRenderBuffer=function(t){this.status=1,function(t,e){if(void 0!==e.modelData){var i=e.modelData.getScene(0);for(var r in i.nodes)Ko(e.modelData,t,i.nodes[r],t.rootNode);t.bInited=!0}}(this,t),this._map._triggerFrame(!0)},i.prototype.setCarPosition=function(t){var e=this;this.carPosition=t,this._layer&&(this._layer.setPosition([this.carPosition.X,this.carPosition.Y]),this._layer.setHeight(this.carPosition.Z+this.options.vehicleHeight)),this._models.forEach((function(t){"Group"==t.type&&t.setPosition([e.carPosition.X,e.carPosition.Y,e.carPosition.Z])})),this._map._triggerFrame(!0)},i.prototype.setPosition=function(e){var i=this;this.options.position=e,e instanceof t.LngLat?(this.carPosition.X=e.lng,this.carPosition.Y=e.lat):e instanceof Array&&(this.carPosition.X=e[0],this.carPosition.Y=e[1]),this._models.forEach((function(t){"Group"==t.type&&t.setPosition([i.carPosition.X,i.carPosition.Y,i.carPosition.Z])})),this._update(),this._layer&&this._layer.setPosition(e)},i.prototype.getPosition=function(){return new t.LngLat(this.carPosition.X,this.carPosition.Y)},i.prototype.show=function(){this.carVisable=!0,this._update(),this._layer&&this._layer.show()},i.prototype.hide=function(){this.carVisable=!1,this._update(),this._layer&&this._layer.hide()},i.prototype.remove=function(){this._layer&&this._layer.remove()},i.prototype.setHeight=function(t){var e=this;this.carPosition.Z=t,this._models.forEach((function(t){"Group"==t.type&&t.setPosition([e.carPosition.X,e.carPosition.Y,e.carPosition.Z])})),this._update(),this._layer&&this._layer.setHeight(t+this.options.vehicleHeight)},i.prototype.getHeight=function(){return this.carPosition.Z},i.prototype.setRotation=function(t){var e=Math.PI*-(t+this.options.deltaRotation)/180;this.carFront.X=Math.cos(e),this.carFront.Y=Math.sin(e),this._update(),this.options.rotation=t},i.prototype.getRotation=function(){return 180*-Math.atan2(this.carFront.Y,this.carFront.X)/Math.PI-this.options.deltaRotation},i.prototype.updateBox=function(t,i){i.PushModelMat(this.carMatrix),e.prototype.updateBox.call(this,t,i),i.PopModelMat()},i.prototype.Render=function(i,r){if(this.carVisable&&1===this.status){var o=this.carPosition.ToLngLat(),n=t.MercatorCoordinate.fromLngLat(o,this.carPosition.Z),a=n.meterInMercatorCoordinateUnits(),s=new Float64Array(16);t.identity(s);var l=new Float64Array(3);if(this.relativeMode){var u=this.relativeScale/i.transform.pixelsPerMeter;u>1&&(a*=u)}t.set(l,n.x,n.y,n.z),t.translate(s,s,l);var h=new Float64Array(3);t.set(h,a,a,a),t.scale(s,s,h),t.rotateX(s,s,Math.PI/2);var p=co.MakeVector2(this.carFront.X,this.carFront.Y),c=Math.atan2(p.X,p.Y);c=1.035*Math.PI+this.carBaseYaw-c,t.rotateY(s,s,c),t.copy(this.carMatrix,s),r.PushModelMat(this.carMatrix),e.prototype.Render.call(this,i,r),r.PopModelMat()}},i}(Go),an=function(t){this._naviPath=t,this._pathInfo=[],this._total=0};an.prototype.calculation=function(){if(this._pathInfo=[],this._total=0,this._naviPath&&!(this._naviPath.length<2))for(var e,i=0;i<this._naviPath.length-1;++i){var r=new t.LngLat(this._naviPath[i].x,this._naviPath[i].y),o=new t.LngLat(this._naviPath[i+1].x,this._naviPath[i+1].y),n=o.distance(r);this._total=this._total+n,e=yo.FromMercator(t.MercatorCoordinate.fromLngLat(r,0));var a=yo.FromMercator(t.MercatorCoordinate.fromLngLat(o,0)).Subtract(e);a.Normalize(),this._pathInfo.push({seg:n,start:yo.MakeVector3(r.lng,r.lat,this._naviPath[i].z),end:yo.MakeVector3(o.lng,o.lat,this._naviPath[i+1].z),vec:a})}},an.prototype.getNaviPathInfo=function(t){if(0===this._total||t<0)return null;for(var e=0,i=0;i<this._pathInfo.length;++i)if(t<=(e+=this._pathInfo[i].seg)){var r=(e-t)/this._pathInfo[i].seg,o=new yo;return o.X=this._pathInfo[i].start.X*r+this._pathInfo[i].end.X*(1-r),o.Y=this._pathInfo[i].start.Y*r+this._pathInfo[i].end.Y*(1-r),o.Z=this._pathInfo[i].start.Z*r+this._pathInfo[i].end.Z*(1-r),{sucessed:!0,isEnd:!1,pos:o,vec:this._pathInfo[i].vec}}return{sucessed:!0,isEnd:!0,pos:this._pathInfo[this._pathInfo.length-1].end,vec:this._pathInfo[this._pathInfo.length-1].vec}};var sn=function(t){this.naviMgr=t,this.naviPath=[],this.EARTH_RADIUS=6371137,this.desIndex=0,this.lineLength=0,this.lastTime=0,this.curTime=0,this.curPosition=new yo,this.curFront=new yo,this.pathLinePoints=[],this.bPlayEnd=!1,this.bHasData=!1,this.bRunning=!1,this.startTime=new Date,this.speed=20,this.mapLastUpdateTime=0,this.mapUpdateDelta=1},ln={Running:{configurable:!0}};sn.prototype.StartSim=function(){this.startTime=new Date,this.curTime=this.startTime.getTime(),this.lastTime=this.startTime.getTime(),this.bRunning=!0},sn.prototype.init=function(t){this.options=t,this.setPath(this.options.path),t.speed&&this.setSpeed(t.speed),t.time&&(this.speed=this.pathInfo._total/t.time)},sn.prototype.EndSim=function(){this.bRunning=!1},sn.prototype.setSpeed=function(t){this.options.speed=t,this.speed=1e3*t/3600},sn.prototype.getSpeed=function(){return this.options.speed},sn.prototype.setPath=function(t){this.ClearData(),this.options.path=t,this._updatePath()},sn.prototype.getPath=function(){return this.options.path},sn.prototype.setStartIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.startIndex=t,this._updatePath()},sn.prototype.setEndIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.endIndex=t,this._updatePath()},sn.prototype.getStartIndex=function(){return this.options.startIndex},sn.prototype.getEndIndex=function(){return this.options.endIndex},sn.prototype._updatePath=function(){this.naviPath=this._getNaviPath(),this.pathInfo=new an(this.naviPath),this.pathInfo.calculation(),this.lineLength=0,this.bHasData=!0},sn.prototype._getNaviPath=function(){var t=[],e=0;this.options.startIndex&&(e=this.options.startIndex);var i=this.options.path.length;this.options.endIndex&&(i=this.options.endIndex);for(var r=e;r<i;++r)t.push(this.options.path[r]);return t},sn.prototype.UpdataCar=function(t){t.setCarPosition(this.curPosition),t.carFront=this.curFront},sn.prototype.Tick=function(){if(this.bHasData&&this.bRunning){var t=new Date;this.curTime=t.getTime();var e=(this.curTime-this.lastTime)/1e3;this.lastTime=this.curTime,(this.curTime-this.mapLastUpdateTime)/1e3>this.mapUpdateDelta&&(this.mapLastUpdateTime=this.curTime,this.naviMgr.sceneMgr.UpdateMap()),this.lineLength=this.lineLength+e*this.speed;var i=this.pathInfo.getNaviPathInfo(this.lineLength);i&&i.sucessed&&(this.curFront=i.vec,this.curPosition=i.pos,i.isEnd&&(this.Running=!1))}},ln.Running.set=function(t){this.bRunning=t,this.bRunning||this.naviMgr._eventCallback("traceEnd")},sn.prototype.ClearData=function(){this.naviPath=[],this.lineLength=0,this.mapLastUpdateTime=0,this.curPosition=new yo,this.curFront=new yo,this.pathLinePoints=[],this.bPlayEnd=!1,this.bHasData=!1},sn.prototype.IsEnded=function(){return this.bPlayEnd},sn.prototype.HasData=function(){return this.bHasData},sn.prototype.HaverSin=function(t){var e=Math.sin(t/2);return e*e},sn.prototype.EarthDistance=function(t,e){var i=t.Y,r=t.X,o=e.Y,n=e.X;i=this.ConvertDegreesToRadians(i),r=this.ConvertDegreesToRadians(r),o=this.ConvertDegreesToRadians(o),n=this.ConvertDegreesToRadians(n);var a=Math.abs(r-n),s=Math.abs(i-o),l=this.HaverSin(s)+Math.cos(i)*Math.cos(o)*this.HaverSin(a);return 2*this.EARTH_RADIUS*Math.asin(Math.sqrt(l))},sn.prototype.ConvertDegreesToRadians=function(t){return t*Math.PI/180},Object.defineProperties(sn.prototype,ln);var un=function(e){function i(t,i){e.call(this),this._map=i,this.sceneMgr=t,this.carRenderBuffer=void 0,this.naviRunning=!1,this.naviStop=!0,this.naviSim=new sn(this)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.InitNavi=function(){},i.prototype.init=function(e,i){this.naviSim.init(i),this.carRenderBuffer=e,this.naviRunning=!1,this.naviStop=!0,this.offset=i.offset?t.pointGeometry.convert(i.offset):null},i.prototype.setModel=function(t){t&&(this.carRenderBuffer=t)},i.prototype.StartNavi=function(t,e,i,r){},i.prototype.start=function(){this.naviRunning=!0,this.naviStop=!1,this.naviSim.StartSim(),this.sceneMgr.mapInst._triggerFrame(!0),this.sceneMgr.mapInst._updateMapMovestartEvent(),this._eventCallback("traceStart")},i.prototype.stop=function(){this.naviRunning=!1,this.naviStop=!0,this.sceneMgr.mapInst._updateMapMoveendEvent(),this._eventCallback("traceStop")},i.prototype.isRunning=function(){return this.naviRunning},i.prototype.isStop=function(){return this.naviStop},i.prototype.setNaviSpeed=function(t){this.naviSim.setSpeed(t)},i.prototype.setSpeed=function(t){this.naviSim.setSpeed(t)},i.prototype.getSpeed=function(){return this.naviSim.getSpeed()},i.prototype.setPathData=function(t){this.naviSim.setPath(t)},i.prototype.getPathData=function(){return this.naviSim.getPath()},i.prototype.setStartIndex=function(t){void 0===t&&(t=0),this.naviSim.setStartIndex(t)},i.prototype.setEndIndex=function(t){void 0===t&&(t=0),this.naviSim.setEndIndex(t)},i.prototype.getStartIndex=function(){return this.naviSim.getStartIndex()},i.prototype.getEndIndex=function(){return this.naviSim.getEndIndex()},i.prototype.UpdateNavi=function(t,e){this.naviRunning&&this.naviSim.HasData()&&(this.naviSim.Tick(),this.naviSim.bRunning&&null!==this.carRenderBuffer&&(e&&(t.transform._isTrackModeUpdate=!0,t.transform.center=this.naviSim.curPosition.ToLngLat(),t.transform._isTrackModeUpdate=!1),this.naviSim.UpdataCar(this.carRenderBuffer),this.sceneMgr.mapInst._updateMapMoveEvent(),this._eventCallback("trace")))},i.prototype._eventCallback=function(e,i){void 0===e&&(e=""),void 0===i&&(i={}),i.type=e,i.target=this,i.speed=this.naviSim.options.speed,this.carRenderBuffer&&(i.model=this.carRenderBuffer),this.fire(new t.Event(e,i))},i}(t.Evented),hn=function(e){this.mapInst=e,this.naviMgr=new un(this,e),this.renderTree=new Fo,this.bHasAnim=!1,this.defaultModelUrl="https://maph.luokuang.com/api/Map/gltf/supercar.glb",this.models=new Map,this.result=[],this.modelDataCache=new Map,this.layerId="SceneMgr_"+t.getRandomId(),this._debug=!1,t.bindAll(["onMapClick"],this),this.mapInst.on("click",this.onMapClick)};hn.prototype.getNaviMgr=function(){return this.naviMgr||(this.naviMgr=new un(this,this.mapInst)),this.naviMgr},hn.prototype.UpdateMap=function(){return this.mapInst.style._updateSources(this.mapInst.transform),!0},hn.prototype.setTrackedModel=function(t){this._tracked=t},hn.prototype.addModel=function(e){var i=this,r=null;if(this.models.has(e.id))r=this.models.get(e.id);else{var o=null;if(r=new nn(this.mapInst,e),"string"==typeof e.model)if(this.modelDataCache.has(e.model))o=this.modelDataCache.get(e.model),r.fillRenderBuffer(o);else{var n=e.model;(function(e){return new Promise((function(i,r){try{!function(e,i,r){var o=new t.window.AbortController,n=new t.window.Request(e,{method:"GET",body:void 0,credentials:"include",headers:{},referrer:t.getReferrer(),signal:o.signal});n.headers.set("Accept","*/*"),function(i,r){t.window.fetch(n).then((function(t){if(!t.ok)return r({errorType:"Ajax Error",statusText:t.statusText,status:t.status,url:e});t.arrayBuffer().then((function(t){(new fo).parseModel(t,i,r)})).catch((function(t){return r({errorType:"Data Read Error",errorMessage:t})}))})).catch((function(t){if(20===t.code)return r({errorType:"Abort Error"});r({errorType:"Ajax Error",errorMessage:t})}))}(i,r)}(e,i,r)}catch(t){r(t)}}))})(n).then((function(t){i.modelDataCache.set(n,t),r.fillRenderBuffer(t)})).catch((function(t){}))}this.models.set(e.id,r),this.AddRenderBuffer(r)}return r},hn.prototype.removeModel=function(t){var e="";if("string"==typeof t)e=t;else{if(t instanceof Array)return this;e=t.id,t.remove(),this.renderTree.RemoveRenderBuffer(e)}if(this.models.has(e)){var i=this.models.get(e);i.remove(),this.renderTree.RemoveRenderBuffer(i)}return this.models.clear(e),this.mapInst.triggerRepaint(),this},hn.prototype.onMapClick=function(t){this.models.forEach((function(t,e){}))},hn.prototype.getModels=function(t){var e=[];return this.models.forEach((function(t,i){e.push(t)})),e},hn.prototype.removeAllModel=function(){this.models.clear(),this.result=[]},hn.prototype.getModel=function(t){return this.models.get(t)},hn.prototype.hasModel=function(t){return this.modelDataCache.has(t)},hn.prototype.HasAnim=function(){return!!this.naviMgr.naviSim.bRunning||this.bHasAnim},hn.prototype.InitSceneMgr=function(t){t&&this.naviMgr.InitNavi()},hn.prototype.AddRenderBuffer=function(t){this.renderTree.AddRenderBuffer(t)},hn.prototype.UpdateBox=function(){var e=this;this.renderTree.UpdateBox(this.mapInst.painter),this._debug&&this.models.forEach((function(i,r){var o=i;if(!o.box3d.isEmpty()){var n=new t.MercatorCoordinate(o.box3d.min.X,o.box3d.min.Y,o.box3d.min.Z),a=new t.MercatorCoordinate(o.box3d.max.X,o.box3d.max.Y,o.box3d.max.Z),s=n.toLngLat(),l=a.toLngLat(),u=[[s.lng,s.lat],[l.lng,s.lat],[l.lng,l.lat],[s.lng,l.lat]];o._region?o._region.setPath(u):o._region=new rn({map:e.mapInst,path:u,cursor:"move",strokeWeight:2,strokeColor:"#0f0",fillOpacity:.5})}}))},hn.prototype.UpdateScene=function(t){var e=this,i=!1;if(this._tracked&&this._tracked.type){var r=null;switch(this._tracked.type){case"Model":i=!0,r=this._tracked.carPosition.ToLngLat();break;case"marker":case"text":r=this._tracked._lngLat;break;case"Group":r=this._tracked.coordinates.slice(0,2);break;default:r=this._tracked.carPosition.ToLngLat()}t.transform.center.lng==r.lng&&t.transform.center.lat==r.lat||(r&&(t.transform.center=r),this.mapInst._updateMapMoveendEvent())}this.models.forEach((function(t,i){var r=t;if(!t.IsModelReady()&&e.modelDataCache.has(r.url)){var o=e.modelDataCache.get(r.url);r.fillRenderBuffer(o)}})),this.naviMgr.UpdateNavi(t,i),this.renderTree.UpdateRenderTree(t),this.UpdateBox()},hn.prototype.RenderScene=function(t){this.renderTree.Render(t)};var pn=t.window.HTMLImageElement,cn=t.window.HTMLElement,fn=t.window.ImageBitmap,dn=t.config.version,mn={center:[116.39636259768668,39.907768102373495],zoom:10,bearing:0,pitch:0,minZoom:3,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,boxZoomIsZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0,style:"lkmap://styles/standard",token:"",styleType:1,MapAuthData:{logoUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJwAAAAoCAYAAAAL45MuAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAnKADAAQAAAABAAAAKAAAAACKkCEMAAAbn0lEQVR4Ae2cB3yV1d3Hz80eJIQQlqyEFRAQUVkyjLS2tXVRtfWjr6MOWq22r9LWUWtfrFvbWmcdr9vWgbbaKlpB2QiyZIUAApGdhCRA9ny/v3Pv8/Dcm3uzgPp5LSef/z3rf8Zznt/5n//5n/PEZ8K4xsbG8SRPgU6BsqCOUCIUBx0JV00lohJoG7QM+pvP51uIf8z9p4wAQOsJzYa+Kqe2e/6njPd/4nP6nIfmRecQngF1Vlr+nnrzwnsVZu6KarNlV70pPtBgqqobTW1do7Lb7eJifSY+zmcyOkaZfj1jzKSRceayM5NMZo9op859BC5A2s1xEo75X58RsIALSJXPeazOgtP9L5WZ3zx9wNQdJrhaO0wxMT7zP1enmFsvTzFR/ikg0I0AdDtbW8cxvv8fI+AAbjbdnSywnX9LsfnbnMqvpPfnTEo0f7s/3QHdxwDuG19JR441etRGwId00wZhgVq4/+Uyc8vj+49aY62p+O5rO5rbLu/gsE5ozUaCZ9Dm5nKnUIj/JXU86KTBexzhaU48xK+B99aQtKAo5X9LglU7gjL8kRcpv9xJh/cMwoOdeIifC++skDQbpZz0C23awrktlFsRmkGZ60hLCE0nXgD/K950eKOI3+hNOwrhYupcTNsbvHULcA+RMG1HYYPpN2XPYeto3srbE9byunlGN9O3u9Xpfk+Hf9FSPTzDJfAEDaqnzBrC50IS4OWQNiUroXCugsRsT0Yp7Zd54oa2thDP8qZ5wv9N+F2ojnLb4X2J8KWefG/wTSI3BRJq4d/rZFIuibD6Gs49A+/U0AzKaMefFppOfBX8I73p8MYQr/WmHaWwxvwJ6Ab6oLBRw5IO5uWZFf8WsGkN79klymT3jTXrt9aa3fsa1LzrpDe+9H6F+c2VKUqzfXMzIweSlfXZZ5+t/etf/yr9z2RlZZkbbrjhNILDIYHEcVsV2LVr146HH354s8LJycnmt7/9bQ5BvejtkOt4OfOJXMeArQ0kyjwk/rkHDx60ST/+8Y+Py87OHkjk4QAJmNI/7SB/8sknyzds2GCBe8IJJ6SOHz9eALgwQHgwNjYW4N1OO8/YBH4aGhrq//GPfyxVvH///p2GDRsmaXkmvDOVFuLssvDUU0/Nq6qqaujevXvsD3/4w/EhPE7UUaUa/vSnP81zEo+k361bt5jzzz//5Li4uJ9Sr8b0ftUvwGUqMG+lzGJHznVI9JlBfWJMtqjvIV9pyYlR5vEZZWb2smrTLT3K7C0OBt28VTVORzKdQAv+Fcp/6aWXSnixApkpKipavHPnzi8VdlxqampaSkqKlU7PPffc5pUrV+YoLyEhIa+goGC3w+f4aTgGbCLxN3nJw/BHQN1LSkoKFy1aZNsRL+181qFDBxeoMTExsQy4JKl1Dz30UGxNTY3l37NnzycDBw4Maos2EmiqK8xP045QLCnJpq2u5rHHHhun8KBBg+Y//vjjAlyvACm5iXvrrbdGUEfHxMTEPADXJD+QYCcCfA3vvfdeTiSmw02nL6tmzJhxIvX8jLYeZDI1CHCdVPFWTB/tcalJPjN+RNwhYCG5BLLjukRHrE5gu/6h/eb3P0s1MxdXA7hgsG/ZWeeUtX1zIuF8HuR60seVlZXtz8vLO8Hh2b1797grrrjCiVqfB66//vrrV5599tkjFixYMMjJRCJkX3LJJU7U9eEv/+Mf/7hh6NChetE/gSSVzF/+8pdcvC4Ky917772j/KFDvxkZGZK2w/bu3bsGsA1xcgDq6ZATdf3hw4cv/cMf/jCaBOmQFnA8m5sfGrj99tvnbN682Uq1P//5z1kANpJeGVrUjYfWz8TLjYqKityoW7L5QGVlZX/qjt+/f/+JpaWlhfRNenN3aJcAF6/iRaXBUkZpLbn0VJ+Z9WiGGZnd+gMIB2wP3ZBqbro4xTz8WnmTZvbtd/ti+9aEgQQeSIN9D3SD8n/1q1+tIW2CwpEc+dGAoI7ldH59fb2VOJF4lQ5/8osvvrjngQceEOAegaIKCwsL3n33XRdAYoPsEoUvZ18YEnZocXFxwR133FFEWqzNaeZnzZo1zmRx6wbwEUts3LgxFUl7khiqq6uDJGZIoSE8x/pAWgX+Yui+EB4bffvtt/vFxsa6Y15bW1uDhLJLeq9evZImTpxo2wtX1pv23e9+N5+yfZVG3xzpYSWQC7jqWjtO3nLNhgW22Y9lmBMHtQ9s0y5JMRVVDWZHQVPJWlXj9sV9+DCd0aD9FODU3nrrrYs2bdp0mnh4STXM/jWDBw8+7rLLLmskX7Or8oUXXihgMOPQccoR9Q5vBUBdf8opp2QiJdbOnj07R3V861vfmnvNNdcMVZhZ70ivqC9wP//5zxvRrQYoD8m3HD3w5DvvvHPB/PnzLdiRoJ+ee+6541gOq2688cZFW7ZsOU+8LJs7AXuK0lnqtHxKd1zLSz5eYfrtDKTeyWtKa4NzByxMGY2hC2LCJ0PaRKlNeV4XVA/j9Bmqh32ub37zmx8DOC9vu8J6OOtq2gC4IwE2Nbppe71fHPi74P7W1LrB5gJ2xgCuRehiDoAO8JJzJ02aNEYFe/fuvXjbtm0CXGJ+fn7h2LFjT5o3b14P5bF07J4+fXoBaXZj8p3vfCcDwCnLrFixIollIMNGAj8sDfuuvfba3kgLAaPu9NNP/+yWW26x+tWYMWMSAZzlXLx4cSWAM++8884K9EkLNnTHdQC6N34qTKnoeNsBXu/y8nIBt5a+eCeWUHC2KqMteUFu4cKFK++5555UJIikrnU/+tGPtMv9IhDNko+akPm9733PSbNZgL6CzY7vxBNPHKaEMPW7CNRS+Pzzz9uJJV7GZsysWbP2KxzJoRLsRDWwEygSjwu4SAyh6UcKbKo3L791yArtgzdeUVHBWPuKeNB1ACC7S5cuFmzi+cEPfhDz6quvLlZ437598gxAWom+VnXOOeeM4kVb8CmdHeCgzMzMhQojeerlex0vuBYJuR1wlbArHcCmwIJNPKNHj+7rlCVdNi6TlJQUzTK05NJLL02fPHmylZZKl/v2t7/9xerVq7crzLLbD31P+o3rPvjgg6X0uwFACAD2eZCUWdT1Kd2IQSfs7zITIK2vN64wZeND+YgbJPJipH0oe1ActWE3IC5Dkg90MqjPWgKceDiffthnCpfnpMkOZ6dR/MRdpiUpdyTBpg7c9dwBjtD8pgWnQ/Il6hsWSzDZsDvrbELgh24/SfAn0pNQUqvZIKR5849EGF1kORIzJ6SuRiRT006HMLUlCvB97CpTnDKAYk6k3SPgXDZlypRqduTd0I+sBPr+978/t3PnzlZ4PPvssyMZm6To6OgdV155Zb5T5zPPPKOlNIEJseSVV16xIEbdqEOyu0Ln/fffr/r4449XI6kGArZOvIdqNlifMnEH0scozWw5BVXvtGnTNm3fvv1Uhel/LvpelnbcXh2OtnbTpiZ2H4pudxtToebckQab2sr70tEnm2u5+bz09PSusqnB5b6w5ku0PlcSIdQx+/dcfPHFrmQMzW9PnBdR+q9//cstOmLEiA7suLWx8W3dutXqUCzDW5GiO1AXfABgAi93BYCzZQDcQF6qnaEAzi57vPhy+MY7lQI4TZIEJy6fdr1RG0ZvqwVsseiuG1iWB7NBOg01ZCUqQU9AbXVPGBsB2zzAZlUZAFhIuzIhOfV7dQFv2NrhmjQamnA0wKY2Nh4e4LR70q7rJtXldSj2S9BBapECmu3JDOw+jMCbevbsmYwp4QCDM5x06VP7WR7X9evXzwUrJo46yo701kf4Lehp6MOQ9KMSRT88BTIAvhI9zLZBH3dgh5vYigaDXrCHvym6PJlOkE1Ulz59+hgAPvDqq69eJAmm8WCSFaIvrxg5cmT/qVOn5jHxHLCV3HfffQVdu3YNUhuc+vCD2m1RwnVOjTKzHuvcrt3og5g+tBuN5PLy2y/hANHzgCaTupsA7qSTTup53HHH9WL3mQf4OjBje/Kyah988MFizfqTTz75C3aTJSjufZ9++ulBd9111070MBl1pb8tZoAV9LoVRNZ7E5zwr3/96+UYZbs58fb4Wq4oJ5VAIvUVSO/lMqg9LugFt7WCAQMGDHLKMDHH8Hxzli1bdhpj2OV3v/tdZ8a9iPBo8cTHx29k15/IRI4ENqcq128RcGOGxZrXZ1WaNyBJYIlhv++HrhtWHtXq1ODxt8qNwPaLZsBWUFxv9pdHmoxu/w4rgGkk+7XXXitEl1mDYXj4TTfdlIZEW3TBBRec+vrrr5dcddVVKzV7mbmpbCTmn3feecdzEpDpNNqxI5f2/K7KSQv1GWxtPlOopwlKQ3nDxXlpcWx0nCW6nPG9iomUBG97AReumXalaSJgWurBsr6cTdcp9CsKcpbVKvTmIiRbONtcRNC3CLj3F1UbUVvc1POSmgWb6joS+lukPl1++eW9PHk6ERDJJTAjT4UU1imGSDu6OJTbiZCi1vHiG1jWnN3jZic9nP/kk0+uRAfLCZfXUhoSdc3f//53AU5S9LyW+I92PsAq4Fk2YgbxsZwOQpplO20yJrpNU0qaQGfHkhWiHNB9im5Zc+aZZ2ZiiupDXkRJ0iLgnMba4vfoHN0i++Espy1WfpgM7PB2IfG+4EBeOtNu6APImdmHWXvE4tW8zBbNChFLH8qI+LIPsYQPAbZiTC/afHiftQz1ZPVZZ53VwO5zOBOky6pVq9a+8cYbRfhZMslwfDf2zTffNCKM4KsoL/XAcUH9OSqAC2OvdBp3/cPcMLj1KMDNiB7YrQSMILdkyZL8Rx99VBuHeGWgCOcjxRIZNC1ZYR2rSDS7LQ26SEqmborUUIfld3wb8f/42LFNQFes9KTZIEbWJeg/OZQv/uc//5kYmq84ea7OFJofpq1QlnDxSMuZfQAmkwuA0Prpi8HWuBmA7cI43MCtli6yT5J2qrchGY4hmyQLAcDbuXz58kp21olcYpDS7u2DN9y6Xaq3sdaE3SdqhvlILqkCCWLd0YNsq1zr+fSRRx6RRd2CTYnHH398Ptv8oAGwzCE/mCXS2HgMJ7kCmuXN1ksJdbQfA0ibTF5elMtKfljAuQxhAuHaCsPWYhLqZRF1pQtg6JuutT20fkxM6djiNNEG3HbbbXNuvvnmAfCU8nxlPEs5ppJqwFjJFasGxieN8czU5kyE9PP2I98b8YabDJI3s73hliTcui21Zv6qtumFEfqiwQlyXBXazoH59i+//DJoVooJ6/4kKIg/XITbIHZpGDdunKaxzh1fdfhCpYKTzsZkEYfpQVtyTkGylU+ZVIy1axxer499KyNgGJ3qTVc4UluhfJHi2NHKMAd9zpj0oi57VDdkyJDWyAPDRkYzq0q7UxE7eoOB3fCMZt26dYZzYUnnelaNzU888URUZmZmv0j98Kb/2wEnsE3+aZEpOdiq5/b2tblwI2eYn3PQXM7Z6WgYezvMDMo+Zmiz6OZlxAQUYaeYBtYpo7NT14VKBSeD3W139JlIgx6jXbLD6/UBxbZAvMabrnCktkL5IsWRSB0wc9QyJn3FI+MxlxI0Pi06TlhOg3QmW8Oz7dmxY0cRk7iMc2tfbm5ud51yMG7RPPMAJOi6FisMMLiAi8YAEM/1bq2+Uej8UQQ0wySttIoo31qLKKiBEPwbGhpNvT3ua/Qv2v7iJu7QShLUj9xtteaCW4ttXT0zqBCn+msb/PWpTm1wfIFPt2y0FT/oD2uRan6lIsBPH4sxe+RyM0OSzl91mLoOHDhQinTaxt0tV1HWzvGMM85QfQ3QwjDFmiRhJN0DSHd4Mz766KMkmRPoSzn9WO7Nc8JY7639j3g2462lr9jJOxL+L3/5y4nUOwc9Nxrj7SksjToNmAmdGal+7gqu4Bw4rUePHl0FWqRXH5H4qcMWA2TFc+fO3chRWA2XWntGqis03QWczlEFqGjAFM3riSEnTgDENQAqJICJgQEIcubKfZ+aBlNXr3wh0g84PxD5drXJ0bdOFWrNFdNLTBXzWHw1XCWvh68e0EYDcJKss1gjra2OOqt5eauZcbG6+Mcgp2O4PJUbD3vQW3aNGjXqIDutHiwpUtJta9iXtlx33XU+lgsXrDJmvvzyy314MdL9HqHejd6+aBKGcxwvCdhBjhsqc5C8SqsG/JOCMptG3iXp99T/Dr5OQcI6rmFtQtXqGDYzTKL0Wy415IRkOUdQIcn+cWGnqVvD1tTA8xczJgVsBkoBbQ2bhWiM5Bns4PtxK2asbsa0xbmAS+dEoZ75XFffyNVmAFXZYA4CqHrPALNk8wmfD2A2mjhQmcgricGPjwOIvAfhJIEFKK1DAD2BnmxAsp01bZ8p5JJnNIgSuERWklLehvUj6YZvg214Cu6l9WMzUMdsHMW1IN2GkKF3IFUkcB7ZA8nTQ2eVInZpe+6+++7CmTNn7uOMcBwDK2BZB2CXAdKBDK5e6NtQk1MMP2fwL7uzIFA6uUg3+9KIR0fiES+SpAuTQjbBaQFSsl1hbIAflrMu6IFrea5hHK6vd9Jb4e+FZw/kSFIVOV0/kSYPS+9OJqH+C0M0lM6yKtK1fbN27VoTsFdWcSMmNysrq4gTnegLL7xwFMCMuPtXe3Iu4Iq4ZevBls3UhzaSOBYEpGjTpa/m4/X1fGyUSYhHOsGgC5M65xZQS/k6v6zikBTQFaSL7yjhAx1jOvAtQ52kWl0D4PYDNzaGxVsS0rYl0Pmlng208geguVdndPlRsw6g1TI467jDVcgSkcGL0vGLj/TuzHjxuzoVz1eD4XIRxziTCGutfwO6jHAYWU1OiEMxlz7j1xGC8yRN9WI7cpQWUSpddNFF87wSkHt0edx72xvY4FjJyAsfHFx1+BiSZzW8UZyAaDeaDe2GlkEjmExc25sfi7mjhvNQPSvJQc6+OHaqfRinRkweu7lzuofbxQfx69HjEgFdNqudJkcCm6ITtIEQTZgwQZcLsoJqCxMR4ICKievSKcqU8O8cWDnRwQQo3VJFiglgkJZXgaaKpbea5bSsoh5+gYPpK51PyMSh+WmRtU6SbcrNxaaA4y6lxVJHLHUnJ0ZbSShp6UNaCnx1AiwiMiE+ynRKcd+do7gHamziRZTnSLJYzBtDOfQu5axzA0dZSzFQ2ms51OLuJjt16rTi/vvvT2Om5pCubk4X8TKcxyBqHU+qSRfrTlLFGXzxhfIqqy0u6M1zGF7MztICzVsJutJqwHkQtWA0/XO320gj2zfxYnec6C1DWCCwJyqff/65vlYbi91sgXiYCPK8zu0H4+fj1KCHKCcnx+WhTCMTOQ9Q7l26dGlHdODjyQQthxws7gvk2pKzfFtzjAZPBsu4DJbUrp1ADp2Q0i78AHK7mywuqrdgU5r0PB4W0pKIvmeH35GEapQ8/jYg2fQVf8nBBgtcPxABKxKwvEIHvwCPxSwtxf9/Ruzyqkp5dx4dsCXA9VKLjmPbrpm4Y/369cUMai0zrytpgxmAsQ6PfPpfj91uGWerydiTTgrk5eFfTZ59GYE0r6dvExoZwKBlg5e4l6Vay/fhuFCQOHXVsbxvwPhaxLllr/79+5/gZND/Cu4C2igSPJ9NSdBYOHz4kqxWugJi66PXuQD18CnYBIEh+Ro7H5dds0XKQ5qWIzVXoVfaMUAv3soE6B0oVxlQFVQv4sm/pJbid+ycFmVyt9ab6loAAogSE6JMh6Qo06OzD4o2ZXx/UFEFOvG1hGr5jIlhSQUkAp6cBSE/2iBccEul1dm0wWhks5eM5OqY7DOdAHZHJFhMQLtRGZWWhJR0LcVckgJfwJU4geb8u+66aw6DPljLJXxDwvEKZOw+cydPnryPndYQ9DVH2hXC/yCkDUJEgJOn04YClu9uzP4dtGVfMPfMxnINKhfJ16rlN1zfqLMSu5bz7YQBPFEAeznX3weTZ6+DB8rtx98GjUDqRLP02mTd6uDbiOUYl60UsYkhP+wq0wCHBSzADQs49LBNgLFF0IVUrWg858lfMiY7WWb7E7diCPuibI8yw+QxfogZf8Y2/L6dUqJNRXWtBU1NHbtIbnKUltUBgkarr2mDkAIAJQVT0MVqkeIHqaKsshHfD0YroX0N5r0F1aYDoOkOUNMBVwqbCEGIRvnVbtjvi1//kUnfqeo5lZ/K8jq0vyuh1bcWHZMqNgA2l5eB28t18h0sqQd5OUnoLdlIC+/LWw/zs9DTtFvuFmw+8CnZ5wLaTZg8HIkSg01qiHMZsvni4XN5SQK96zgEdyaD0jZDn0AzofehHtAXfGR86ocffriAZ59APAZpdzJ+iw4A57EzHy1G//s4VISbzK5eeyi1fSEdI/LtRbdA6RedWoREKZSn3Tk11cxZXk0nQIFV4pE6FiD+5bOmju8C2FgUIHPqEUWxHMl17IC+xddb2X3jKIcyiH6nh9BO1RalYr+eRgB0CWAy+BaV1psD5Q2WXxsQ6YFxlEmU/oYEvJR/3xVw6ltzTsjVtwux6Cbz0TcSsB+lojB3Q9/RwzoP7NQhkfAB9Br9XOIktsF/Ct5zuaSYg3lgKbvcCpaPNhQPz8pEUEYOJCm5EFoaIP1vjh2EvW4bknY6CdO5qTEBfSoXXaqQHTHqZFjBZcsyAU1mZmYc5ptR0m+VSN1RfI01xzIcoR+kbAPG5kSuro8M2Pw+p+pHnOqD/pnNRbcXm4+WCnSHAGOBgx1OEk2bBqmnKXxVn85VMV3OlK/NgHQ0gc3uOKldeqDiVqLh7S5q4CutOqvTJaNGSqoJYHZpFcBVBv6T+Mb1+d+kOf1r9p/ZMPCvwnixwxzia/mRSJfBVTSP+vPxD8vR5s1UcC+kLh9pt5c+Si1o0dGP62G6DZLEa4sTKv8XuqYthdrJ+yLlbuKZ/MomETtodH424ckIIHPifxWYXYCjFl1OABOHdK+MtGjTGXBJyZcpRE54shQIS1JZKcjlyoISGYYbTZdOMSzDWopZWqlHJbUMF5EvSbcfE4p0wgQkXb9eMeaTJzKcN/kxHf2G2onk6Pd55A2DJBmki8rmtA3aStlW6X/wttnR7gAKTYSkL7o7sjZX1LTAQfo9vWly+BT6wbpgzoD6QamQXmEkp9UsH1oIbYFugY6WUztzeZZQ6ewCricMEn2d1YMH+LddMz6usPpXh2TZybQ0KscDMuKyqQk4AtfeEv9/yZT5JIkNR3IiigWFKgGT9LSKKv+JQjd0wO4ca3UXCNOj7YmGltrOAPrOqSkO2PbR1LF/SGhH/Ov1E4CRVKzGHB5tBmRBt+aLOv7larnZWYBtDkREo9TriGtfaSO7T78EKynTcZdOF3Tq4CedPGii6dfZHIB0q8vJzlYVOBKTfa9fr2gzZmicmZKTYIb3i6WEdQLbsX+5GhiMr7UH6I79U+mv9Rv+6h/OlXDergC88cSnQPo3CFmQDIbaOrpiiPDhONmLMKoYKfZboWXQsX+bzyB83d3/AYg1bZn/9M0jAAAAAElFTkSuQmCC",recordationNumber:""},showLogo:!0,recordationNumber:!0,cursor:"grab",isHotspot:!1,isHotspotActive:!1,isHotspotTextColor:"#0037e4",enable3D:!1,enableNavi:!1,sky:!0,fog:!0,indoor:!1,indoorOptions:{},isWebGL2:!0},yn=function(r){function o(e,o){var n=this;if(void 0===o&&(o={}),"string"==typeof e&&e.length>0&&(o.container=e),o.container&&o.container.length>0&&(e=o.container),e instanceof cn&&(o.container=e),null!=(o=t.extend({},mn,o)).minZoom&&null!=o.maxZoom&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=o.minPitch&&null!=o.maxPitch&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=o.minPitch&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=o.maxPitch&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");var a=new Yi(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies);if(r.call(this,a,o),this._options=o,this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._optimizeForTerrain=o.optimizeForTerrain,this._renderTaskQueue=new Yr,this._domRenderTaskQueue=new Yr,this._mapId=t.uniqueId(),this._locale=t.extend({},po,o.locale),this._clickTolerance=o.clickTolerance,this._SkyClass=null,this._TripleSpatialClass=null,this._requestManager=new t.RequestManager(o.transformRequest,o.accessToken,o.testMode),this._silenceAuthErrors=!!o.testMode,this._popup=[],this._timeout=null,this._interval=null,this._cursor=o.cursor||"grab",this._isHotspot=o&&o.isHotspot||!1,this._isHotspotActive=o&&o.isHotspotActive||!1,this._isHotspotTextColor=o&&o.isHotspotTextColor||"#0037e4",this._controls=[],this._markers=[],this._texts=[],this._customLayers=[],this._mapvglLayers=[],this._LKClustererLayers=[],this._hotspotLayerId=[],this._hotspotLayerStyle={},this._hotspotData={},this._hotspotActiveData=null,o.indoor&&(this.indoor=new uo(this,o.indoorOptions)),this.db=null,this.IndexDB=new ho(this),o.enableNavi&&(o.enable3D=!0),o.enable3D?(this.modelBox=this._sceneMgr=new hn(this),this.modelBox.InitSceneMgr(o.enableNavi),this.tracePlayback=this.modelBox.getNaviMgr()):this.modelBox=null,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new io(0),this._controls=[],"string"==typeof o.container){if(this._container=t.window.document.getElementById(o.container),!this._container)throw new Error("Container '"+o.container+"' not found.")}else{if(!(o.container instanceof cn))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),i.supported()){if(t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.modelBox&&this.painter.SetSceneMgr(this.modelBox),this.on("move",(function(){return n._update(!1)})),this.on("moveend",(function(){return n._update(!1)})),this.on("zoom",(function(){return n._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Xr(this,o),this._hash=o.hash&&new Ji("string"==typeof o.hash&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,t.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localFontFamily=o.localFontFamily,this._localIdeographFontFamily=o.localIdeographFontFamily,o.style&&this.setStyle(o.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),this._logoControl=new Hr,this._logoControl.onAdd(this),this.on("style.load",(function(){n.transform.unmodified&&n.jumpTo(n.style.stylesheet)})),this.on("data",(function(e){n._update("style"===e.dataType),n.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){n.fire(new t.Event(e.dataType+"dataloading",e))}))}else this._container.innerHTML='<p style="width: fit-content;margin: auto; margin-top: 40%;">您当前使用的浏览器版本过低,请升级或更换浏览器后重试。</p>'}r&&(o.__proto__=r),(o.prototype=Object.create(r&&r.prototype)).constructor=o;var n={showTileBoundaries:{configurable:!0},showTerrainWireframe:{configurable:!0},speedIndexTiming:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return o.prototype.setTrackedModel=function(t){this.modelBox.setTrackedModel(t)},o.prototype._getMapId=function(){return this._mapId},o.prototype.addControl=function(t,e){var i=this;if(this._loaded)return this._addControlBack(t,e);this._interval&&(clearInterval(this._interval),this._interval=null),this._interval=setInterval((function(){if(i._loaded)return clearInterval(i._interval),clearTimeout(i._timeout),i._interval=null,i._addControlBack(t,e)}),10),this._timeout=setTimeout((function(){clearInterval(i._interval),i._interval=null}),1e4)},o.prototype._addControlBack=function(e,i){if(void 0===i&&e.getDefaultPosition&&(i=e.getDefaultPosition()),void 0===i&&(i="top-left"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=e.onAdd(this);this._controls.push(e);var o=this._controlPositions[i];if(-1!==i.indexOf("bottom")?o.insertBefore(r,o.firstChild):o.appendChild(r),"left-center"==i||"right-center"==i){var n=this._controlPositions[i].offsetHeight/2;n>0&&(this._controlPositions[i].style.marginTop="-"+n+"px")}return this},o.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this},o.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},o.prototype.resize=function(e){var i=this._containerDimensions(),r=i[0],o=i[1];this._resizeCanvas(r,o),this.transform.resize(r,o),this.painter.resize(r,o);var n=!this._moving;return n&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),n&&this.fire(new t.Event("moveend",e)),this},o.prototype._updateMapMovestartEvent=function(e){this.fire(new t.Event("movestart",e))},o.prototype._updateMapMoveEvent=function(e){this.fire(new t.Event("move",e))},o.prototype._updateMapMoveendEvent=function(e){this.fire(new t.Event("moveend",e))},o.prototype.getBounds=function(){return this.transform.getBounds()},o.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},o.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},o.prototype.setMinZoom=function(t){if((t=null==t?3:t)>=3&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between 3 and the current maxZoom, inclusive")},o.prototype.getMinZoom=function(){return this.transform.minZoom},o.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},o.prototype.getMaxZoom=function(){return this.transform.maxZoom},o.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},o.prototype.getMinPitch=function(){return this.transform.minPitch},o.prototype.setMaxPitch=function(t){if((t=null==t?85:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},o.prototype.getMaxPitch=function(){return this.transform.maxPitch},o.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},o.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},o.prototype.project=function(e){return this.transform.locationPoint3D(t.LngLat.convert(e))},o.prototype.unproject=function(e){return this.transform.pointLocation3D(t.pointGeometry.convert(e))},o.prototype.containerToLngLat=function(e){return this.transform.pointLocation(t.pointGeometry.convert(e))},o.prototype.getLngLatElevation=function(t){var e=0;return this.transform._terrainEnabled()&&this.transform._elevation&&(e=this.transform._getLngLatElevation(t)),e},o.prototype.lngLatToContainer=function(e){var i=this.transform.locationPoint(t.LngLat.convert(e));return i.x=Math.round(i.x),i.y=Math.round(i.y),i},o.prototype.lngLatToMercator=function(t){var e=null,r=null;t instanceof Array?(e=t[0],r=t[1]):(e=t.lng,r=t.lat);var o=e/360+.5,n=Math.sin(r*Math.PI/180),a=.5-.25*Math.log((1+n)/(1-n))/Math.PI,s=Math.min(Math.max(a,0),1);return new i.Pixel(o,s)},o.prototype.mercatorToLngLat=function(t){var e=null,r=null;t instanceof Array?(e=t[0],r=t[1]):(e=t.x,r=t.y);var o=360*e,n=360/Math.PI*Math.atan(Math.exp((180-360*r)*(Math.PI/180)))-90;return new i.LngLat(o-180,n)},o.prototype.getResolution=function(t,e){var i;i=!t||t instanceof Array?t?t[1]:this.getCenter().lat:t.lat;var r=e||this.getZoom();return e&&e<this.getMinZoom()&&(r=this.getMinZoom()),e&&e>this.getMaxZoom()&&(r=this.getMaxZoom()),12756274*Math.PI/(256*Math.pow(2,r))*Math.cos(i*Math.PI/180)},o.prototype.isMoving=function(){return this._moving||this.handlers&&this.handlers.isMoving()},o.prototype.isZooming=function(){return this._zooming||this.handlers&&this.handlers.isZooming()},o.prototype.isRotating=function(){return this._rotating||this.handlers&&this.handlers.isRotating()},o.prototype._createDelegatedListener=function(t,e,i){var r,o=this;if("mouseenter"===t||"mouseover"===t){var n=!1;return{layer:e,listener:i,delegates:{mousemove:function(r){t&&t.indexOf("_Custom")>0?t=t.split("_")[0]:r.type.indexOf("_Custom")>0&&(t=r.type.split("_")[0]),r.hasOwnProperty("LKTargetBack")&&(r.target=r.LKTargetBack,delete r.LKTargetBack);var a=o.getLayer(e)?o.queryRenderedFeatures(r.point,{layers:[e]}):[];if(a.length){if(!n){n=!0;var s={features:a,layer:o.getIdLayers(e)};s.layer&&s.layer.id.indexOf("MassClusterer_many_")>-1&&(s.isClusterer=!0),i.call(o,new ar(t,o,r.originalEvent,s))}}else n=!1},mouseout:function(){n=!1}}}}if("mouseleave"===t||"mouseout"===t||t.indexOf("mouseout_")>-1||t.indexOf("mouseleave_")>-1){var a=!1;return{layer:e,listener:i,delegates:{mousemove:function(r){if(t&&t.indexOf("_Custom")>0?t=t.split("_")[0]:r.type.indexOf("_Custom")>0&&(t=r.type.split("_")[0]),r.hasOwnProperty("LKTargetBack")&&(r.target=r.LKTargetBack,delete r.LKTargetBack),(o.getLayer(e)?o.queryRenderedFeatures(r.point,{layers:[e]}):[]).length)a=!0;else if(a){a=!1;var n={layer:o.getIdLayers(e)};n.layer&&n.layer.id.indexOf("MassClusterer_many_")>-1&&(n.isClusterer=!0),i.call(o,new ar(t,o,r.originalEvent,n))}},mouseout:function(r){if(t&&t.indexOf("_Custom")>0?t=t.split("_")[0]:r.type.indexOf("_Custom")>0&&(t=r.type.split("_")[0]),r.hasOwnProperty("LKTargetBack")&&(r.target=r.LKTargetBack,delete r.LKTargetBack),a){a=!1;var n={layer:o.getIdLayers(e)};n.layer&&n.layer.id.indexOf("MassClusterer_many_")>-1&&(n.isClusterer=!0),i.call(o,new ar(t,o,r.originalEvent,n))}}}}}return{layer:e,listener:i,delegates:(r={},r[t]=function(t){var r=o.getLayer(e)?o.queryRenderedFeatures(t.point,{layers:[e]}):[];t.type&&t.type.indexOf("_Custom")>0&&(t.type=t.type.split("_")[0]),t.hasOwnProperty("LKTargetBack")&&(t.target=t.LKTargetBack,delete t.LKTargetBack),r.length&&(t.layer=o.getIdLayers(e),t.features=r,i.call(o,t))},r)}},o.prototype.on=function(t,e,i){if("dragging"===t&&(t="drag"),"error"==t&&"function"==typeof e&&void 0===i)return void 0===this._errorFun&&(this._errorFun=[]),void this._errorFun.push(e);if(void 0===i)return!this._isHotspot&&!this._isHotspotActive&&["hotspotover","hotspotout","hotspotclick"].indexOf(t)>-1&&this._addPoiHoverStyle(),r.prototype.on.call(this,t,e);var o=this._createDelegatedListener(t,e,i);for(var n in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o),o.delegates)this.on(n,o.delegates[n]);return this},o.prototype.once=function(t,e,i){if(void 0===i)return r.prototype.once.call(this,t,e);var o=this._createDelegatedListener(t,e,i);for(var n in o.delegates)this.once(n,o.delegates[n]);return this},o.prototype.off=function(t,e,i){var o=this;if("dragging"===t&&(t="drag"),"error"!=t||"function"!=typeof e||void 0!==i)return void 0===i?r.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(r){for(var n=r[t],a=0;a<n.length;a++){var s=n[a];if(s.layer===e&&s.listener===i){for(var l in s.delegates)o.off(l,s.delegates[l]);return n.splice(a,1),o}}}(this._delegatedListeners),this);for(var n in this._errorFun)if(this._errorFun.hasOwnProperty(n)&&this._errorFun[n].name==e.name){this._errorFun.splice(n,1);break}},o.prototype.evalEvent=function(e,i){this.fire(new t.Event(e,i))},o.prototype.queryRenderedFeatures=function(e,i){return this.style?(void 0!==i||void 0===e||e instanceof t.pointGeometry||Array.isArray(e)||(i=e,e=void 0),this.style.queryRenderedFeatures(e=e||[[0,0],[this.transform.width,this.transform.height]],i=i||{},this.transform)):[]},o.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},o.prototype.setStyle=function(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&i.localFontFamily===this._localFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(e,i))},o.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},o.prototype._updateStyle=function(t,e){var i=this;return this.style&&(this.style.setEventedParent(null),this.style._remove(),delete this.style),t&&(this.style=new ne(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.getStyleData(t,i._options.token,i._options.styleType).then((function(t){0==t.code?(t.data.styleContent=t.data.styleContent,i._styleFile=JSON.parse(JSON.stringify(t.data)),i.style.loadJSON(t.data.styleContent),i._options.MapAuthData.recordationNumber=t.data.recordationNumber,i._createLogoControl()):i.getStyleData("lkmap://styles/standard").then((function(t){0==t.code&&(t.data.styleContent=t.data.styleContent,i._styleFile=JSON.parse(JSON.stringify(t.data)),i.style.loadJSON(t.data.styleContent),i._options.MapAuthData.recordationNumber=t.data.recordationNumber,i._createLogoControl())}),(function(t){}))}),(function(t){})):"string"==typeof t?i.style.loadURL(t):(i.style.loadJSON(t),i._styleFile||(i._styleFile={name:t.name,recordationNumber:i._options.MapAuthData.recordationNumber,sign:"",styleContent:t}))),this._updateTerrain(),this},o.prototype._createLogoControl=function(t){null!=t&&(this._options.MapAuthData.recordationNumber=t||"")},o.prototype.addLogo=function(t){if(this._log&&a.remove(this._log),t){this._log=a.create("div","LK-map-logo");var e=a.create("img","LK-map-logo-img");e.src=t,this._log.appendChild(e),this._container.appendChild(this._log)}},o.prototype.addMapAuditCode=function(t){if(this._recordationNumberDOM&&a.remove(this._recordationNumberDOM),t){this._recordationNumberDOM=a.create("div","LK-map-logo-right");var e=document.createElement("p");e.innerHTML=t,this._recordationNumberDOM.appendChild(e),this._container.appendChild(this._recordationNumberDOM)}},o.prototype.clearLogo=function(){this._log&&a.remove(this._log),this._recordationNumberDOM&&a.remove(this._recordationNumberDOM)},o.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new ne(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},o.prototype._diffStyle=function(e,i){var r=this;if("string"==typeof e){var o=this._requestManager.normalizeStyleURL(e),n=this._requestManager.transformRequest(o,t.ResourceType.Style);t.getJSON(n,(function(e,o){e?r.fire(new t.ErrorEvent(e)):o&&r._updateDiff(o,i)}))}else"object"==typeof e&&this._updateDiff(e,i)},o.prototype._updateDiff=function(e,i){try{this.style.setState(e)&&this._update(!0)}catch(r){t.warnOnce("Unable to perform style diff: "+(r.message||r.error||r)+".  Rebuilding the style from scratch."),this._updateStyle(e,i)}},o.prototype.getStyle=function(){if(this.style)return this.style.serialize()},o.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},o.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},o.prototype.isSourceLoaded=function(e){var i=this.style&&this.style._getSourceCaches(e);if(0!==i.length)return i.every((function(t){return t.loaded()}));this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},o.prototype.areTilesLoaded=function(){var t=this.style&&this.style._sourceCaches;for(var e in t){var i=t[e]._tiles;for(var r in i){var o=i[r];if("loaded"!==o.state&&"errored"!==o.state)return!1}}return!0},o.prototype.addSourceType=function(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)},o.prototype.removeSource=function(t){return this.style.removeSource(t),this._updateTerrain(),this._update(!0)},o.prototype.getSource=function(t){return this.style.getSource(t)},o.prototype.addImage=function(e,i,r){void 0===r&&(r={});var o=r.pixelRatio;void 0===o&&(o=1);var n=r.sdf;void 0===n&&(n=!1);var a=r.stretchX,s=r.stretchY,l=r.content;if(this._lazyInitEmptyStyle(),i instanceof pn||fn&&i instanceof fn){var u=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:u.width,height:u.height},u.data),pixelRatio:o,stretchX:a,stretchY:s,content:l,sdf:n,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var h=i;this.style.addImage(e,{data:new t.RGBAImage({width:i.width,height:i.height},new Uint8Array(i.data)),pixelRatio:o,stretchX:a,stretchY:s,content:l,sdf:n,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}},o.prototype.updateImage=function(e,i){var r=this.style.getImage(e);if(!r)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var o=i instanceof pn||fn&&i instanceof fn?t.exported.getImageData(i):i,n=o.width,a=o.height,s=o.data;return void 0===n||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):n!==r.data.width||a!==r.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(r.data.replace(s,!(i instanceof pn||fn&&i instanceof fn)),void this.style.updateImage(e,r))},o.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},o.prototype.removeImage=function(t){this.style.removeImage(t)},o.prototype.loadImage=function(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),(function(e,r){i(e,r instanceof pn?t.exported.getImageData(r):r)}))},o.prototype.listImages=function(){return this.style.listImages()},o.prototype.addLayer=function(t,e,i,r){return void 0===r&&(r={}),t.hasOwnProperty("setMap")&&(this._customLayers.push(t),t.hasOwnProperty("type")&&["tileLayer","imageLayer","videoLayer","canvasLayer"].indexOf(t.type)>-1?t.setMap(this):(t._map=this,t=t.geojson)),t.type&&0==t.type.indexOf("LKMapvgl-")&&this._customLayers.push(t),t.type&&"sky"==t.type&&this.removeSky(),this._lazyInitEmptyStyle(),this.style.addLayer(t,e,r,i),this._update(!0)},o.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},o.prototype.removeLayer=function(t){"object"==typeof t&&t.lineGeojson&&(this.style.removeLayer(t.lineGeojson.id),this.style.getSource(t.lineGeojson.id)&&this.removeSource(t.lineGeojson.id));var e="string"==typeof t?t:t.id,i=[];return this._customLayers.forEach((function(t){t.id!=e&&i.push(t)})),this._customLayers=i,this.style.removeLayer(e),this.style.getSource(e)&&this.removeSource(e),this._update(!0)},o.prototype.clearMap=function(){var t=this;this._markers.forEach((function(t){t&&t.remove()})),[].concat(this._customLayers).forEach((function(e){t.removeLayer(e)})),this.getAllOverlays().forEach((function(t){"remove"in t&&t.remove(),"clear"in t&&t.clear()}))},o.prototype.getLayer=function(t){var e=this,i=null;return this._customLayers.forEach((function(r){if(r.id===t)return r.coverage=e.style.getLayer(r.id),i=r})),!i&&this.style.getLayer(t)&&(i=this.style.getLayer(t)),i},o.prototype.getLayers=function(t){var e=this._markers.concat(this._texts,this._customLayers);return t&&e.forEach((function(e){if(e.id==t)return e})),e},o.prototype.getIdLayers=function(t){var e=this._markers.concat(this._texts,this._customLayers);if("string"==typeof t)return e.forEach((function(e){if(e.id==t)return e})),this._mapvglLayers.length>0&&this._mapvglLayers.forEach((function(e){if(e._layersId.indexOf(t)>-1)return e.getLayer(t)})),this.getLayer(t);if(t instanceof Array){var i=[];for(var r in t)for(var o in e)e[o].id==t[r]&&i.push(e[o]);return i.length>0?i:null}return null},o.prototype.getAllOverlays=function(t){var e=this,i={marker:"_marker_",text:"_text_",circle:"_circle_",polyline:"_line_",polygon:"_fill_",curveLine:"_curveLine_",ellipse:"_ellipse_",imageLayer:"_imageLayer_",videoLayer:"_videoLayer_",tileLayer:"_tileLayer_",canvasLayer:"_canvasLayer_",circleMarker:"_circleMarker_",rectangle:"_rectangle_",inforWindow:"_inforWindow_",infoWindow:"_inforWindow_",mapvgl:"LKMapvgl-",clusterer:"LKClusterer_"},r=Object.keys(i);if(t&&r.indexOf(t)<0)return[];var o=this._markers.concat(this._texts,this._customLayers,this._popup);if(this._mapvglLayers&&this._mapvglLayers.length>0&&(o=o.concat(this._mapvglLayers)),this._LKClustererLayers&&this._LKClustererLayers.length>0&&(o=o.concat(this._LKClustererLayers)),t&&i[t]){var n=[];return o.forEach((function(r){r.id&&r.id.indexOf(i[t])>=0&&(r.coverage=e.getLayer(r.id),n.push(r)),r.type&&0==r.type.indexOf(i[t])&&r._userLayers&&r._userLayers.length>0&&n.push(r)})),n}return o},o.prototype.setLayerZoomRange=function(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)},o.prototype.setFilter=function(t,e,i){return void 0===i&&(i={}),this.style.setFilter(t,e,i),this._update(!0)},o.prototype.getFilter=function(t){return this.style.getFilter(t)},o.prototype.setPaintProperty=function(t,e,i,r){return void 0===r&&(r={}),this.style.setPaintProperty(t,e,i,r),this._update(!0)},o.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},o.prototype.setLayoutProperty=function(t,e,i,r){return void 0===r&&(r={}),this.style.setLayoutProperty(t,e,i,r),this._update(!0)},o.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},o.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},o.prototype.getLight=function(){return this.style.getLight()},o.prototype.setTerrain=function(t,e){this._lazyInitEmptyStyle(),e&&(this.transform.maxDrapeOverZoom=e),this.style.setTerrain(t),this._averageElevationLastSampledAt=-1/0;var i=this._update(!0);return this.hasOwnProperty("tb")&&this.tb._updateResizeFun(),i},o.prototype.addTerrain=function(t){void 0===t&&(t={}),t.url&&!this.getSource("lk-map-dixing-dem-source")&&(this.addSource("lk-map-dixing-dem-source",{type:"raster-dem",tiles:[t.url],tileSize:t.tileSize||512,maxzoom:t.maxzoom||16,minzoom:t.minzoom||0,scheme:t.scheme||"xyz",bounds:t.bounds||[-180,-85,180,85]}),this.setTerrain({source:"lk-map-dixing-dem-source",exaggeration:t.exaggeration||1},t.maxDrapeOverZoom||2))},o.prototype.removeTerrain=function(){this.getSource("lk-map-dixing-dem-source")&&(this.removeHillshading(),this.setTerrain(),this.removeSource("lk-map-dixing-dem-source"))},o.prototype.addHillshading=function(t){void 0===t&&(t={}),this.getSource("lk-map-dixing-dem-source")&&this.addLayer({id:"lk-map-dixing-hillshading",source:"lk-map-dixing-dem-source",type:"hillshade",paint:{"hillshade-accent-color":t.accentColor||"#000000","hillshade-exaggeration":t.exaggeration||.5,"hillshade-highlight-color":t.highlightColor||"#ffffff","hillshade-illumination-anchor":t.illuminationAnchor||"viewport","hillshade-illumination-direction":t.illuminationDirection||335,"hillshade-shadow-color":t.shadowColor||"#000000"},layout:{visibility:"visible"}})},o.prototype.setHillshading=function(t){var e=this;if(void 0===t&&(t={}),this.getLayer("lk-map-dixing-hillshading")){var i={accentColor:"hillshade-accent-color",exaggeration:"hillshade-exaggeration",highlightColor:"hillshade-highlight-color",illuminationAnchor:"hillshade-illumination-anchor",illuminationDirection:"hillshade-illumination-direction",shadowColor:"hillshade-shadow-color"};Object.keys(t).forEach((function(r){e.setPaintProperty("lk-map-dixing-hillshading",i[r],t[r])}))}},o.prototype.removeHillshading=function(){this.getLayer("lk-map-dixing-hillshading")&&this.removeLayer("lk-map-dixing-hillshading")},o.prototype.getTerrain=function(){return this.style?this.style.getTerrain():null},o.prototype.setFog=function(t){return this._lazyInitEmptyStyle(),this.style.setFog(t),this._options.fog=!0,this._update(!0)},o.prototype.getFog=function(){return this.style?this.style.getFog():null},o.prototype._queryFogOpacity=function(e){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(t.LngLat.convert(e),this.transform):0},o.prototype.queryTerrainElevation=function(e,i){var r=this.transform.elevation;return r?(i=t.extend({},{exaggerated:!0},i),r.getAtPoint(t.MercatorCoordinate.fromLngLat(e),null,i.exaggerated)):null},o.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},o.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},o.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},o.prototype.getContainer=function(){return this._container},o.prototype.getCanvasContainer=function(){return this._canvasContainer},o.prototype.getMarkersContainer=function(){return this._markersContainer},o.prototype.setCursor=function(t){t&&(this._cursor=t,this._canvasContainer.style.cursor=t)},o.prototype.getCursor=function(){return this._cursor},o.prototype.getCanvas=function(){return this._canvas},o.prototype._containerDimensions=function(){var t=0,e=0;if(this._container){if(e=this._container.clientHeight,0==(t=this._container.clientWidth)){var i=this._container.style.width||getComputedStyle(this._container).width;if(i&&i.length>0&&i.indexOf("px")>0)t=parseInt(i);else if("100%"==i||this._container.parentNode){var r=this._container.parentNode.style.width||getComputedStyle(this._container.parentNode).width;r&&r.length>0&&r.indexOf("px")>0&&(t=parseInt(r))}}if(0==e){var o=this._container.style.height||getComputedStyle(this._container).height;if(o&&o.length>0&&o.indexOf("px")>0)e=parseInt(o);else if("100%"==o&&this._container.parentNode){var n=this._container.parentNode.style.height||getComputedStyle(this._container.parentNode).height;n&&n.length>0&&n.indexOf("px")>0&&(e=parseInt(n))}}}return 0===t&&(t=400),0===e&&(e=300),[t,e]},o.prototype._detectMissingCSS=function(){t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")},o.prototype._setupContainer=function(){var t=this._container;t.classList.add("lkmap-map"),(this._missingCSSCanary=a.create("div","lkmap-canary",t)).style.visibility="hidden";var e=this._canvasContainer=a.create("div","lkmap-canvas-container",t);this._interactive&&e.classList.add("lkmap-interactive"),e.style.cursor=this._cursor,this._markersContainer=a.create("div","lkmap-markers",e),this._markersContainer.style.position="absolute",this._markersContainer.style.position="absolute",this._markersContainer.style.zIndex="100",this._canvas=a.create("canvas","lkmap-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var i=this._containerDimensions();this._resizeCanvas(i[0],i[1]);var r=this._controlContainer=a.create("div","lkmap-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right","left-center","right-center"].forEach((function(t){o[t]=a.create("div","lkmap-ctrl-"+t,r)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},o.prototype._resizeCanvas=function(e,i){var r=t.exported.devicePixelRatio||1;this._canvas.width=r*e,this._canvas.height=r*i,this._canvas.style.width=e+"px",this._canvas.style.height=i+"px"},o.prototype._setupPainter=function(){var i=this,r=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=null;this._options.isWebGL2&&(o=this._canvas.getContext("webgl2",r)||this._canvas.getContext("experimental-webgl2",r)),o?o.isWebGL2=!0:(o=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r)).isWebGL2=!1,o?(t.storeAuthState(o,!0),this.painter=new Ri(o,this.transform),this.on("data",(function(t){"source"===t.dataType&&i.painter.setTileLoadedFlag(!0)})),t.exported$1.testSupport(o)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},o.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},o.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},o.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},o.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},o.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},o.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},o.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},o.prototype._requestDomTask=function(t){!this.isMoving()&&this.loaded()?t():this._domRenderTaskQueue.add(t)},o.prototype._render=function(e,i){var r,o=this;void 0===i&&(i=!0);var n=this.painter.context.extTimerQuery,a=t.exported.now();this.listens("gpu-timing-frame")&&(r=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,r)),this.style._statisticsTool.frameStart();var s=this._updateAverageElevation(a);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),!this._removed){var l=!1,u=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;var h=this.transform.zoom,p=t.exported.now();this.style.zoomHistory.update(h,p);var c=new t.EvaluationParameters(h,{now:p,fadeDuration:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=c.crossFadingFactor();1===f&&f===this._crossFadingFactor||(l=!0,this._crossFadingFactor=f),this.style.update(c)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,u,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:u,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded){if(this.indoor&&this.indoor.init(),this._loaded=!0,this._container.clientWidth!=this._canvas.width||this._container.clientHeight!=this._canvas.height){var d=this._containerDimensions(),m=d[0],y=d[1];this._resizeCanvas(m,y),this.transform.resize(m,y),this.painter.resize(m,y)}this.fire(new t.Event("load"))}if(this._loaded&&this.indoor&&this.indoor._update(),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),null!==this.modelBox&&this.modelBox.HasAnim()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var g=t.exported.now()-a;n.endQueryEXT(n.TIME_ELAPSED_EXT,r),setTimeout((function(){var e=n.getQueryObjectEXT(r,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(r),o.fire(new t.Event("gpu-timing-frame",{cpuTime:g,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var _=this.painter.collectGpuTimers();setTimeout((function(){var e=o.painter.queryGpuTimers(_);o.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var v=this._sourcesDirty||this._styleDirty||this._placementDirty||s;if(v||this._repaint)this.triggerRepaint();else{var x=!this.isMoving()&&this.loaded();if(x&&(s=this._updateAverageElevation(a,!0)),s)this.triggerRepaint();else if(i&&this._triggerFrame(!1),x&&(this.fire(new t.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){var b=this._calculateSpeedIndex();this.fire(new t.Event("speedindexcompleted",{speedIndex:b})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,this._authenticate()),this}},o.prototype._updateAverageElevation=function(t,e){var i=this;void 0===e&&(e=!1);var r=function(t){return i.transform.averageElevation=t,i._update(!1),!0};if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);if((e||t-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(t)){var o=this.transform.averageElevation,n=this.transform.sampleAverageElevation();isNaN(n)?n=0:this._averageElevationLastSampledAt=t;var a=Math.abs(o-n);if(a>1)this._averageElevation.easeTo(n,t,300);else if(a>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(t)&&r(this._averageElevation.getValue(t))},o.prototype._authenticate=function(){var e=this;t.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(function(i){if(i&&(i.message===t.AUTH_ERR_MSG||401===i.status)){var r=e.painter.context.gl;t.storeAuthState(r,!1),e._logoControl instanceof Hr&&e._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),e._silenceAuthErrors||e.fire(new t.ErrorEvent(new Error("A valid luokuang access token is required to use LKMap JS. To create an account or a new access token, visit https://lbs.luokuang.com/doc.html#/doc/jsapi/devGuide/intro/prepare")))}})),t.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(function(){}))},o.prototype._updateTerrain=function(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming()),this.fire(new t.Event("updateTerrain"))},o.prototype._calculateSpeedIndex=function(){var t=this.painter.canvasCopy(),e=this.painter.getCanvasCopiesAndTimestamps();e.timeStamps.push(performance.now());var i=this.painter.context.gl,r=i.createFramebuffer();function o(t){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0);var e=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,e),e}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(o(t),e.canvasCopies.map(o),e.timeStamps)},o.prototype._canvasPixelComparison=function(t,e,i){for(var r=i[1]-i[0],o=t.length/4,n=0;n<e.length;n++){for(var a=e[n],s=0,l=0;l<a.length;l+=4)a[l]===t[l]&&a[l+1]===t[l+1]&&a[l+2]===t[l+2]&&a[l+3]===t[l+3]&&(s+=1);r+=(i[n+2]-i[n+1])*(1-s/o)}return r},o.prototype.destroy=function(){this._hash&&this._hash.remove();for(var e=0,i=this._controls;e<i.length;e+=1)i[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),gn(this._canvasContainer),gn(this._controlContainer),gn(this._missingCSSCanary),this._container.classList.remove("lkmap-map"),t.removeAuthState(this.painter.context.gl),this.clearLogo(),this._removed=!0,this.fire(new t.Event("remove"))},o.prototype.triggerRepaint=function(){this._triggerFrame(!0)},o.prototype._triggerFrame=function(e){var i=this;this._renderNextFrame=this._renderNextFrame||e,this.style&&!this._frame&&(this._frame=t.exported.frame((function(t){var e=!!i._renderNextFrame;i._frame=null,i._renderNextFrame=null,e&&i._render(t)})))},o.prototype._onWindowOnline=function(){this._update()},o.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},n.showTileBoundaries.get=function(){return!!this._showTileBoundaries},n.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},n.showTerrainWireframe.get=function(){return!!this._showTerrainWireframe},n.showTerrainWireframe.set=function(t){this._showTerrainWireframe!==t&&(this._showTerrainWireframe=t,this._update())},n.speedIndexTiming.get=function(){return!!this._speedIndexTiming},n.speedIndexTiming.set=function(t){this._speedIndexTiming!==t&&(this._speedIndexTiming=t,this._update())},n.showPadding.get=function(){return!!this._showPadding},n.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},n.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},n.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},n.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},n.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},n.repaint.get=function(){return!!this._repaint},n.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},n.vertices.get=function(){return!!this._vertices},n.vertices.set=function(t){this._vertices=t,this._update()},o.prototype._setCacheLimits=function(e,i){t.setCacheLimits(e,i)},n.version.get=function(){return dn},o.prototype.getStyleData=function(e,i,r){void 0===i&&(i=null),void 0===r&&(r=1),e.indexOf("lkmap://styles/")<0&&(e="lkmap://styles/"+e),this.styleId=this._options.styleId=e;var o,n=null===i||"string"==typeof i?i:null;o=e.indexOf("lkmap://styles/")>=0?e.split("/styles/")[1]:e;var a=t.config.API_URL+"/v1/mapStyle/getStyle",s={styleId:o,type:0===r||1===r?r:1,ak:t.config.USER_AK,certInfoId:254};return new Promise((function(t,e){ro.ajax(a,{type:"get",data:s,contentType:"application/x-www-form-urlencoded",token:n,success:function(e){if("string"==typeof e){var i=JSON.parse(e);try{if(0==i.code){var r=JSON.parse(i.data.styleContent);i.data.styleContent=r}t(i)}catch(t){}}else try{if(0==e.code){var o=JSON.parse(e.data.styleContent);e.data.styleContent=o}t(e)}catch(t){}},error:function(t){e()}})}))},o.prototype.plugin=function(t,e){!t||t.length<=0||so.request(t,e)},o.prototype.setMapStyle=function(t,e){if("string"==typeof t){var i=this;return 0!=e&&1!=e||e==this._options.styleType||(this._options.styleType=e),this.getStyleData(t,this,this._options.token,this._options.styleType).then((function(t){if(0===t.code){try{t.data.styleContent=t.data.styleContent,i._styleFile=JSON.parse(JSON.stringify(t.data)),(i._isHotspot||i._isHotspotActive)&&i._addPoiHoverStyle()}catch(e){i._showErrorEvent(t)}t.data&&null!=t.data.recordationNumber&&(i._options.MapAuthData.recordationNumber=t.data.recordationNumber?t.data.recordationNumber:""),i.setStyle(t.data.styleContent,{diff:!1})}else i._showErrorEvent(t),i.getStyleData(mn.style,i,i._options.token,i._options.styleType).then((function(e){try{e.data.styleContent=e.data.styleContent,i._styleFile=JSON.parse(JSON.stringify(e.data)),(i._isHotspot||i._isHotspotActive)&&i._addPoiHoverStyle()}catch(e){i._showErrorEvent(t)}e.data&&null!=e.data.recordationNumber&&(i._options.MapAuthData.recordationNumber=e.data.recordationNumber?e.data.recordationNumber:""),i.setStyle(e.data.styleContent,{diff:!1})}),(function(t){}))}),(function(t){})),i._createLogoControl(),i._styleFile}},o.prototype.updateMapStyle=function(t){var e=this;t&&(this._styleFile.styleContent.layers.forEach((function(t){e.removeLayer(t.id)})),this.getStyleData(t).then((function(t){if(0===t.code){var i=JSON.parse(JSON.stringify(t.data));"custom_sprite"in i.styleContent&&i.styleContent.custom_sprite.forEach((function(t){e.loadSprite(t,(function(t){e.triggerRepaint()}))}));var r=e.style.order[0];i.styleContent.layers.reverse().forEach((function(t,i){e.addLayer(t,r),r=t.id})),e._options.MapAuthData.recordationNumber=i.recordationNumber?i.recordationNumber:"",e._createLogoControl(),e._styleFile=i}})))},o.prototype._showErrorEvent=function(t){this._errorFun&&this._errorFun.length>0&&this._errorFun.forEach((function(e){e(t)}))},o.prototype.getMapStyle=function(){return this._options.styleId},o.prototype.getStyleFile=function(){return this._styleFile},o.prototype.clearInfoWindow=function(){this._popup&&this._popup.remove()},o.prototype.getThumbnail=function(t){var e=this;void 0===t&&(t={});var i=t.width,r=t.height;return new Promise((function(t){e.once("render",(function(){var o=e.getCanvas();i=i||o.width,r=r||o.height;var n=document.createElement("canvas");n.width=i,n.height=r;var a=n.getContext("2d",{willReadFrequently:!0});a.beginPath(),a.drawImage(o,0,0,i,r);var s=n.toDataURL();t(s)})),e.setBearing(e.getBearing())}))},o.prototype.loadSprite=function(t,e,i){void 0===i&&(i={}),this.style._loadImageSprite(t,e,i)},o.prototype.getRandomId=function(t){for(var e=(new Date).getTime().toString(),i=t||6,r="",o="",n=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F","G","H","I","G","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"),a=new Array("A","B","C","D","E","F","G","H","I","G","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",0,1,2,3,4,5,6,7,8,9),s=0;s<i;s++)o+=a[Math.floor(32*Math.random())];for(var l=0;l<i;l++)r+=n[Math.floor(32*Math.random())];return r.length!=i&&createCode(),r+e+o},o.prototype.createDom=function(t,e){void 0===e&&(e=null);var i=document.createElement(t);if(e&&"object"==typeof e)for(var r in e)i[r]=e[r];return i},o.prototype.setBounds=function(t,e,i){void 0===e&&(e={}),void 0===i&&(i={}),this.fitBounds(t instanceof Array?t:[t._sw,t._ne],e,i)},o.prototype.getStatus=function(){return{dragRotate:this.dragRotate.isEnabled(),dragPan:this.dragPan.isEnabled(),scrollZoom:this.scrollZoom.isEnabled(),doubleClickZoom:this.doubleClickZoom.isEnabled(),keyboard:this.keyboard.isEnabled(),touchZoomRotate:this.touchZoomRotate.isEnabled()}},o.prototype.setFitView=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e={}),void 0===i&&(i={});var r=null;if(t&&t.length>0)r=this.getLngLat(t);else if(!t||t instanceof Array){var o=this.getAllOverlays();if(0==o.length)return;r=this.getLngLat(o)}else r=this.getLngLat([t]);r&&r.length>0&&this.setMapBounds(r,e,i)},o.prototype.setMapBounds=function(t,e,i){var r=200,o=200,n=0,a=0;t.forEach((function(t){parseFloat(t[0])>n&&(n=parseFloat(t[0])),parseFloat(t[0])<r&&(r=parseFloat(t[0])),parseFloat(t[1])>a&&(a=parseFloat(t[1])),parseFloat(t[1])<o&&(o=parseFloat(t[1]))}));var s=[n,a],l=[r,o];this.panTo([(n+r)/2,(a+o)/2]),this.fitBounds([l,s],e,i)},o.prototype.getLngLat=function(t){var e=[];return t.forEach((function(t){if(0==t.type.indexOf("LKMapvgl-")||0==t.type.indexOf("LKClusterer_")){var i=t.getBounds();e.push(i._sw.toArray()),e.push(i._ne.toArray())}else if("marker"==t.type||"text"==t.type||"inforWindow"==t.type||"circleMarker"==t.type)e.push(t.getPosition().toArray());else{var r=t.getPath("all");e=e.concat(r)}})),e},o.prototype.add=function(t){var e=this;t instanceof Array?t.forEach((function(t){t.id?t.setMap(e):t.addTo(e)})):t.id?t.setMap(this):t.addTo(this)},o.prototype.remove=function(t){var e=this;void 0===t&&(t=null),t&&(t instanceof Array?t.forEach((function(t){t.id&&"marker"!=t.type?(e.getSource(t)&&e.removeSource(t.id),e.removeLayer(t),t.lineGeojson&&(e.getSource(t.lineGeojson.id)&&e.removeSource(t.lineGeojson.id),e.removeLayer(t.lineGeojson))):t.remove()})):t.id&&"marker"!=t.type?(this.getSource(t.id)&&this.removeSource(t.id),this.removeLayer(t),t.lineGeojson&&(this.getSource(t.lineGeojson.id)&&this.removeSource(t.lineGeojson.id),this.removeLayer(t.lineGeojson))):t.remove())},o.prototype.setDragRotate=function(t){void 0===t&&(t=!1),t?this.dragRotate.enable():this.dragRotate.disable()},o.prototype.getDragRotate=function(t){return void 0===t&&(t="isEnabled"),"isActive"==t?this.dragRotate.isActive():this.dragRotate.isEnabled()},o.prototype.setScrollZoom=function(t){void 0===t&&(t=!1),t?this.scrollZoom.enable():this.scrollZoom.disable()},o.prototype.setScrollZoomRate=function(t){void 0===t&&(t=.01),this.scrollZoom.setZoomRate(parseFloat(t))},o.prototype.setWheelScrollZoomRate=function(t){void 0===t&&(t=1/450),this.scrollZoom.setWheelZoomRate(parseFloat(t))},o.prototype.getScrollZoom=function(){return this.dragRotate.isEnabled()},o.prototype.setDragPan=function(t){void 0===t&&(t=!1),t?this.dragPan.enable():this.dragPan.disable()},o.prototype.getDragPan=function(t){return void 0===t&&(t="isEnabled"),"isActive"==t?this.dragPan.isActive():this.dragPan.isEnabled()},o.prototype.setDragRotate=function(t){void 0===t&&(t=!1),t?this.dragRotate._mouseRotate.enable():this.dragRotate._mouseRotate.disable()},o.prototype.getDragRotate=function(t){return void 0===t&&(t="isEnabled"),"isActive"==t?this.dragRotate._mouseRotate.isActive():this.dragRotate._mouseRotate.isEnabled()},o.prototype.setDragPitch=function(t){void 0===t&&(t=!1),t?this.dragRotate._mousePitch.enable():this.dragRotate._mousePitch.disable()},o.prototype.getDragPitch=function(t){return void 0===t&&(t="isEnabled"),"isActive"==t?this.dragRotate._mousePitch.isActive():this.dragRotate._mousePitch.isEnabled()},o.prototype.setKeyboard=function(t){void 0===t&&(t=!1),t?this.keyboard.enable():this.keyboard.disable()},o.prototype.getKeyboard=function(t){return this.keyboard.isEnabled()},o.prototype.setDoubleClickZoom=function(t){void 0===t&&(t=!1),t?this.doubleClickZoom.enable():this.doubleClickZoom.disable()},o.prototype.getDoubleClickZoom=function(t){return void 0===t&&(t="isEnabled"),"isActive"==t?this.doubleClickZoom.isActive():this.doubleClickZoom.isEnabled()},o.prototype.setTouchZoomRotate=function(t){void 0===t&&(t=!1),t?this.touchZoomRotate.enable():this.touchZoomRotate.disable()},o.prototype.getTouchZoomRotate=function(){return this.touchZoomRotate.isEnabled()},o.prototype.setTouchRotate=function(t){void 0===t&&(t=!1),t?this.touchZoomRotate.enableRotation():this.touchZoomRotate.disableRotation()},o.prototype.getTouchRotate=function(){return this.touchZoomRotate.isEnabledTouchRotate()},o.prototype.setTouchZoom=function(t){void 0===t&&(t=!1),t?this.touchZoomRotate.enableTouchZoom():this.touchZoomRotate.disableTouchZoom()},o.prototype.getTouchZoom=function(){return this.touchZoomRotate.isEnabledTouchZoom()},o.prototype.setTouchPitch=function(t){void 0===t&&(t=!1),t?this.touchPitch.enable():this.touchPitch.disable()},o.prototype.getTouchPitch=function(){return"isActive"==type?this.touchPitch.isActive():this.touchPitch.isEnabled()},o.prototype.removeSky=function(){this.style.hasLayer("LK_SKY_layer")&&(this._options.sky=!1,this.removeLayer("LK_SKY_layer"))},o.prototype.addSky=function(){this.style.hasLayer("LK_SKY_layer")||(this._options.sky=!0,this._SkyClass&&"LK_SKY_layer"==this._SkyClass.id?this._SkyClass.setMap(this):this.addLayer({id:"LK_SKY_layer",type:"sky",paint:{"sky-type":"gradient","sky-gradient":["interpolate",["linear"],["sky-radial-progress"],.8,"rgba(87, 141, 219, 0.8)",1,"rgba(202, 233, 250, 0.1)"],"sky-gradient-center":[0,0],"sky-gradient-radius":96,"sky-opacity":["interpolate",["exponential",1],["zoom"],5,1,22,1]}}))},o.prototype.removeFog=function(){this.getFog()&&(this._options.fog=!1,this.setFog())},o.prototype.addFog=function(){this.getFog()||(this._options.fog=!0,this.setFog({range:["interpolate",["exponential",.1],["zoom"],1,["literal",[1,11]],10,["literal",[2,10]],12,["literal",[3,10]],13,["literal",[5,10]],14,["literal",[4,10]],15,["literal",[3,10]],16,["literal",[2,10]],17,["literal",[0,10]],18,["literal",[3,10]],19,["literal",[5,10]],20,["literal",[7,20]],21,["literal",[10,20]],22,["literal",[11,20]]],color:["interpolate",["linear"],["zoom"],5,"rgba(202, 233, 250, 1)",9,"rgba(202, 233, 250, 1)"],"horizon-blend":.2}))},o.prototype.updateSKYLatyer=function(){},o.prototype._removePOIEvent=function(){var t=this;this._hotspotLayerId.length>0&&this._hotspotLayerId.forEach((function(e){t.off("click",e,t._poiClickEventCallback),t.off("mouseover",e,t._poiMouseoverEventCallback),t.off("mouseout",e,t._poiMouseoutEventCallback)}))},o.prototype._getPoiOldStyle=function(){var t=this;this._hotspotLayerStyle={},this._hotspotLayerId.forEach((function(e){var i=t.getPaintProperty(e,"text-color");!i||i instanceof Array||!i.hasOwnProperty("stops")||(i=i.stops[0][1]),t._hotspotLayerStyle[e]={"text-color":i}}))},o.prototype._addPoiHoverStyle=function(t){var e=this;if(this._removePOIEvent(),this.style.stylesheet&&this.style.stylesheet.layers){var i=this.style.stylesheet.layers;this._hotspotLayerId=[],i.forEach((function(t){"cn_poi_label"==t["source-layer"]&&"symbol"==t.type&&e._hotspotLayerId.push(t.id)})),this._getPoiOldStyle(),this._hotspotLayerId.forEach((function(t){e.on("click",t,e._poiClickEventCallback),e.on("mouseover",t,e._poiMouseoverEventCallback),e.on("mouseout",t,e._poiMouseoutEventCallback)})),this._setActivePoiStyle()}else var r=setInterval((function(){e.style.stylesheet&&e.style.stylesheet.layers&&(clearInterval(r),clearTimeout(o),e._addPoiHoverStyle())}),100),o=setTimeout((function(){clearInterval(r)}),5e3)},o.prototype._setActivePoiStyle=function(){if(this._hotspotActiveData){var t=this._hotspotActiveData.layerId;if(!this.style.getLayer(t))return;var e=this._hotspotLayerStyle[t]["text-color"];e&&this.setPaintProperty(t,"text-color",["case",["==",["id"],this._hotspotActiveData.featuresOneId],this._isHotspotTextColor,e])}},o.prototype._poiClickEventCallback=function(e){var i=!0;if(this._hotspotActiveData&&this._hotspotData&&this._isHotspotActive){var r=this._hotspotActiveData.layerId;if(e.layer.id!==r&&this.style.getLayer(r)){var o=this._hotspotLayerStyle[r]["text-color"];o&&this.setPaintProperty(r,"text-color",o)}if(e.features[0].id!=this._hotspotActiveData.featuresOneId){var n=e.layer.id,a=this._hotspotLayerStyle[n]["text-color"];a&&this.setPaintProperty(n,"text-color",["case",["==",["id"],e.features[0].id],this._isHotspotTextColor,a])}else i=!1}this.fire(new t.Event("hotspotclick",this._getHotspotData(e,"click",i)))},o.prototype._getHotspotData=function(e,i,r){void 0===i&&(i=""),void 0===r&&(r=!0);var o=t.extend({},{layerId:e.layer.id,target:e.target,originalEvent:e.originalEvent,features:e.features,point:e.point,type:"hotspotclick"});if(e.features&&e.features.length>0){var n=e.features[0].geometry.coordinates,a=e.features[0].properties;o=t.extend(o,{featuresOneId:e.features[0].id,id:"emg:venue:"+e.features[0].id,name:a.namec,maki:a.maki,namep:a.namep,lngLat:new t.LngLat(n[0],n[1])})}return"mouseout"==i&&e.layer.id==this._hotspotData.layer.id&&(o=this._hotspotData,this._hotspotData={}),"mouseover"==i&&(this._hotspotData=o),"click"==i&&(this._hotspotActiveData=this._isHotspotActive&&r?o:null),o},o.prototype._poiMouseoverEventCallback=function(e){var i=e.layer.id;if(this._isHotspot&&this._hotspotLayerId.indexOf(i)>-1&&e.features&&e.features.length>0){this.setCursor("pointer");var r=e.features[0].id,o=this._hotspotLayerStyle[i]["text-color"],n=["case",["==",["id"],r],this._isHotspotTextColor,o];this._isHotspotActive&&this._hotspotActiveData&&(n=["case",["any",["==",["id"],this._hotspotActiveData.featuresOneId],["==",["id"],r]],this._isHotspotTextColor,o]),o&&this.setPaintProperty(i,"text-color",n)}this.listens("hotspotover")&&this.fire(new t.Event("hotspotover",this._getHotspotData(e,"mouseover")))},o.prototype._poiMouseoutEventCallback=function(e){var i=e.layer.id;if(this._isHotspot&&this._hotspotLayerId.indexOf(i)>-1){this.setCursor(this._options.cursor);var r=this._hotspotLayerStyle[i]["text-color"],o=r;this._isHotspotActive&&this._hotspotActiveData&&(o=["case",["==",["id"],this._hotspotActiveData.featuresOneId],this._isHotspotTextColor,r]),r&&this.setPaintProperty(i,"text-color",o)}this.listens("hotspotout")&&this.fire(new t.Event("hotspotout",this._getHotspotData(e,"mouseout")))},o.prototype.addSatellite=function(t,e){if(void 0===e&&(e={}),!this.getLayer("10000000000020")){var i=null;if("number"==typeof t?(t>this.style._order.length&&(t=this.style._order.length-1),i=this.style._order[t]):!t||t instanceof Array?"string"==typeof t&&(i=t):(i=this.style._order[t.zIndex],e=t),e.beforeId&&(i=e.beforeId),!this.getSource("satellite")){var r={type:"raster",tiles:["https://api.luokuang.com/satellite/v1/wmts/service/1010/64?service=WMTS&request=GetTile&encryption=GCJ02&version=1.0.0&layer=&style=&tilematrixSet=GoogleMapsCompatible&format=image/png&transparent=1&width=256&height=256&opacity=1&srs=EPSG:3857&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"],tileSize:256},o=Object.keys(e);o.length>0&&o.forEach((function(t){r[t]=e[t]})),this.addSource("satellite",r)}var n={id:"10000000000020",type:"raster",source:"satellite","source-layer":"",minzoom:0,maxzoom:24,groupid:"",groupname:"卫星图",name:"卫星图层"};return i?this.addLayer(n,i):this.addLayer(n),this.getLayer("10000000000020")}},o.prototype.clearSatellite=function(){this.getLayer("10000000000020")&&this.removeLayer("10000000000020")},o.prototype.setSatellitezIndex=function(t){if(this.getLayer("10000000000020")&&t){var e=this.style._order[this.style._order.length-1];"number"==typeof t?(t>this.style._order.length&&(t=this.style._order.length-1),e=this.style._order[t]):"string"==typeof t&&(e=t),this.moveLayer("10000000000020",e)}},o.prototype.getSatellitezIndex=function(){return this.style._order.indexOf("10000000000020")},o.prototype.showSatellite=function(){this.getLayer("10000000000020")&&this.setLayoutProperty("10000000000020","visibility","visible")},o.prototype.hideSatellite=function(){this.getLayer("10000000000020")&&this.setLayoutProperty("10000000000020","visibility","none")},o.prototype.getMapView=function(t){void 0===t&&(t=!1);var e={center:[this.transform.center.lng,this.transform.center.lat],zoom:parseFloat(this.transform.zoom.toFixed(1)),pitch:parseFloat(this.transform.pitch.toFixed(1)),bearing:parseFloat(this.transform.bearing.toFixed(1))};return t?JSON.stringify(e):e},Object.defineProperties(o.prototype,n),o}(Wr);function gn(t){t.parentNode&&t.parentNode.removeChild(t)}var _n={showCompass:!0,showZoom:!0,visualizePitch:!1},vn=function(e){var i=this;this.options=t.extend({},_n,e),this._container=a.create("div","lkmap-ctrl lkmap-ctrl-group"),this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("lkmap-ctrl-zoom-in",(function(t){return i._map.zoomIn({},{originalEvent:t})})),a.create("span","lkmap-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("lkmap-ctrl-zoom-out",(function(t){return i._map.zoomOut({},{originalEvent:t})})),a.create("span","lkmap-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("lkmap-ctrl-compass",(function(t){i.options.visualizePitch?i._map.resetNorthPitch({},{originalEvent:t}):i._map.resetNorth({},{originalEvent:t})})),this._compassIcon=a.create("span","lkmap-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};vn.prototype._updateZoomButtons=function(){var t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},vn.prototype._rotateCompassArrow=function(){var t=this,e=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._map._requestDomTask((function(){t._compassIcon&&(t._compassIcon.style.transform=e)}))},vn.prototype.onAdd=function(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new xn(this._map,this._compass,this.options.visualizePitch)),this._container},vn.prototype.onRemove=function(){a.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map},vn.prototype._createButton=function(t,e){var i=a.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i},vn.prototype._setButtonTitle=function(t,e){var i=this._map._getUIString("NavigationControl."+e);t.title=i,t.setAttribute("aria-label",i)};var xn=function(e,i,r){void 0===r&&(r=!1),this._clickTolerance=10,this.element=i,this.mouseRotate=new vr({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,r&&(this.mousePitch=new xr({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener(i,"mousedown",this.mousedown),a.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),a.addEventListener(i,"touchmove",this.touchmove),a.addEventListener(i,"touchend",this.touchend),a.addEventListener(i,"touchcancel",this.reset)};xn.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),a.disableDrag()},xn.prototype.move=function(t,e){var i=this.map,r=this.mouseRotate.mousemoveWindow(t,e);if(r&&r.bearingDelta&&i.setBearing(i.getBearing()+r.bearingDelta),this.mousePitch){var o=this.mousePitch.mousemoveWindow(t,e);o&&o.pitchDelta&&i.setPitch(i.getPitch()+o.pitchDelta)}},xn.prototype.off=function(){var t=this.element;a.removeEventListener(t,"mousedown",this.mousedown),a.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(t,"touchmove",this.touchmove),a.removeEventListener(t,"touchend",this.touchend),a.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},xn.prototype.offTemp=function(){a.enableDrag(),a.removeEventListener(t.window,"mousemove",this.mousemove),a.removeEventListener(t.window,"mouseup",this.mouseup)},xn.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),a.mousePos(this.element,e)),a.addEventListener(t.window,"mousemove",this.mousemove),a.addEventListener(t.window,"mouseup",this.mouseup)},xn.prototype.mousemove=function(t){this.move(t,a.mousePos(this.element,t))},xn.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},xn.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},xn.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=a.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},xn.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},xn.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var bn,wn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},kn=0,Tn=!1,In=function(e){function i(i){e.call(this),this.options=t.extend({},wn,i),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.onAdd=function(e){var i;return this._map=e,this._container=a.create("div","lkmap-ctrl lkmap-ctrl-group"),i=this._setupUI,void 0!==bn?i(bn):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){i(bn="denied"!==t.state)})):i(bn=!!t.window.navigator.geolocation),this._container},i.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,kn=0,Tn=!1},i.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())},i.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting")}},i.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("lkmap-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},i.prototype._updateCamera=function(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,o=this._map.getBearing(),n=t.extend({bearing:o},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),n,{geolocateSource:!0})},i.prototype._updateMarker=function(e){if(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},i.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([100,t]),r=e.distanceTo(i)/100,o=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=o+"px",this._circleElement.style.height=o+"px"},i.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},i.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Tn)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("lkmap-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},i.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},i.prototype._setupUI=function(e){var i=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=a.create("button","lkmap-ctrl-geolocate",this._container),a.create("span","lkmap-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","lkmap-user-location-dot"),this._userLocationDotMarker=new eo(this._dotElement),this._circleElement=a.create("div","lkmap-user-location-accuracy-circle"),this._accuracyCircleMarker=new eo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==i._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(i._watchState="BACKGROUND",i._geolocateButton.classList.add("lkmap-ctrl-geolocate-background"),i._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active"),i.fire(new t.Event("trackuserlocationend")))}))},i.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":kn--,Tn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background"),this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("lkmap-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("lkmap-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++kn>1?(e={maximumAge:6e5,timeout:0},Tn=!0):(e=this.options.positionOptions,Tn=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},i.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("lkmap-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},i}(t.Evented),Sn=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};Sn.prototype.getDefaultPosition=function(){return"bottom-right"},Sn.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=a.create("div","lkmap-ctrl lkmap-ctrl-attrib"),this._compactButton=a.create("button","lkmap-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.create("div","lkmap-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("lkmap-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Sn.prototype.onRemove=function(){a.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},Sn.prototype._setElementTitle=function(t,e){var i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i)},Sn.prototype._toggleAttribution=function(){this._container.classList.contains("lkmap-compact-show")?(this._container.classList.remove("lkmap-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("lkmap-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},Sn.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".lkmap-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];e&&(i.reduce((function(t,e,r){return e.value&&(t+=e.key+"="+e.value+(r<i.length-1?"&":"")),t}),"?"),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback"))},Sn.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},Sn.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return"string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var i=this._map.style._sourceCaches;for(var r in i){var o=i[r];if(o.used){var n=o.getSource();n.attribution&&t.indexOf(n.attribution)<0&&t.push(n.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,i){for(var r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("lkmap-attrib-empty")):this._container.classList.add("lkmap-attrib-empty"),this._editLink=null)}},Sn.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("lkmap-compact"):this._container.classList.remove("lkmap-compact","lkmap-compact-show")};var En={maxWidth:100,unit:"metric"},An=function(e){this.options=t.extend({},En,e),t.bindAll(["_onMove","setUnit"],this)};function Pn(t,e,i){var r=i&&i.maxWidth||100,o=t._container.clientHeight/2,n=t.unproject([0,o]),a=t.unproject([r,o]),s=n.distanceTo(a);if(i&&"imperial"===i.unit){var l=3.2808*s;l>5280?Mn(e,r,l/5280,t._getUIString("ScaleControl.Miles"),t):Mn(e,r,l,t._getUIString("ScaleControl.Feet"),t)}else i&&"nautical"===i.unit?Mn(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles"),t):s>=1e3?Mn(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers"),t):Mn(e,r,s,t._getUIString("ScaleControl.Meters"),t)}function Mn(t,e,i,r,o){var n,a,s,l=(n=i,(a=Math.pow(10,(""+Math.floor(n)).length-1))*(s=(s=n/a)>=10?10:s>=5?5:s>=3?3:s>=2?2:s>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(s))),u=l/i;o._requestDomTask((function(){t.style.width=e*u+"px",t.innerHTML=l+"&nbsp;"+r}))}An.prototype.getDefaultPosition=function(){return"bottom-left"},An.prototype._onMove=function(){Pn(this._map,this._container,this.options)},An.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","lkmap-ctrl lkmap-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},An.prototype.onRemove=function(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},An.prototype.setUnit=function(t){this.options.unit=t,Pn(this._map,this._container,this.options)};var Ln=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in t.window.document&&(this._fullscreenchange="webkitfullscreenchange")};Ln.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=a.create("div","lkmap-ctrl lkmap-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Ln.prototype.onRemove=function(){a.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Ln.prototype._checkFullscreenSupport=function(){return!(!t.window.document.fullscreenEnabled&&!t.window.document.webkitFullscreenEnabled)},Ln.prototype._setupUI=function(){var e=this._fullscreenButton=a.create("button","lkmap-ctrl-fullscreen",this._controlContainer);a.create("span","lkmap-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Ln.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Ln.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Ln.prototype._isFullscreen=function(){return this._fullscreen},Ln.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("lkmap-ctrl-shrink"),this._fullscreenButton.classList.toggle("lkmap-ctrl-fullscreen"),this._updateTitle())},Ln.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Cn={closeButton:!0,closeOnClick:!1,focusAfterOpen:!0,className:"",maxWidth:"1000px",isCustom:!1,anchor:"bottom",autoMove:!0,showShadow:!1,offset:[0,0],extData:null,height:0,heightBuffer:0,followFogOpacity:!0,heightAnchorElevation:!0,clearOtherInfoWindow:!0},Dn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),zn=function(e){function r(i){e.call(this),this.options=t.extend(Object.create(Cn),i),this.id="custom_inforWindow_"+t.getRandomId(),this.type="inforWindow",this.options.extData&&(this.extData=this.options.extData),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag","setMap","open","nodeToString","setMarkerLngLat","setPosition","getElement","close","_checkInforWindowWidthHeight","_getPixelXone","_getPixelXtow","_getPixelXthree","_getPixelYone","_getPixelYtwo","_getPixelYthree","_setShowShadowStyle","setExtData","getExtData","getId","setOffset","getOffset","_checkAutMoveShowShadow","on","off","setBubble","getBubble","getHeightBuffer","setHeightBuffer","setHeightAnchorElevation"],this),this._eventAll=[],this._eventArr=["click","dblclick","contextmenu","mousemove","mouseover","mouseout","mousedown","mouseup","touchstart","touchmove","touchend"],this._otherEvent={},this._bubbleEvent={click:null,dblclick:null,contextmenu:null,mousemove:null,mouseover:null,mouseout:null,mousedown:null,mouseup:null,mouseup:null,mouseup:null,mouseup:null},this._timeout=null,this._interval=null,this._scale=i&&i.scale||1,this._offset=t.pointGeometry.convert(i&&i.offset||[0,0]),this._defaultMarker=!0,this._height=i&&i.height||0,this._heightBuffer=i&&i.heightBuffer||0,this._heightAnchorElevation=this.options.heightAnchorElevation,this.init()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.init=function(){this.options.position&&this.setLngLat(this.options.position),this.options.content&&("string"==typeof this.options.content?this.setHTML(this.options.content):this.setDOMContent(this.nodeToString(this.options.content))),this.options.map&&this.open(this.options.map)},r.prototype.getHeightBuffer=function(){return this._heightBuffer},r.prototype.setHeightBuffer=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._heightBuffer=t)},r.prototype.getId=function(){return this.id},r.prototype.nodeToString=function(t){var e=document.createElement("div");return e.appendChild(t),e},r.prototype.addTo=function(e){var i=this;if(e)return this.options.clearOtherInfoWindow&&(this._map._popup.forEach((function(t){t.remove()})),this._map._popup=[]),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("updateTerrain",this._update),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("lkmap-popup-track-pointer"),this._map._canvasContainer.classList.add("lkmap-track-pointer")):this._map.on("move",this._update),this._map._popup.push(this),this.fire(new t.Event("open")),this._eventAll.length>0&&this._eventAll.forEach((function(t){i._addMarkerEvent(t)})),this},r.prototype.setMap=function(t){var e=this;t&&this.options.position&&(this._map=t,this._map._loaded?(this.addTo(t),this._checkAutMoveShowShadow()):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e.addTo(t),e._checkAutMoveShowShadow())}),10)))},r.prototype.open=function(t,e){var i=this;t&&(e||this._lngLat)&&(e&&this.setLngLat(e),this._map=t,this._map._loaded?(this.addTo(t),this._checkAutMoveShowShadow()):(this._timeout=setTimeout((function(){clearInterval(i._interval)}),5e3),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i.addTo(t),i._checkAutMoveShowShadow())}),10)))},r.prototype._checkAutMoveShowShadow=function(){this.options.autoMove&&this._checkInforWindowWidthHeight(),this.options.showShadow&&this._setShowShadowStyle()},r.prototype.isOpen=function(){return!!this._map},r.prototype.remove=function(){if(this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map){for(var e=0;e<this._map._popup.length;e++)if(this._map._popup[e].id==this.id){this._map._popup.splice(0,1);break}this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("updateTerrain",this._update),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map}return this.fire(new t.Event("close")),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.getPosition=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this.options.position=this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("lkmap-popup-track-pointer"),this._map._canvasContainer.classList.remove("lkmap-track-pointer")),this},r.prototype.setMarkerLngLat=function(t){t&&(this.setLngLat(t.lng&&t.lat?[t.lng,t.lat]:t),this.options.position=t)},r.prototype.setPosition=function(t){this.setMarkerLngLat(t)},r.prototype.setAnchor=function(t){this.options.anchor=t,this._update()},r.prototype.getAnchor=function(){return this.options.anchor},r.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("lkmap-popup-track-pointer"),this._map._canvasContainer.classList.add("lkmap-track-pointer")),this},r.prototype.getElement=function(){return this._content},r.prototype.close=function(){this.remove()},r.prototype.setText=function(e){return this._contentText=a.create("div","lkmap-popup-text"),this._contentText.appendChild(t.window.document.createTextNode(e)),this.setDOMContent(this._contentText)},r.prototype.setHTML=function(e){var i,r=t.window.document.createDocumentFragment(),o=t.window.document.createElement("body");for(o.innerHTML=e;i=o.firstChild;)r.appendChild(i);return this.setDOMContent(r)},r.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},r.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},r.prototype.setDOMContent=function(t){return this.options.isCustom?this._content=t:(this._createContent(),this._content.appendChild(t)),this._update(),this},r.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},r.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},r.prototype.setOffset=function(e){return this.options.offset=e,this._offset=t.pointGeometry.convert(e||[0,0]),this._update(),this},r.prototype.getOffset=function(){return this._offset},r.prototype.setExtData=function(t){this.extData=this.options.extData=t},r.prototype.getExtData=function(){return this.extData||this.options.extData},r.prototype.getHeight=function(){return this._height},r.prototype.setHeight=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._height=this.options.height=t,this._update())},r.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},r.prototype._createContent=function(){this._content&&a.remove(this._content),this._content=a.create("div","lkmap-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("div","lkmap-popup-close-button",this._content),this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},r.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=a.create("div","lkmap-popup-close-button",this._content),this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},r.prototype._onMouseUp=function(t){this._update(t.point)},r.prototype._onMouseMove=function(t){this._update(t.point)},r.prototype._onDrag=function(t){this._update(t.point)},r.prototype.setHeightAnchorElevation=function(t){this._heightAnchorElevation=!!t,this.options.heightAnchorElevation=this._heightAnchorElevation,this._update()},r.prototype._update=function(e){var i=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=a.create("div","lkmap-popup",this._map.getContainer()),this.options.isCustom||(this._tip=a.create("div","lkmap-popup-tip",this._container)),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return i._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("lkmap-popup-track-pointer")),this._container.style.willChange="transform",this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),!this.options.isCustom&&this.options.size&&(this._content.style.width=this.options.size instanceof Array?this.options.size[0]:this.options.size.width,this._content.style.height=this.options.size instanceof Array?this.options.size[1]:this.options.size.height),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Kr(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var r=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);if(this._height&&0!==this._height){var o=t.LngLat.convert(this._lngLat),n=new t.MercatorCoordinate(t.mercatorXfromLng(o.lng),t.mercatorYfromLat(o.lat),t.mercatorZfromAltitude(this._height,o.lat));r=this._pos=this._trackPointer&&e?e:this._map.transform._coordinatePoint(n,!0,this._heightAnchorElevation)._add(this._transformedOffset())}var s=this.options.anchor,l=On(this.options.offset);if(this.options.offset&&(this.options.offset instanceof Array||(l=On([this.options.offset.x,this.options.offset.y]))),!s){var u,h=this._container.offsetWidth,p=this._container.offsetHeight;u=r.y+l.bottom.y<p?["top"]:r.y>this._map.transform.height-p?["bottom"]:[],r.x<h/2?u.push("left"):r.x>this._map.transform.width-h/2&&u.push("right"),s=0===u.length?"bottom":u.join("-")}this._evaluateOpacity();var c=r.add(l[s]).round();this._container&&s&&(a.setTransform(this._container,Jr[s]+" translate("+c.x+"px,"+c.y+"px)"),Qr(this._container,s,"popup")),this._container.style.willChange=null}},r.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Dn);t&&t.focus()}},r.prototype._onClose=function(){this.remove()},r.prototype._setOpacity=function(t){this._content&&(this._content.style.opacity=t),this._tip&&(this._tip.style.opacity=t)},r.prototype._setShowShadowStyle=function(){var e=this._content.offsetHeight,i=this._content.offsetWidth;this._showShadow=a.create("div","lkmap-popup-showShadow",this._container);var r=1.5696202531645569*i,o=.6*e;this._showShadow.style.width=r+"px",this._showShadow.style.height=o+"px";var n=parseInt(o/2),s=r/2,l=0,u=0,h=0;if(i/e>=3&&(h=50,l=-n/Math.cos(h)),!this.options.isCustom)switch(this.options.anchor){case"center":l+=16;break;case"bottom":case"bottom-center":case"bottom-left":case"bottom-right":u+=10;break;case"left":case"middle-left":l+=10}this.options.showShadowOffset&&(this.options.showShadowOffset instanceof Array?(l-=this.options.showShadowOffset[0],u-=this.options.showShadowOffset[1]):(l-=this.options.showShadowOffset.x,u-=this.options.showShadowOffset.y)),this._showShadow.style.left=l+"px",this._showShadow.style.bottom=u+"px",this._showShadow.style.transform="skewX("+h+"deg)";var p=t.window.document.createElement("div");p.className="topLeft",p.style.width=s+"px",p.style.height=n+"px";var c=t.window.document.createElement("div");c.className="topRight",c.style.width=s+"px",c.style.left=r/2+"px",c.style.height=n+"px";var f=t.window.document.createElement("div");f.className="bottomRight",f.style.width=s+"px",f.style.height=n+"px",f.style.left=r/2+"px",f.style.top=n+"px";var d=t.window.document.createElement("div");d.className="bottomLeft",d.style.width=s+"px",d.style.height=n+"px",d.style.top=n+"px",this._showShadow.appendChild(p),this._showShadow.appendChild(c),this._showShadow.appendChild(f),this._showShadow.appendChild(d)},r.prototype._checkInforWindowWidthHeight=function(){var t=this._map.lngLatToContainer(this.options.position),e=this._map.getContainer().offsetWidth,i=this._map.getContainer().offsetHeight,r=this._container.offsetWidth,o=this._container.offsetHeight,n=[0,0];switch(this.checkStatus=!1,this.options.offset&&(t.x+=this.options.offset instanceof Array?this.options.offset[0]:this.options.offset.x,t.y+=this.options.offset instanceof Array?this.options.offset[1]:this.options.offset.y),this.options.anchor){case"center":t.x<r/2?(n[0]-=r/2-t.x,this.checkStatus=!0):t.x>e-r/2&&(n[0]+=t.x+r/2-e+20,this.checkStatus=!0),n[1]=this._getPixelYone(t,o,i);break;case"bottom":case"bottom-center":n[0]=this._getPixelXone(t,r,e),n[1]=this._getPixelYthree(t,o,i);break;case"top":case"top-center":n[0]=this._getPixelXone(t,r,e),n[1]=this._getPixelYtwo(t,o,i);break;case"left":case"middle-left":n[0]=this._getPixelXtow(t,r,e),n[1]=this._getPixelYone(t,o,i);break;case"right":case"middle-right":n[0]=this._getPixelXthree(t,r,e),n[1]=this._getPixelYone(t,o,i);break;case"top-left":n[0]=this._getPixelXtow(t,r,e),n[1]=this._getPixelYtwo(t,o,i);break;case"top-right":n[0]=this._getPixelXthree(t,r,e),n[1]=this._getPixelYtwo(t,o,i);break;case"bottom-left":n[0]=this._getPixelXtow(t,r,e),n[1]=this._getPixelYthree(t,o,i);break;case"bottom-right":n[0]=this._getPixelXthree(t,r,e),n[1]=this._getPixelYthree(t,o,i)}this.checkStatus&&this._map.panBy(n)},r.prototype._getPixelXone=function(t,e,i){var r=0;return t.x<e/2?(r-=e/2-t.x+20,this.checkStatus=!0):t.x>i-e/2&&(r+=t.x+e/2-i+20,this.checkStatus=!0),r},r.prototype._getPixelXtow=function(t,e,i){var r=0;return t.x<0?(r=t.x+-20,this.checkStatus=!0):t.x>i-e&&(r=t.x+e-i+20,this.checkStatus=!0),r},r.prototype._getPixelXthree=function(t,e,i){var r=0;return t.x<e?(r-=e-t.x+20,this.checkStatus=!0):t.x>i&&(r+=t.x-i+20,this.checkStatus=!0),r},r.prototype._getPixelYone=function(t,e,i){var r=0;return t.y<e/2?(r-=e/2-t.y+20,this.checkStatus=!0):t.y>i-e/2&&(r=t.y+e/2-i+20,this.checkStatus=!0),r},r.prototype._getPixelYtwo=function(t,e,i){var r=0;return t.y<0?(r=t.y+-20,this.checkStatus=!0):t.y>i-e&&(r=t.y+e-i+20,this.checkStatus=!0),r},r.prototype._getPixelYthree=function(t,e,i){var r=0;return t.y<e?(r-=e-t.y+20,this.checkStatus=!0):t.y>i&&(r+=t.y-i+20,this.checkStatus=!0),r},r.prototype._setBubble=function(){a.addEventListener(this._content,"mousedown",this._stopPropagation),a.addEventListener(this._content,"mouseup",this._stopPropagation),a.addEventListener(this._content,"contextmenu",this._stopPropagation),a.addEventListener(this._content,"touchstart",this._stopPropagation),a.addEventListener(this._content,"touchmove",this._stopPropagation),a.addEventListener(this._content,"touchend",this._stopPropagation),a.addEventListener(this._content,"dblclick",this._stopPropagation),a.addEventListener(this._content,"click",this._stopPropagation)},r.prototype._stopPropagation=function(t){t.preventDefault(),t.stopPropagation()},r.prototype._addMarkerEvent=function(t){var e=this;e._container.dispatchEvent?e._container.addEventListener(t,e._eventCallbackFun.bind(e)):e._container.attachEvent("on"+t,e._eventCallbackFun.bind(e))},r.prototype._eventCallbackFun=function(e){var r=this;if(("lkmap-popup"==e.target.className.split(" ")[0]||"lkmap-popup-content"==e.target.className.split(" ")[0]||"lkmap-popup-tip"==e.target.className.split(" ")[0])&&r._bubbleEvent[e.type])if("click"==e.type||"dblclick"==e.type){if(t.window._inforWindowClicked)return void(t.window._inforWindowClicked=!1);if(t.window._inforWindowClicked=!0,setTimeout((function(){t.window._inforWindowClicked=!1}),500),r._bubbleEvent[e.type]){var o={};o.target=r,o.layer=r,o.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},o.originalEvent=e,o.lngLat=o.mouse.lngLat,o.point=o.mouse.point,o.type=o.mouse.type,r._bubbleEvent[e.type](o)}}else if(r._bubbleEvent[e.type]){var n={};n.target=r,n.layer=r,n.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},n.originalEvent=e,n.lngLat=n.mouse.lngLat,n.point=n.mouse.point,n.type=n.mouse.type,r._bubbleEvent[e.type](n)}},r.prototype._evaluateOpacity=function(){if(this.options.followFogOpacity&&this._map._options.fog){var t=this._pos?this._pos.sub(this._transformedOffset()):null;if(this._withinScreenBounds(t)){var e=this._map.unproject(t),i=!1;if(this._map.getTerrain()){var r=this._map.getFreeCameraOptions();if(r.position){var o=r.position.toLngLat();i=o.distanceTo(e)<.9*o.distanceTo(this._lngLat)}}var n=(1-this._map._queryFogOpacity(e))*(i?.2:1);this._container.style.opacity=""+n,this._popup&&this._popup._setOpacity(""+n)}}},r.prototype._withinScreenBounds=function(t){if(!this._map)return!1;var e=this._map.transform;return!!t&&t.x>=0&&t.x<e.width&&t.y>=0&&t.y<e.height},r.prototype._transformedOffset=function(){return this._defaultMarker?this._offset.mult(this._scale):this._offset},r}(t.Evented);function On(e){if(e){if("number"==typeof e){var i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-center":new t.pointGeometry(0,e),"top-left":new t.pointGeometry(i,i),"top-right":new t.pointGeometry(-i,i),bottom:new t.pointGeometry(0,-e),"bottom-center":new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(i,-i),"bottom-right":new t.pointGeometry(-i,-i),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0),"middle-left":new t.pointGeometry(e,0),"middle-right":new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){var r=t.pointGeometry.convert(e);return{center:r,top:r,"top-center":r,"top-left":r,"top-right":r,bottom:r,"bottom-center":r,"bottom-left":r,"bottom-right":r,left:r,right:r,"middle-left":r,"middle-right":r}}return{center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-center":t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-center":t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0]),"middle-left":t.pointGeometry.convert(e.left||[0,0]),"middle-right":t.pointGeometry.convert(e.right||[0,0])}}return On(new t.pointGeometry(0,0))}var Rn={position:[116.39636259768668,39.907768102373495],visible:!0,cursor:"pointer",title:"",animation:"LKMAP_ANIMATION_NONE",rotation:0,bubble:!0,zIndex:150,extData:null,height:0,heightBuffer:0,heightAnchorElevation:!0,pitchAlignment:"auto",rotationAlignment:"auto",followFogOpacity:!0,style:{}},Bn=function(e){function r(i,r){e.call(this),this.options=t.extend(Object.create(Rn),i),(i instanceof t.window.HTMLElement||r)&&(i=t.extend({element:i},r)),i.position&&this.setLngLat(i.position),this.type="text",this.id="custom_text_"+t.getRandomId(),this.options.content&&(this.content=this.options.content),this.options.extData&&(this.extData=this.options.extData),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_setTransformOrigin","_eventCallbackFun","_addMarkerEvent","setMap","setIcon","setAnimation","getAnimation","show","hide","setCursor","getMap","setExtData","getExtData","setzIndex","getzIndex","getId","_setLabelFun","setBubble","getBubble","getHeightBuffer","setHeightBuffer","setHeightAnchorElevation","_evaluateOpacity"],this),this._eventAll=[],this._eventArr=["click","dblclick","contextmenu","mousemove","mouseover","mouseout","mousedown","mouseup","touchstart","touchmove","touchend"],this._otherEvent={},this._bubbleEvent={click:null,dblclick:null,contextmenu:null,mousemove:null,mouseover:null,mouseout:null,mousedown:null,mouseup:null,mouseup:null,mouseup:null,mouseup:null},this._rotation=i&&(i.rotation||i.angle)||0,this._customStyle=i&&i.style||{},this._bubble=this.options.bubble,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&"auto"!==i.pitchAlignment?i.pitchAlignment:this._rotationAlignment,this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._state="inactive",this._height=i&&i.height||0,this._heightBuffer=i&&i.heightBuffer||0,this._heightAnchorElevation=this.options.heightAnchorElevation,this._visible=this.options&&this.options.visible,this._cursor=this.options.cursor&&this.options.cursor,this._title=this.options.title&&this.options.title,this._zIndex=parseInt(i.zIndex)||150,i&&i.element?(this._element=i.element,this._offset=t.pointGeometry.convert(i&&i.offset||[0,0])):(this._defaultMarker=!0,this._element=a.create("div"),this._element.className="LKmap-text",this._element.style.cursor=this._cursor,this._textContentDom=a.create("div"),this._textContentDom.className="LKmap-text-content",this._textContainerDom=a.create("div"),this._textContainerDom.className="text-content-container",this._textContainerDom.innerHTML=i.text,this._textContentDom.appendChild(this._textContainerDom),this._element.appendChild(this._textContentDom),this._offset=t.pointGeometry.convert(i&&i.offset||[0,0])),this._element.classList.add("lkmap-marker"),this._popup=null,this._timeout=null,this._interval=null,this.init()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getHeightBuffer=function(){return this._heightBuffer},r.prototype.setHeightBuffer=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._heightBuffer=t)},r.prototype.getText=function(){return this._textContainerDom.innerHTML},r.prototype.setText=function(t){this._textContainerDom.innerHTML=t},r.prototype.setTitle=function(t){void 0===t&&(t=""),this._title=t,this.options.title=t,this._element.setAttribute("title",t)},r.prototype.getTitle=function(){return this._title},r.prototype.setStyle=function(t){for(var e in void 0===t&&(t={}),t)t.hasOwnProperty(e)&&(this._textContainerDom.style[e]=(this.toHump(e),t[e]),this.options.style[e]=t[e])},r.prototype.getStyle=function(){return this.options.style},r.prototype.toHump=function(t){return t.replace(/\-(\w)/g,(function(t,e){return e.toUpperCase()}))},r.prototype.addTo=function(t){return this.remove(),this._map=t,this._map.on("move",this._update),this._map.on("moveend",this._update),this._map.on("updateTerrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.getMarkersContainer().appendChild(this._element),this._map._texts.push(this),this._map.on("click",this._onMapClick),this},r.prototype.remove=function(){var t=this;return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("updateTerrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map._texts=this._map._texts.filter((function(e){return e.id!==t.id})),delete this._map),a.remove(this._element),this._popup&&this._popup.remove(),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},r.prototype.getElement=function(){return this._element},r.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null),t){if(!("offset"in t.options)){var e=13.5,i=Math.sqrt(Math.pow(e,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-center":[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-center":[0,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[e,-24.6],right:[-13.5,-24.6],"middle-left":[e,-24.6],"middle-right":[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat)}return this},r.prototype._onMapClick=function(t){var e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},r.prototype.on=function(t,e){void 0===e&&(e=null);var i=this;i._eventArr.indexOf(t)>=0?(i._eventAll.push(t),i._addMarkerEvent(t,e)):e&&(i._otherEvent[t]=e,i.onBack(t,i._markerOtherEvent))},r.prototype._markerOtherEvent=function(t){var e=this,r={};r.target=e,r.layer=e,r.mouse={lngLat:e._map.containerToLngLat(new i.Pixel(t.x,t.y)),point:new i.Pixel(t.x,t.y),type:t.type},r.originalEvent=t,r.lngLat=e._lngLat,r.point=e._map.lngLatToContainer(r.mouse.lngLat),r.type=t.type,e._otherEvent[t.type]&&e._otherEvent[t.type](r)},r.prototype.off=function(t,e){var i=this;i._map&&(i._eventArr.indexOf(t)>=0?(i._eventAll.splice(t,1),i._bubbleEvent[t]&&(i._bubbleEvent[t]=null),i._element.dispatchEvent?i._element.removeEventListener(t,i._eventCallbackFun):i._element.detachEvent("on"+t,i._eventCallbackFun)):i._otherEvent[t]&&(i.offBack(t,i._markerOtherEvent),delete i._otherEvent[t]))},r.prototype._addMarkerEvent=function(t,e){var i=this;i._bubbleEvent[t]=e,i._element.dispatchEvent?i._element.addEventListener(t,i._eventCallbackFun):i._element.attachEvent("on"+t,i._eventCallbackFun)},r.prototype._eventCallbackFun=function(e){var r=this;if("click"==e.type||"dblclick"==e.type){if(t.window.markerClicked)return void(t.window.markerClicked=!1);if(t.window.markerClicked=!0,setTimeout((function(){t.window.markerClicked=!1}),500),r._bubbleEvent[e.type]){var o={};o.target=r,o.layer=r,o.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},o.originalEvent=e,o.lngLat=o.mouse.lngLat,o.point=o.mouse.point,o.type=o.mouse.type,r._bubbleEvent[e.type](o)}}else if(r._bubbleEvent[e.type]){var n={};n.target=r,n.layer=r,n.mouse={lngLat:r._map.containerToLngLat(new i.Pixel(e.x,e.y)),point:new i.Pixel(e.x,e.y),type:e.type},n.originalEvent=e,n.lngLat=n.mouse.lngLat,n.point=n.mouse.point,n.type=n.mouse.type,r._bubbleEvent[e.type](n)}},r.prototype.getPopup=function(){return this._popup},r.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),t.setMap(this._map),this):this},r.prototype._evaluateOpacity=function(){if(this._map&&this.options.followFogOpacity&&this._map._options.fog){var t=this._pos?this._pos.sub(this._transformedOffset()):null;if(this._withinScreenBounds(t)){var e=this._map.unproject(t),i=!1;if(this._map.getTerrain()){var r=this._map.getFreeCameraOptions();if(r.position){var o=r.position.toLngLat();i=o.distanceTo(e)<.9*o.distanceTo(this._lngLat)}}var n=(1-this._map._queryFogOpacity(e))*(i?.2:1);this._element.style.opacity=""+n,this._popup&&this._popup._setOpacity(""+n)}}},r.prototype._withinScreenBounds=function(t){if(!this._map)return!1;var e=this._map.transform;return!!t&&t.x>=0&&t.x<e.width&&t.y>=0&&t.y<e.height},r.prototype.setAnchor=function(t){void 0===t&&(t=""),""!=t&&(this._anchor=t&&t||"center",this.options.anchor=this._anchor,this._update())},r.prototype.setHeightAnchorElevation=function(t){this._heightAnchorElevation=!!t,this.options.heightAnchorElevation=this._heightAnchorElevation,this._update()},r.prototype._update=function(e){if(this._map&&(!e||"move"!=e.type&&"moveend"!=e.type||!this._map||!this._map._sceneMgr||!this._map._sceneMgr._tracked||this._map._sceneMgr._tracked.id!=this.id)){if(this._element.style.willChange="transform",this._map.transform.renderWorldCopies&&(this._lngLat=Kr(this._lngLat,this._pos,this._map.transform)),this._height&&0!==this._height){var i=t.LngLat.convert(this._lngLat),r=new t.MercatorCoordinate(t.mercatorXfromLng(i.lng),t.mercatorYfromLat(i.lat),t.mercatorZfromAltitude(this._height,i.lat));this._pos=this._map.transform._coordinatePoint(r,!0,this._heightAnchorElevation)._add(this._transformedOffset())}else this._pos=this._map.project(this._lngLat)._add(this._transformedOffset());e&&"moveend"!==e.type||(this._pos=this._pos.round()),this._element.style.display=this._visible?"block":"none",this._element.style.zIndex=this._zIndex,this._textContentDom.style&&this.setStyle(this._customStyle);var o="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?o="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(o="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n="rotateX("+this._map.getPitch()+"deg)"),0!=this._rotation&&this._setTransformOrigin(),this._setBubble(),this._evaluateOpacity(),a.setTransform(this._element,Jr[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+n+" "+o),Qr(this._element,this._anchor,"marker"),this._element.style.willChange=null}},r.prototype._setBubble=function(){this._bubble?(a.removeEventListener(this._element,"mousedown",this._stopPropagation),a.removeEventListener(this._element,"mouseup",this._stopPropagation),a.removeEventListener(this._element,"contextmenu",this._stopPropagation),a.removeEventListener(this._element,"touchstart",this._stopPropagation),a.removeEventListener(this._element,"touchmove",this._stopPropagation),a.removeEventListener(this._element,"touchend",this._stopPropagation),a.removeEventListener(this._element,"dblclick",this._stopPropagation),a.removeEventListener(this._element,"click",this._stopPropagation)):(a.addEventListener(this._element,"mousedown",this._stopPropagation),a.addEventListener(this._element,"mouseup",this._stopPropagation),a.addEventListener(this._element,"contextmenu",this._stopPropagation),a.addEventListener(this._element,"touchstart",this._stopPropagation),a.addEventListener(this._element,"touchmove",this._stopPropagation),a.addEventListener(this._element,"touchend",this._stopPropagation),a.addEventListener(this._element,"dblclick",this._stopPropagation),a.addEventListener(this._element,"click",this._stopPropagation))},r.prototype.setBubble=function(t){void 0===t&&(t=!1),this._bubble=this.options.bubble=t,this._setBubble()},r.prototype.getBubble=function(){return this._bubble},r.prototype._stopPropagation=function(t){t.preventDefault(),t.stopPropagation()},r.prototype._setTransformOrigin=function(){var t="";switch(this._anchor){case"left":case"middle-left":t="0% 50%";break;case"top-left":t="0% 0%";break;case"bottom-left":t="0% 100%";break;case"right":case"middle-right":t="100% 50%";break;case"top-right":t="100% 0%";break;case"bottom-right":t="100% 100%";break;case"bottom":case"bottom-center":t="50% 100%";break;case"top":case"top-center":t="50% 0%";break;case"center":t="50% 50%"}this._element.style["transform-origin"]=t,this._element.style["-ms-transform-origin"]=t,this._element.style["-webkit-transform-origin"]=t,this._element.style["-moz-transform-origin"]=t,this._element.style["-o-transform-origin"]=t},r.prototype._transformedOffset=function(){if(!this._defaultMarker||!this._map)return this._offset;var t=this._map.transform,e=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&e._rotate(t.angle),"map"===this._pitchAlignment&&(e.y*=Math.cos(t._pitch)),e},r.prototype.getOffset=function(){return this._offset},r.prototype.getHeight=function(){return this._height},r.prototype.setHeight=function(t){void 0===t&&(t=0),"number"==typeof t&&(this._height=this.options.height=t,this._update())},r.prototype.setOffset=function(e){return this.options.offset=this._offset=t.pointGeometry.convert(e),this._update(),this},r.prototype._onMove=function(e){this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag"))},r.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},r.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},r.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},r.prototype.isDraggable=function(){return this._draggable},r.prototype.getAngle=function(){return this._rotation},r.prototype.setAngle=function(t){this.setRotation(t)},r.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},r.prototype.getRotation=function(){return this._rotation},r.prototype.setRotationAlignment=function(t){return this._rotationAlignment=this.options.rotationAlignment=t||"auto","auto"==this.options.pitchAlignment&&(this._pitchAlignment=this._rotationAlignment),this._update(),this},r.prototype.getRotationAlignment=function(){return this._rotationAlignment},r.prototype.setPitchAlignment=function(t){return this._pitchAlignment=this.options.pitchAlignment="auto"!==t?t:this._rotationAlignment,this._update(),this},r.prototype.getPitchAlignment=function(){return this._pitchAlignment},r.prototype.getId=function(){return this.id},r.prototype.setzIndex=function(t){this._zIndex=this.options.zIndex=parseInt(t),this._update()},r.prototype.getzIndex=function(){return this.options.zIndex},r.prototype.setExtData=function(t){this.extData=this.options.extData=t},r.prototype.getExtData=function(){return this.extData||this.options.extData},r.prototype.setIcon=function(t){if(void 0===t&&(t=null),t)if(this.options.icon=t,"string"==typeof t){var e=this.createIcon();this.updateIcon(e)}else this.updateIcon(t.element)},r.prototype.getIcon=function(){return this.options.icon},r.prototype.init=function(){this.setMarkerLngLat(this.options.position),this.options.popup&&this.setPopup(this.options.popup),this.options.map&&(this.setMap(this.options.map),this.options.label&&this.options.label.content&&(this.options.label=t.extend({direction:"top"},this.options.label),this.setLabel(this.options.label)),this.options.title&&this.setTitle(this.options.title),this.options.animation&&this.setAnimation(this.options.animation))},r.prototype.setMap=function(t){var e=this;t?(this._map=t,this._map._loaded?(this.addTo(t),this._setLabelFun()):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e.addTo(t),e._setLabelFun())}),10))):this._map&&this.remove()},r.prototype._setLabelFun=function(){this.options.label&&this.options.label.content&&(this.options.label=t.extend({direction:"top"},this.options.label),this.setLabel(this.options.label)),this.options.title&&this.setTitle(this.options.title),this.options.animation&&this.setAnimation(this.options.animation)},r.prototype.getMap=function(){return this._map},r.prototype.getAnchor=function(){return this._anchor},r.prototype.getLabelAnchor=function(){return this._labelOptions.direction},r.prototype.setMarkerLngLat=function(t){if(t){var e=t.lng,i=t.lat;e&&i&&this.setLngLat([e,i]),this.setLngLat(t)}},r.prototype.setPosition=function(t){this.setMarkerLngLat(t),this._map&&this._map._sceneMgr&&this._map._sceneMgr._tracked&&this._map._sceneMgr._tracked.id==this.id&&this._map.triggerRepaint()},r.prototype.getPosition=function(){return this.getLngLat()},r.prototype.setAnimation=function(t){switch(void 0===t&&(t="LKMAP_ANIMATION_NONE"),t){case"LKMAP_ANIMATION_NONE":default:this._element.classList.remove("textKeyframesAnimation"),this._element.classList.remove("textKeyframesAnimationDrop");break;case"LKMAP_ANIMATION_BOUNCE":this._element.classList.remove("textKeyframesAnimationDrop"),this._element.classList.add("textKeyframesAnimation");break;case"LKMAP_ANIMATION_DROP":this._element.classList.remove("textKeyframesAnimation"),this._element.classList.add("textKeyframesAnimationDrop"),"LKMAP_ANIMATION_DROP"==this.options.animation&&(this._element.style.display="none",this._element.style.display="block")}this.options.animation=t},r.prototype.getAnimation=function(){return this.options.animation},r.prototype.show=function(){this._visible=this.options.visible=!0,this._element.style.display="block"},r.prototype.hide=function(){this._visible=this.options.visible=!1,this._element.style.display="none"},r.prototype.setCursor=function(t){this.options.cursor=t,this._cursor=t,this._element.style.cursor=this._cursor},r.prototype.createIcon=function(){var t=document.createElement("div");return t.className="lkmapMarker",t.style["background-size"]="cover",t.style.width="20px",t.style.height="30px",this.createImg(t)},r.prototype.createImg=function(t){var e=document.createElement("img");return e.className="marker-img",e.src=this.options.icon,e.style.width="20px",e.style.height="30px",t.appendChild(e),t.appendChild(e),t},r}(t.Evented);function Fn(){this.time=null}Fn.prototype={constructor:Fn,init:function(){},clearOld:function(){document.getElementsByClassName("lkMsgTost").length>0&&document.getElementsByClassName("lkMsgTost")[0].remove()},createDom:function(t,e){var i=this;i.clearOld();var r=document.createElement("div");r.className="lkMsgTost animated fadeInDown",r.innerText=e,r.classList.add(t),document.getElementsByTagName("body")[0].appendChild(r),clearTimeout(i.time),i.time=setTimeout((function(){i.clearOld()}),1500)},success:function(t){this.createDom("success",t)},error:function(t){this.createDom("error",t)},warning:function(t){this.createDom("warning",t)}};var Un=new Fn,jn={center:[116.39636259768668,39.907768102373495],radius:50,strokeColor:"#0037e4",strokeOpacity:1,strokeStyle:"solid",strokeDasharray:[2,2],strokeWeight:0,strokeImage:"",fillColor:"#0037e4",fillOpacity:1,fillImage:"",pitchAlignment:"viewport",visible:!0,zIndex:50},Nn=function(e){this.options=t.extend(Object.create(jn),e),this.type="circle",e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),t.bindAll(["show","hide","delete","remove","getCenter","setRadius","getRadius","setOptions","getValue","getOptions","getLayoutProperty","on","off","getId","contains","setMap","getArea","setDataType","updateSourceData","_addLayer","_addFillImage","setFillImage","_addStrokeImage","setStrokeImage","_creatLineGeoJson","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","_staticSetMapFun"],this),this.geojson={},this._layers={one:"",two:""},this._timeout=null,this._interval=null,this.init()};Nn.prototype.init=function(){this.setDataType(),this.creatCircleData()},Nn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Nn.prototype.getExtData=function(){return this.extData||this.options.extData},Nn.prototype.setDataType=function(){this.options.coordinates=this.options.center&&this.options.center.lng?[this.options.center.lng,this.options.center.lat]:this.options.center},Nn.prototype.creatCircleData=function(){var e=t.circle(this.options.coordinates,this.options.radius/1e3,{steps:720,units:"kilometers",properties:{foo:"bar"}});this._circleData=e,this.id=this.geojson.id="custom_circle_"+t.getRandomId(),this.geojson.type="fill",this.geojson.source={type:"geojson",data:e},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"fill-color":this.options.fillColor,"fill-opacity":this.options.fillOpacity,"fill-antialias":!0},this._creatLineGeoJson(),this._map&&this.setMap(this._map)},Nn.prototype._creatLineGeoJson=function(){this.lineGeojson={id:"custom_circle_border_"+t.getRandomId(),type:"line",source:this.geojson.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity}},"dashed"==this.options.strokeStyle&&(this.lineGeojson.paint["line-dasharray"]=this.options.strokeDasharray)},Nn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},Nn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e),this._map.off(t,this.lineGeojson.id,e)},Nn.prototype.getPath=function(){return this._circleData.geometry.coordinates[0]},Nn.prototype.getId=function(){return this.id},Nn.prototype._addFillImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.fillImage&&(this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,r){t||(i._map.addImage(i.fillImageName,r),i.geojson.paint["fill-pattern"]=i.fillImageName,""==e&&i._addLayer())})))},Nn.prototype.setFillImage=function(e){var i=this;e?(this.options.fillImage=e,this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,e){t||(i._map.addImage(i.fillImageName,e),i._map.setPaintProperty(i.id,"fill-pattern",i.fillImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.id,"fill-pattern",null)},Nn.prototype._addStrokeImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.strokeImage&&(this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,r){t||(i._map.addImage(i.strokeImageName,r),i.lineGeojson.paint["line-pattern"]=i.strokeImageName,""==e&&i._addLayer())})))},Nn.prototype.setStrokeImage=function(e){var i=this;e?(this.options.strokeImage=e,this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.lineGeojson.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.lineGeojson.id,"line-pattern",null)},Nn.prototype.setMap=function(t){var e=this;t?(this._map=t,this._map._loaded?this._staticSetMapFun():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._staticSetMapFun())}),10))):this._map&&this.remove()},Nn.prototype._staticSetMapFun=function(){""==this.options.fillImage&&""==this.options.strokeImage?this._addLayer():""!=this.options.fillImage&&""!=this.options.strokeImage?(this._addFillImage("add"),this._addStrokeImage()):""!=this.options.fillImage?this._addFillImage():""!=this.options.strokeImage&&this._addStrokeImage()},Nn.prototype._addLayer=function(){this._layers={one:this.id,two:this.lineGeojson.id},this._map.addLayer(this,"",this.options.zIndex),this._map.addLayer(this.lineGeojson,"",this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},Nn.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},Nn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},Nn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},Nn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},Nn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},Nn.prototype.delete=function(){this._map.removeLayer(this.id)},Nn.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this._map.getLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id),this._layers={one:"",two:""})},Nn.prototype.setCenter=function(t){this.options.center=t,this.setDataType(),this.updateSourceData()},Nn.prototype.getCenter=function(){return this.options.center},Nn.prototype.setRadius=function(t){this.options.radius=t,this.setDataType(),this.updateSourceData()},Nn.prototype.updateSourceData=function(){this._circleData=t.circle(this.options.coordinates,this.options.radius/1e3,{steps:720,units:"kilometers",properties:{foo:"bar"}}),this.geojson.source.data=this._circleData,this._map.getSource(this.id).setData(this.geojson.source.data.geometry),this.options.strokeWeight>0&&(this.lineGeojson.source=this.geojson.source,this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data.geometry))},Nn.prototype.getArea=function(){var t=this.options.radius;return t*t*3.14},Nn.prototype.getLayoutProperty=function(t){return this.geojson.paint[t]},Nn.prototype.getRadius=function(){return this.options.radius},Nn.prototype.getOptions=function(){return this.options},Nn.prototype.setOptions=function(t){t.radius&&this.setRadius(t.radius),t.center&&this.setCenter(t.center),(t.fillImage||""==t.fillImage)&&this.setFillImage(t.fillImage),t.strokeImage&&""==t.strokeImage&&this.setStrokeImage(t.strokeImage),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var e={fillColor:"fill-color",fillOpacity:"fill-opacity"},i=Object.keys(e),r={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity"},o=Object.keys(r),n=this._map.getLayer(this.id);for(var a in t)this.options[a]=t[a],n&&(i.indexOf(a)>=0&&this._map.setPaintProperty(this.id,e[a],t[a]),o.indexOf(a)>=0&&this._map.setPaintProperty(this.lineGeojson.id,r[a],t[a]));n&&("dashed"==t.strokeStyle?this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",null),t.center&&this.setCenter(t.center),t.radius&&this.setRadius(t.radius),1==t.visible?this.show():0==t.visible&&this.hide(),(t.cursor||""==t.cursor)&&this.setCursor()),t.map&&this.setMap(t.map)},Nn.prototype.contains=function(e){var i,r=this._circleData.geometry.coordinates[0];i=t.point(e instanceof Array?e:[e.lng,e.lat]);var o=t.polygon([r]);return t.booleanPointInPolygon(i,o)},Nn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Nn.prototype.getzIndex=function(){return this.options.zIndex};var Vn={center:[116.39636259768668,39.907768102373495],strokeColor:"#ffffff",strokeOpacity:1,strokeWeight:0,fillColor:"#0037e4",fillOpacity:1,visible:!0,strokeStyle:"solid",strokeDasharray:[2,2],offset:{x:0,y:0},radius:20,zIndex:150},Gn=function(e,i){this.options=t.extend(Object.create(Vn),e),this.id=null,this.geojson={},this.type="circleMarker",this._LngLat=this.options.center&&this.options.center.lng?this.options.center:{lng:this.options.center[0],lat:this.options.center[1]},this.options.center=this._LngLat,this.options.offset&&this.setOffset(this.options.offset),e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),t.bindAll(["setMap","on","off","show","hide","setOptions","setCenter","getCenter","setRadius","getRadius","getOptions","getId","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","getPosition"],this),this._layers={one:""},this._timeout=null,this._interval=null,this.init()};Gn.prototype.init=function(){this.createGeojson()},Gn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Gn.prototype.getExtData=function(){return this.extData||this.options.extData},Gn.prototype.setLngLat=function(t){return this._LngLat=t&&t.lng?t:{lng:t[0],lat:t[1]},this.options.center=this._LngLat,this._LngLat},Gn.prototype.setOffset=function(t){return this.options.offset=t&&(t.x||0==t.x)?t:{x:t[0],y:t[1]},this.options.offset},Gn.prototype.getPath=function(t){return[[this._LngLat.lng,this._LngLat.lat]]},Gn.prototype.getLngLat=function(t){return[[this._LngLat.lng,this._LngLat.lat]]},Gn.prototype.getPosition=function(){return new i.LngLat(this._LngLat.lng,this._LngLat.lat)},Gn.prototype.createGeojson=function(){this.id=this.geojson.id="custom_circleMarker_"+t.getRandomId(),this.geojson.type="circle",this.geojson.source={type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:[this._LngLat.lng,this._LngLat.lat]}}},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"circle-radius":this.options.radius,"circle-color":this.options.fillColor,"circle-opacity":this.options.fillOpacity,"circle-stroke-color":this.options.strokeColor,"circle-stroke-width":this.options.strokeWeight,"circle-stroke-opacity":this.options.strokeOpacity,"circle-translate":[this.options.offset.x,this.options.offset.y]},this._map&&this.setMap(this._map)},Gn.prototype.setCenter=function(t){this.setLngLat(t),this.geojson.source.data.geometry.coordinates=[this._LngLat.lng,this._LngLat.lat],this._map&&this._map.getSource(this.id).setData(this.geojson.source.data.geometry)},Gn.prototype.getCenter=function(){return this._LngLat},Gn.prototype.getOptions=function(){return this.options},Gn.prototype.getId=function(){return this.id},Gn.prototype.remove=function(){this._map&&this._map.removeLayer(this.id),this._layers.one=""},Gn.prototype.setMap=function(t){var e=this;t?(this._map=t,this._layers.one=this.id,this._map._loaded?(this._map.addLayer(this,"",this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._map.addLayer(e,"",e.options.zIndex),e._mapStyleCursor=e._map._options.cursor,e.options.cursor&&e.setCursor(e.options.cursor))}),10))):this._map&&this.remove()},Gn.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},Gn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},Gn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},Gn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},Gn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},Gn.prototype.setRadius=function(t){var e=parseInt(t,10);this.options.radius=e,this._map.setPaintProperty(this.id,"circle-radius",e)},Gn.prototype.getRadius=function(){return this.options.radius},Gn.prototype.setOptions=function(t){var e={radius:"circle-radius",fillColor:"circle-color",fillOpacity:"circle-opacity",strokeColor:"circle-stroke-color",strokeWeight:"circle-stroke-width",strokeOpacity:"circle-stroke-opacity",offset:"circle-translate"},i=Object.keys(e);if(t.offset){var r=this.setOffset(t.offset);t.offset=[r.x,r.y]}!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var o=this._map.getLayer(this.id);for(var n in t)this.options[n]=t[n],o&&i.indexOf(n)>=0&&(this.options[n]=t[n],this._map.setPaintProperty(this.id,e[n],t[n]));o&&(t.center&&this.setCenter(t.center),t.radius&&this.setRadius(t.radius),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor()),t.map&&this.setMap(t.map)},Gn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible")},Gn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none")},Gn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Gn.prototype.getzIndex=function(){return this.options.zIndex};var Zn={content:"",position:[116.39636259768668,39.907768102373495]},qn=function(e){this.options=t.extend(Object.create(Zn),e),this.mapContainer=null,this.contentStatus=!1,this._isOpen=!1,this.prototype={},this.openCallback=null,this.closeCallback=null,this.type="contextMenu",this.options.extData&&(this.extData=this.options.extData),t.bindAll(["addItem","removeItem","checkMapClick","closeOverlays","setStyle","updataStyle","close","open","on","off","offEvent","setExtData","getExtData"],this),this._timeout=null,this._interval=null,this._mapOverlays=a.create("div","lkmap-overlays"),this._container=a.create("div","lkmap-menu"),this.options.content?this.contentStatus=!0:this.listUL=a.create("ul","lkmap-menu-outer")};qn.prototype.setExtData=function(t){this.extData=this.options.extData=t},qn.prototype.getExtData=function(){return this.extData||this.options.extData},qn.prototype.checkMapClick=function(){this._map.on("click",this.closeOverlays),this._map.on("dragstart",this.closeOverlays),this._map.on("zoomstart",this.closeOverlays),this._map.on("rotatestart",this.closeOverlays),this._map.on("pitchstart",this.closeOverlays),this._map.on("resize",this.updataStyle)},qn.prototype.offEvent=function(){this._map.off("click",this.closeOverlays),this._map.off("dragstart",this.closeOverlays),this._map.off("zoomstart",this.closeOverlays),this._map.off("rotatestart",this.closeOverlays),this._map.off("pitchstart",this.closeOverlays),this._map.off("resize",this.updataStyle)},qn.prototype.closeOverlays=function(t){""!=this._mapOverlays.innerHTML&&(this._mapOverlays.innerHTML="",this._isOpen=!1,this.closeCallback&&"function"==typeof this.closeCallback&&this.closeCallback())},qn.prototype.close=function(t){this.closeOverlays()},qn.prototype.on=function(t,e){void 0===e&&(e=null),"close"==t&&e&&(this.closeCallback=e),"open"==t&&e&&(this.openCallback=e)},qn.prototype.off=function(t,e){void 0===e&&(e=null),"close"==t&&e&&(this.closeCallback=null),"open"==t&&e&&(this.openCallback=null)},qn.prototype.updataStyle=function(){var t=this._map.lngLatToContainer(this.lnglat);this.setStyle(t)},qn.prototype.init=function(){this.mapContainer=this._map.getContainer(),this.checkMapClick(),this.options.content?(this.contentStatus=!0,"string"==typeof this.options.content?this._container.innerHTML=this.options.content:this._container.appendChild(this.options.content)):this._container.appendChild(this.listUL),this.mapContainer.appendChild(this._mapOverlays)},qn.prototype.addItem=function(t,e,i){void 0===i&&(i=null);var r,o=this;t&&(this.contentStatus?((r=a.create("p")).innerText=t,this._container.children&&this._container.children[0]?this._container.children[0].appendChild(r):this._container.appendChild(r)):((r=a.create("li")).innerText=t,e&&r.addEventListener("click",(function(){o.closeOverlays(),e()})),null===i?this.listUL.appendChild(r):this.listUL.insertBefore(r,this.listUL.children[i])))},qn.prototype.removeItem=function(t,e){if(this.contentStatus)this.clearCustom(t);else if("string"==typeof t){var i=this.listUL.children;for(var r in i)i[r].innerText==t&&i[r].remove()}else if("number"==typeof t){var o=this.listUL.children[t];e&&obj.removeEventListener(ev,e),o.remove()}},qn.prototype.clearCustom=function(t){var e=this._container.children[0].children,i=[];if("string"==typeof t)for(var r in e)e[r].innerText==t&&i.push(e[r]);else if("number"==typeof t)for(var r in e)r==t&&i.push(e[r]);for(var o in i)i[o].remove()},qn.prototype.open=function(t,e){var i=this;if(t&&e)if(this._map&&this.offEvent(),this.lnglat=e,this._map=t,this._map._loaded){this.init(),this._isOpen=!0;var r=this._map.lngLatToContainer(e);this.setStyle(r),this.openCallback&&"function"==typeof this.openCallback&&this.openCallback()}else clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){if(i._map._loaded){clearInterval(i._interval),clearTimeout(i._timeout),i.init(),i._isOpen=!0;var t=i._map.lngLatToContainer(e);i.setStyle(t),i.openCallback&&"function"==typeof i.openCallback&&i.openCallback()}}),10);else this.close()},qn.prototype.setStyle=function(t){this._container.style.top=t.y+"px",this._container.style.left=t.x+"px",this._mapOverlays.appendChild(this._container)};var Xn={showDir:!1,lineCap:"square",strokeColor:"#0037e4",strokeWeight:2,strokeDasharray:[2,2],strokeImage:"",lineJoin:"miter",strokeOpacity:1,strokeOffset:[0,0],visible:!0,strokeStyle:"solid",animated:!1,dirSize:.3,dirSpacing:15,zIndex:100},Wn=function(e,i){this.options=t.extend(Object.create(Xn),e),this.id=null,this.animateFun=null,this.animatedId=0,this.geojson={},this.type="curveLine",this.features=[],e.map&&(this._map=e.map),this.id=this.geojson.id="custom_curveLine_"+t.getRandomId(),this.lineGeojsonID="custom_curveLine-icon_"+t.getRandomId(),this.lineArrwImageName="lk-CurveLine-arrw",this._layers={one:"",two:""},this.options.extData&&(this.extData=this.options.extData),t.bindAll(["setMap","on","off","setColor","setOpacity","setWeight","show","hide","setOptions","getId","setPath","getPath","animate","getOptions","getLength","getBounds","getCurvelinePath","_addLayer","_addStrokeImage","setStrokeImage","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","_addShowDirFun","_creatDirLine","setzIndex","getzIndex","setExtData","getExtData"],this),this._timeout=null,this._interval=null,this.init()};Wn.prototype.init=function(){this.getCurvelinePath(),this.createGeojson(),this._map&&this.setMap(this._map)},Wn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Wn.prototype.getExtData=function(){return this.extData||this.options.extData},Wn.prototype.getCurvelinePath=function(){var e=this.options.path;this.features=[];for(var i=0;i<e.length-1;i++){var r=[e[i],e[i+1]],o=t.lineString(r),n=t.transformRotate(o,-60,{pivot:r[0]}),a=this.getThreeLngLat(r,n.geometry.coordinates[1]),s=this.createBezierCurvePoints(2,a);this.features=this.features.concat(s)}},Wn.prototype.getThreeLngLat=function(e,i){var r=t.lineString([[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2],i]),o=t.length$2(r,{units:"kilometers"}),n=t.along(r,o/3,{units:"kilometers"});return[e[0],n.geometry.coordinates,e[1]]},Wn.prototype.createBezierCurvePoints=function(t,e){var i=0,r=0;function o(t){return t<=1?1:t*o(t-1)}for(var n=[],a=0;a<1;a+=.01){i=0,r=0;for(var s=0;s<=t;s++)i+=o(t)/(o(s)*o(t-s))*Math.pow(1-a,t-s)*Math.pow(a,s)*e[s][0],r+=o(t)/(o(s)*o(t-s))*Math.pow(1-a,t-s)*Math.pow(a,s)*e[s][1];n.push([i,r])}return n.push(e[2]),n},Wn.prototype.createGeojson=function(){var t=this.features;this.geojson.type="line",this.geojson.source={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}},this.geojson.layout={"line-join":this.options.lineJoin,"line-cap":this.options.lineCap,visibility:this.options.visible?"visible":"none"},this.geojson.paint={"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity,"line-translate":this.options.strokeOffset},"dashed"==this.options.strokeStyle&&(this.geojson.paint["line-dasharray"]=this.options.strokeDasharray),this.options.showDir&&this._creatDirLine()},Wn.prototype._creatDirLine=function(){this.lineGeojson={id:this.lineGeojsonID,type:"symbol",source:this.geojson.source,layout:{"symbol-avoid-edges":!1,"icon-anchor":"center","symbol-placement":"line","symbol-spacing":this.options.dirSpacing,"symbol-z-order":"source","icon-image":this.lineArrwImageName,"icon-size":this.options.dirSize,"icon-rotate":-90,"icon-pitch-alignment":"viewport",visibility:this.options.visible?"visible":"none"},paint:{"icon-color":"#fff"}}},Wn.prototype.getLength=function(){var e=t.lineString(this.options.path),i=t.length$2(e,{units:"kilometers"});return Math.round(1e3*i)},Wn.prototype.getBounds=function(){return this.getNewBounds(this.options.path)},Wn.prototype.getNewBounds=function(t){var e=200,i=200,r=0,o=0;for(var n in t)t[n][0]>r&&(r=t[n][0]),t[n][0]<e&&(e=t[n][0]),t[n][1]>o&&(o=t[n][1]),t[n][1]<i&&(i=t[n][1]);return new $o([e,i],[r,o])},Wn.prototype.getId=function(){return this.id},Wn.prototype.remove=function(){this._map&&(this._map.removeLayer(this),this._layers.one="",this.options.showDir&&(this._layers.two="",this._map.removeLayer(this.lineGeojson.id)))},Wn.prototype._addStrokeImage=function(){var e=this;""!=this.options.strokeImage&&(this.strokeImageName="custom_curveLine_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,i){t||(e._map.addImage(e.strokeImageName,i),e.geojson.paint["line-pattern"]=e.strokeImageName,e._addLayer())})))},Wn.prototype.setStrokeImage=function(e){var i=this;e?(this.options.strokeImage=e,this.strokeImageName="custom_curveLine_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.id,"line-pattern",null)},Wn.prototype.setMap=function(t){var e=this;void 0===t&&(t=null),t?(this._map=t,""==this.options.strokeImage?this._map._loaded?(this._addLayer(),this._addShowDirFun()):(this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._addLayer(),e._addShowDirFun())}),10)):this._map._loaded?(this._addStrokeImage(),this._addShowDirFun()):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._addStrokeImage(),e._addShowDirFun())}),10))):this._map&&this.remove()},Wn.prototype._addShowDirFun=function(){var e=this;this.options.showDir&&this._map.loadImage(t.FILE_API+"/file_sdk_icon/1586072044051.png",(function(t,i){e._map.hasImage(e.lineArrwImageName)||e._map.addImage(e.lineArrwImageName,i),e._layers.two=e.lineGeojson.id,e._map.addLayer(e.lineGeojson,"",e.options.zIndex)}))},Wn.prototype._addLayer=function(){this._layers.one=this.id,this._map.addLayer(this,"",this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},Wn.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},Wn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},Wn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},Wn.prototype.setPath=function(t){t instanceof Array&&(this.options.path=t,this.getCurvelinePath(),this.createGeojson(),this._map.getSource(this.id).setData(this.geojson.source.data),this.options.showDir&&(this.lineGeojson.source=this.geojson.source,this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data)))},Wn.prototype.getPath=function(){return this.options.path},Wn.prototype.animate=function(){this.geojson.source.data.geometry.coordinates.push(this.options.path[this.animatedId]),this._map.getSource(this.id).setData(this.geojson.source.data.geometry),this.animatedId++,this.animatedId>this.options.path.length&&cancelAnimationFrame(this.animateFun),this.animateFun=requestAnimationFrame(this.animate())},Wn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},Wn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},Wn.prototype.setOptions=function(t){t.strokeImage&&t.strokeImage.length>5&&this.setStrokeImage(t.strokeImage),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var e={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity"},i=Object.keys(e),r={lineJoin:"line-join",lineCap:"line-cap"},o=Object.keys(r),n=this._map.getLayer(this.id);for(var a in t)this.options[a]=t[a],n&&(i.indexOf(a)>=0&&this._map.setPaintProperty(this.id,e[a],t[a]),o.indexOf(a)>=0&&this._map.setLayoutProperty(this.id,r[a],t[a]));n&&("dashed"==t.strokeStyle?this._map.setPaintProperty(this.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.id,"line-dasharray",null),this.lineGeojson||this._map.getLayer(this.lineGeojsonID)?0==t.showDir?(this._map.removeLayer(this.lineGeojsonID),this.lineGeojson=null):t.dirSize&&this._map.setLayoutProperty(this.lineGeojsonID,"icon-size",this.options.dirSize):1==t.showDir&&(this._creatDirLine(),this._addShowDirFun()),t.path&&this.setPath(t.path),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor()),t.map&&this.setMap(t.map)},Wn.prototype.getOptions=function(){return this.options},Wn.prototype.setColor=function(t){this._map.setPaintProperty(this.id,"line-color",t)},Wn.prototype.setOpacity=function(t){this._map.setPaintProperty(this.id,"line-opacity",t)},Wn.prototype.setWeight=function(t){this._map.setPaintProperty(this.id,"line-width",t)},Wn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},Wn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},Wn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Wn.prototype.getzIndex=function(){return this.options.zIndex};var Hn={center:[116.39636259768668,39.907768102373495],radius:[1e3,1e3],rotate:0,strokeColor:"#F33",strokeOpacity:1,strokeStyle:"solid",strokeDasharray:[2,2],strokeWeight:0,strokeImage:"",fillColor:"#ee2200",fillOpacity:1,fillImage:"",pitchAlignment:"viewport",visible:!0,zIndex:50},Yn=function(e){this.options=t.extend(Object.create(Hn),e),this.type="ellipse",this.geojson={},this.id=this.geojson.id="custom_ellipse_"+t.getRandomId(),this._layers={one:"",two:""},e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),t.bindAll(["show","hide","delete","remove","getCenter","setRadius","getRadius","setOptions","getValue","getOptions","getLayoutProperty","on","off","contains","setMap","getArea","getEllipseData","setDataType","updateSourceData","setRotate","_addLayer","_addFillImage","setFillImage","_addStrokeImage","setStrokeImage","getId","_creatLineGeoJson","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","_staticSetMapFun"],this),this._timeout=null,this._interval=null,this.init()};Yn.prototype.init=function(){this.setDataType(),this.getEllipseData(),this.creatSourceData(),this._map&&this.setMap(this._map)},Yn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Yn.prototype.getExtData=function(){return this.extData||this.options.extData},Yn.prototype.setDataType=function(){this.coordinates=this.options.center&&this.options.center.lng?[this.options.center.lng,this.options.center.lat]:this.options.center,this.options.radius instanceof Array&&1==this.options.radius.length?this.options.radius=this.options.radius.concat(this.options.radius):this.options.radius instanceof Array||(this.options.radius=[parseInt(this.options.radius),parseInt(this.options.radius)])},Yn.prototype.getEllipseData=function(){for(var e=this.coordinates,i=this.options.radius,r=e[0],o=e[1],n=parseFloat(i[0]),a=parseFloat(i[1]),s=[],l=Math.PI/180,u=180/Math.PI,h=r*l,p=o*l,c=6356725+21412*(90-o)/90,f=c*Math.cos(p),d=0;d<360;d++){var m=Math.PI/180*d,y=0,g=0;d<90||d>270?g=-(y=n*a/Math.sqrt(a*a+n*n*Math.tan(m)*Math.tan(m)))*Math.tan(m):90==d?(y=0,g=-a):270==d?(y=0,g=a):g=-(y=-n*a/Math.sqrt(a*a+n*n*Math.tan(m)*Math.tan(m)))*Math.tan(m),s.push([(y/f+h)*u,(g/c+p)*u])}s.push(s[0]),this._circleData=t.polygon([s]),0!=this.options.rotate&&(this._circleData=t.transformRotate(this._circleData,this.options.rotate,{pivot:e}))},Yn.prototype.creatSourceData=function(){this.geojson.type="fill",this.geojson.source={type:"geojson",data:this._circleData},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"fill-color":this.options.fillColor,"fill-opacity":this.options.fillOpacity,"fill-antialias":!0},this._creatLineGeoJson()},Yn.prototype._creatLineGeoJson=function(){this.lineGeojson={id:"custom_ellipse_border_"+t.getRandomId(),type:"line",source:this.geojson.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity}},"dashed"==this.options.strokeStyle&&(this.lineGeojson.paint["line-dasharray"]=this.options.strokeDasharray)},Yn.prototype.setRotate=function(e){if(e!=this.options.rotate){var i=parseInt(e)-this.options.rotate;this.options.rotate=parseInt(e),this._circleData=t.transformRotate(this._circleData,i,{pivot:this.coordinates}),this.geojson.source.data=this._circleData,this.updateSourceData()}},Yn.prototype.setCenter=function(t){this.options.center=t,this.setDataType(),this.getEllipseData(),this.geojson.source.data=this._circleData,this.updateSourceData()},Yn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},Yn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e),this._map.off(t,this.lineGeojson.id,e)},Yn.prototype.getPath=function(){return this._circleData.geometry.coordinates[0]},Yn.prototype.getId=function(){return this.id},Yn.prototype._addFillImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.fillImage&&(this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,r){t||(i._map.addImage(i.fillImageName,r),i.geojson.paint["fill-pattern"]=i.fillImageName,""==e&&i._addLayer())})))},Yn.prototype.setFillImage=function(e){var i=this;e?(this.options.fillImage=e,this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,e){t||(i._map.addImage(i.fillImageName,e),i._map.setPaintProperty(i.id,"fill-pattern",i.fillImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.id,"fill-pattern",null)},Yn.prototype._addStrokeImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.strokeImage&&(this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,r){t||(i._map.addImage(i.strokeImageName,r),i.lineGeojson.paint["line-pattern"]=i.strokeImageName,""==e&&i._addLayer())})))},Yn.prototype.setStrokeImage=function(e){var i=this;e?(this.options.strokeImage=e,this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.lineGeojson.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.lineGeojson.id,"line-pattern",null)},Yn.prototype.setMap=function(t){var e=this;t?(this._map=t,this._map._loaded?this._staticSetMapFun():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._staticSetMapFun())}),10))):this._map&&this.remove()},Yn.prototype._staticSetMapFun=function(){""==this.options.fillImage&&""==this.options.strokeImage?this._addLayer():""!=this.options.fillImage&&""!=this.options.strokeImage?(this._addFillImage("add"),this._addStrokeImage()):""!=this.options.fillImage?this._addFillImage():""!=this.options.strokeImage&&this._addStrokeImage()},Yn.prototype._addLayer=function(){this._layers={one:this.id,two:this.lineGeojson.id},this._map.addLayer(this,"",this.options.zIndex),this._map.addLayer(this.lineGeojson,"",this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},Yn.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},Yn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},Yn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},Yn.prototype.show=function(){this._map.getLayer(this.id)&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible"))},Yn.prototype.hide=function(){this._map.getLayer(this.id)&&(this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none"))},Yn.prototype.delete=function(){this._map.getLayer(this.id)&&(this._map.removeLayer(this.id),this._layers.one="")},Yn.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this._map.getLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id),this._layers={one:"",two:""})},Yn.prototype.getCenter=function(){return this.options.center},Yn.prototype.setRadius=function(t){this.options.radius=t,this.setDataType(),this.getEllipseData(),this.geojson.source.data=this._circleData,this.updateSourceData()},Yn.prototype.updateSourceData=function(){this._map.getSource(this.id).setData(this.geojson.source.data),this.options.strokeWeight>0&&(this.lineGeojson.source=this.geojson.source,this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data))},Yn.prototype.getArea=function(){return i.GeometryUtil.ringArea(this._circleData.geometry.coordinates[0])},Yn.prototype.getLayoutProperty=function(t){return this.geojson.paint[t]},Yn.prototype.getRadius=function(){return this.options.radius},Yn.prototype.getOptions=function(){return this.options},Yn.prototype.setOptions=function(t){t.radius&&this.setRadius(t.radius),t.center&&this.setCenter(t.center),(t.rotate||0==t.rotate)&&this.setRotate(t.rotate),(t.fillImage||""==t.fillImage)&&this.setFillImage(t.fillImage),(t.strokeImage||""==t.strokeImage)&&this.setStrokeImage(t.strokeImage),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var e={fillColor:"fill-color",fillOpacity:"fill-opacity"},i=Object.keys(e),r={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity"},o=Object.keys(r),n=this._map.getLayer(this.id);for(var a in t)this.options[a]=t[a],n&&(i.indexOf(a)>=0&&this._map.setPaintProperty(this.id,e[a],t[a]),o.indexOf(a)>=0&&this._map.setPaintProperty(this.lineGeojson.id,r[a],t[a]));n&&("dashed"==t.strokeStyle?this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",null),t.center&&this.setCenter(t.center),t.radius&&this.setRadius(t.radius),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor()),t.map&&this.setMap(t.map)},Yn.prototype.contains=function(e){var i,r=this._circleData.geometry.coordinates[0];i=t.point(e instanceof Array?e:[e.lng,e.lat]);var o=t.polygon([r]);return t.booleanPointInPolygon(i,o)},Yn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Yn.prototype.getzIndex=function(){return this.options.zIndex};var Kn=function(e){this.options=e,this._polygonLayers=[],this._polylineLayers=[],this._markerLayers=[],e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),t.bindAll(["setMap","show","hide","getId","importData","clearOverlays","remove","removeOverlay","removeOverlays","getOverlays","hasOverlay","addOverlays","addOverlay","add","setExtData","getExtData"],this),this.init()};Kn.prototype.init=function(){this.createGeojson()},Kn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Kn.prototype.getExtData=function(){return this.extData||this.options.extData},Kn.prototype.createPolygon=function(){},Kn.prototype.importData=function(t){this.remove(),this.options.geoJSON=t,this.createGeojson(),this._map&&this.setMap(this._map)},Kn.prototype.createGeojson=function(){var t=this.options.geoJSON.features;if(0!=t.length)for(var e in t)switch(t[e].geometry.type){case"point":case"Point":if(this.options.getMarker&&"function"==typeof this.options.getMarker){var i=this.options.getMarker(t[e],t[e].geometry.coordinates);this._markerLayers.push(i)}break;case"Polyline":case"LineString":if(this.options.getPolyline&&"function"==typeof this.options.getPolyline){var r=t[e].geometry.coordinates;r[0]&&r[0][0]&&r[0][0]instanceof Array&&(r=r[0]);var o=this.options.getPolyline(t[e],r);this._polylineLayers.push(o)}break;case"Polygon":case"MultiPolygon":if(this.options.getPolygon&&"function"==typeof this.options.getPolygon){var n=t[e].geometry.coordinates;n&&n.length<4&&n[0]instanceof Array&&(n=n[0]&&n[0].length<4&&n[0][0]instanceof Array&&n[0][0].length>3?n[0][0]:n[0]);var a=this.options.getPolygon(t[e],n);this._polygonLayers.push(a)}}},Kn.prototype.getPath=function(t){return void 0===t&&(t=null),"all"==t?this.getLngLat(this.options.path):this.options.path},Kn.prototype.getLngLat=function(t){var e=[];for(var i in t)if(t[i].length>0)for(var r in t[i])if(t[i][r].length>0)for(var o in t[i][r])e.push(t[i][r][o]);return e},Kn.prototype.getId=function(){return this.id},Kn.prototype.clearOverlays=function(){this.remove()},Kn.prototype.remove=function(){if(this._map){if(this._markerLayers.length>0)for(var t in this._markerLayers)this._markerLayers[t].remove();if(this._polylineLayers.length>0)for(var t in this._polylineLayers)this._polylineLayers[t].remove();if(this._polygonLayers.length>0)for(var t in this._polygonLayers)this._polygonLayers[t].remove();this._polygonLayers=[],this._polylineLayers=[],this._markerLayers=[],this.options.geoJSON={}}},Kn.prototype.setMap=function(t){if(t){if(this._map=t,this._markerLayers.length>0)for(var e in this._markerLayers)this._markerLayers[e].setMap(this._map);if(this._polylineLayers.length>0)for(var e in this._polylineLayers)this._polylineLayers[e].setMap(this._map);if(this._polygonLayers.length>0)for(var e in this._polygonLayers)this._polygonLayers[e].setMap(this._map)}else this.clearOverlays()},Kn.prototype.show=function(){if(this._markerLayers.length>0)for(var t in this._markerLayers)this._markerLayers[t].show();if(this._polylineLayers.length>0)for(var t in this._polylineLayers)this._polylineLayers[t].show();if(this._polygonLayers.length>0)for(var t in this._polygonLayers)this._polygonLayers[t].show()},Kn.prototype.hide=function(){if(this._markerLayers.length>0)for(var t in this._markerLayers)this._markerLayers[t].hide();if(this._polylineLayers.length>0)for(var t in this._polylineLayers)this._polylineLayers[t].hide();if(this._polygonLayers.length>0)for(var t in this._polygonLayers)this._polygonLayers[t].hide()},Kn.prototype.pushLayer=function(t){switch(t.type){case"marker":case"text":this._markerLayers.push(t);break;case"polyline":this._polylineLayers.push(t);break;case"polygon":this._polygonLayers.push(t)}},Kn.prototype.addOverlay=function(t){this._map&&(t.setMap(this._map),this.pushLayer(t))},Kn.prototype.addOverlays=function(t){var e=this;void 0===t&&(t=[]),this._map&&t.forEach((function(t){e.pushLayer(t),"marker"==t.type||"inforWindow"==t.type||"text"==t.type?t.addTo(e._map):"setMap"in t&&t.setMap(e._map)}))},Kn.prototype.getOverlays=function(){return this._markerLayers.concat(this._polylineLayers,this._polygonLayers)},Kn.prototype.hasOverlay=function(t){var e=this._polylineLayers.concat(this._polygonLayers);if("marker"==t.type){for(var i in this._markerLayers)if(t.getPosition()==this._markerLayers[i].getPosition())return!0}else for(var i in e)if(t.id==e[i].id)return!0;return!1},Kn.prototype.removeOverlay=function(t){switch(this._polylineLayers.concat(this._polygonLayers),t.type){case"marker":var e=[];for(var i in this._markerLayers)t.getPosition()==this._markerLayers[i].getPosition()?this._markerLayers[i].remove():e.push(this._markerLayers[i]);this._markerLayers=e;break;case"polyline":var r=[];for(var i in this._polylineLayers)t.id==this._polylineLayers[i].id?this._polylineLayers[i].remove():r.push(this._polylineLayers[i]);this._polylineLayers=r;break;case"polygon":var o=[];for(var i in this._polygonLayers)t.id==this._polygonLayers[i].id?this._polygonLayers[i].remove():o.push(this._polygonLayers[i]);this._polygonLayers=r}},Kn.prototype.removeOverlays=function(t){for(var e in t)this.removeOverlay(t[e])};var Jn={url:"",bounds:null,zooms:[3,24],opacity:1,cursor:"",visible:!0,zIndex:50},Qn=function(e,i){this.options=t.extend(Object.create(Jn),e),this.geojson={},this.type="imageLayer",e.map&&(this._map=e.map),this.id=this.geojson.id="custom_imageLayer_"+t.getRandomId(),this.sourceId="custom_imageLayer_source"+t.getRandomId(),this.status=!1,this.options.extData&&(this.extData=this.options.extData),this._layers={one:""},t.bindAll(["setMap","getMap","show","hide","setOptions","getOptions","getId","getBounds","setBounds","setStrokeImage","getZooms","setZooms","getImageUrl","setImageUrl","getPath","setzIndex","getzIndex","setExtData","getExtData","init","remove"],this),this._timeout=null,this._interval=null,this.init()};Qn.prototype.init=function(){this.createGeojson()},Qn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Qn.prototype.getExtData=function(){return this.extData||this.options.extData},Qn.prototype.getPath=function(){return this.geojson.source&&this.geojson.source.coordinates&&this.geojson.source.coordinates.length>0?this.geojson.source.coordinates:[]},Qn.prototype.getBounds=function(){return this.options.bounds},Qn.prototype.setBounds=function(t){this.status&&(this.geojson.source.coordinates=[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]],this._map.getSource(this.id).setCoordinates(this.geojson.source.coordinates))},Qn.prototype.getZooms=function(){return this.options.zooms},Qn.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.id,t[0],t[1]))},Qn.prototype.getImageUrl=function(){return this.options.url},Qn.prototype.setImageUrl=function(t){this.status&&(this.options.url=t,t?this._map.getSource(this.id)?this._map.getSource(this.id).updateImage({url:this.options.url,coordinates:this.geojson.source.coordinates}):this._map&&this.setMap(this._map):this.remove())},Qn.prototype.getMap=function(){return this._map},Qn.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},Qn.prototype.createGeojson=function(){this.geojson.type="raster",this.geojson.source={type:"image",url:this.options.url,coordinates:[[this.options.bounds._sw.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._sw.lat],[this.options.bounds._sw.lng,this.options.bounds._sw.lat]]},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"raster-opacity":this.options.opacity},this.geojson.minzoom=this.options.zooms[0],this.geojson.maxzoom=this.options.zooms[1],this._map&&this.setMap(this._map)},Qn.prototype.getId=function(){return this.id},Qn.prototype.remove=function(){this._map&&(this.status=!1,this._map.removeLayer(this.id),this._layers.one="")},Qn.prototype.setMap=function(t){var e=this;this.status||(t?(this._map=t,this._map._loaded?(this.status=!0,this._layers.one=this.id,this._map.addLayer(this.geojson,"",this.options.zIndex)):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e.status=!0,e._layers.one=e.id,e._map.addLayer(e.geojson,"",e.options.zIndex))}),10))):this._map&&this.remove())},Qn.prototype.setOptions=function(t){var e=this;if(void 0===t&&(t={}),this.status&&this._map){"bounds"in t&&this.setBounds(t.bounds),"zooms"in t&&this.setZooms(t.zooms),"url"in t&&this.setImageUrl(t.url),!("zIndex"in t)&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var i={opacity:"raster-opacity"};Object.keys(i).forEach((function(r){t.hasOwnProperty(r)&&(e._map.setPaintProperty(e.id,i[r],t[r]),e.options[r]=t[r])}))}},Qn.prototype.getOptions=function(){return this.options},Qn.prototype.show=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","visible")},Qn.prototype.hide=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","none")},Qn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Qn.prototype.getzIndex=function(){return this.options.zIndex};var $n={showDir:!1,lineCap:"round",strokeHeight:0,strokeColor:"#0037e4",strokeWeight:2,strokeDasharray:[2,2],strokeImage:"",lineJoin:"round",strokeOpacity:1,strokeOffset:[0,0],showBorder:!1,borderWeight:1,borderOpacity:1,borderColor:"#000000",visible:!0,strokeStyle:"solid",animated:!1,dirSize:.3,dirSpacing:15,zIndex:100,beforeId:""},ta=function(e,i){this.options=t.extend(Object.create($n),e),this.id=null,this.animateFun=null,this.animatedId=0,this.geojson={id:"custom_line_"+t.getRandomId(),type:"line"},this.id=this.geojson.id,this.type="polyline",this.lineArrwImageName="lk-Polyline-arrw",this.borderGeoJson={id:"lineBorder_"+t.getRandomId(),type:"line"},this.strokeImageName="",this._sourceData=null,this._sourceId="Polyline-source-id-"+t.getRandomId(),this.options.extData&&(this.extData=this.options.extData),this.options.strokeHeight>0&&(this.options.showDir=!1),this._layers={one:"",two:"",three:""},e.map&&(this._map=e.map),t.bindAll(["setMap","on","off","setColor","setOpacity","setWeight","setBorderColor","setBorderOpacity","setBorderWeight","show","hide","setOptions","getId","getPath","animate","getOptions","getLength","getBounds","_addLayer","_addStrokeImage","setStrokeImage","_creatDirLine","setCursor","_addShowDirFun","_mouseenterCallbackFun","_mouseleaveCallbackFun","_createLineGeojson","_createBorderLine","setExtData","getExtData","_updateLineStyle","setzIndex","getzIndex","setHeight"],this),this._timeout=null,this._interval=null,this._map&&this.setMap(this._map,this.options.beforeId)};ta.prototype.init=function(){this._addPolylineSource(),this.createGeojson()},ta.prototype._addPolylineSource=function(){this._map.getSource(this._sourceId)&&this._map.removeSource(this._sourceId),this._sourceData={type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:this.options.path}}},this._map.addSource(this._sourceId,this._sourceData)},ta.prototype.createGeojson=function(){this._createLineGeojson(),this.options.showBorder&&this._createBorderLine(),this.options.showDir&&this._creatDirLine(),this._addLayer(),this._addShowDirFun()},ta.prototype._createLineGeojson=function(){this.geojson.source=this._sourceId,this.geojson.layout={"line-join":this.options.lineJoin,"line-cap":this.options.lineCap,visibility:this.options.visible?"visible":"none"},this.geojson.paint={"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity,"line-translate":this.options.strokeOffset,"line-height":parseFloat(this.options.strokeHeight)},this.strokeImageName&&(this.geojson.paint["line-pattern"]=this.strokeImageName),"dashed"==this.options.strokeStyle&&(this.geojson.paint["line-dasharray"]=this.options.strokeDasharray)},ta.prototype._createBorderLine=function(){this.borderGeoJson.source=this._sourceId,this.borderGeoJson.layout={"line-join":this.options.lineJoin,"line-cap":this.options.lineCap,visibility:this.options.visible?"visible":"none"},this.borderGeoJson.paint={"line-color":this.options.borderColor,"line-width":this.options.borderWeight,"line-opacity":this.options.borderOpacity,"line-gap-width":this.options.strokeWeight,"line-translate":this.options.strokeOffset,"line-height":parseFloat(this.options.strokeHeight)-.05},this._layers.one=this.borderGeoJson.id,this._layers.two=this.id},ta.prototype._creatDirLine=function(){this.lineGeojson={id:"custom_line-icon_"+t.getRandomId(),type:"symbol",source:this._sourceId,layout:{"symbol-avoid-edges":!1,"icon-anchor":"center","symbol-placement":"line","symbol-spacing":this.options.dirSpacing,"symbol-z-order":"source","icon-image":this.lineArrwImageName,"icon-size":this.options.dirSize,"icon-rotate":-90,"icon-pitch-alignment":"viewport",visibility:this.options.visible?"visible":"none"},paint:{"icon-color":"#fff"}},this._layers.three=this.lineGeojson.id},ta.prototype.setExtData=function(t){this.extData=this.options.extData=t},ta.prototype.getExtData=function(){return this.extData||this.options.extData},ta.prototype.getLength=function(){var e=t.lineString(this.options.path),i=t.length$2(e,{units:"kilometers"});return Math.round(1e3*i)},ta.prototype.getBounds=function(){return this.getNewBounds(this.options.path)},ta.prototype.getNewBounds=function(t){var e=200,i=200,r=0,o=0;for(var n in t)t[n][0]>r&&(r=t[n][0]),t[n][0]<e&&(e=t[n][0]),t[n][1]>o&&(o=t[n][1]),t[n][1]<i&&(i=t[n][1]);return new $o([e,i],[r,o])},ta.prototype.getId=function(){return this.id},ta.prototype.remove=function(){this._map&&(this._map.getLayer(this.borderGeoJson.id)&&this._map.removeLayer(this.borderGeoJson.id),this._map.getLayer(this.id)&&this._map.removeLayer(this),this._layers={one:"",two:"",three:""})},ta.prototype._addStrokeImage=function(e){var i=this;""!=this.options.strokeImage&&(this.strokeImageName="custom_line_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,r){t||(i._map.addImage(i.strokeImageName,r),e&&e())})))},ta.prototype.setStrokeImage=function(e){var i=this;if(!e)return this._map.setPaintProperty(this.id,"line-pattern",null),void(this.strokeImageName="");this.options.strokeImage=e,this.strokeImageName="custom_line_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))},ta.prototype.setMap=function(t,e){var i=this;void 0===t&&(t=null),void 0===e&&(e=""),t?(e&&(this.options.beforeId=e),this._map=t,""==this.options.strokeImage?this._map._loaded?this.init():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i.init())}),10)):this._map._loaded?this._addStrokeImage((function(){i.init()})):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i._addStrokeImage((function(){i.init()})))}),10))):this._map&&this.remove()},ta.prototype._addShowDirFun=function(){var e=this;this.options.showDir&&this._map.loadImage(t.FILE_API+"/file_sdk_icon/1586072044051.png",(function(t,i){e._map.hasImage(e.lineArrwImageName)||e._map.addImage(e.lineArrwImageName,i),e._layers.three=e.lineGeojson.id,e._map.addLayer(e.lineGeojson,e.options.beforeId,e.options.zIndex)}))},ta.prototype._addLayer=function(){this._layers.one=this.id,this._map.addLayer(this,this.options.beforeId,this.options.zIndex),this.options.showBorder&&(this._layers.one=this.borderGeoJson.id,this._layers.two=this.id,this._map.addLayer(this.borderGeoJson,this.id,this.options.zIndex)),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},ta.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.geojson.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.geojson.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.geojson.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.geojson.id,this._mouseleaveCallbackFun))},ta.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},ta.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},ta.prototype.setPath=function(t){t instanceof Array&&(this.options.path=t,this._sourceData.data.geometry.coordinates=t,this._map.getSource(this._sourceId).setData(this._sourceData.data))},ta.prototype.getPath=function(){return this.options.path},ta.prototype.animate=function(){this._sourceData.data.geometry.coordinates.push(this.options.path[this.animatedId]),this.options.showBorder&&this._map.getSource(this.borderGeoJson.id).setData(this._sourceData.data.geometry),this._map.getSource(this._sourceId).setData(this._sourceData.data.geometry),this.animatedId++,this.animatedId>this.options.path.length&&cancelAnimationFrame(this.animateFun),this.animateFun=requestAnimationFrame(this.animate())},ta.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},ta.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},ta.prototype.setOptions=function(t){(t.strokeImage||""==t.strokeImage)&&this.setStrokeImage(t.strokeImage);var e={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity",strokeHeight:"line-height"},i=Object.keys(e),r={borderColor:"line-color",borderWeight:"line-width",borderOpacity:"line-opacity"},o=Object.keys(r),n={lineJoin:"line-join",lineCap:"line-cap"},a=Object.keys(n);for(var s in!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex),t)this.options[s]=t[s],this._map.getLayer(this.id)&&(i.indexOf(s)>=0&&("strokeWeight"==s&&this.options.showBorder&&this._map.setPaintProperty(this.borderGeoJson.id,e[s],t[s]+2*this.options.borderWeight),"strokeHeight"==s&&this.options.showBorder&&this.setHeight(t[s]),this._map.setPaintProperty(this.id,e[s],t[s])),this.options.showBorder&&o.indexOf(s)>=0&&this._map.setPaintProperty(this.borderGeoJson.id,r[s],"borderWeight"==s?this.options.strokeWeight+2*t[s]:t[s]),a.indexOf(s)>=0&&(this.options.showBorder&&this._map.setLayoutProperty(this.borderGeoJson.id,n[s],t[s]),this._map.setLayoutProperty(this.id,n[s],t[s])));this._map.getLayer(this.id)&&this._updateLineStyle(t),t.map&&this.setMap(t.map)},ta.prototype._updateLineStyle=function(t){this._map.getLayer(this.borderGeoJson.id)||1!=t.showBorder?this._map.getLayer(this.borderGeoJson.id)&&0==t.showBorder&&(this._map.removeLayer(this.borderGeoJson.id),this._layers.one=this.id,this._layers.two=""):(this._createBorderLine(),this._layers.two=this.id,this._layers.one=this.borderGeoJson.id,this._map.addLayer(this.borderGeoJson,this.id,this.options.zIndex)),"dashed"==t.strokeStyle?this._map.setPaintProperty(this.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.id,"line-dasharray",null),this.lineGeojson?0==t.showDir?(this._map.removeLayer(this.lineGeojson.id),this.lineGeojson=null,this._layers.three=""):t.dirSize&&this._map.setLayoutProperty(this.lineGeojson.id,"icon-size",this.options.dirSize):1==t.showDir&&(this._creatDirLine(),this._addShowDirFun()),t.path&&this.setPath(t.path),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor(t.cursor)},ta.prototype.getOptions=function(){return this.options},ta.prototype.setHeight=function(t){void 0===t&&(t=0),this._map&&this._map.style.hasLayer(this.id)&&NaN!=parseFloat(t)&&(this.options.strokeHeight=parseFloat(t),this.options.strokeHeight>0&&this.options.showDir&&this._map.style.hasLayer(this.lineGeojson.id)&&(this._map.removeLayer(this.lineGeojson.id),this.options.showDir=!1),this._map.setPaintProperty(this.id,"line-height",this.options.strokeHeight),this.options.showBorder&&this._map.style.hasLayer(this.borderGeoJson.id)&&this._map.setPaintProperty(this.borderGeoJson.id,"line-height",this.options.strokeHeight-.05))},ta.prototype.setColor=function(t){this._map&&this._map.style.hasLayer(this.id)&&(this.options.strokeColor=t,this._map.setPaintProperty(this.id,"line-color",t))},ta.prototype.setOpacity=function(t){this._map&&this._map.style.hasLayer(this.id)&&(this.options.strokeOpacity=t,this._map.setPaintProperty(this.id,"line-opacity",t))},ta.prototype.setWeight=function(t){this._map&&this._map.style.hasLayer(this.id)&&(this.options.strokeWeight=t,this.options.showBorder&&this._map.setPaintProperty(this.borderGeoJson.id,"line-width",t+2*this.options.borderWeight),this._map.setPaintProperty(this.id,"line-width",t))},ta.prototype.setBorderColor=function(t){this._map&&this._map.style.hasLayer(this.borderGeoJson.id)&&(this.options.borderColor=t,this.options.showBorder&&this._map.setPaintProperty(this.borderGeoJson.id,"line-color",t))},ta.prototype.setBorderOpacity=function(t){this._map&&this._map.style.hasLayer(this.borderGeoJson.id)&&(this.options.borderOpacity=t,this.options.showBorder&&this._map.setPaintProperty(this.borderGeoJson.id,"line-opacity",t))},ta.prototype.setBorderWeight=function(t){this._map&&this._map.style.hasLayer(this.borderGeoJson.id)&&(this.options.borderWeight=t,this.options.showBorder&&this._map.setPaintProperty(this.borderGeoJson.id,"line-width",this.options.strokeWeight+2*t))},ta.prototype.show=function(){this.options.showBorder&&this._map.setLayoutProperty(this.borderGeoJson.id,"visibility","visible"),this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},ta.prototype.hide=function(){this.options.showBorder&&this._map.setLayoutProperty(this.borderGeoJson.id,"visibility","none"),this._map.setLayoutProperty(this.id,"visibility","none"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},ta.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},ta.prototype.getzIndex=function(){return this.options.zIndex},ta.prototype.showDir=function(){this.options.showDir=!0,this._creatDirLine(),this._addShowDirFun()},ta.prototype.removeDir=function(){this.options.showDir&&this._map.style.hasLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id)};var ea={center:[116.39636259768668,39.907768102373495],strokeColor:"#0037e4",strokeOpacity:1,strokeWeight:0,strokeImage:"",fillColor:"#75f329",fillOpacity:1,fillImage:"",visible:!0,strokeStyle:"solid",strokeDasharray:[2,2],zIndex:50},ia=function(e,i){this.options=t.extend(Object.create(ea),e),this.id=null,this.geojson={},this.type="rectangle",this.options.extData&&(this.extData=this.options.extData),this._layers={one:"",two:""},e.map&&(this._map=e.map),t.bindAll(["setMap","on","off","show","hide","setOptions","getId","getBounds","setBounds","getOptions","contains","isPointInRing","getArea","_addLayer","_addFillImage","setFillImage","_addStrokeImage","setStrokeImage","_creatLineGeoJson","setCursor","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","_staticSetMapFun"],this),this._timeout=null,this._interval=null,this.init()};ia.prototype.init=function(){this.createGeojson()},ia.prototype.setExtData=function(t){this.extData=this.options.extData=t},ia.prototype.getExtData=function(){return this.extData||this.options.extData},ia.prototype.getPath=function(t){return this.options.path},ia.prototype.getLngLat=function(t){var e=[];for(var i in t)if(t[i].length>0)for(var r in t[i])if(t[i][r].length>0)for(var o in t[i][r])e.push(t[i][r][o]);return e},ia.prototype.getBounds=function(){return this.options.bounds},ia.prototype.setBounds=function(e){this.options.bounds=e,this.options.path=[[this.options.bounds.southwest.lng,this.options.bounds.southwest.lat],[this.options.bounds.southwest.lng,this.options.bounds.northeast.lat],[this.options.bounds.northeast.lng,this.options.bounds.northeast.lat],[this.options.bounds.northeast.lng,this.options.bounds.southwest.lat],[this.options.bounds.southwest.lng,this.options.bounds.southwest.lat]];var i=t.multiPolygon([[this.options.path]]),r=t.flatten(i);this.geojson.source.data=r,this._map.getSource(this.id).setData(this.geojson.source.data.features[0].geometry),this.options.strokeWeight>0&&(this.lineGeojson.source=this.geojson.source,this._map.getSource(this.lineGeojson.id).setData(this.lineGeojson.source.data.features[0].geometry))},ia.prototype.createGeojson=function(){this.options.path=[[this.options.bounds.southwest.lng,this.options.bounds.southwest.lat],[this.options.bounds.southwest.lng,this.options.bounds.northeast.lat],[this.options.bounds.northeast.lng,this.options.bounds.northeast.lat],[this.options.bounds.northeast.lng,this.options.bounds.southwest.lat],[this.options.bounds.southwest.lng,this.options.bounds.southwest.lat]];var e=t.multiPolygon([[this.options.path]]),i=t.flatten(e);this._layers.one=this.id=this.geojson.id="custom_rectangle_"+t.getRandomId(),this.geojson.type="fill",this.geojson.source={type:"geojson",data:i},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"fill-color":this.options.fillColor,"fill-opacity":this.options.fillOpacity,"fill-antialias":!0},this._creatLineGeoJson(),this._map&&this.setMap(this._map)},ia.prototype._creatLineGeoJson=function(){this.lineGeojson={id:"custom_rectangle_border_"+t.getRandomId(),type:"line",source:this.geojson.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"line-color":this.options.strokeColor,"line-width":this.options.strokeWeight,"line-opacity":this.options.strokeOpacity}},this._layers.two=this.lineGeojson.id,"dashed"==this.options.strokeStyle&&(this.lineGeojson.paint["line-dasharray"]=this.options.strokeDasharray)},ia.prototype.getId=function(){return this.id},ia.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this._map.getLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id),this._layers={one:"",two:""})},ia.prototype._addFillImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.fillImage&&(this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,r){t||(i._map.addImage(i.fillImageName,r),i.geojson.paint["fill-pattern"]=i.fillImageName,""==e&&i._addLayer())})))},ia.prototype.setFillImage=function(e){var i=this;e?(this.options.fillImage=e,this.fillImageName="custom_circle_fillImageName_"+t.getRandomId(),this._map.loadImage(this.options.fillImage,(function(t,e){t||(i._map.addImage(i.fillImageName,e),i._map.setPaintProperty(i.id,"fill-pattern",i.fillImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.id,"fill-pattern",null)},ia.prototype._addStrokeImage=function(e){var i=this;void 0===e&&(e=""),""!=this.options.strokeImage&&(this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,r){t||(i._map.addImage(i.strokeImageName,r),i.lineGeojson.paint["line-pattern"]=i.strokeImageName,""==e&&i._addLayer())})))},ia.prototype.setStrokeImage=function(e){var i=this;e?(this.options.strokeImage=e,this.strokeImageName="custom_circle_strokeImageName_"+t.getRandomId(),this._map.loadImage(this.options.strokeImage,(function(t,e){t||(i._map.addImage(i.strokeImageName,e),i._map.setPaintProperty(i.lineGeojson.id,"line-pattern",i.strokeImageName),i.hide(),i.show())}))):this._map.setPaintProperty(this.lineGeojson.id,"line-pattern",null)},ia.prototype.setMap=function(t){var e=this;t?(this._map=t,this._map._loaded?this._staticSetMapFun():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e._staticSetMapFun())}),10))):this._map&&this.remove()},ia.prototype._staticSetMapFun=function(){""==this.options.fillImage&&""==this.options.strokeImage?this._addLayer():""!=this.options.fillImage&&""!=this.options.strokeImage?(this._addFillImage("add"),this._addStrokeImage()):""!=this.options.fillImage?this._addFillImage():""!=this.options.strokeImage&&this._addStrokeImage()},ia.prototype._addLayer=function(){this._map.addLayer(this,"",this.options.zIndex),this._map.addLayer(this.lineGeojson,"",this.options.zIndex),this._mapStyleCursor=this._map._options.cursor,this.options.cursor&&this.setCursor(this.options.cursor)},ia.prototype.setCursor=function(t){t&&(this.options.cursor=t,this._map.off("mouseenter",this.id,this._mouseenterCallbackFun),this._map.off("mouseleave",this.id,this._mouseleaveCallbackFun),this._map.on("mouseenter",this.id,this._mouseenterCallbackFun),this._map.on("mouseleave",this.id,this._mouseleaveCallbackFun))},ia.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},ia.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},ia.prototype.on=function(t,e){this._map.on(t,this.id,e)},ia.prototype.off=function(t,e){this._map.off(t,this.id,e)},ia.prototype.setOptions=function(t){(t.fillImage||""==t.fillImage)&&this.setFillImage(t.fillImage),(t.strokeImage||""==t.strokeImage)&&this.setStrokeImage(t.strokeImage),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var e={fillColor:"fill-color",fillOpacity:"fill-opacity"},i=Object.keys(e),r={strokeColor:"line-color",strokeWeight:"line-width",strokeOpacity:"line-opacity"},o=Object.keys(r),n=this._map.getLayer(this.id);for(var a in t)this.options[a]=t[a],n&&(i.indexOf(a)>=0&&this._map.setPaintProperty(this.id,e[a],t[a]),o.indexOf(a)>=0&&this._map.setPaintProperty(this.lineGeojson.id,r[a],t[a]));n&&("dashed"==t.strokeStyle?this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",this.options.strokeDasharray):"solid"==t.strokeStyle&&this._map.setPaintProperty(this.lineGeojson.id,"line-dasharray",null),t.bounds&&this.setBounds(t.bounds),1==t.visible?this.show():0==t.visible&&this.hide(),t.cursor&&""!=t.cursor&&this.setCursor()),t.map&&this.setMap(t.map)},ia.prototype.getOptions=function(){return this.options},ia.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},ia.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},ia.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},ia.prototype.isPointInRing=function(e,i){var r;r=t.point(e instanceof Array?e:[e.lng,e.lat]);var o=t.polygon([i]);return t.booleanPointInPolygon(r,o)},ia.prototype.getArea=function(){return this.ringArea(this.options.path)},ia.prototype.ringArea=function(e){if(!(e.length<2)){if(2==e.length){t.polygon([e[0]]),t.area$1(o);var i=Math.round(n);t.polygon([e[1]]),t.area$1(o);var r=Math.round(n);return i-r>0?i-r:0}var o=t.polygon([e]),n=t.area$1(o);return Math.round(n)}},ia.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},ia.prototype.getzIndex=function(){return this.options.zIndex};var ra={url:"",bounds:null,zooms:[3,24],opacity:1,cursor:"",visible:!0,zIndex:50},oa=function(e,i){this.options=t.extend(Object.create(ra),e),this.id=null,this.geojson={},this.type="videoLayer",e.map&&(this._map=e.map),this.id=this.geojson.id="custom_videoLayer_"+t.getRandomId(),this.sourceId="custom_videoLayer_source"+t.getRandomId(),this.status=!1,this.options.extData&&(this.extData=this.options.extData),this._layers={one:this.id},t.bindAll(["setMap","getMap","show","hide","setOptions","getOptions","getId","getBounds","setBounds","getZooms","setZooms","getVideoUrl","setVideoUrl","getElement","pause","play","getPath","setzIndex","getzIndex","setExtData","getExtData","init","remove"],this),this._timeout=null,this._interval=null,this.init()};oa.prototype.init=function(){this.createGeojson(),this._map&&this.setMap(this._map)},oa.prototype.setExtData=function(t){this.extData=this.options.extData=t},oa.prototype.getExtData=function(){return this.extData||this.options.extData},oa.prototype.getPath=function(){return this.geojson.source&&this.geojson.source.coordinates&&this.geojson.source.coordinates.length>0?this.geojson.source.coordinates:[]},oa.prototype.getBounds=function(){return this.options.bounds},oa.prototype.setBounds=function(t){this.status&&(this.geojson.source.coordinates=[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]],this._map.getSource(this.id).setCoordinates(this.geojson.source.coordinates))},oa.prototype.getZooms=function(){return this.options.zooms},oa.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.id,t[0],t[1]))},oa.prototype.getVideoUrl=function(){return this.options.url},oa.prototype.setVideoUrl=function(t){this.status&&(this.options.url=t,this.remove(),this.init())},oa.prototype.getElement=function(){if(this.status)return this._map.getSource(this.id).getVideo()},oa.prototype.getMap=function(){return this._map},oa.prototype.createGeojson=function(){var t=this.options.url;"string"==typeof this.options.url&&(t=[this.options.url]),this.geojson.type="raster",this.geojson.source={type:"video",urls:t,coordinates:[[this.options.bounds._sw.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._sw.lat],[this.options.bounds._sw.lng,this.options.bounds._sw.lat]]},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"raster-opacity":this.options.opacity},this.geojson.minzoom=this.options.zooms[0],this.geojson.maxzoom=this.options.zooms[1]},oa.prototype.getId=function(){return this.id},oa.prototype.remove=function(){this._map&&(this.status=!1,this._map.removeLayer(this.id),this._layers.one="")},oa.prototype.setMap=function(t){var e=this;this.status||(t?(this._map=t,this._map._loaded?(this.status=!0,this._layers.one=this.id,this._map.addLayer(this.geojson,"",this.options.zIndex)):(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(e._interval)}),1e4),this._interval=setInterval((function(){e._map._loaded&&(clearInterval(e._interval),clearTimeout(e._timeout),e.status=!0,e._layers.one=e.id,e._map.addLayer(e.geojson,"",e.options.zIndex))}),10))):this._map&&this.remove())},oa.prototype.setOptions=function(t){var e=this;t.bounds&&this.setBounds(t.bounds),t.zooms&&this.setZooms(t.zooms),t.url&&this.setVideoUrl(t.url),!t.zIndex&&0!=t.zIndex||t.zIndex==this.options.zIndex||this.setzIndex(t.zIndex);var i={opacity:"raster-opacity"};Object.keys(i).forEach((function(r){t.hasOwnProperty(r)&&(e._map.setPaintProperty(e.id,i[r],t[r]),e.options[r]=t[r])}))},oa.prototype.getOptions=function(){return this.options},oa.prototype.show=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","visible")},oa.prototype.hide=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","none")},oa.prototype.pause=function(){this.status&&this._map.getSource(this.id).video.pause()},oa.prototype.play=function(){this.status&&this._map.getSource(this.id).video.play()},oa.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},oa.prototype.getzIndex=function(){return this.options.zIndex};var na={visible:!0},aa=function(e){this.matrix=new Float64Array(16),t.identity(this.matrix),this.indexData=[],this._options=e=t.extend(e=e||{},na),this.type="custom",this.renderingMode="3d",this.width=e.width||1,this.visible=e.visible,this.id=e.id?e.id:"Polyline3D_"+t.getRandomId(),this.mercatorCoordinates=[],this.indexElementCount=0,this.points=[],this._path=[],this.geojsonData={type:"FeatureCollection",features:[]};var i=e.opacity||1;if(this.color=t.Color.parse(e.color||new t.Color(1,0,0,i)),this.color.a=i,this.offset=e.offset||0,e.data){var r;if(e.data.length>1){var o=e.data[0];r=t.MercatorCoordinate.fromLngLat({lng:o.x,lat:o.y},o.z+this.offset),this.meterInMercator=r,t.translate(this.matrix,this.matrix,[r.x,r.y,r.z]);for(var n=0;n<e.data.length;++n){this._path.push([(o=e.data[n]).x,o.y]);var a=t.MercatorCoordinate.fromLngLat({lng:o.x,lat:o.y},o.z+this.offset);this.points.push(this.create64Vec3(a.x,a.y,a.z)),this.mercatorCoordinates.push(a)}this.geojsonData.features.push({type:"Feature",properties:{color:e.color,width:e.width,opacity:e.opacity,offset:e.offset,image:e.image},geometry:{type:"LineString",coordinates:this._path}})}e.image&&(this.image=e.image,this.imageName="lk_polyline_3d"+t.getRandomId()),this.makeBuffer(this.points)}};aa.prototype.getPath=function(){return this._path},aa.prototype.getBounds=function(){if(i&&this.geojsonData&&i.LKTurf&&i.LKTurf.bbox){var t=i.LKTurf.bbox(this.geojsonData),e=new i.LngLat(t[0],t[1]),r=new i.LngLat(t[2],t[3]);return new i.Bounds(e,r)}},aa.prototype.isEquals=function(t,e,i){var r=i||1e-8;return Math.abs(t.x-e.x)<r&&Math.abs(t.y-e.y)<r&&Math.abs(t.z-e.z)<r},aa.prototype.create64Vec3=function(e,i,r){var o=new Float64Array(3);return t.set(o,e||0,i||0,r||0),o},aa.prototype.subNormalPerp=function(e,i){var r=this.create64Vec3();t.subtract(r,e,i),r[2]=0,t.normalize(r,r);var o=r[1];return r[1]=r[0],r[0]=-o,r},aa.prototype.getWidth=function(){return this.width},aa.prototype.setWidth=function(t){if(this.width=t,this.makeBuffer(this.points),this.buffer){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bufferData(e.ARRAY_BUFFER,this.data,e.DYNAMIC_DRAW),this.data=[],e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indexData,e.STATIC_DRAW),this.indexElementCount=this.indexData.length,this.indexData=[]}},aa.prototype.makeBuffer=function(e){if(!(e.length<2)){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0;for(var i=this.points[0],r=this.meterInMercator.meterInMercatorCoordinateUnits(),o=e.length;o>=2&&this.isEquals(e[o-1],e[o-2],r);)o--;for(var n=0;n<o-1&&this.isEquals(e[n],e[n+1],r);)n++;var a,s=[];s.push(0);for(var l=n;l<o-1;l++){var u=this.mercatorCoordinates[l].toLngLat(),h=this.mercatorCoordinates[l+1].toLngLat();this.distance+=u.distance(h),s.push(this.distance)}var p=void 0,c=void 0,f=void 0,d=this.isEquals(e[n],e[o-1]),m=[],y=[];d&&(f=this.subNormalPerp(e[n],a=e[o-2]));for(var g=n;g<o;g++)if(!(p=g===o-1?d?e[n+1]:void 0:e[g+1])||!this.isEquals(e[g],p,r)){f&&(c=f),a=e[g],f=p?this.subNormalPerp(p,a):c,c=c||f;var _=this.create64Vec3();t.add(_,c,f),0===_.x&&0===_.y||t.normalize(_,_);var v=this.create64Vec3(),x=t.scale$2(_,_,this.width*r);t.add(v,a,x),m.push(v);var b=this.create64Vec3();t.sub(b,a,x),y.push(b)}var w=this.create64Vec3();if(this.image){this.data=new Float32Array(10*m.length);for(var k=0,T=0;T<m.length;++T)t.subtract(w,m[T],i),this.data[k++]=w[0],this.data[k++]=w[1],this.data[k++]=w[2],this.data[k++]=s[T]/this.width,this.data[k++]=0;for(var I=0;I<y.length;++I)t.subtract(w,y[I],i),this.data[k++]=w[0],this.data[k++]=w[1],this.data[k++]=w[2],this.data[k++]=s[I]/this.width,this.data[k++]=1}else{this.data=new Float32Array(6*m.length);for(var S=0,E=0;E<m.length;++E)t.subtract(w,m[E],i),this.data[S++]=w[0],this.data[S++]=w[1],this.data[S++]=w[2];for(var A=0;A<y.length;++A)t.subtract(w,y[A],i),this.data[S++]=w[0],this.data[S++]=w[1],this.data[S++]=w[2]}this.indexData=new Uint16Array(6*(m.length-1));for(var P=0,M=0;M<m.length;++M)this.indexData[P++]=M,this.indexData[P++]=M+1,this.indexData[P++]=m.length+M,this.indexData[P++]=M+1,this.indexData[P++]=m.length+M,this.indexData[P++]=m.length+M+1}},aa.prototype.getExtension=function(t,e){for(var i=e.length,r=0;r<i;++r){var o=t.getExtension(e[r]);if(o)return o}},aa.prototype.createAndLinkProgram=function(t,e){this._debugShaders=this.getExtension(t,["WEBGL_debug_shaders"]);var i=e._vertexShaderText,r=e._fragmentShaderText,o=t.createShader(t.VERTEX_SHADER);t.shaderSource(o,i),t.compileShader(o);var n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,r),t.compileShader(n);var a=t.createProgram();t.attachShader(a,o),t.attachShader(a,n),t.deleteShader(o),t.deleteShader(n);var s,l=e._attributeLocations;if(l)for(var u in l)l.hasOwnProperty(u)&&t.bindAttribLocation(a,l[u],u);if(t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS)){var h=this._debugShaders;if(!t.getShaderParameter(n,t.COMPILE_STATUS)){if(s=t.getShaderInfoLog(n),defined(h))h.getTranslatedShaderSource(n);throw t.deleteProgram(a),new RuntimeError("Fragment shader failed to compile.  Compile log: "+s)}if(!t.getShaderParameter(o,t.COMPILE_STATUS)){if(s=t.getShaderInfoLog(o),defined(h))h.getTranslatedShaderSource(o);throw t.deleteProgram(a),new RuntimeError("Vertex shader failed to compile.  Compile log: "+s)}throw s=t.getProgramInfoLog(a),defined(h),t.deleteProgram(a),new RuntimeError("Program failed to link.  Link log: "+s)}var p=e._logShaderCompilation;return p&&(s=t.getShaderInfoLog(o),defined(s)&&s.length),p&&(s=t.getShaderInfoLog(n),defined(s)&&s.length),p&&(s=t.getProgramInfoLog(a),defined(s)&&s.length),a},aa.prototype.complieShader=function(t){this.image?(this.program=this.createAndLinkProgram(t,{_vertexShaderText:"  \n                attribute vec3 aPos;\n                attribute vec2 aTexCoord; \n                uniform mat4 uMatrix;  \n                varying vec2 vTexCoord;\n                void main() { \n                    gl_Position = uMatrix * vec4(aPos, 1.0);\n                    vTexCoord = aTexCoord;\n                } ",_fragmentShaderText:"\n                precision highp float; \n                uniform sampler2D uSampler;\n                varying vec2 vTexCoord;\n                void main() {\n                    gl_FragColor = texture2D(uSampler, vTexCoord);\n                } "}),this.program.aPos=t.getAttribLocation(this.program,"aPos"),this.program.uMatrix=t.getUniformLocation(this.program,"uMatrix"),this.program.aTexCoord=t.getAttribLocation(this.program,"aTexCoord"),this.program.uSampler=t.getUniformLocation(this.program,"uSampler")):(this.program=this.createAndLinkProgram(t,{_vertexShaderText:"  \n                attribute vec3 aPos;\n                uniform mat4 uMatrix; \n                uniform vec4 uColor; \n                varying vec4 vColor;\n                void main() {\n                    vColor = uColor;\n                    gl_Position = uMatrix * vec4(aPos, 1.0);\n                } ",_fragmentShaderText:"\n                precision highp float;\n                varying vec4 vColor;\n                void main() {\n                    gl_FragColor = vColor;\n                } "}),this.program.aPos=t.getAttribLocation(this.program,"aPos"),this.program.uMatrix=t.getUniformLocation(this.program,"uMatrix"),this.program.u_color=t.getUniformLocation(this.program,"uColor"))},aa.prototype.onAdd=function(e,i){var r=this;this.map=e,this.gl=i,this.complieShader(i),this.buffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.buffer),i.bufferData(i.ARRAY_BUFFER,this.data,i.DYNAMIC_DRAW),this.data=[],this.indexBuffer=i.createBuffer(),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,this.indexData,i.STATIC_DRAW),this.indexElementCount=this.indexData.length,this.indexData=[],this.image&&e.loadImage(this.image,(function(i,o){if(!i){e.addImage(r.imageName,o),r.image=e.style.getImage(r.imageName);var n=e.painter.context;r.texture=new t.Texture(n,r.image.data,n.gl.RGBA)}}))},aa.prototype.render=function(e,i){var r=new Float32Array(16);e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.multiply(r,i,this.matrix),e.uniformMatrix4fv(this.program.uMatrix,!1,r),this.image?(this.texture?this.texture.bind(e.LINEAR,e.REPEAT):this.map.painter.emptyTexture.bind(e.LINEAR,e.REPEAT),this.map.painter.context.activeTexture.set(e.TEXTURE0),e.uniform1i(this.program.uSampler,0),e.enableVertexAttribArray(this.program.aPos),e.vertexAttribPointer(this.program.aPos,3,e.FLOAT,!1,20,0),e.enableVertexAttribArray(this.program.aTexCoord),e.vertexAttribPointer(this.program.aTexCoord,2,e.FLOAT,!1,20,12),e.uniform1i(this.program.uSampler,0)):(e.enableVertexAttribArray(this.program.aPos),e.vertexAttribPointer(this.program.aPos,3,e.FLOAT,!1,0,0),e.uniform4fv(this.program.u_color,[this.color.r,this.color.g,this.color.b,this.color.a])),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawElements(e.TRIANGLES,this.indexElementCount,e.UNSIGNED_SHORT,0)},aa.prototype.remove=function(){this.map&&(this.map.removeLayer(this.id),this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.texture&&this.texture.destroy(),this.indexBuffer&&(this.gl.deleteBuffer(this.indexBuffer),this.indexBuffer=null),this.buffer&&(this.gl.deleteBuffer(this.buffer),this.buffer=null))};var sa={map:null,tileSize:256,errorUrl:"",getTileUrl:null,url:null,zIndex:200,opacity:1,zooms:[3,24],sourceZooms:[3,22],visible:!0,beforeId:"",extData:null,hueRotate:0,brightnessMin:0,brightnessMax:1,saturation:0,contrast:0,resampling:"linear",fadeDuration:300,scheme:"xyz",bounds:null},la=function(e){this.options=t.extend(Object.create(sa),e),this.id="custom_tileLayer_"+t.getRandomId(),this.geojson={},this.type="tileLayer",e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),this.status=!1,t.bindAll(["setMap","show","hide","setOptions","getOptions","getId","_getBounds","_addLayer","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","getTiles","getTileBBox","_getLayerTiles","reload","setTileUrl","getZooms","setZooms","setOpacity","getOpacity","init","remove","reload"],this),this._timeout=null,this._interval=null,this.init()};la.prototype.init=function(){this.createGeojson()},la.prototype.getZooms=function(){return this.options.zooms},la.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.geojson.id,t[0],t[1]))},la.prototype.setExtData=function(t){this.extData=this.options.extData=t},la.prototype.getExtData=function(){return this.extData||this.options.extData},la.prototype._getBounds=function(){return this.options.bounds instanceof Array?this.options.bounds:[this.options.bounds._sw.lng,this.options.bounds._sw.lat,this.options.bounds._ne.lng,this.options.bounds._ne.lat]},la.prototype.createGeojson=function(){this.source={type:"raster",tiles:[],tileSize:this.options.tileSize,maxzoom:this.options.sourceZooms[1],minzoom:this.options.sourceZooms[0],wms:!0},this.options.bounds&&(this.source.bounds=this.options.bounds),this.geojson={id:this.id,type:"raster",source:this.source,"source-layer":"",minzoom:this.options.zooms[0],maxzoom:this.options.zooms[1],name:"卫星图层"},this.options.getTileUrl&&("string"==typeof this.options.getTileUrl?this.geojson.source.tiles=[this.options.getTileUrl]:"function"==typeof this.options.getTileUrl&&(this.geojson.source.getTileUrl=this.options.getTileUrl)),this.options.url&&("string"==typeof this.options.url?this.geojson.source.tiles=[this.options.url]:"function"==typeof this.options.url&&(this.geojson.source.getTileUrl=this.options.url)),this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"raster-hue-rotate":this.options.hueRotate,"raster-opacity":this.options.opacity,"raster-brightness-min":this.options.brightnessMin,"raster-brightness-max":this.options.brightnessMax,"raster-saturation":this.options.saturation,"raster-contrast":this.options.contrast,"raster-resampling":this.options.resampling,"raster-fade-duration":this.options.fadeDuration},this._map&&this.setMap(this._map,this.options.beforeId)},la.prototype.getId=function(){return this.id},la.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this.status=!1)},la.prototype.reload=function(){this.status&&this._map&&(this.remove(),this._addLayer())},la.prototype.setTileUrl=function(t){this.status&&this._map&&t&&(this.options.getTileUrl=t,this.init(),this.remove(),this._addLayer())},la.prototype.setMap=function(t,e){var i=this;void 0===e&&(e=""),t?(e&&(this.options.beforeId=e),this._map=t,this._map._loaded?this._addLayer():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i._addLayer())}),10))):this._map&&this.remove()},la.prototype._addLayer=function(){this.status=!0,this._map.addLayer(this.geojson,this.options.beforeId,this.options.zIndex)},la.prototype.setOptions=function(t){var e=this;if(this.status&&this._map){t.hasOwnProperty("zIndex")&&t.zIndex!=this.options.zIndex&&this.setzIndex(t.zIndex),t.hasOwnProperty("visible")&&(this.options.visible&&this.show(),this.options.visible||this.hide()),t.hasOwnProperty("zooms")&&this.setZooms(t.zooms),t.hasOwnProperty("getTileUrl")&&this.setTileUrl(t.getTileUrl),t.hasOwnProperty("url")&&this.setTileUrl(t.url),t.hasOwnProperty("tileSize")&&(this.init(),this.remove(),this._addLayer());var i={hueRotate:"raster-hue-rotate",opacity:"raster-opacity",brightnessMin:"raster-brightness-min",brightnessMax:"raster-brightness-max",saturation:"raster-saturation",contrast:"raster-contrast",resampling:"raster-resampling",fadeDuration:"raster-fade-duration"};Object.keys(i).forEach((function(r){t.hasOwnProperty(r)&&(e._map.setPaintProperty(e.id,i[r],t[r]),e.options[r]=t[r])})),t.map&&(this.remove(),this.setMap(t.map))}},la.prototype.getOptions=function(){return{map:this.options.map,zIndex:this.options.zIndex,opacity:this.options.opacity,zooms:this.options.zooms,visible:this.options.visible,getTileUrl:this.options.getTileUrl,url:this.options.url,tileSize:this.options.tileSize,extData:this.options.extData}},la.prototype.setOpacity=function(t){this.status&&"number"==typeof t&&(t>1&&(t=1),t<0&&(t=0),this.options.opacity=t,this._map.setPaintProperty(this.id,"raster-opacity",this.options.opacity))},la.prototype.getOpacity=function(){return this.options.opacity},la.prototype.show=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.visible=!0)},la.prototype.hide=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","none"),this.options.visible=!1)},la.prototype.setzIndex=function(t){if(this.status&&this._map){this.options.zIndex=parseInt(t);var e=mapObj.style._getOldLayer(this.options.zIndex);this._map.moveLayer(this.id,e.oldLayerID)}},la.prototype.getzIndex=function(){return this.options.zIndex},la.prototype._getLayerTiles=function(){return this._map.transform.coveringTiles({tileSize:this.options.tileSize,minzoom:this.options.zooms[0],maxzoom:this.options.zooms[1],roundZoom:!1,reparseOverscaled:!0,isTerrainDEM:!1})},la.prototype.getTiles=function(){if(this.status&&this._map){var t=this._getLayerTiles(),e=[];return t.forEach((function(t){e.push({x:t.canonical.x,y:t.canonical.y,z:t.canonical.z})})),e}},la.prototype.getTileBBox=function(){if(this.status&&this._map){var t=this._getLayerTiles(),e=[];return t.forEach((function(t){var i=t.canonical.getTileBBox();e.push(i)})),e}},la.prototype.getQuadkey=function(){if(this.status&&this._map){var t=this._getLayerTiles(),e=[];return t.forEach((function(t){var i=t.canonical.getQuadkey();e.push(i)})),e}};var ua={map:null,beforeId:"",tiles:[],url:"",attribution:"",maxzoom:24,minzoom:3,bounds:[],scheme:"xyz",volatile:!1,promoteId:null},ha=function(e){void 0===e&&(e={}),this.options=t.extend(Object.create(ua),e),this._map=e.map||null,t.bindAll(["init","_addSourceFun","setOptions","_setDefaultData","on","off","show","hide","addLayer","getLayer","removeLayer","_getBeforeId","_updateListData","updateLayer","_getLayerNewStyle","_setMapvglStorage","_mouseenterCallbackFun","_mouseleaveCallbackFun","remove","_staticAddLayerFun","_getFillExtrusionLayout","_getFillExtrusionPaint","_getSymbolLayout","_getSymbolPaint","_getCircleLayout","_getCirclePaint","_getFillLayout","_getFillPaint","_getLineLayout","_getLinePaint","_updateUserLayers","setMap"],this),this._setDefaultData(),this._map&&this.init()};ha.prototype.setMap=function(t){var e=this;if(void 0===t&&(t=null),!t&&this._map)return this._layersId.forEach((function(t){e._map.removeLayer(t)})),this._map.removeSource(this._sourceId),this._setDefaultData(),this._map=null,this;this._map=t,this._setDefaultData(),this.init()},ha.prototype._setDefaultData=function(){this._layers=[],this._layersId=[],this._userLayers=[],this._FillExtrusion_layoutKeys=["visibility"],this._FillExtrusion_paintKeys=["fill-extrusion-base","fill-extrusion-color","fill-extrusion-height","fill-extrusion-opacity","fill-extrusion-pattern","fill-extrusion-translate","fill-extrusion-translate-anchor","fill-extrusion-vertical-gradient","fill-extrusion-exclude","fill-extrusion-roofcolor","fill-extrusion-isTile","fill-extrusion-isGradient","fill-extrusion-direction"],this._Symbol_layoutKeys=["icon-allow-overlap","visibility","icon-anchor","icon-ignore-placement","icon-image","icon-keep-upright","icon-offset","icon-optional","icon-padding","icon-pitch-alignment","icon-rotate","icon-rotation-alignment","icon-size","icon-text-fit","icon-text-fit-padding","symbol-avoid-edges","symbol-placement","symbol-sort-key","symbol-spacing","symbol-z-order","text-allow-overlap","text-anchor","text-field","text-font","text-ignore-placement","text-justify","text-keep-upright","text-letter-spacing","text-line-height","text-max-angle","text-max-width","text-offset","text-padding","text-pitch-alignment","text-radial-offset","text-rotate","text-rotation-alignment","text-transform"],this._Symbol_paintKeys=["icon-color","icon-halo-blur","icon-halo-color","icon-halo-width","icon-opacity","icon-translate","icon-translate-anchor","text-color","text-halo-blur","text-halo-color","text-halo-width","text-opacity","text-optional","text-size","text-translate","text-translate-anchor","text-variable-anchor","text-writing-mode"],this._Circle_layoutKeys=["circle-sort-key","visibility"],this._Circle_paintKeys=["circle-blur","circle-color","circle-opacity","circle-pitch-alignment","circle-pitch-scale","circle-radius","circle-stroke-color","circle-stroke-opacity","circle-stroke-width","circle-translate","circle-translate-anchor"],this._Fill_layoutKeys=["fill-sort-key","visibility"],this._Fill_paintKeys=["fill-antialias","fill-color","fill-opacity","fill-outline-color","fill-pattern","fill-translate","fill-translate-anchor"],this._Line_layoutKeys=["line-cap","line-join","line-round-limit","line-sort-key","visibility"],this._Line_paintKeys=["line-color","line-width","line-blur","line-dasharray","line-gap-width","line-offset","line-opacity","line-pattern","line-translate","line-translate-anchor","line-animate-enable","line-animate-interval","line-animate-trailLength","line-animate-duration"]},ha.prototype.init=function(){this._addSourceFun()},ha.prototype._addSourceFun=function(){this._sourceId="custom_tileLayer_vector_source"+t.getRandomId(),this._source={type:"vector",minzoom:this.options.minzoom,maxzoom:this.options.maxzoom,scheme:this.options.scheme,volatile:this.options.volatile},this.options.tiles.length>0&&(this._source.tiles=this.options.tiles),this.options.url.length>0&&(this._source.url=this.options.url),this.options.bounds.length>0&&(this._source.bounds=this.options.bounds),this.options.attribution.length>0&&(this._source.attribution=this.options.attribution),this.options.volatile&&(this._source.volatile=this.options.volatile),this.options.promoteId&&(this._source.promoteId=this.options.promoteId),this._map.addSource(this._sourceId,this._source)},ha.prototype.addLayer=function(e){if(void 0===e&&(e={}),e.type)if(e.id&&this._layersId.indexOf(e.id)>-1);else{e.hasOwnProperty("minzoom")||(e.minzoom=e.minzoom||3),e.hasOwnProperty("maxzoom")||(e.maxzoom=e.maxzoom||24),e.hasOwnProperty("zIndex")||(e.zIndex=e.zIndex||0),this._userLayers.push(e);var i={id:e.id||"custom_tileLayer_vector_"+t.getRandomId(),type:e.type,source:this._sourceId,"source-layer":e["source-layer"]};switch(e.filter&&(i.filter=e.filter),e.minzoom&&(i.minzoom=e.minzoom),e.maxzoom&&(i.maxzoom=e.maxzoom),this._layersId.push(i.id),e.type){case"line":i.layout=this._getLineLayout(e.lineStyle),i.paint=this._getLinePaint(e.lineStyle);break;case"fill":i.layout=this._getFillLayout(e.fillStyle),i.paint=this._getFillPaint(e.fillStyle);break;case"polygon":i.type="fill",i.layout=this._getFillLayout(e.polygonStyle),i.paint=this._getFillPaint(e.polygonStyle);break;case"circle":i.layout=this._getCircleLayout(e.circleStyle),i.paint=this._getCirclePaint(e.circleStyle);break;case"symbol":i.layout=this._getSymbolLayout(e.symbolStyle),i.paint=this._getSymbolPaint(e.symbolStyle);break;case"fill-extrusion":i.layout=this._getFillExtrusionLayout(e.FillExtrusionStyle),i.paint=this._getFillExtrusionPaint(e.FillExtrusionStyle)}if(this._layers.push(i),void 0!==e.beforeId)this._map.addLayer(i,e.beforeId);else if(void 0!==e.zIndex){var r=this._getBeforeId(e.zIndex);this._map.addLayer(i,r)}else this._map.addLayer(i)}},ha.prototype._getBeforeId=function(t,e){void 0===e&&(e="");var i="",r=e+"_border";for(var o in this._userLayers.sort((function(t,e){return t.zIndex-e.zIndex})),this._userLayers)if(this._userLayers.hasOwnProperty(o)&&this._userLayers[o].zIndex>t&&this._userLayers[o].id!=e&&this._userLayers[o].id!=r){i=this._userLayers[o].id;break}return i},ha.prototype._getFillExtrusionLayout=function(t){var e=this,i={};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._FillExtrusion_layoutKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getFillExtrusionPaint=function(t){var e=this,i={"fill-extrusion-base":0,"fill-extrusion-color":"#ff0","fill-extrusion-height":100};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._FillExtrusion_paintKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getSymbolLayout=function(t){var e=this,i={};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Symbol_layoutKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getSymbolPaint=function(t){var e=this,i={};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Symbol_paintKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getCircleLayout=function(t){var e=this,i={};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Circle_layoutKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getCirclePaint=function(t){var e=this,i={"circle-color":"#ff0","circle-radius":5};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Circle_paintKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getFillLayout=function(t){var e=this,i={};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Fill_layoutKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getFillPaint=function(t){var e=this,i={"fill-color":"#ff0"};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Fill_paintKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getLineLayout=function(t){var e=this,i={"line-cap":"round","line-join":"round"};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Line_layoutKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype._getLinePaint=function(t){var e=this,i={"line-color":"#ff0","line-width":2};if(!t)return i;var r=Object.keys(t);return 0==r.length||r.forEach((function(r){e._Line_paintKeys.indexOf(r)>-1&&(i[r]=t[r])})),i},ha.prototype.updateLayer=function(t){var e=this;if(t&&0!=this._layersId.length&&this._map&&!(this._layersId.indexOf(t.id)<0)){var i=this._updateUserLayers(t);Object.keys(t).forEach((function(r){switch(r){case"beforeId":e._map.moveLayer(t.id,t.beforeId);break;case"zIndex":var o=e._getBeforeId(t.zIndex,t.id);e._map.moveLayer(t.id,o);break;case"filter":e._map.setFilter(t.id,t.filter);break;case"minzoom":case"maxzoom":e._map.setLayerZoomRange(t.id,i.minzoom||3,i.maxzoom||22)}}))}},ha.prototype._updateUserLayers=function(e){for(var i=this,r=null,o=0;o<this._userLayers.length;o++)if(this._userLayers[o].id===e.id){r=this._userLayers[o];break}switch(r.type){case"line":if(e.lineStyle){var n=Object.keys(e.lineStyle);n.length>0&&(r.lineStyle=t.extend(r.lineStyle,e.lineStyle),n.forEach((function(t){i._Line_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.lineStyle[t]),i._Line_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.lineStyle[t])})))}r=t.extend(r,e);break;case"fill":if(e.fillStyle){var a=Object.keys(e.fillStyle);a.length>0&&(r.fillStyle=t.extend(r.fillStyle,e.fillStyle),a.forEach((function(t){i._Fill_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.fillStyle[t]),i._Fill_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.fillStyle[t])})))}r=t.extend(r,e);break;case"polygon":if(r.type="fill",e.polygonStyle){var s=Object.keys(e.polygonStyle);s.length>0&&(r.polygonStyle=t.extend(r.polygonStyle,e.polygonStyle),s.forEach((function(t){i._Fill_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.polygonStyle[t]),i._Fill_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.polygonStyle[t])})))}r=t.extend(r,e);break;case"circle":if(e.circleStyle){var l=Object.keys(e.circleStyle);l.length>0&&(r.circleStyle=t.extend(r.circleStyle,e.circleStyle),l.forEach((function(t){i._Circle_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.circleStyle[t]),i._Circle_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.circleStyle[t])})))}r=t.extend(r,e);break;case"symbol":if(e.symbolStyle){var u=Object.keys(e.symbolStyle);u.length>0&&(r.symbolStyle=t.extend(r.symbolStyle,e.symbolStyle),u.forEach((function(t){i._Symbol_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.symbolStyle[t]),i._Symbol_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.symbolStyle[t])})))}r=t.extend(r,e);break;case"fill-extrusion":if(e.FillExtrusionStyle){var h=Object.keys(e.FillExtrusionStyle);h.length>0&&(r.FillExtrusionStyle=t.extend(r.FillExtrusionStyle,e.FillExtrusionStyle),h.forEach((function(t){i._FillExtrusion_layoutKeys.indexOf(t)>-1&&i._map.setLayoutProperty(e.id,t,e.FillExtrusionStyle[t]),i._FillExtrusion_paintKeys.indexOf(t)>-1&&i._map.setPaintProperty(e.id,t,e.FillExtrusionStyle[t])})))}r=t.extend(r,e)}return r},ha.prototype.show=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"show")},ha.prototype.hide=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"hide")},ha.prototype.removeLayer=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"remove")},ha.prototype.remove=function(t){void 0===t&&(t=null),this.removeLayer(t)},ha.prototype._updateListData=function(t,e){var i=this;if(void 0===t&&(t=null),void 0===e&&(e=""),t){if("string"==typeof t&&this._layersId.indexOf(t)>-1)switch(e){case"remove":this._map.removeLayer(t),this._layersId.splice(this._layersId.findIndex((function(e){return e==t})),1),this._layers.splice(this._layers.findIndex((function(e){return e.id==t})),1),this._userLayers.splice(this._userLayers.findIndex((function(e){return e.id==t})),1);break;case"show":this._map.setLayoutProperty(t,"visibility","visible");break;case"hide":this._map.setLayoutProperty(t,"visibility","none")}else if(t instanceof Array){var r=function(r){if(t.hasOwnProperty(r)){var o=t[r];for(var n in i._userLayers)if(i._userLayers.hasOwnProperty(n)&&i._userLayers[n].id==o)switch(e){case"remove":i._map.removeLayer(o),i._layersId.splice(i._layersId.findIndex((function(t){return t==o})),1),i._layers.splice(i._layers.findIndex((function(t){return t.id==o})),1),i._userLayers.splice(i._userLayers.findIndex((function(t){return t.id==o})),1);break;case"show":i._map.setLayoutProperty(o,"visibility","visible");break;case"hide":i._map.setLayoutProperty(o,"visibility","none")}}};for(var o in t)r(o)}}else this._layersId.forEach((function(t){switch(e){case"remove":i._map.removeLayer(t),i._setDefaultData();break;case"show":i._map.setLayoutProperty(t,"visibility","visible");break;case"hide":i._map.setLayoutProperty(t,"visibility","none")}}))},ha.prototype.getLayer=function(t){if(void 0===t&&(t=null),0==this._layersId.length||!this._map)return null;if(!t)return this._userLayers;if("string"==typeof t&&this._layersId.indexOf(t)>-1){for(var e in this._userLayers)if(this._userLayers.hasOwnProperty(e)&&this._userLayers[e].id==t)return this._userLayers[e]}else if(t instanceof Array){var i=[];for(var r in t)if(t.hasOwnProperty(r))for(var e in this._userLayers)this._userLayers.hasOwnProperty(e)&&this._userLayers[e].id==t[r]&&i.push(this._userLayers[e]);return i}return null},ha.prototype.on=function(t,e,i){if(this._layersId.length,this._map&&0!=this._layersId.length&&(void 0!==e||void 0!==i)){if(void 0===i&&this._layersId.length>0)for(var r in this._layersId)this._layersId.hasOwnProperty(r)&&this._map.on(t,this._layersId[r],e);else"object"==typeof e&&!(e instanceof Array)&&e.id&&e.id.length>0?this._map.getLayer(e.id)&&this._map.on(t,e.id,i):"string"==typeof e&&this._map.getLayer(e)&&this._map.on(t,e,i);return this}},ha.prototype.off=function(t,e,i){if(this._map&&0!=this._layersId.length&&(void 0!==e||void 0!==i)){if(void 0===i&&this._layersId.length>0)for(var r in this._layersId)this._layersId.hasOwnProperty(r)&&this._map.off(t,this._layersId[r],e);else"object"==typeof e&&!(e instanceof Array)&&e.id&&e.id.length>0?this._map.getLayer(e.id)&&this._map.off(t,e.id,i):"string"==typeof e&&this._map.getLayer(e)&&this._map.off(t,e,i);return this}};var pa={map:null,tileSize:256,errorUrl:"",getTileUrl:null,zIndex:200,opacity:1,zooms:[3,24],sourceZooms:[3,22],visible:!0,beforeId:"",extData:null,hueRotate:0,brightnessMin:0,brightnessMax:1,saturation:0,contrast:0,resampling:"linear",fadeDuration:300,scheme:"xyz",bounds:null},ca=function(e){this.options=t.extend(Object.create(pa),e),this.id="custom_tileLayer_"+t.getRandomId(),this.geojson={},this.type="tileLayer",e.map&&(this._map=e.map),this.options.extData&&(this.extData=this.options.extData),this.status=!1,t.bindAll(["setMap","show","hide","setOptions","getOptions","getId","_getBounds","_addLayer","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","getTiles","reload","setTileUrl","getZooms","setZooms","setOpacity","getOpacity","init","remove","createGeojson"],this),this._timeout=null,this._interval=null,this.init()};ca.prototype.init=function(){this.createGeojson()},ca.prototype.getZooms=function(){return this.options.zooms},ca.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.geojson.id,t[0],t[1]))},ca.prototype.setExtData=function(t){this.extData=this.options.extData=t},ca.prototype.getExtData=function(){return this.extData||this.options.extData},ca.prototype._getBounds=function(){return this.options.bounds instanceof Array?this.options.bounds:[this.options.bounds._sw.lng,this.options.bounds._sw.lat,this.options.bounds._ne.lng,this.options.bounds._ne.lat]},ca.prototype.createGeojson=function(){this.source={type:"raster",tiles:[],tileSize:this.options.tileSize,scheme:this.options.scheme,maxzoom:this.options.sourceZooms[1],minzoom:this.options.sourceZooms[0]},this.options.bounds&&(this.source.bounds=this.options.bounds),this.geojson={id:this.id,type:"raster",source:this.source,"source-layer":"",minzoom:this.options.zooms[0],maxzoom:this.options.zooms[1],name:"卫星图层"},this.options.getTileUrl&&("string"==typeof this.options.getTileUrl?this.geojson.source.tiles=[this.options.getTileUrl]:"function"==typeof this.options.getTileUrl&&(this.geojson.source.getTileUrl=this.options.getTileUrl)),this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"raster-hue-rotate":this.options.hueRotate,"raster-opacity":this.options.opacity,"raster-brightness-min":this.options.brightnessMin,"raster-brightness-max":this.options.brightnessMax,"raster-saturation":this.options.saturation,"raster-contrast":this.options.contrast,"raster-resampling":this.options.resampling,"raster-fade-duration":this.options.fadeDuration},this._map&&this.setMap(this._map,this.options.beforeId)},ca.prototype.getId=function(){return this.id},ca.prototype.remove=function(t){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this.status=!1)},ca.prototype.reload=function(){this.status&&this._map&&(this.remove(),this.init(),this._addLayer())},ca.prototype.setTileUrl=function(t){this.status&&this._map&&t&&(this.options.getTileUrl=t,this.init(),this.remove(),this._addLayer())},ca.prototype.setMap=function(t,e){var i=this;void 0===e&&(e=""),t?(e&&(this.options.beforeId=e),this._map=t,this._map._loaded?this._addLayer():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i._addLayer())}),10))):this._map&&this.remove()},ca.prototype._addLayer=function(){this.status=!0,this._map.addLayer(this.geojson,this.options.beforeId,this.options.zIndex)},ca.prototype.setOptions=function(t){var e=this;if(this.status&&this._map){t.hasOwnProperty("zIndex")&&t.zIndex!=this.options.zIndex&&this.setzIndex(t.zIndex),t.hasOwnProperty("visible")&&(this.options.visible&&this.show(),this.options.visible||this.hide()),t.hasOwnProperty("zooms")&&this.setZooms(t.zooms),t.hasOwnProperty("getTileUrl")&&this.setTileUrl(t.getTileUrl),t.hasOwnProperty("tileSize")&&(this.init(),this.remove(),this._addLayer());var i={hueRotate:"raster-hue-rotate",opacity:"raster-opacity",brightnessMin:"raster-brightness-min",brightnessMax:"raster-brightness-max",saturation:"raster-saturation",contrast:"raster-contrast",resampling:"raster-resampling",fadeDuration:"raster-fade-duration"};Object.keys(i).forEach((function(r){t.hasOwnProperty(r)&&(e._map.setPaintProperty(e.id,i[r],t[r]),e.options[r]=t[r])})),t.map&&(this.remove(),this.setMap(t.map))}},ca.prototype.getOptions=function(){return{map:this.options.map,zIndex:this.options.zIndex,opacity:this.options.opacity,zooms:this.options.zooms,visible:this.options.visible,getTileUrl:this.options.getTileUrl,tileSize:this.options.tileSize,extData:this.options.extData}},ca.prototype.setOpacity=function(t){this.status&&"number"==typeof t&&(t>1&&(t=1),t<0&&(t=0),this.options.opacity=t,this._map.setPaintProperty(this.id,"raster-opacity",this.options.opacity))},ca.prototype.getOpacity=function(){return this.options.opacity},ca.prototype.show=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.visible=!0)},ca.prototype.hide=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","none"),this.options.visible=!1)},ca.prototype.setzIndex=function(t){if(this.status&&this._map){this.options.zIndex=parseInt(t);var e=this._map.style._getOldLayer(this.options.zIndex);this._map.moveLayer(this.id,e.oldLayerID)}},ca.prototype.getzIndex=function(){return this.options.zIndex},ca.prototype.getTiles=function(){if(this.status&&this._map){var t=this._map.transform.coveringTiles({tileSize:this.options.tileSize,minzoom:this.options.zooms[0],maxzoom:this.options.zooms[1],roundZoom:!1,reparseOverscaled:!0,isTerrainDEM:!1}),e=[];return t.forEach((function(t){e.push({x:t.canonical.x,y:t.canonical.y,z:t.canonical.z})})),e}},ca.WMS=la,ca.VECTOR=ha;var fa={map:null,tileSize:256,errorUrl:"",canvasId:"",canvas:null,zIndex:200,opacity:1,zooms:[3,24],visible:!0,beforeId:"",extData:null,hueRotate:0,brightnessMin:0,brightnessMax:1,saturation:0,contrast:0,resampling:"linear",fadeDuration:300,bounds:null,animate:!0},da=function(e){this.options=t.extend(Object.create(fa),e),this.id="custom_canvasLayer_"+t.getRandomId(),this.geojson={},this.type="canvasLayer",this._map=e.map,this.options.extData&&(this.extData=this.options.extData),this.status=!1,t.bindAll(["setMap","show","hide","setOptions","getOptions","getId","getBounds","setBounds","_addLayer","_mouseenterCallbackFun","_mouseleaveCallbackFun","setzIndex","getzIndex","setExtData","getExtData","reload","setTileUrl","getZooms","setZooms","setOpacity","getOpacity","init","remove","setCanvas","getElement"],this),this._timeout=null,this._interval=null,this.init()};function ma(t,e){var i=JSON.parse(JSON.stringify(t));for(var r in e)i[r]=e[r];return i}da.prototype.init=function(){this.createGeojson()},da.prototype.getZooms=function(){return this.options.zooms},da.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.geojson.id,t[0],t[1]))},da.prototype.setExtData=function(t){this.extData=this.options.extData=t},da.prototype.getExtData=function(){return this.extData||this.options.extData},da.prototype.getBounds=function(){return this.options.bounds},da.prototype.setBounds=function(t){this.status&&(this.geojson.source.coordinates=[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]],this._map.getSource(this.id).setCoordinates(this.geojson.source.coordinates))},da.prototype.createGeojson=function(){this.source={type:"canvas",canvas:this.options.canvasId,animate:this.options.animate,coordinates:[]},this.options.bounds&&(this.source.coordinates=[[this.options.bounds._sw.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._ne.lat],[this.options.bounds._ne.lng,this.options.bounds._sw.lat],[this.options.bounds._sw.lng,this.options.bounds._sw.lat]]),this.geojson={id:this.id,type:"raster",source:this.source,"source-layer":"",minzoom:this.options.zooms[0],maxzoom:this.options.zooms[1],name:"卫星图层"},this.geojson.layout={visibility:this.options.visible?"visible":"none"},this.geojson.paint={"raster-opacity":this.options.opacity,"raster-hue-rotate":this.options.hueRotate,"raster-brightness-min":this.options.brightnessMin,"raster-brightness-max":this.options.brightnessMax,"raster-saturation":this.options.saturation,"raster-contrast":this.options.contrast,"raster-resampling":this.options.resampling,"raster-fade-duration":this.options.fadeDuration},this._map&&this.setMap(this._map,this.options.beforeId)},da.prototype.getId=function(){return this.id},da.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this.status=!1)},da.prototype.reload=function(){this.status&&this._map&&(this.remove(),this.init(),this._addLayer())},da.prototype.setMap=function(t,e){var i=this;void 0===e&&(e=""),t?(e&&(this.options.beforeId=e),this._map=t,this._map._loaded?this._addLayer():(clearInterval(this._interval),clearTimeout(this._timeout),this._timeout=setTimeout((function(){clearInterval(i._interval)}),1e4),this._interval=setInterval((function(){i._map._loaded&&(clearInterval(i._interval),clearTimeout(i._timeout),i._addLayer())}),10))):this._map&&this.remove()},da.prototype._addLayer=function(){this.status=!0,this._map.addLayer(this.geojson,this.options.beforeId,this.options.zIndex)},da.prototype.getElement=function(){return document.getElementById(this.options.canvasId)},da.prototype.setCanvas=function(t){this.status&&this._map&&t&&(this.options.canvasId=t,this.reload())},da.prototype.setOptions=function(t){var e=this;if(this.status&&this._map){t.hasOwnProperty("zIndex")&&t.zIndex!=this.options.zIndex&&this.setzIndex(t.zIndex),t.hasOwnProperty("visible")&&(this.options.visible&&this.show(),this.options.visible||this.hide()),t.hasOwnProperty("zooms")&&this.setZooms(t.zooms),t.hasOwnProperty("bounds")&&this.setBounds(t.bounds),t.hasOwnProperty("canvasId")&&this.setCanvas(t.canvasId);var i={hueRotate:"raster-hue-rotate",opacity:"raster-opacity",brightnessMin:"raster-brightness-min",brightnessMax:"raster-brightness-max",saturation:"raster-saturation",contrast:"raster-contrast",resampling:"raster-resampling",fadeDuration:"raster-fade-duration"};Object.keys(i).forEach((function(r){t.hasOwnProperty(r)&&(e._map.setPaintProperty(e.id,i[r],t[r]),e.options[r]=t[r])})),t.map&&(this.remove(),this.setMap(t.map))}},da.prototype.getOptions=function(){return{map:this.options.map,zIndex:this.options.zIndex,opacity:this.options.opacity,canvas:this.options.canvas,zooms:this.options.zooms,visible:this.options.visible,bounds:this.options.bounds,extData:this.options.extData}},da.prototype.setOpacity=function(t){this.status&&"number"==typeof t&&(t>1&&(t=1),t<0&&(t=0),this.options.opacity=t,this._map.setPaintProperty(this.id,"raster-opacity",this.options.opacity))},da.prototype.getOpacity=function(){return this.options.opacity},da.prototype.show=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.visible=!0)},da.prototype.hide=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","none"),this.options.visible=!1)},da.prototype.setzIndex=function(t){if(this.status&&this._map){this.options.zIndex=parseInt(t);var e=mapObj.style._getOldLayer(this.options.zIndex);this._map.moveLayer(this.id,e.oldLayerID)}},da.prototype.getzIndex=function(){return this.options.zIndex};var ya=function(e){function r(t){var i;e.call(this),this.map=t.map,i=this,["init","aroundTo","_mapAroundTo","_startAnimationFrame","_stopAnimationFun","_lerp","_altitudeToZoom","flyTo","flyOver","_flyOverAnimation","followPath","_cancelAnimationFrame"].forEach((function(t){i[t]&&(i[t]=i[t].bind(i))})),this.init()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.init=function(){this.duration=3e4,this.lastTime=0,this.animationTime=0,this.animationFun=null,this.aroundToDefault={duration:1e4,point:null,rotate:360,oldRotate:0,oldZoom:null,zoom:null,altitude:null,pitch:null,oldPitch:null,callback:null},this.callback=null,this.flyOverDefault={duration:1e4,start:null,lookAtPoint:null,lookToAtPoint:null,end:null},this._followPathOptions={target:[],camera:[],duration:15e3,altitude:20}},r.prototype.aroundTo=function(t,e){void 0===t&&(t={}),this.aroundToOptions=ma(this.aroundToDefault,t),this.duration=this.aroundToOptions.duration,this.aroundToOptions.oldRotate=this.map.getBearing(),this.aroundToOptions.oldZoom=this.map.getZoom(),this.aroundToOptions.oldPitch=this.map.getPitch(),this.callback=e,"zoom"in t?this.aroundToOptions.zoom=t.zoom:"altitude"in t&&(this.aroundToOptions.zoom=this._altitudeToZoom(t.altitude)),"pitch"in t&&(this.aroundToOptions.pitch=t.pitch),"center"in t&&this.map.setCenter(t.center),this.animationFun=this._mapAroundTo,this._startAnimationFrame(0)},r.prototype._mapAroundTo=function(t){var e=this.aroundToOptions,i=e.oldRotate,r=e.zoom,o=e.oldZoom,n=e.pitch,a=e.oldPitch,s=this._lerp(0,e.rotate,t);if(s+=i,null!=r){var l=this._lerp(o,r,t);this.map.setZoom(l)}if(null!=n){var u=this._lerp(a,n,t);this.map.setPitch(u)}this.map.rotateTo(s,{duration:0})},r.prototype._startAnimationFrame=function(t){this.animationTime||(this.animationTime=t);var e=(t-this.animationTime)/this.duration;if(e>=1)return this.animationFun&&this.animationFun(1),window.cancelAnimationFrame(this.animationId),this.animationId=null,void this._stopAnimationFun();this.animationFun&&this.animationFun(e),this.animationId=window.requestAnimationFrame(this._startAnimationFrame)},r.prototype._stopAnimationFun=function(){this.animationTime=0,this.lastTime=0,this.animationFun=null,this.callback&&this.callback()},r.prototype._cancelAnimationFrame=function(){window.cancelAnimationFrame(this.animationId),this.animationId=null,this.animationTime=0,this.lastTime=0,this.animationFun=null},r.prototype._lerp=function(t,e,i){if(Array.isArray(t)&&Array.isArray(e)){for(var r=[],o=0;o<Math.min(t.length,e.length);o++)r[o]=t[o]*(1-i)+e[o]*i;return r}return t*(1-i)+e*i},r.prototype._altitudeToZoom=function(t){var e=this.map.transform.clone(),r=this.map.getFreeCameraOptions();return r.position=i.MercatorCoordinate.fromLngLat({lng:e.center.lng,lat:e.center.lat},t),r.lookAtPoint({lng:e.center.lng,lat:e.center.lat}),e.setFreeCameraOptions(r),e.zoom},r.prototype.flyTo=function(t,e){this._cancelAnimationFrame();var i=ma({},t);!("easing"in t)&&e&&(i.easing=function(t){return 1==t&&e&&e(),t}),this.map.flyTo(i)},r.prototype.easeTo=function(t,e){this._cancelAnimationFrame();var i=ma({},t);!("easing"in t)&&e&&(i.easing=function(t){return 1==t&&e&&e(),t}),this.map.easeTo(i)},r.prototype.jumpTo=function(t,e){this._cancelAnimationFrame(),this.map.jumpTo(t),e&&e()},r.prototype.flyOver=function(t,e){this._cancelAnimationFrame(),this.flyOverOptions=ma(this.flyOverDefault,t),this.callback=e,this.duration=this.flyOverOptions.duration,this.animationFun=this._flyOverAnimation,this._startAnimationFrame(0)},r.prototype._flyOverAnimation=function(t){var e=this.flyOverOptions,r=e.lookAtPoint,o=e.lookToAtPoint,n=e.altitude,a=this._lerp(e.start,e.end,t),s=this._lerp(n[0],n[1],t),l=map.getFreeCameraOptions();if(l.position=i.MercatorCoordinate.fromLngLat(a,s),o){var u=this._lerp(r,o,t);l.lookAtPoint(u)}else l.lookAtPoint(r);this.map.setFreeCameraOptions(l)},r.prototype.getCameraData=function(){return{altitude:this.map.transform.getFreeCameraOptions().position.toAltitude(),position:this.map.getFreeCameraOptions()._position.toLngLat().toArray(),pitch:this.map.getPitch(),bearing:this.map.getBearing(),zoom:this.map.getZoom(),center:this.map.getCenter().toArray()}},r.prototype.followPath=function(e,r){void 0===e&&(e={}),this._cancelAnimationFrame();var o=this;o._followPathOptions=ma(o._followPathOptions,e);var n=o._followPathOptions.target,a=o._followPathOptions.camera,s=o._followPathOptions.altitude,l=t.length$2(t.lineString(n)),u=t.length$2(t.lineString(a));o.duration=o._followPathOptions.duration,o.callback=r,o.map.transform.maxZoom=28,this.animationFun=function(e){var r=t.along(t.lineString(n),l*e).geometry.coordinates,h=t.along(t.lineString(a),u*e).geometry.coordinates,p=o.map.getFreeCameraOptions();e>=1?o.map.transform.maxZoom=o.map._options.maxZoom:(p.position=i.MercatorCoordinate.fromLngLat({lng:h[0],lat:h[1]},s),p.lookAtPoint({lng:r[0],lat:r[1]}),o.map.setFreeCameraOptions(p))},this._startAnimationFrame(0)},r}(t.Evented);i&&(i.CameraAnimation=ya);var ga=function(t,e,i,r){this._naviPath=t,this._speed=e,this._pathInfo=[],this._total=0,this._lerpDistance=i,this._distanceCalculationType=r};ga.prototype.lngLatToMercator=function(t,e){var i=t/360+.5,r=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return{lngX:i,latY:Math.min(Math.max(o,0),1)}},ga.prototype.mercatorToLngLat=function(t,e){return[360*t-180,360/Math.PI*Math.atan(Math.exp((180-360*e)*(Math.PI/180)))-90]},ga.prototype.lngLat_Mercator=function(t,e){void 0===e&&(e="arr");var i={x:0,y:0,z:0};i.x=t[0]*Math.PI/180*6371008.8;var r=t[1]*Math.PI/180;return i.y=3185504.4*Math.log((1+Math.sin(r))/(1-Math.sin(r))),i.z=t[2]||0,"obj"==e?i:[i.x,i.y,i.z]},ga.prototype._getHorizontalDistance=function(t,e){var i=Math.pow(t,2),r=Math.pow(e,2);return Math.sqrt(i+r)},ga.prototype.getSpatialDistance=function(t,e){var i=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y),o=this._getHorizontalDistance(i,r),n=Math.abs(t.z-e.z);return this._getHorizontalDistance(o,n)},ga.prototype.calculate_distance=function(t,e,i,r){var o=e*Math.PI/180,n=r*Math.PI/180,a=t*Math.PI/180-i*Math.PI/180,s=2*Math.asin(Math.sqrt(Math.pow(Math.sin((o-n)/2),2)+Math.cos(o)*Math.cos(n)*Math.pow(Math.sin(a/2),2)));return Math.round(1e4*(s*=6378137))/1e4},ga.prototype.getEarthDistance=function(t,e){return 0+(t[0]==e[0]&&t[1]==e[1]?Math.max(t[2],e[2])-Math.min(t[2],e[2]):this.calculate_distance(t[0],t[1],e[0],e[1]))},ga.prototype.calculation=function(){var e=this;if(this._pathInfo=[],this._total=0,this._naviPath&&!(this._naviPath.length<2)){for(var i=0;i<this._naviPath.length-1;++i){var r=[this._naviPath[i][0],this._naviPath[i][1],this._naviPath[i][2]||0],o=[this._naviPath[i+1][0],this._naviPath[i+1][1],this._naviPath[i+1][2]||0],n=0;if("mercator"==this._distanceCalculationType){var a=this.lngLat_Mercator(r,"obj"),s=this.lngLat_Mercator(o,"obj");n=this.getSpatialDistance(a,s)}else"earth"==this._distanceCalculationType&&(n=this.getEarthDistance(r,o));var l=t.bearing(r,o);l<0&&(l+=360),this._total=this._total+n;var u=yo.FromMercator(t.MercatorCoordinate.fromLngLat({lng:r[0],lat:r[1]},0)),h=yo.FromMercator(t.MercatorCoordinate.fromLngLat({lng:o[0],lat:o[1]},0)).Subtract(u);h.Normalize();var p=180*-Math.atan2(h.Y,h.X)/Math.PI;-180==p&&(p=180),this._pathInfo.push({distance:n,start:r,end:o,rotation:p,heading:l})}this._pathInfo.forEach((function(t,i){t.start[0]==t.end[0]&&t.start[1]==t.end[1]&&(i<e._pathInfo.length-1&&(t.rotation=e._pathInfo[i+1].rotation),i==e._pathInfo.length-1&&(t.rotation=e._pathInfo[i-1].rotation))}))}},ga.prototype.getTurnAngle=function(t,e){var i=e-t;return i<-180&&(i+=360),i>180&&(i-=360),i},ga.prototype._lerp=function(t,e,i){if(Math.abs(t-e)>180&&(t<0?t+=360:e+=360),Array.isArray(t)&&Array.isArray(e)){for(var r=[],o=0;o<Math.min(t.length,e.length);o++)r[o]=t[o]*(1-i)+e[o]*i;return r}return t*(1-i)+e*i},ga.prototype.getNaviPathInfo=function(t){if(0===this._total||t<0)return null;for(var e=0,i=-1,r=0;r<this._pathInfo.length;r++)if(t<=(e+=this._pathInfo[r].distance)){i=r;break}if(i>=0){var o=(e-t)/this._pathInfo[i].distance,n=this._pathInfo[i].start,a=this._pathInfo[i].end,s=0==i||this._pathInfo[i].distance>this._lerpDistance?this._pathInfo[i].rotation:this._lerp(this._pathInfo[i-1].rotation,this._pathInfo[i].rotation,1-o),l=0==i||this._pathInfo[i].distance>this._lerpDistance?this._pathInfo[i].heading:this._lerp(this._pathInfo[i-1].heading,this._pathInfo[i].heading,1-o);return{sucessed:!0,isEnd:!1,position:[n[0]*o+a[0]*(1-o),n[1]*o+a[1]*(1-o),n[2]*o+a[2]*(1-o)],rotation:s,heading:l}}return{sucessed:!0,isEnd:!0,position:this._pathInfo[this._pathInfo.length-1].end,rotation:this._pathInfo[this._pathInfo.length-1].rotation,heading:this._pathInfo[this._pathInfo.length-1].heading}};var _a=function(t){this.flyPath=t,this.map=t._map,this.naviPath=[],this.EARTH_RADIUS=6371137,this.desIndex=0,this.lineLength=0,this.timeLength=0,this.lastTime=0,this.curTime=0,this.position=null,this.rotation=null,this.pathLinePoints=[],this.bPlayEnd=!1,this.bHasData=!1,this.bRunning=!1,this.startTime=new Date,this.speed=20,this.mapLastUpdateTime=0,this.mapUpdateDelta=1},va={Running:{configurable:!0}};_a.prototype.StartSim=function(){this.startTime=new Date,this.curTime=this.startTime.getTime(),this.lastTime=this.startTime.getTime(),this.bRunning=!0},_a.prototype.init=function(t){this.options=t,t.lerpDistance&&(this.lerpDistance=t.lerpDistance),"distanceCalculationType"in t&&(this.distanceCalculationType=t.distanceCalculationType||"mercator"),this.setPath(this.options.path),t.speed&&this.setSpeed(t.speed),t.time&&(this.speed=this.pathInfo._total/t.time)},_a.prototype.EndSim=function(){this.bRunning=!1},_a.prototype.setSpeed=function(t){this.options.speed=t,this.speed=1e3*t/3600},_a.prototype.getSpeed=function(){return this.options.speed},_a.prototype.setPath=function(t){this.ClearData(),this.options.path=t,this._updatePath()},_a.prototype.getPath=function(){return this.options.path},_a.prototype.setStartIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.startIndex=t,this._updatePath()},_a.prototype.setEndIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.endIndex=t,this._updatePath()},_a.prototype.getStartIndex=function(){return this.options.startIndex},_a.prototype.getEndIndex=function(){return this.options.endIndex},_a.prototype._updatePath=function(){this.naviPath=this._getNaviPath(),this.pathInfo=new ga(this.naviPath,this.speed,this.lerpDistance,this.distanceCalculationType),this.pathInfo.calculation(),this.lineLength=0,this.timeLength=0,this.bHasData=!0},_a.prototype._getNaviPath=function(){var t=[],e=0;this.options.startIndex&&(e=this.options.startIndex);var i=this.options.path.length;this.options.endIndex&&(i=this.options.endIndex);for(var r=e;r<i;++r)t.push(this.options.path[r]);return t},_a.prototype.getNowInfo=function(){return{rotation:this.rotation,position:this.position,heading:this.heading}},_a.prototype.Tick=function(){if(this.bHasData&&this.bRunning){this.curTime=(new Date).getTime();var t=(this.curTime-this.lastTime)/1e3;this.lastTime=this.curTime,this.lineLength+=t*this.speed,this.timeLength+=t;var e=this.pathInfo.getNaviPathInfo(this.lineLength);e&&e.sucessed&&(this.rotation=e.rotation,this.position=e.position,this.heading=e.heading,e.isEnd&&(this.Running=!1,28==this.map.transform.maxZoom&&(this.map.transform.maxZoom=this.map._options.maxZoom)))}},va.Running.set=function(t){this.bRunning=t,this.bRunning||(this.flyPath._eventCallback("flyEnd"),this.flyPath.models.forEach((function(t){t.firstMoveRotationZ&&(t.firstMoveRotationZ=null)})))},_a.prototype.ClearData=function(){this.naviPath=[],this.lineLength=0,this.mapLastUpdateTime=0,this.position=null,this.rotation=null,this.pathLinePoints=[],this.bPlayEnd=!1,this.bHasData=!1},_a.prototype.IsEnded=function(){return this.bPlayEnd},_a.prototype.HasData=function(){return this.bHasData},_a.prototype.HaverSin=function(t){var e=Math.sin(t/2);return e*e},_a.prototype.EarthDistance=function(t,e){var i=t.Y,r=t.X,o=e.Y,n=e.X;i=this.ConvertDegreesToRadians(i),r=this.ConvertDegreesToRadians(r),o=this.ConvertDegreesToRadians(o),n=this.ConvertDegreesToRadians(n);var a=Math.abs(r-n),s=Math.abs(i-o),l=this.HaverSin(s)+Math.cos(i)*Math.cos(o)*this.HaverSin(a);return 2*this.EARTH_RADIUS*Math.asin(Math.sqrt(l))},_a.prototype.ConvertDegreesToRadians=function(t){return t*Math.PI/180},Object.defineProperties(_a.prototype,va);var xa=function(e){function i(t){e.call(this),this._map=t.map,this._camera=this._map.getFreeCameraOptions(),this.carRenderBuffer=void 0,this.naviSim=new _a(this),this.options=t,this.cameraHeightBuffer=0,this.flyPattern={type:"freedom",pitch:85},this.oldFlyPatternType="freedom",this.models=[],this._map.painter.SetFlyPath(this),this._navOptionOptions={path:[],speed:60,pitch:85,cameraHeightBuffer:1,lerpDistance:1e5,distanceCalculationType:"mercator"},"flyConfig"in t&&this.setFlyConfig(t.flyConfig)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.InitNavi=function(){},i.prototype.setFlyConfig=function(e){this._navOptionOptions=t.extend({},this._navOptionOptions,e),this.naviSim.init(this._navOptionOptions),this.naviRunning=!1,this.naviStop=!0,this.cameraHeightBuffer=e.cameraHeightBuffer||0,this.offset=e.offset?t.pointGeometry.convert(e.offset):null},i.prototype.setFlyPattern=function(e){this.oldFlyPatternType=this.flyPattern.type,this.flyPattern=t.extend({},this.flyPattern,e)},i.prototype.getFlyPattern=function(){return this.flyPattern},i.prototype.setModels=function(t){t instanceof Array?t instanceof Array&&(this.models=t):this.models=[t]},i.prototype.getModels=function(){return this.models||[]},i.prototype.addModels=function(t){if(t)return this.models&&this.models.length>0?t instanceof Array?t instanceof Array&&(this.models=this.models.concat(t)):this.models.push(t):t instanceof Array?t instanceof Array&&(this.models=t):this.models=[t],this.models||[]},i.prototype.removeModels=function(t){if(this.models&&this.models.length>0){var e=[],i=[];this.models.forEach((function(t){i.push(t.getId())})),"string"==typeof t?e.push(t):t instanceof Array?t instanceof Array&&t.forEach((function(t){e.push(t.getId())})):e.push(t.getId());var r=[];return this.models.forEach((function(t){e.indexOf(t.getId())<0&&r.push(t)})),this.models=r,this.models||[]}},i.prototype.StartNavi=function(t,e,i,r){},i.prototype.start=function(){this.naviRunning=!0,this.naviStop=!1,this.naviSim.StartSim(),this._map._updateMapMovestartEvent(),this._eventCallback("flyStart")},i.prototype.stop=function(){this.naviRunning=!1,this.naviStop=!0,this._map._updateMapMoveendEvent(),this._eventCallback("flyStop")},i.prototype.isRunning=function(){return this.naviRunning},i.prototype.isStop=function(){return this.naviStop},i.prototype.setNaviSpeed=function(t){this.naviSim.setSpeed(t)},i.prototype.setSpeed=function(t){this.naviSim.setSpeed(t)},i.prototype.getSpeed=function(){return this.naviSim.getSpeed()},i.prototype.setPathData=function(t){this.naviSim.setPath(t)},i.prototype.getPathData=function(){return this.naviSim.getPath()},i.prototype.setStartIndex=function(t){void 0===t&&(t=0),this.naviSim.setStartIndex(t)},i.prototype.setEndIndex=function(t){void 0===t&&(t=0),this.naviSim.setEndIndex(t)},i.prototype.getStartIndex=function(){return this.naviSim.getStartIndex()},i.prototype.getEndIndex=function(){return this.naviSim.getEndIndex()},i.prototype._startAnimationFrame=function(){this.UpdateNavi(),this.animationId=requestAnimationFrame(this._startAnimationFrame.bind(this))},i.prototype._stopAnimationFun=function(){cancelAnimationFrame(this.animationId),this.animationId=null},i.prototype.UpdateNavi=function(){if(this.naviRunning&&this.naviSim.HasData()&&(this.naviSim.Tick(),this.naviSim.bRunning)){var t=this.naviSim.getNowInfo();this.updateCamear(t),this._map._updateMapMoveEvent(),this._eventCallback("flyChange")}},i.prototype.updateCamear=function(t){var e=t.position,i=t.heading,r=t.rotation,o=this.flyPattern,n=o.pitch;switch(o.type){case"freedom":28==this._map.transform.maxZoom&&(this._map.transform.maxZoom=this._map._options.maxZoom);break;case"follow":"firstperson"==this.oldFlyPatternType&&(this.oldFlyPatternType="",this._map.setZoom(this._map.transform.zoom-.5)),28==this._map.transform.maxZoom&&(this._map.transform.maxZoom=this._map._options.maxZoom),this._map.painter.transform._isTrackModeUpdate=!0,this._map.painter.transform.center={lng:e[0],lat:e[1]},this._map.painter.transform._isTrackModeUpdate=!1;break;case"firstperson":var a=0==e[2]?1.6783777427013993:e[2];(a+=this.cameraHeightBuffer)<20&&28!=this._map.transform.maxZoom&&(this._map.transform.maxZoom=28),this._camera.position=this._map.transform.locationCoordinateAltitude({lng:e[0],lat:e[1]},a),Math.abs(this._map.getBearing()-i)<1&&(i=this._map.getBearing()),this._camera.setPitchBearing(n,90-r),this._map.setFreeCameraOptions(this._camera)}this._updateModels(t)},i.prototype._updateModels=function(t){var e=t.position,i=t.rotation;this.models&&0!=this.models.length&&this.models.forEach((function(t){switch(t.type){case"Group":case"Mesh":var r=t.userData.heightBuffer;void 0===r&&(r=0),t.firstMoveRotationZ||(t.firstMoveRotationZ=i),t.setPosition([e[0],e[1],e[2]+r]),t.rotation.set(t.userData.rotation.x/180*Math.PI,(i+t.userData.rotation.y-t.firstMoveRotationZ)/180*Math.PI,t.userData.rotation.z/180*Math.PI);break;case"marker":case"text":case"inforWindow":var o=t._heightBuffer||0;t.setPosition([e[0],e[1]]),t.setHeight(e[2]+o)}}))},i.prototype._eventCallback=function(e,i){void 0===e&&(e=""),void 0===i&&(i={}),i.type=e,i.target=this,i.speed=this.naviSim.options.speed,i.models=this.models,i.flyPattern=this.flyPattern,i.flyOverDistance=this.naviSim.lineLength,i.flyOverTime=this.naviSim.timeLength,i.allDistance=this.naviSim.pathInfo._total,i.position=this.naviSim.position,i.rotation=this.naviSim.rotation,i.speed=this.naviSim.options.speed,this.fire(new t.Event(e,i))},i}(t.Evented),ba={distance:function(e,i){if(e&&i){var r,o;r=t.point(e instanceof Array?e:e.toArray()),o=t.point(i instanceof Array?i:i.toArray());var n=(1e3*t.distance(r,o)).toFixed(2);return parseFloat(n)}},ringArea:function(e){if(e){if(e instanceof Array)if(1==e.length)var i=t.polygon(e);else{if(2==e.length){t.polygon([ba.getLineAllLngLat(e[0])]),t.area$1(i);var r=Math.round(n);t.polygon([ba.getLineAllLngLat(e[1])]),t.area$1(i);var o=Math.round(n);return r-o>0?r-o:0}i=t.polygon([e])}else i=t.polygon([e.getPath()]);var n=t.area$1(i);return Math.round(n)}},isClockwise:function(e){var i;if(e&&!(e instanceof Array&&e.length<2))return i=t.lineString(e instanceof Array?ba.getLineAllLngLat(e):e.getPath()),t.booleanClockwise(i)},distanceOfLine:function(e){if(e&&!(e instanceof Array&&e.length<2)){var i;i=t.lineString(e instanceof Array?ba.getLineAllLngLat(e):e.getPath());var r=(1e3*t.length$2(i,{units:"kilometers"})).toFixed(2);return parseFloat(r)}},distanceToLine:function(e,i){if(e&&i){var r,o;r=t.point(e instanceof Array?e:e.toArray()),o=t.lineString(i instanceof Array?ba.getLineAllLngLat(i):i.getPath());var n=(1e3*t.pointToLineDistance(r,o,{units:"kilometers"})).toFixed(2);return parseFloat(n)}},isPointInRing:function(e,i){var r,o;return o=t.point(e instanceof Array?e:e.toArray()),r=t.polygon(i instanceof Array?[ba.getLineAllLngLat(i)]:[i.getPath()]),t.booleanPointInPolygon(o,r)},isPointOnLine:function(e,i){var r,o;return r=t.point(e instanceof Array?e:e.toArray()),o=t.lineString(i instanceof Array?ba.getLineAllLngLat(i):i.getPath()),t.booleanPointOnLine(r,o)},closestOnLine:function(e,r){var o,n;o=t.point(e instanceof Array?e:e.toArray()),n=t.lineString(r instanceof Array?ba.getLineAllLngLat(r):r.getPath());var a=t.nearestPointOnLine(n,o);return new i.LngLat(a.geometry.coordinates[0],a.geometry.coordinates[1])},midpoint:function(e,r){var o,n;o=t.point(e instanceof Array?e:e.toArray()),n=t.point(r instanceof Array?r:r.toArray());var a=t.midpoint(o,n);return new i.LngLat(a.geometry.coordinates[0],a.geometry.coordinates[1])},doesRingRingIntersect:function(e,i){var r,o;r=t.polygon(e instanceof Array?[ba.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ba.getLineAllLngLat(i)]:[i.getPath()]);var n=t.booleanOverlap(r,o),a=t.booleanOverlap(o,r),s=ba.isRingInRing(e,i);return!!(n||a||s)},getRingIntersect:function(e,i){var r,o;return r=t.polygon(e instanceof Array?[ba.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ba.getLineAllLngLat(i)]:[i.getPath()]),t.intersect(r,o).geometry.coordinates[0]},ringRingClip:function(e,i){var r,o;r=t.polygon(e instanceof Array?[ba.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ba.getLineAllLngLat(i)]:[i.getPath()]);var n=t.intersect(r,o),a=t.area$1(n);return Math.round(a)},isRingInRing:function(e,i){var r,o;r=t.polygon(e instanceof Array?[ba.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ba.getLineAllLngLat(i)]:[i.getPath()]);var n=t.booleanContains(r,o),a=t.booleanContains(o,r);return!(!n&&!a)},getSegmentsIntersectPoint:function(e,i){var r,o;r=t.lineString(e instanceof Array?ba.getLineAllLngLat(e):e.getPath()),o=t.lineString(i instanceof Array?ba.getLineAllLngLat(i):i.getPath());var n=t.lineIntersect(r,o),a=[];if(n.features.length>0)for(var s in n.features)a.push(n.features[s].geometry.coordinates);return a},doesLineLineIntersect:function(e,i){var r,o;r=t.lineString(e instanceof Array?ba.getLineAllLngLat(e):e.getPath()),o=t.lineString(i instanceof Array?ba.getLineAllLngLat(i):i.getPath());var n=t.lineIntersect(r,o),a=[];if(n.features.length>0)for(var s in n.features)a.push(n.features[s].geometry.coordinates);return 0!=a.length},triangulateShape:function(e){var i;if(e instanceof Array)if(2==e.length){var r=t.polygon([ba.getLineAllLngLat(e[0])]),o=t.polygon([ba.getLineAllLngLat(e[1])]);i=ba.ringArea(e[0])>ba.ringArea(e[1])?t.mask(o,r):t.mask(r,o)}else i=t.polygon([e]);else 2==e.getPath().length?(r=t.polygon([e.getPath()[0]]),o=t.polygon([e.getPath()[1]]),i=ba.ringArea(e.getPath()[0])>ba.ringArea(e.getPath()[1])?t.mask(o,r):t.mask(r,o)):i=t.polygon([e.getPath()]);var n=t.tesselate(i),a=[];if(n.features.length>0)for(var s in n.features)a.push(n.features[s].geometry.coordinates[0]);return a},closestOnSegment:function(e){var r="array",o=null;e instanceof Array||(r="object");var n=[];for(var a in e)0==a?o=t.point(e[a]instanceof Array?e[a]:e[a].toArray()):n.push(t.point(e[a]instanceof Array?e[a]:e[a].toArray()));var s=t.featureCollection(n),l=t.nearestPoint(o,s);return"array"==r?l.geometry.coordinates:new i.LngLat(l.geometry.coordinates[0],l.geometry.coordinates[1])},getLineAllLngLat:function(t){var e=[];for(var i in t)e.push(t[i]instanceof Array?t[i]:t[i].toArray());return e}},wa={version:t.config.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:yn,NavigationControl:vn,GeolocateControl:In,AttributionControl:Sn,ScaleControl:An,FullscreenControl:Ln,Popup:zn,InforWindow:zn,InfoWindow:zn,Marker:eo,Text:Bn,Style:ne,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,FreeCameraOptions:qi,Evented:t.Evented,config:t.config,Bounds:t.LngLatBounds,LKTurf:t.LKTurf,Size:Jo,Pixel:Qo,Icon:tn,GeometryUtil:ba,Msg:Un,Polyline:ta,Circle:Nn,Polygon:rn,GeoJSON:Kn,CircleMarker:Gn,Rectangle:ia,ContextMenu:qn,CurveLine:Wn,Ellipse:Yn,ImageLayer:Qn,VideoLayer:oa,Polyline3D:aa,TileLayer:ca,CanvasLayer:da,CameraAnimation:ya,FlyPath:xa,UT:ro,replaceRequestAK:t.replaceRequestAK,prewarm:function(){K().acquire(H)},clearPrewarmedResources:function(){var t=W;t&&t.isPreloaded()&&1===t.numActive()&&(t.release(H),W=null)},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Y.workerCount},set workerCount(t){Y.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:"",workerClass:null,setNow:t.exported.setNow,restoreNow:t.exported.restoreNow};return wa})),i}));