var _LKMapUserVersion='2.6.4'; !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(https://lkmap1.aeroiot.cn/1598236280888.png)}.lkmap-popup .lkmap-popup-showShadow .topLeft{top:0;left:0;background-image:url(https://lkmap1.aeroiot.cn/1598240025105.png)}.lkmap-popup .lkmap-popup-showShadow .topRight{top:0;left:0;background-image:url(https://lkmap1.aeroiot.cn/1598253720190.png)}.lkmap-popup .lkmap-popup-showShadow .bottomRight{top:0;left:0;background-image:url(https://lkmap1.aeroiot.cn/1598240026449.png)}.lkmap-popup .lkmap-popup-showShadow .bottomLeft{top:0;left:0;background-image:url(https://lkmap1.aeroiot.cn/1598240026089.png)}.lkmap-popup .lkmap-popup-showShadow-one{background-image:url(https://lkmap1.aeroiot.cn/1598087045017.png)}.lkmap-popup .lkmap-popup-showShadow-two{background-image:url(https://lkmap1.aeroiot.cn/1598087044309.png)}.lkmap-popup .lkmap-popup-showShadow-three{background-image:url(https://lkmap1.aeroiot.cn/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(https://lkmap1.aeroiot.cn/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(https://lkmap1.aeroiot.cn/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(https://lkmap1.aeroiot.cn/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(https://lkmap1.aeroiot.cn/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)(r=1))return r;for(;in?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:{};function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var i=0;i=1)return 1;var e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function f(t,i,r,o){var n=new e(t,i,r,o);return function(t){return n.solve(t)}}var d=f(.25,.1,.25,1);function m(t,e,i){return Math.min(i,Math.max(e,t))}function y(t,e,i){var r=i-e,o=((t-e)%r+r)%r+e;return o===e?i:o}function g(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 _(t){var e=[];for(var i in t)e.push(t[i]);return e}function v(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,o=e;r>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function k(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function T(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 I(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function S(t,e){return-1!==t.indexOf(e,t.length-e.length)}function E(t,e,i){var r={};for(var o in t)r[o]=e.call(i||this,t[o],o,t);return r}function A(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 P(t){return Array.isArray(t)?t.map(P):"object"==typeof t&&t?E(t,P):t}var M={};function L(t){M[t]||(M[t]=!0)}function C(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function z(t){for(var e=0,i=0,r=t.length,o=r-1,n=void 0,a=void 0;i@\,;\:\\"\/\[\]\?\=\{\}\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 R,B,F,U=null;function j(t){if(null==U){var e=t.navigator?t.navigator.userAgent:null;U=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return U}function N(t){try{var e=n[t];return e.setItem("_lkmap_test_",1),e.removeItem("_lkmap_test_"),!0}catch(t){return!1}}var V,G,Z,q={now:function(){return void 0!==F?F:n.performance.now()},setNow:function(t){F=t},restoreNow:function(){F=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 R||(R=n.document.createElement("a")),R.href=t,R.href},get devicePixelRatio(){return n.devicePixelRatio},get prefersReducedMotion(){return!!n.matchMedia&&(null==B&&(B=n.matchMedia("(prefers-reduced-motion: reduce)")),B.matches)}},X="https://lkmap2.aeroiot.cn",W={API_URL:X,get API_URL_REGEX(){if(null==V){var t=/^((https?:)?\/\/)?([^\/]+\.)?luokuang\.c(n|om)(\/|\?|$)/i;try{V=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t}catch(e){V=t}}return V},get EVENTS_URL(){return null},SESSION_PATH:!1,FEEDBACK_URL:"https://apps.luokuang.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:"ACCESS_TOKEN",MAX_PARALLEL_IMAGE_REQUESTS:16,USER_AK:"",url:X,key:"",accessToken:"",sdkAPI:"https://lkmap3.aeroiot.cn",version:"2.6.4",updateVersion:"2.6.4",userVersion:"",stamp:"",httpsStatus:!0},H={supported:!1,testSupport:function(t){!Y&&Z&&(K?J(t):G=t)}},Y=!1,K=!1;function J(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,Z),t.isContextLost())return;H.supported=!0}catch(t){}t.deleteTexture(e),Y=!0}n.document&&((Z=n.document.createElement("img")).onload=function(){G&&J(G),G=null,K=!0},Z.onerror=function(){Y=!0,G=null},Z.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var Q="01",$="NO_ACCESS_TOKEN",tt=function(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken(),this._config=W,W.USER_AK=W.key=this.getKey(),W.userVersion=n._LKMapUserVersion||this.getKey("v")||this.getKey("version")||""};function et(t){return 0===t.indexOf("luokuang:")}function it(t){return W.API_URL_REGEX.test(t)}tt.prototype.getKey=function(t){void 0===t&&(t="ak");try{var e=function(t){for(var e=t.length,i=null,r=0;r-1&&(i.indexOf(W.sdkAPI+"/maps")>-1||i.indexOf("lkmap-dev.js")>-1||i.indexOf("lkmap.js")>-1||i.indexOf("LKmap.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;othis._skuTokenExpiresAt},tt.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="+W.USER_AK}},tt.prototype.normalizeStyleURL=function(t,e){if(!et(t))return t;var i=ot(t);return i.path="/styles/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},tt.prototype.normalizeImageLibURL=function(t,e){if(!et(t))return t;var i=ot(t);return this._makeAPIURL(i,this._customAccessToken||e)},tt.prototype.normalizeGlyphsURL=function(t,e){if(!et(t))return t;var i=ot(t);return i.path="/fonts/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},tt.prototype.normalizeSourceURL=function(t,e){if(!et(t))return t;var i=ot(t);return i.path="/v4/"+i.authority+".json",i.params.push("secure"),this._makeAPIURL(i,this._customAccessToken||e)},tt.prototype.normalizeSpriteURL=function(t,e,i,r){var o=ot(t);return et(t)?(o.path="/styles/v1"+o.path+"/sprite"+e+i,this._makeAPIURL(o,this._customAccessToken||r)):(o.path+=""+e+i,nt(o))},tt.prototype.normalizeTileURL=function(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!et(t))return t;var r=ot(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(e||i&&"raster"!==r.authority&&512===i?"@2x":"")+(H.supported?".webp":"$1")),"raster"===r.authority?r.path="/"+W.RASTER_URL_PREFIX+r.path:(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/"+W.TILE_URL_VERSION+r.path);var o=this._customAccessToken||function(t){for(var e=0,i=t;e=0&&t.params.splice(r,1)}if("/"!==i.path&&(t.path=""+i.path+t.path),!W.REQUIRE_ACCESS_TOKEN)return nt(t);if(e=e||W.ACCESS_TOKEN,!this._silenceAuthErrors&&!e)throw new Error("An ak access token is required to use LKMap. See https://lbs.luokuang.com/doc.html#/doc/jsapi/devGuide/intro/prepare");return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+(e||"")),nt(t)};var rt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ot(t){var e=t.match(rt);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 nt(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}var at="LKMap.eventData";function st(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 lt=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};lt.prototype.getStorageKey=function(t){var e,i=st(W.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))}))):W.ACCESS_TOKEN||"",t?at+"."+t+":"+e:at+":"+e},lt.prototype.fetchEventData=function(){var t=N("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){L("Unable to read from LocalStorage")}},lt.prototype.saveEventData=function(){var t=N("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){L("Unable to write to LocalStorage")}},lt.prototype.processRequests=function(t){},lt.prototype.postEvent=function(t,e,i,r){var o=this;if(W.EVENTS_URL){var n=ot(W.EVENTS_URL);n.params.push("access_token="+(r||W.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"lkmap",sdkVersion:"2.3.0-dev",skuId:Q,userId:this.anonId},s=e?v(a,e):a,l={url:nt(n),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=Ct(l,(function(t){o.pendingRequest=null,i(t),o.saveEventData(),o.processRequests(r)}))}},lt.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var ut,pt,ht=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,W.EVENTS_URL&&(i||W.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error($)))},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(),T(this.anonId)||(this.anonId=w()),this.postEvent(o,{skuToken:this.skuToken},(function(t){t?e.errorCb(t):r&&(e.success[r]=!0)}),t))}},e}(lt),ct=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(W.API_URL&&W.SESSION_PATH){var n=ot(W.API_URL+W.SESSION_PATH);n.params.push("sku="+(e||"")),n.params.push("access_token="+(r||W.ACCESS_TOKEN||""));var a={url:nt(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=zt(a,(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,W.SESSION_PATH&&W.API_URL&&(i||W.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error($)))},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}(lt),ft=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){W.EVENTS_URL&&W.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return et(t)||it(t)}))&&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=st(W.ACCESS_TOKEN),r=i?i.u:W.ACCESS_TOKEN,o=r!==this.eventData.tokenU;T(this.anonId)||(this.anonId=w(),o=!0);var n=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(n),l=(n-this.eventData.lastSuccess)/864e5;o=o||l>=1||l<-1||a.getDate()!==s.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}(lt),dt=new ft,mt=dt.postTurnstileEvent.bind(dt),yt=new ht,gt=yt.postMapLoadEvent.bind(yt),_t=new ct,vt=_t.getSessionAPI.bind(_t),xt=new Set,bt="lkmap-tiles",wt=500,kt=50;function Tt(){n.caches&&!ut&&(ut=n.caches.open(bt))}function It(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var St=1/0,Et={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Et);var At=function(t){function e(e,i,r){401===i&&it(r)&&(e+=": you may have provided an invalid LKMap access ak. See https://lbs.luokuang.com/doc.html#/doc/jsapi/devGuide/intro/prepare"),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=D()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===n.location.protocol?n.parent:n).location.href},Mt=function(t,e){if(!function(t){return/^file:/.test(t)||/^file:/.test(Pt())&&!/^\w+:/.test(t)}(t.url)){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=function(t){return t.indexOf("sku=")>0&&it(t)}(r.url);"json"===t.type&&r.headers.set("Accept","application/json");var l=function(i,o,l){if(!a){if(i&&"SecurityError"!==i.message&&L(i),o&&l)return u(o);var p=Date.now();n.fetch(r).then((function(i){if(i.ok){var r=s?i.clone():null;return u(i,r,p)}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(Tt(),ut){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=O(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===pt)try{new Response(new ReadableStream),pt=!0}catch(t){pt=!1}pt?e(t.body):t.blob().then(e)}(e,(function(e){var i=new n.Response(e,r);Tt(),ut&&ut.then((function(e){return e.put(It(t.url),i)})).catch((function(t){return L(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(Tt(),!ut)return e(null);var i=It(t.url);ut.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=O(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(D()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}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(v(t,{type:"arrayBuffer"}),e)},Ct=function(t,e){return Mt(v(t,{method:"POST"}),e)},zt=function(t,e){return Mt(v(t,{method:"GET"}),e)};function Dt(t){var e=n.document.createElement("a");return e.href=t,e.protocol===n.document.location.protocol&&e.host===n.document.location.host}var Ot,Rt,Bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ot=[],Rt=0;var Ft=function(t,e){if(H.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Rt>=W.MAX_PARALLEL_IMAGE_REQUESTS){var i={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ot.push(i),i}Rt++;var r=!1,o=function(){if(!r)for(r=!0,Rt--;Ot.length&&Rt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))},Gt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Zt={$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"}}},qt=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 Xt(t){var e=t.value;return e?[new qt(t.key,e,"constants have been deprecated as of v8")]:[]}function Wt(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,o=e;r":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var he=[$t,te,ee,ie,re,se,oe,ue(ne),le];function ce(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ce(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=he;i255?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 p=s.substr(0,l),h=s.substr(l+1,u-(l+1)).split(","),c=1;switch(p){case"rgba":if(4!==h.length)return null;c=n(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),c];case"hsla":if(4!==h.length)return null;c=n(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=n(h[1]),m=n(h[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){}})),ge=function(t,e,i,r){void 0===r&&(r=1),this.r=t,this.g=e,this.b=i,this.a=r};ge.parse=function(t){if(t){if(t instanceof ge)return t;if("string"==typeof t){var e=ye.parseCSSColor(t);if(e)return new ge(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ge.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+")"},ge.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]},ge.black=new ge(0,0,0,1),ge.white=new ge(1,1,1,1),ge.transparent=new ge(0,0,0,0),ge.red=new ge(1,0,0,1),ge.blue=new ge(0,0,1,1);var _e=ge,ve=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"})};ve.prototype.compare=function(t,e){return this.collator.compare(t,e)},ve.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var xe=ve,be=function(t,e,i,r,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=o},we=function(t){this.sections=t};we.fromString=function(t){return new we([new be(t,null,null,null,null)])},we.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}))},we.factory=function(t){return t instanceof we?t:we.fromString(t)},we.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},we.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e=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 Ee(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 _e)return!0;if(t instanceof xe)return!0;if(t instanceof ke)return!0;if(t instanceof Ie)return!0;if(Array.isArray(t)){for(var e=0,i=t;e2){var s=t[1];if("string"!=typeof s||!(s in De)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=De[s],r++}else n=ne;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=ue(n,a)}else i=De[o];for(var l=[];r1)&&e.push(r)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var Re=Oe,Be=function(t){this.type=se,this.sections=t};Be.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,te)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,ue(ee))))return null;var u=null;if(a["text-color"]&&!(u=e.parse(a["text-color"],1,re)))return null;var p=r[r.length-1];p.scale=s,p.font=l,p.textColor=u}else{var h=e.parse(t[n],1,ne);if(!h)return null;var c=h.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:h,scale:null,font:null,textColor:null})}}return new Be(r)},Be.prototype.evaluate=function(t){return new ke(this.sections.map((function(e){var i=e.content.evaluate(t);return Ae(i)===le?new be("",i,null,null,null):new be(Pe(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},Be.prototype.eachChild=function(t){for(var e=0,i=this.sections;e-1),i},Ue.prototype.eachChild=function(t){t(this.input)},Ue.prototype.outputDefined=function(){return!1},Ue.prototype.serialize=function(){return["image",this.input.serialize()]};var je=Ue,Ne={"to-boolean":ie,"to-color":re,"to-number":te,"to-string":ee},Ve=function(t,e){this.type=t,this.args=e};Ve.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=Ne[i],o=[],n=1;n4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":Se(e[0],e[1],e[2],e[3])))return new _e(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ze(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=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ti(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*Je),Math.round(r*o*Je)]}function ei(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 ii(t,e){for(var i,r,o,n,a,s,l,u=!1,p=0,h=e.length;p0&&s<0||a<0&&s>0}function ni(t,e,i){for(var r=0,o=i;ri[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}Qe(e,t)}function hi(t,e,i,r){for(var o=Math.pow(2,r.z)*Je,n=[r.x*Je,r.y*Je],a=[],s=0,l=t;s=0)return!1;var i=!0;return t.eachChild((function(t){i&&!gi(t,e)&&(i=!1)})),i}var _i=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};_i.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 _i(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)},_i.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},_i.prototype.eachChild=function(){},_i.prototype.outputDefined=function(){return!1},_i.prototype.serialize=function(){return["var",this.name]};var vi=_i,xi=function(t,e,i,r,o){void 0===e&&(e=[]),void 0===r&&(r=new Qt),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};xi.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)},xi.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new Re(e,[t]):"coerce"===i?new Ge(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 Le)&&"resolvedImage"!==n.type.kind&&wi(n)){var l=new Xe;try{n=new Le(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.")},xi.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 xi(this.registry,r,e||null,o,this.errors)},xi.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 Kt(r,t))},xi.prototype.checkSubtype=function(t,e){var i=ce(t,e);return i&&this.error(i),i};var bi=xi;function wi(t){if(t instanceof vi)return wi(t.boundExpression);if(t instanceof He&&"error"===t.name)return!1;if(t instanceof Ke)return!1;if(t instanceof di)return!1;var e=t instanceof Ge||t instanceof Re,i=!0;return t.eachChild((function(t){i=e?i&&wi(t):i&&t instanceof Le})),!!i&&mi(t)&&gi(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script"])}function ki(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||ee))throw new ze("Input is not a number.");n=a-1}return 0}var Ti=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var r=0,o=i;r=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var p=e.parse(s,u,o);if(!p)return null;o=o||p.type,r.push([a,p])}return new Ti(o,i,r)},Ti.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[ki(e,r)].evaluate(t)},Ti.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ii=Ti;function Si(t,e,i){return t*(1-i)+e*i}var Ei=Object.freeze({__proto__:null,number:Si,color:function(t,e,i){return new _e(Si(t.r,e.r,i),Si(t.g,e.g,i),Si(t.b,e.b,i),Si(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,r){return Si(t,e[r],i)}))}}),Ai=.95047,Pi=1.08883,Mi=4/29,Li=6/29,Ci=3*Li*Li,zi=Math.PI/180,Di=180/Math.PI;function Oi(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ci+Mi}function Ri(t){return t>Li?t*t*t:Ci*(t-Mi)}function Bi(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Fi(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ui(t){var e=Fi(t.r),i=Fi(t.g),r=Fi(t.b),o=Oi((.4124564*e+.3575761*i+.1804375*r)/Ai),n=Oi((.2126729*e+.7151522*i+.072175*r)/1);return{l:116*n-16,a:500*(o-n),b:200*(n-Oi((.0193339*e+.119192*i+.9503041*r)/Pi)),alpha:t.a}}function ji(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*Ri(e),i=Ai*Ri(i),r=Pi*Ri(r),new _e(Bi(3.2404542*i-1.5371385*e-.4985314*r),Bi(-.969266*i+1.8760108*e+.041556*r),Bi(.0556434*i-.2040259*e+1.0572252*r),t.alpha)}function Ni(t,e,i){var r=e-t;return t+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var Vi={forward:Ui,reverse:ji,interpolate:function(t,e,i){return{l:Si(t.l,e.l,i),a:Si(t.a,e.a,i),b:Si(t.b,e.b,i),alpha:Si(t.alpha,e.alpha,i)}}},Gi={forward:function(t){var e=Ui(t),i=e.l,r=e.a,o=e.b,n=Math.atan2(o,r)*Di;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*zi,i=t.c;return ji({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Ni(t.h,e.h,i),c:Si(t.c,e.c,i),l:Si(t.l,e.l,i),alpha:Si(t.alpha,e.alpha,i)}}},Zi=Object.freeze({__proto__:null,lab:Vi,hcl:Gi}),qi=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;n1})))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,te)))return null;var l=[],u=null;"interpolate-hcl"===i||"interpolate-lab"===i?u=re:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var p=0;p=h)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([h,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new qi(u,i,r,o,l):e.error("Type "+pe(u)+" is not interpolatable.")},qi.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=ki(e,r),a=qi.interpolationFactor(this.interpolation,r,e[n],e[n+1]),s=i[n].evaluate(t),l=i[n+1].evaluate(t);return"interpolate"===this.operator?Ei[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Gi.reverse(Gi.interpolate(Gi.forward(s),Gi.forward(l),a)):Vi.reverse(Vi.interpolate(Vi.forward(s),Vi.forward(l),a))},qi.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e=i.length)throw new ze("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new ze("Array index must be an integer, but found "+e+" instead.");return i[e]},Qi.prototype.eachChild=function(t){t(this.index),t(this.input)},Qi.prototype.outputDefined=function(){return!1},Qi.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var $i=Qi,tr=function(t,e){this.type=ie,this.needle=t,this.haystack=e};tr.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,ne),r=e.parse(t[2],2,ne);return i&&r?fe(i.type,[ie,ee,te,$t,ne])?new tr(i,r):e.error("Expected first argument to be of type boolean, string, number or null, but found "+pe(i.type)+" instead"):null},tr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!de(e,["boolean","string","number","null"]))throw new ze("Expected first argument to be of type boolean, string, number or null, but found "+pe(Ae(e))+" instead.");if(!de(i,["string","array"]))throw new ze("Expected second argument to be of type array or string, but found "+pe(Ae(i))+" instead.");return i.indexOf(e)>=0},tr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},tr.prototype.outputDefined=function(){return!0},tr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var er=tr,ir=function(t,e,i){this.type=te,this.needle=t,this.haystack=e,this.fromIndex=i};ir.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,ne),r=e.parse(t[2],2,ne);if(!i||!r)return null;if(!fe(i.type,[ie,ee,te,$t,ne]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+pe(i.type)+" instead");if(4===t.length){var o=e.parse(t[3],3,te);return o?new ir(i,r,o):null}return new ir(i,r)},ir.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!de(e,["boolean","string","number","null"]))throw new ze("Expected first argument to be of type boolean, string, number or null, but found "+pe(Ae(e))+" instead.");if(!de(i,["string","array"]))throw new ze("Expected second argument to be of type array or string, but found "+pe(Ae(i))+" instead.");if(this.fromIndex){var r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)},ir.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},ir.prototype.outputDefined=function(){return!1},ir.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 rr=ir,or=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};or.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;aNumber.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,Ae(c)))return null}else i=Ae(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,ne);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 or(i,r,d,o,n,m):null},or.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(Ae(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},or.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},or.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},or.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],r={},o=0,n=Object.keys(this.cases).sort();o=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,ne),r=e.parse(t[2],2,te);if(!i||!r)return null;if(!fe(i.type,[ue(ne),ee,ne]))return e.error("Expected first argument to be of type array or string, but found "+pe(i.type)+" instead");if(4===t.length){var o=e.parse(t[3],3,te);return o?new lr(i.type,i,r,o):null}return new lr(i.type,i,r)},lr.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!de(e,["string","array"]))throw new ze("Expected first argument to be of type array or string, but found "+pe(Ae(e))+" instead.");if(this.endIndex){var r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)},lr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},lr.prototype.outputDefined=function(){return!1},lr.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 ur=lr;function pr(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 hr(t,e,i,r){return 0===r.compare(e,i)}function cr(t,e,i){var r="=="!==t&&"!="!==t;return function(){function o(t,e,i){this.type=ie,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,ne);if(!n)return null;if(!pr(i,n.type))return e.concat(1).error('"'+i+"\" comparisons are not supported for type '"+pe(n.type)+"'.");var a=e.parse(t[2],2,ne);if(!a)return null;if(!pr(i,a.type))return e.concat(2).error('"'+i+"\" comparisons are not supported for type '"+pe(a.type)+"'.");if(n.type.kind!==a.type.kind&&"value"!==n.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+pe(n.type)+"' and '"+pe(a.type)+"'.");r&&("value"===n.type.kind&&"value"!==a.type.kind?n=new Re(a.type,[n]):"value"!==n.type.kind&&"value"===a.type.kind&&(a=new Re(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,ae)))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=Ae(n),l=Ae(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new ze('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=Ae(n),p=Ae(a);if("string"!==u.kind||"string"!==p.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 fr=cr("==",(function(t,e,i){return e===i}),hr),dr=cr("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!hr(0,e,i,r)})),mr=cr("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),gr=cr("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),_r=cr(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0})),vr=function(t,e,i,r,o){this.type=ee,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=o};vr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,te);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,ee)))return null;var n=null;if(r.currency&&!(n=e.parse(r.currency,1,ee)))return null;var a=null;if(r["min-fraction-digits"]&&!(a=e.parse(r["min-fraction-digits"],1,te)))return null;var s=null;return r["max-fraction-digits"]&&!(s=e.parse(r["max-fraction-digits"],1,te))?null:new vr(i,o,n,a,s)},vr.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))},vr.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)},vr.prototype.outputDefined=function(){return!1},vr.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 xr=vr,br=function(t){this.type=te,this.input=t};br.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 "+pe(i.type)+" instead."):new br(i):null},br.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 ze("Expected value to be of type string or array, but found "+pe(Ae(e))+" instead.")},br.prototype.eachChild=function(t){t(this.input)},br.prototype.outputDefined=function(){return!1},br.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var wr={"==":fr,"!=":dr,">":yr,"<":mr,">=":_r,"<=":gr,array:Re,at:$i,boolean:Re,case:sr,coalesce:Yi,collator:Ke,format:Fe,image:je,in:er,"index-of":rr,interpolate:Wi,"interpolate-hcl":Wi,"interpolate-lab":Wi,length:br,let:Ji,literal:Le,match:nr,number:Re,"number-format":xr,object:Re,slice:ur,step:Ii,string:Re,"to-boolean":Ge,"to-color":Ge,"to-number":Ge,"to-string":Ge,var:vi,within:di};function kr(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=Se(i,r,o,a);if(s)throw new ze(s);return new _e(i/255*a,r/255*a,o/255*a,a)}function Tr(t,e){return t in e}function Ir(t,e){var i=e[t];return void 0===i?null:i}function Sr(t){return{type:t}}He.register(wr,{error:[{kind:"error"},[ee],function(t,e){throw new ze(e[0].evaluate(t))}],typeof:[ee,[ne],function(t,e){return pe(Ae(e[0].evaluate(t)))}],"to-rgba":[ue(te,4),[re],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[re,[te,te,te],kr],rgba:[re,[te,te,te,te],kr],has:{type:ie,overloads:[[[ee],function(t,e){return Tr(e[0].evaluate(t),t.properties())}],[[ee,oe],function(t,e){var i=e[1];return Tr(e[0].evaluate(t),i.evaluate(t))}]]},get:{type:ne,overloads:[[[ee],function(t,e){return Ir(e[0].evaluate(t),t.properties())}],[[ee,oe],function(t,e){var i=e[1];return Ir(e[0].evaluate(t),i.evaluate(t))}]]},"feature-state":[ne,[ee],function(t,e){return Ir(e[0].evaluate(t),t.featureState||{})}],properties:[oe,[],function(t){return t.properties()}],"geometry-type":[ee,[],function(t){return t.geometryType()}],id:[ne,[],function(t){return t.id()}],zoom:[te,[],function(t){return t.globals.zoom}],"heatmap-density":[te,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[te,[],function(t){return t.globals.lineProgress||0}],"sky-radial-progress":[te,[],function(t){return t.globals.skyRadialProgress||0}],accumulated:[ne,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[te,Sr(te),function(t,e){for(var i=0,r=0,o=e;r":[ie,[ee,ne],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->":[ie,[ne],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r>o}],"filter-<=":[ie,[ee,ne],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-<=":[ie,[ne],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r<=o}],"filter->=":[ie,[ee,ne],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->=":[ie,[ne],function(t,e){var i=e[0],r=t.id(),o=i.value;return typeof r==typeof o&&r>=o}],"filter-has":[ie,[ne],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[ie,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[ie,[ue(ee)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[ie,[ue(ne)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[ie,[ee,ue(ne)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[ie,[ee,ue(ne)],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:ie,overloads:[[[ie,ie],function(t,e){var i=e[1];return e[0].evaluate(t)&&i.evaluate(t)}],[Sr(ie),function(t,e){for(var i=0,r=e;i-1}function Cr(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Dr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Or(t){return t}function Rr(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||(Cr(e)?"exponential":"interval");if(n&&((t=Wt({},t)).stops&&(t.stops=t.stops.map((function(t){return[t[0],_e.parse(t[1])]}))),t.default=_e.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Zi[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);if("exponential"===l)i=jr;else if("interval"===l)i=Ur;else if("categorical"===l){i=Fr,r=Object.create(null);for(var u=0,p=t.stops;u=t.stops[r-1][0])return t.stops[r-1][1];var o=ki(t.stops.map((function(t){return t[0]})),i);return t.stops[o][1]}function jr(t,e,i){var r=void 0!==t.base?t.base:1;if("number"!==zr(i))return Br(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=ki(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=Ei[e.type]||Or;if(t.colorSpace&&"rgb"!==t.colorSpace){var p=Zi[t.colorSpace];u=function(t,e){return p.reverse(p.interpolate(p.forward(t),p.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 Nr(t,e,i){return"color"===e.type?i=_e.parse(i):"formatted"===e.type?i=ke.fromString(i.toString()):"resolvedImage"===e.type?i=Ie.fromString(i.toString()):zr(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),Br(i,t.default,e.default)}var Vr=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Xe,this._defaultValue=e?function(t){return"color"===t.type&&Dr(t.default)?new _e(0,0,0,0):"color"===t.type?_e.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Gr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Er}function Zr(t,e){var i=new bi(Er,[],e?function(t){var e={color:re,string:ee,number:te,enum:ee,boolean:ie,formatted:se,resolvedImage:le};return"array"===t.type?ue(e[t.value]||ne,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?Ar(new Vr(r,e)):Pr(i.errors)}Vr.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)},Vr.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 ze("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 qr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!yi(e.expression)};qr.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,o,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,o,n)},qr.prototype.evaluate=function(t,e,i,r,o,n){return this._styleExpression.evaluate(t,e,i,r,o,n)};var Xr=function(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!yi(e.expression),this.interpolationType=r};function Wr(t,e){if("error"===(t=Zr(t,e)).result)return t;var i=t.value.expression,r=mi(i);if(!r&&!Mr(e))return Pr([new Kt("","data expressions not supported")]);var o=gi(i,["zoom"]);if(!o&&!Lr(e))return Pr([new Kt("","zoom expressions not supported")]);var n=Yr(i);return n||o?n instanceof Kt?Pr([n]):n instanceof Wi&&!Cr(e)?Pr([new Kt("",'"interpolate" expressions cannot be used with this property')]):Ar(n?new Xr(r?"camera":"composite",t.value,n.labels,n instanceof Wi?n.interpolation:void 0):new qr(r?"constant":"source",t.value)):Pr([new Kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Xr.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,o,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,o,n)},Xr.prototype.evaluate=function(t,e,i,r,o,n){return this._styleExpression.evaluate(t,e,i,r,o,n)},Xr.prototype.interpolationFactor=function(t,e,i){return this.interpolationType?Wi.interpolationFactor(this.interpolationType,t,e,i):0};var Hr=function(t,e){this._parameters=t,this._specification=e,Wt(this,Rr(this._parameters,this._specification))};function Yr(t){var e=null;if(t instanceof Ji)e=Yr(t.result);else if(t instanceof Yi)for(var i=0,r=t.args;ia)return[new qt(e,i,i+" is greater than the maximum value "+a)]}return[]}function $r(t){var e,i,r,o=t.valueSpec,n=Ht(t.value.type),a={},s="categorical"!==n&&void 0===t.value.property,l=!s,u="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),p=Kr({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 qt(t.key,t.value,'identity function may not have a "stops" property')];var e=[],i=t.value;return e=e.concat(Jr({key:t.key,value:i,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===zr(i)&&0===i.length&&e.push(new qt(t.key,i,"array must have at least one stop")),e},default:function(t){return So({key:t.key,value:t.value,valueSpec:o,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&s&&p.push(new qt(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||p.push(new qt(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!Cr(t.valueSpec)&&p.push(new qt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Mr(t.valueSpec)?p.push(new qt(t.key,t.value,"property functions not supported")):s&&!Lr(t.valueSpec)&&p.push(new qt(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!u||void 0!==t.value.property||p.push(new qt(t.key,t.value,'"property" property is required')),p;function h(t){var e=[],n=t.value,s=t.key;if("array"!==zr(n))return[new qt(s,n,"array expected, "+zr(n)+" found")];if(2!==n.length)return[new qt(s,n,"array length 2 expected, length "+n.length+" found")];if(u){if("object"!==zr(n[0]))return[new qt(s,n,"object expected, "+zr(n[0])+" found")];if(void 0===n[0].zoom)return[new qt(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new qt(s,n,"object stop key must have value")];if(r&&r>Ht(n[0].zoom))return[new qt(s,n[0].zoom,"stop zoom values must appear in ascending order")];Ht(n[0].zoom)!==r&&(r=Ht(n[0].zoom),i=void 0,a={}),e=e.concat(Kr({key:s+"[0]",value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Qr,value:c}}))}else e=e.concat(c({key:s+"[0]",value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Gr(Yt(n[1]))?e.concat([new qt(s+"[1]",n[1],"expressions are not allowed in function stops.")]):e.concat(So({key:s+"[1]",value:n[1],valueSpec:o,style:t.style,styleSpec:t.styleSpec}))}function c(t,r){var s=zr(t.value),l=Ht(t.value),u=null!==t.value?t.value:r;if(e){if(s!==e)return[new qt(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 qt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){var p="number expected, "+s+" found";return Mr(o)&&void 0===n&&(p+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new qt(t.key,u,p)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==i&&l=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);ee?1:0}function ao(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(var e=1;e"===i||"<="===i||">="===i?lo(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(so))):"all"===i?["all"].concat(t.slice(1).map(so)):"none"===i?["all"].concat(t.slice(1).map(so).map(ho)):"in"===i?uo(t[1],t.slice(2)):"!in"===i?ho(uo(t[1],t.slice(2))):"has"===i?po(t[1]):"!has"===i?ho(po(t[1])):"within"!==i||t}function lo(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 uo(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(no)]]:["filter-in-small",t,["literal",e]]}}function po(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function ho(t){return["!",t]}function co(t){return io(Yt(t.value))?to(Wt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):fo(t)}function fo(t){var e=t.value,i=t.key;if("array"!==zr(e))return[new qt(i,e,"array expected, "+zr(e)+" found")];var r,o=t.styleSpec,n=[];if(e.length<1)return[new qt(i,e,"filter array must have at least 1 element")];switch(n=n.concat(eo({key:i+"[0]",value:e[0],valueSpec:o.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ht(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Ht(e[1])&&n.push(new qt(i,e,'"$type" cannot be use with operator "'+e[0]+'"'));case"==":case"!=":3!==e.length&&n.push(new qt(i,e,'filter array for operator "'+e[0]+'" must have 3 elements'));case"in":case"!in":e.length>=2&&"string"!==(r=zr(e[1]))&&n.push(new qt(i+"[1]",e[1],"string expected, "+r+" found"));for(var a=2;a=e.range[1]&&(n=n.concat([new qt("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?So({key:s,value:e[s],valueSpec:r.transition,style:i,styleSpec:r}):o[s]?So({key:s,value:e[s],valueSpec:o[s],style:i,styleSpec:r}):[new qt(s,e[s],'unknown property "'+s+'"')])}return n}var Io={"*":function(){return[]},array:Jr,boolean:function(t){var e=t.value,i=t.key,r=zr(e);return"boolean"!==r?[new qt(i,e,"boolean expected, "+r+" found")]:[]},number:Qr,color:function(t){var e=t.key,i=t.value,r=zr(i);return"string"!==r?[new qt(e,i,"color expected, "+r+" found")]:null===ye.parseCSSColor(i)?[new qt(e,i,'color expected, "'+i+'" found')]:[]},constants:Xt,enum:eo,filter:co,function:$r,layer:_o,object:Kr,source:bo,light:wo,terrain:ko,fog:To,string:vo,formatted:function(t){return 0===vo(t).length?[]:to(t)},resolvedImage:function(t){return 0===vo(t).length?[]:to(t)}};function So(t){var e=t.value,i=t.valueSpec,r=t.styleSpec;return i.expression&&Dr(Ht(e))?$r(t):i.expression&&Gr(Yt(e))?to(t):i.type&&Io[i.type]?Io[i.type](t):Kr(Wt({},t,{valueSpec:i.type?r[i.type]:i}))}function Eo(t){var e=t.value,i=t.key,r=vo(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new qt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new qt(i,e,'"glyphs" url must include a "{range}" token'))),r}function Ao(t,e){void 0===e&&(e=Zt);var i=[];return i=i.concat(So({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Eo,"*":function(){return[]}}})),t.constants&&(i=i.concat(Xt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Po(i)}function Po(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Mo(t){return function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];return Po(t.apply(this,e))}}Ao.source=Mo(bo),Ao.light=Mo(wo),Ao.terrain=Mo(ko),Ao.fog=Mo(To),Ao.layer=Mo(_o),Ao.filter=Mo(co),Ao.paintProperty=Mo(yo),Ao.layoutProperty=Mo(go);var Lo=Ao,Co=Lo.light,zo=Lo.fog,Do=Lo.paintProperty,Oo=Lo.layoutProperty;function Ro(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=p[f+0]&&r>=p[f+1])?(a[c]=!0,n.push(u[c])):a[c]=!1}}},Fo.prototype._forEachCell=function(t,e,i,r,o,n,a,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),p=this._convertToCellCoord(i),h=this._convertToCellCoord(r),c=l;c<=p;c++)for(var f=u;f<=h;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}},Fo.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Fo.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Fo.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,i=0,r=0;r=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),E(i),d}},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;E(i)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:P(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),d}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),No=jo(),Vo=No;try{regeneratorRuntime=No}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=No:Function("r","regeneratorRuntime = r")(No)}function Go(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Zo(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 qo(t){return function(){var e=this,i=arguments;return new Promise((function(r,o){var n=t.apply(e,i);function a(t){Zo(n,r,o,a,s,"next",t)}function s(t){Zo(n,r,o,a,s,"throw",t)}a(void 0)}))}}function Xo(t){return Xo="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},Xo(t)}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":Xo(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"===Xo(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(t,e){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=qo(Vo.mark((function t(e,i,r){var o,n,a;return Vo.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,pn(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]])}))),un.apply(this,arguments)}function pn(t,e){return hn.apply(this,arguments)}function hn(){return hn=qo(Vo.mark((function t(e,i){var r;return Vo.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)}))),hn.apply(this,arguments)}var cn={},fn=!0;function dn(t,e,i){return mn.apply(this,arguments)}function mn(){return mn=qo(Vo.mark((function t(e,i,r){var o,n;return Vo.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)}))),mn.apply(this,arguments)}function yn(t){return gn.apply(this,arguments)}function gn(){return gn=qo(Vo.mark((function t(e){var i,r=arguments;return Vo.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=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=qo(Vo.mark((function t(e,i,r){var o,n,a,s;return Vo.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)}))),Tn.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"===Xo(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.")}var Ln="2.2.8";function Cn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ln,i=t.version;e&&i&&(e=zn(e),i=zn(i))}function zn(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},On=Dn.global||Dn.self||Dn.window,Rn="object"!==("undefined"==typeof process?"undefined":Xo(process))||"[object process]"!==String(process)||process.browser,Bn="undefined"!=typeof process&&process.version&&process.version.match(/v([0-9]*)/),Fn=Bn&&parseFloat(Bn[1])||0,Un={};function jn(t){return t+3&-4}var Nn={};function Vn(t){for(var e in Nn)t.startsWith(e)&&(t=t.replace(e,Nn[e]));return t.startsWith("http://")||t.startsWith("https://")||(t="".concat("").concat(t)),t}function Gn(t,e){this.v=t,this.k=e}function Zn(t){return new Gn(t,0)}function qn(t){var e,i;function r(e,i){try{var n=t[e](i),a=n.value,s=a instanceof Gn;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){return function(){return new qn(t.apply(this,arguments))}}function Wn(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 Hn(e.call(t));i="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Hn(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 Hn=function(t){this.s=t,this.n=t.next},Hn.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 Hn(t)}function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kn(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,r=new Array(e);i1&&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=this._addAttributes(t),o={primitives:[{attributes:r,indices:e,mode:i}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),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+=jn(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,ta[i-1]||ta[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:na(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-1?t.splice(r,1):i=!1}}},{key:"json",get:function(){return this.gltf.json}}]),t}(),sa=!0;function la(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)))}function ua(t,e,i,r){for(;i+8<=t.header.byteLength;){var o=e.getUint32(i+0,sa),n=e.getUint32(i+4,sa);switch(i+=8,n){case 1313821514:pa(t,e,i,o);break;case 5130562:ha(t,e,i,o);break;case 0:r.glb.strict||pa(t,e,i,o);break;case 1:r.glb.strict||ha(t,e,i,o)}i+=jn(o)}return i}function pa(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 ha(t,e,i,r,o){t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:i,byteLength:r,arrayBuffer:e.buffer})}var ca={id:"glb",name:"GLB",version:"2.2.8",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,parse:function(){var t=qo(Vo.mark((function t(e,i){return Vo.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",fa(e,i));case 1:case"end":return t.stop()}}),t)})));return function(e,i){return t.apply(this,arguments)}}(),parseSync:fa,options:{glb:{strict:!1}}};function fa(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=la(o,i+0),t.version=o.getUint32(i+4,sa);var n=o.getUint32(i+8,sa);t.header={byteOffset:i,byteLength:n},t.json={},t.binChunks=[],ua(t,o,i+12,r)}(r,t,void 0===i?0:i,e),r}var da=n.ImageData,ma=n.ImageBitmap,ya={};function ga(t,e,i){void 0===i&&(i={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ya[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}for(var _a in ga("Object",Object),Bo.serialize=function(t,e){var i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}},Bo.deserialize=function(t){return new Bo(t.buffer)},ga("Grid",Bo),ga("Color",_e),ga("Error",Error),ga("ResolvedImage",Ie),ga("Model",aa),ga("StylePropertyFunction",Hr),ga("StyleExpression",Vr,{omit:["_evaluator"]}),ga("ZoomDependentExpression",Xr),ga("ZoomConstantExpression",qr),ga("CompoundExpression",He,{omit:["_evaluate"]}),Er)Er[_a]._classRegistryKey||ga("Expression_"+_a,Er[_a]);function va(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function xa(t){return ma&&t instanceof ma}function ba(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(va(t)||xa(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var i=t;return e&&e.push(i.buffer),i}if(t instanceof da)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var r=[],o=0,n=t;o=0)){var p=t[u];l[u]=ya[s].shallow.indexOf(u)>=0?p:ba(p,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 wa(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||va(t)||xa(t)||ArrayBuffer.isView(t)||t instanceof da)return t;if(Array.isArray(t))return t.map(wa);if("object"==typeof t){var e=t.$name||"Object",i=ya[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=0?s:wa(s)}}return r}throw new Error("can't deserialize object of type "+typeof t)}var ka=function(){this.first=!0};ka.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=1536&&t<=1791},Ia=function(t){return t>=1872&&t<=1919},Sa=function(t){return t>=2208&&t<=2303},Ea=function(t){return t>=11904&&t<=12031},Aa=function(t){return t>=12032&&t<=12255},Pa=function(t){return t>=12272&&t<=12287},Ma=function(t){return t>=12288&&t<=12351},La=function(t){return t>=12352&&t<=12447},Ca=function(t){return t>=12448&&t<=12543},za=function(t){return t>=12544&&t<=12591},Da=function(t){return t>=12704&&t<=12735},Oa=function(t){return t>=12736&&t<=12783},Ra=function(t){return t>=12784&&t<=12799},Ba=function(t){return t>=12800&&t<=13055},Fa=function(t){return t>=13056&&t<=13311},Ua=function(t){return t>=13312&&t<=19903},ja=function(t){return t>=19968&&t<=40959},Na=function(t){return t>=40960&&t<=42127},Va=function(t){return t>=42128&&t<=42191},Ga=function(t){return t>=44032&&t<=55215},Za=function(t){return t>=63744&&t<=64255},qa=function(t){return t>=64336&&t<=65023},Xa=function(t){return t>=65040&&t<=65055},Wa=function(t){return t>=65072&&t<=65103},Ha=function(t){return t>=65104&&t<=65135},Ya=function(t){return t>=65136&&t<=65279},Ka=function(t){return t>=65280&&t<=65519};function Ja(t){for(var e=0,i=t;e=65097&&t<=65103)||Za(t)||Fa(t)||Ea(t)||Oa(t)||!(!Ma(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Ua(t)||ja(t)||Ba(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)||Ga(t)||La(t)||Pa(t)||function(t){return t>=12688&&t<=12703}(t)||Aa(t)||Ra(t)||Ca(t)&&12540!==t||!(!Ka(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)||!(!Ha(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)||Xa(t)||function(t){return t>=19904&&t<=19967}(t)||Na(t)||Va(t))))}function $a(t){return!(Qa(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)||Ma(t)||Ca(t)||function(t){return t>=57344&&t<=63743}(t)||Wa(t)||Ha(t)||Ka(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function ts(t){return t>=1424&&t<=2303||qa(t)||Ya(t)}function es(t,e){return!(!e&&ts(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||function(t){return t>=6016&&t<=6143}(t))}function is(t){for(var e=0,i=t;e-1&&(ss="error"),as&&as(t)};function ps(){hs.fire(new Nt("pluginStateChange",{pluginStatus:ss,pluginURL:ls}))}var hs=new Gt,cs=function(){return ss},fs=function(){if(ss!==rs||!ls)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ss=os,ps(),ls&&Lt({url:ls},(function(t){t?us(t):(ss=ns,ps())}))},ds={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return ss===ns||null!=ds.applyArabicShaping},isLoading:function(){return ss===os},setState:function(t){ss=t.pluginStatus,ls=t.pluginURL},isParsed:function(){return null!=ds.applyArabicShaping&&null!=ds.processBidirectionalText&&null!=ds.processStyledBidirectionalText},getPluginURL:function(){return ls}},ms=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 ka,this.transition={})};ms.prototype.isSupportedScript=function(t){return function(t,e){for(var i=0,r=t;ithis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}};var ys=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Dr(t))return new Hr(t,e);if(Gr(t)){var i=Wr(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=_e.parse(t)),{kind:"constant",evaluate:function(){return r}}}(void 0===e?t.specification.default:e,t.specification)};ys.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ys.prototype.possiblyEvaluate=function(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)};var gs=function(t){this.property=t,this.value=new ys(t,void 0)};gs.prototype.transitioned=function(t,e){return new vs(this.property,this.value,e,v({},t.transition,this.transition),t.now)},gs.prototype.untransitioned=function(){return new vs(this.property,this.value,null,{},0)};var _s=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};_s.prototype.getValue=function(t){return P(this._values[t].value.value)},_s.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new gs(this._values[t].property)),this._values[t].value=new ys(this._values[t].property,null===e?void 0:P(e))},_s.prototype.getTransition=function(t){return P(this._values[t].transition)},_s.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new gs(this._values[t].property)),this._values[t].transition=P(e)||void 0},_s.prototype.serialize=function(){for(var t={},e=0,i=Object.keys(this._values);ethis.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(rr.zoomHistory.lastIntegerZoom?{from:t,to:e,other:i}:{from:i,to:e,other:t}},e.prototype.interpolate=function(t){return t},e}(Is),Es=function(t){this.specification=t};Es.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 ms(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ms(Math.floor(e.zoom),e)),t.expression.evaluate(new ms(Math.floor(e.zoom+1),e)),e)}},Es.prototype._calculate=function(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}},Es.prototype.interpolate=function(t){return t};var As=function(t){this.specification=t};As.prototype.possiblyEvaluate=function(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)},As.prototype.interpolate=function(){return!1};var Ps=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 ys(i,void 0),o=this.defaultTransitionablePropertyValues[e]=new gs(i);this.defaultTransitioningPropertyValues[e]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}};function Ms(t,e){return 256*(t=m(Math.floor(t),0,255))+m(Math.floor(e),0,255)}ga("DataDrivenProperty",Is),ga("DataConstantProperty",Ts),ga("CrossFadedDataDrivenProperty",Ss),ga("CrossFadedProperty",Es),ga("ColorRampProperty",As);var Ls={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Cs=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},zs=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ds(t,e){void 0===e&&(e=1);var i=0,r=0;return{members:t.map((function(t){var o=Ls[t.type].BYTES_PER_ELEMENT,n=i=Os(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:Os(i,Math.max(r,e)),alignment:e}}function Os(t,e){return Math.ceil(t/e)*e}zs.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},zs.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},zs.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},zs.prototype.clear=function(){this.length=0},zs.prototype.resize=function(t){this.reserve(t),this.length=t},zs.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)}},zs.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};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)},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}(zs);Rs.prototype.bytesPerElement=4,ga("StructArrayLayout2i4",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)},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}(zs);Bs.prototype.bytesPerElement=8,ga("StructArrayLayout4i8",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.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}(zs);Fs.prototype.bytesPerElement=10,ga("StructArrayLayout5i8",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.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,p=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[p+2]=s,t},e}(zs);Us.prototype.bytesPerElement=12,ga("StructArrayLayout2i4ub1f12",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.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,p=16*t,h=4*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.uint8[p+4]=r,this.uint8[p+5]=o,this.uint8[p+6]=n,this.uint8[p+7]=a,this.float32[h+2]=s,this.float32[h+3]=l,t},e}(zs);js.prototype.bytesPerElement=16,ga("StructArrayLayout2i4ub2f16",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){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}(zs);Ns.prototype.bytesPerElement=8,ga("StructArrayLayout2f8",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.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,o,n,a,s,l,u)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,p){var h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=o,this.uint16[h+4]=n,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=p,t},e}(zs);Vs.prototype.bytesPerElement=20,ga("StructArrayLayout10ui20",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.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}(zs);Gs.prototype.bytesPerElement=16,ga("StructArrayLayout8ui16",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.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}(zs);Zs.prototype.bytesPerElement=32,ga("StructArrayLayout8f32",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.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,o,n,a,s,l,u,p,h){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,o,n,a,s,l,u,p,h)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,p,h,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]=p,this.int16[f+10]=h,this.int16[f+11]=c,t},e}(zs);qs.prototype.bytesPerElement=24,ga("StructArrayLayout4i4ui4i24",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.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}(zs);Xs.prototype.bytesPerElement=12,ga("StructArrayLayout3f12",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.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}(zs);Ws.prototype.bytesPerElement=4,ga("StructArrayLayout1ul4",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.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 p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,o,n,a,s,l,u)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,p){var h=16*t,c=8*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.float32[c+1]=r,this.float32[c+2]=o,this.float32[c+3]=n,this.float32[c+4]=a,this.int16[h+10]=s,this.uint32[c+6]=l,this.uint16[h+14]=u,this.uint16[h+15]=p,t},e}(zs);Hs.prototype.bytesPerElement=32,ga("StructArrayLayout2i4f1i1ul2ui32",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.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}(zs);Ys.prototype.bytesPerElement=12,ga("StructArrayLayout2i2i2i12",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.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}(zs);Ks.prototype.bytesPerElement=16,ga("StructArrayLayout2f1f2i16",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.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}(zs);Js.prototype.bytesPerElement=12,ga("StructArrayLayout2ub2f12",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.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}(zs);Qs.prototype.bytesPerElement=6,ga("StructArrayLayout3ui6",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),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,p,h,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,p,h,c,f,d,m,y,g)},e.prototype.emplace=function(t,e,i,r,o,n,a,s,l,u,p,h,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]=p,this.float32[x+7]=h,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}(zs);$s.prototype.bytesPerElement=48,ga("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1ub48",$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.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,p,h,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,p,h,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,p,h,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]=p,this.uint16[A+10]=h,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}(zs);tl.prototype.bytesPerElement=64,ga("StructArrayLayout8i15ui1ul3f64",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.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}(zs);el.prototype.bytesPerElement=4,ga("StructArrayLayout1f4",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.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}(zs);il.prototype.bytesPerElement=6,ga("StructArrayLayout3i6",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.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}(zs);rl.prototype.bytesPerElement=12,ga("StructArrayLayout1ul3ui12",rl);var ol=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}(zs);ol.prototype.bytesPerElement=4,ga("StructArrayLayout2ui4",ol);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._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}(zs);nl.prototype.bytesPerElement=2,ga("StructArrayLayout1ui2",nl);var al=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}(zs);al.prototype.bytesPerElement=16,ga("StructArrayLayout4f16",al);var sl=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}(Cs);sl.prototype.size=32;var ll=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 sl(this,t)},e}(Hs);ga("CollisionBoxArray",ll);var ul=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}(Cs);ul.prototype.size=48;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.get=function(t){return new ul(this,t)},e}($s);ga("PlacedSymbolArray",pl);var hl=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}(Cs);hl.prototype.size=64;var cl=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 hl(this,t)},e}(tl);ga("SymbolInstanceArray",cl);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.getoffsetX=function(t){return this.float32[1*t+0]},e}(el);ga("GlyphOffsetArray",fl);var dl=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}(il);ga("SymbolLineVertexArray",dl);var ml=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}(Cs);ml.prototype.size=12;var yl=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 ml(this,t)},e}(rl);ga("FeatureIndexArray",yl);var gl=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}(Cs);gl.prototype.size=4;var _l=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 gl(this,t)},e}(ol);ga("FillExtrusionCentroidArray",_l);var vl=Ds([{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"}]),xl=Ds([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]),bl=me((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>>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}})),wl=me((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}})),kl=bl,Tl=wl;kl.murmur3=bl,kl.murmur2=Tl;var Il=function(){this.ids=[],this.positions=[],this.indexed=!1};function Sl(t){var e=+t;return!isNaN(e)&&e<=s?e:kl(String(t))}function El(t,e,i,r){for(;i>1],n=i-1,a=r+1;;){do{n++}while(t[n]o);if(n>=a)break;Al(t,n,a),Al(e,3*n,3*a),Al(e,3*n+1,3*a+1),Al(e,3*n+2,3*a+2)}a-i>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},Il.serialize=function(t,e){var i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return El(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}},Il.deserialize=function(t){var e=new Il;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e},ga("FeaturePositionMap",Il);var Pl=function(t,e){this.gl=t.gl,this.location=e},Ml=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}(Pl),Ll=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}(Pl),Cl=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}(Pl),zl=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}(Pl),Dl=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}(Pl),Ol=function(t){function e(e,i){t.call(this,e,i),this.current=_e.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}(Pl),Rl=new Float32Array(16),Bl=function(t){function e(e,i){t.call(this,e,i),this.current=Rl}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}(Pl),Fl=new Float32Array(9),Ul=function(t){function e(e,i){t.call(this,e,i),this.current=Fl}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}(Pl);function jl(t){return[Ms(255*t.r,255*t.g),Ms(255*t.b,255*t.a)]}var Nl=function(t,e,i){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=i};Nl.prototype.setUniform=function(t,e,i){t.set(i.constantOr(this.value))},Nl.prototype.getBinding=function(t,e,i){return"color"===this.type?new Ol(t,e):new Ll(t,e)};var Vl=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Vl.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)},Vl.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)},Vl.prototype.getBinding=function(t,e,i){return"u_pattern_from"===i||"u_pattern_to"===i||"u_dash_from"===i||"u_dash_to"===i?new Dl(t,e):new Ll(t,e)};var Gl=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};Gl.prototype.populatePaintArray=function(t,e,i,r,o){var n=this.paintVertexArray.length,a=this.expression.evaluate(new ms(0),e,{},r,[],o);this.paintVertexArray.resize(t),this._setPaintValue(n,t,a)},Gl.prototype.updatePaintArray=function(t,e,i,r){var o=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,o)},Gl.prototype._setPaintValue=function(t,e,i){if("color"===this.type)for(var r=jl(i),o=t;o=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),A(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)&&Ro(this,t.call(Lo,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:Zt,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 ws&&Mr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Gt),eu=Ds([{name:"a_pos",components:2,type:"Int16"}],4).members,iu=function(t){void 0===t&&(t=[]),this.segments=t};iu.prototype.prepareSegment=function(t,e,i,r){var o=this.segments[this.segments.length-1];return t>iu.MAX_VERTEX_ARRAY_LENGTH&&L("Max vertices per segment is "+iu.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!o||o.vertexLength+t>iu.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},iu.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},iu.prototype.get=function(){return this.segments},iu.prototype.destroy=function(){for(var t=0,e=this.segments;ta.x+1||la.y+1)&&L("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function su(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?au(t):[]}}function lu(t,e,i,r,o){t.emplaceBack(2*e+(r+1)/2,2*i+(o+1)/2)}var uu=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 Rs,this.indexArray=new Qs,this.segments=new iu,this.programConfigurations=new Wl(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function pu(t,e){for(var i=0;i1){if(du(t,e))return!0;for(var r=0;r1?i:i.sub(e)._mult(o)._add(e))}function _u(t,e){for(var i,r,o,n=!1,a=0;ae.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 vu(t,e){for(var i=!1,r=0,o=t.length-1;re.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 xu(t,e,i,o,n){for(var a=0,s=t;a=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 p=0,h=u;po.x&&e.x>o.x||t.yo.y&&e.y>o.y)return!1;var n=C(t,e,i[0]);return n!==C(t,e,i[1])||n!==C(t,e,i[2])||n!==C(t,e,i[3])}function wu(t,e,i){var r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ku(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Tu(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=ru||p<0||p>=ru)){var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=h.vertexLength;lu(this.layoutVertexArray,u,p,-1,-1),lu(this.layoutVertexArray,u,p,1,-1),lu(this.layoutVertexArray,u,p,1,1),lu(this.layoutVertexArray,u,p,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)},ga("CircleBucket",uu,{omit:["layers"]});var Su=new Ps({"circle-sort-key":new Is(Zt.layout_circle["circle-sort-key"])}),Eu={paint:new Ps({"circle-radius":new Is(Zt.paint_circle["circle-radius"]),"circle-color":new Is(Zt.paint_circle["circle-color"]),"circle-blur":new Is(Zt.paint_circle["circle-blur"]),"circle-opacity":new Is(Zt.paint_circle["circle-opacity"]),"circle-translate":new Ts(Zt.paint_circle["circle-translate"]),"circle-translate-anchor":new Ts(Zt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ts(Zt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ts(Zt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Is(Zt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Is(Zt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Is(Zt.paint_circle["circle-stroke-opacity"])}),layout:Su},Au="undefined"!=typeof Float32Array?Float32Array:Array;function Pu(){var t=new Au(9);return Au!=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 Mu(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 Lu(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],p=e[7],h=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*h+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*p+b*d+w*_,t[4]=(v=i[4])*r+(x=i[5])*s+(b=i[6])*h+(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*p+b*d+w*_,t[8]=(v=i[8])*r+(x=i[9])*s+(b=i[10])*h+(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*p+b*d+w*_,t[12]=(v=i[12])*r+(x=i[13])*s+(b=i[14])*h+(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*p+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 Cu=Lu;function zu(){var t=new Au(3);return Au!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Du(t){var e=new Au(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Ou(t){return Math.hypot(t[0],t[1],t[2])}function Ru(t,e,i){var r=new Au(3);return r[0]=t,r[1]=e,r[2]=i,r}function Bu(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Fu(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Uu(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function ju(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Nu(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 Vu(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 Gu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Zu(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 qu(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,p=n*a-r*l,h=r*s-o*a,c=o*h-n*p,f=n*u-r*h,d=r*p-o*u,m=2*i[3];return p*=m,h*=m,f*=2,d*=2,t[0]=a+(u*=m)+(c*=2),t[1]=s+p+f,t[2]=l+h+d,t}var Xu,Wu=Fu,Hu=Uu,Yu=Ou;function Ku(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 Ju(){var t=new Au(4);return Au!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Qu(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function $u(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}zu(),Xu=new Au(4),Au!=Float32Array&&(Xu[0]=0,Xu[1]=0,Xu[2]=0,Xu[3]=0),zu(),Ru(1,0,0),Ru(0,1,0),Ju(),Ju(),Pu();var tp=function(t,e){this.pos=t,this.dir=e};tp.prototype.intersectsPlane=function(t,e,i){var r=Gu(e,this.dir);if(Math.abs(r)<1e-6)return!1;var o=Gu(Wu(zu(),t,this.pos),e)/r;return function(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2]}(i,Nu(zu(),this.pos,this.dir,o)),!0};var ep=function(t,e){this.points=t,this.planes=e};ep.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=Ku([],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=Vu([],Zu([],Wu([],o[t[0]],o[t[1]]),Wu([],o[t[2]],o[t[1]]))),i=-Gu(e,o[t[1]]);return e.concat(i)}));return new ep(o,n)};var ip=function(t,e){this.min=t,this.max=e,this.center=ju([],Bu([],this.min,this.max),.5)};ip.prototype.quadrant=function(t){for(var e=[t%2==0,t<2],i=Du(this.min),r=Du(this.max),o=0;o=0;if(0===s)return 0;s!==r.length&&(o=!1)}if(o)return 2;for(var u=0;u<3;u++){for(var p=Number.MAX_VALUE,h=-Number.MAX_VALUE,c=0;cthis.max[u]-this.min[u])return 0}return 1};var rp=function(t){function e(e){t.call(this,e,Eu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new uu(t)},e.prototype.queryRadius=function(t){var e=t;return wu("circle-radius",this,e)+wu("circle-stroke-width",this,e)+ku(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 p=Iu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),n.angle,t.pixelToTileUnitsFactor),h=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c=u?h*t.pixelToTileUnitsFactor:h,f=0,d=r;ft.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;l80*i){r=n=t[0],o=a=t[1];for(var d=i;dn&&(n=s),l>a&&(a=l);u=0!==(u=Math.max(n-r,a-o))?1/u:0}return Ip(c,f,i,r,o,u),f}function kp(t,e,i,r,o){var n,a;if(o===Wp(t,e,i,r)>0)for(n=e;n=e;n-=r)a=Zp(n,t[n],t[n+1],a);return a&&Fp(a,a.next)&&(qp(a),a=a.next),a}function Tp(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Fp(r,r.next)&&0!==Bp(r.prev,r,r.next))r=r.next;else{if(qp(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Ip(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=zp(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;e0||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?Ep(t,r,o,n):Sp(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),qp(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?Ip(t=Ap(Tp(t),e,i),e,i,r,o,n,2):2===a&&Pp(t,e,i,r,o,n):Ip(Tp(t),e,i,r,o,n,1);break}}}function Sp(t){var e=t.prev,i=t,r=t.next;if(Bp(e,i,r)>=0)return!1;for(var o=t.next.next;o!==t.prev;){if(Op(e.x,e.y,i.x,i.y,r.x,r.y,o.x,o.y)&&Bp(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function Ep(t,e,i,r){var o=t.prev,n=t,a=t.next;if(Bp(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=zp(o.x=u&&c&&c.z<=p;){if(h!==t.prev&&h!==t.next&&Op(o.x,o.y,n.x,n.y,a.x,a.y,h.x,h.y)&&Bp(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,c!==t.prev&&c!==t.next&&Op(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Bp(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Op(o.x,o.y,n.x,n.y,a.x,a.y,h.x,h.y)&&Bp(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;c&&c.z<=p;){if(c!==t.prev&&c!==t.next&&Op(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Bp(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function Ap(t,e,i){var r=t;do{var o=r.prev,n=r.next.next;!Fp(o,n)&&Up(o,r,r.next,n)&&Vp(o,n)&&Vp(n,o)&&(e.push(o.i/i),e.push(r.i/i),e.push(n.i/i),qp(r),qp(r.next),r=t=n),r=r.next}while(r!==t);return Tp(r)}function Pp(t,e,i,r,o,n){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Rp(a,s)){var l=Gp(a,s);return a=Tp(a,a.next),l=Tp(l,l.next),Ip(a,e,i,r,o,n),void Ip(l,e,i,r,o,n)}s=s.next}a=a.next}while(a!==t)}function Mp(t,e){return t.x-e.x}function Lp(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){if(a=s,s===o){if(n===r.y)return r;if(n===r.next.y)return r.next}i=r.x=r.x&&r.x>=p&&o!==r.x&&Op(ni.x||r.x===i.x&&Cp(i,r)))&&(i=r,c=l)),r=r.next}while(r!==u);return i}(t,e);if(!i)return e;var r=Gp(i,t),o=Tp(i,i.next);return Tp(r,r.next),e===i?o:e}function Cp(t,e){return Bp(t.prev,t,e.prev)<0&&Bp(e.next,t,t.next)<0}function zp(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 Dp(t){var e=t,i=t;do{(e.x=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(n-s)-(o-a)*(r-s)>=0}function Rp(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&&Up(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Vp(t,e)&&Vp(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)&&(Bp(t.prev,t,e.prev)||Bp(t,e.prev,e))||Fp(t,e)&&Bp(t.prev,t,t.next)>0&&Bp(e.prev,e,e.next)>0)}function Bp(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Fp(t,e){return t.x===e.x&&t.y===e.y}function Up(t,e,i,r){var o=Np(Bp(t,e,i)),n=Np(Bp(t,e,r)),a=Np(Bp(i,r,t)),s=Np(Bp(i,r,e));return o!==n&&a!==s||!(0!==o||!jp(t,i,e))||!(0!==n||!jp(t,r,e))||!(0!==a||!jp(i,t,r))||!(0!==s||!jp(i,e,r))}function jp(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 Np(t){return t>0?1:t<0?-1:0}function Vp(t,e){return Bp(t.prev,t,t.next)<0?Bp(t,e,t.next)>=0&&Bp(t,t.prev,e)>=0:Bp(t,e,t.prev)<0||Bp(t,t.next,e)<0}function Gp(t,e){var i=new Xp(t.i,t.x,t.y),r=new Xp(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 Zp(t,e,i,r){var o=new Xp(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 qp(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 Xp(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 Wp(t,e,i,r){for(var o=0,n=e,a=i-r;ni;){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);Yp(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 p=t[e],h=i,c=r;for(Kp(t,i,e),o(t[r],p)>0&&Kp(t,i,r);h0;)c--}0===o(t[i],p)?Kp(t,i,c):Kp(t,++c,r),c<=e&&(i=c+1),e<=c&&(r=c-1)}}function Kp(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function Jp(t,e){return te?1:0}function Qp(t,e){var i=t.length;if(i<=1)return[t];for(var r,o,n=[],a=0;a1)for(var l=0;l0&&i.holes.push(r+=t[o-1].length)}return i},xp.default=bp;var ih=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 Rs,this.indexArray=new Qs,this.indexArray2=new ol,this.programConfigurations=new Wl(t.layers,t.zoom),this.segments=new iu,this.segments2=new iu,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};ih.prototype.populate=function(t,e,i){this.hasPattern=th("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),o=[],n=0,a=t;n0},e}(tu),ah=Ds([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),sh=Ds([{name:"a_centroid_pos",components:2,type:"Uint16"}]),lh=ah.members,uh=ph;function ph(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(hh,this,e)}function hh(t,e,i){1==t?e.id=i.readVarint():7==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos>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},ph.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>3}if(r--,1===i||2===i)(o+=t.readSVarint())s&&(s=o),(n+=t.readSVarint())u&&(u=n);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},ph.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=ph.types[this.type];function p(t){for(var e=0;e>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))}dh.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 uh(this._pbf,e,this.extent,this._keys,this._values)};var yh=gh;function gh(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(_h,this,e)}function _h(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos>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},gh.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>3}if(r--,1===i||2===i)(o+=t.readSVarint())s&&(s=o),(n+=t.readSVarint())u&&(u=n);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},gh.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=gh.types[this.type];function p(t){for(var e=0;e>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 kh(t,e,i){var r;2===t&&(r=new fh(i,i.readVarint()+i.pos)).length&&(e[r.name]=r),3===t&&(r=new xh(i,i.readVarint()+i.pos)).length&&(e[r.name]=r)}bh.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 yh(this._pbf,e,this.extent,this._keys,this._values)};var Th={VectorTile:function(t,e){this.layers=t.readFields(kh,{},e)},VectorTileFeature:uh,VectorTileLayer:fh},Ih=Th.VectorTileFeature.types,Sh=Math.pow(2,13);function Eh(t,e,i,r,o,n,a,s){t.emplaceBack((e<<1)+a,(i<<1)+n,(Math.floor(r*Sh)<<1)+o,Math.round(s))}function Ah(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*Sh)<<1)+o,Math.round(s),l)}var Ph=function(){this.acc=new r(0,0),this.polyCount=[]};Ph.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))},Ph.prototype.append=function(t,e){this.currentPolyCount.edges++,this.acc._add(t);var i=!!this.borders,r=this.min,o=this.max;t.xo.x&&(o.x=t.x,i=!0),t.yo.y&&(o.y=t.y,i=!0),((0===t.x||t.x===ru)&&t.x===e.x)!=((0===t.y||t.y===ru)&&t.y===e.y)&&this.processBorderOverlap(t,e),i&&this.checkBorderIntersection(t,e)},Ph.prototype.checkBorderIntersection=function(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,Si(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>ru!=t.x>ru&&this.addBorderIntersection(1,Si(e.y,t.y,(ru-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,Si(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>ru!=t.y>ru&&this.addBorderIntersection(3,Si(e.x,t.x,(ru-e.y)/(t.y-e.y)))},Ph.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];ei[1]&&(i[1]=e)},Ph.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)}},Ph.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)},Ph.prototype.span=function(){return new r(this.max.x-this.min.x,this.max.y-this.min.y)},Ph.prototype.intersectsCount=function(){return this.borders.reduce((function(t,e){return t+ +(e[0]!==Number.MAX_VALUE)}),0)};var Mh=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 Bs,this.VSArray=new Fs,this.centroidVertexArray=new _l,this.indexArray=new Qs,this.programConfigurations=new Wl(t.layers,t.zoom),this.segments=new iu,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.enableTerrain=t.enableTerrain};function Lh(t,e){return t.x===e.x&&(t.x<0||t.x>ru)||t.y===e.y&&(t.y<0||t.y>ru)}function Ch(t){return t.every((function(t){return t.x<=0}))||t.every((function(t){return t.x>=ru}))||t.every((function(t){return t.y<=0}))||t.every((function(t){return t.y>=ru}))}Mh.prototype.populate=function(t,e,i){this.features=[],this.hasPattern=th("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<=1){var y=c[d-1];if(!Lh(m,y)){n&&n.append(m,y),p.vertexLength+4>iu.MAX_VERTEX_ARRAY_LENGTH&&(p=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),Eh(this.layoutVertexArray,m.x,m.y,_,v,0,0,f),Eh(this.layoutVertexArray,m.x,m.y,_,v,0,1,f),Ah(this.VSArray,m.x,m.y,_,v,0,0,f,t.properties.height),Ah(this.VSArray,m.x,m.y,_,v,0,1,f,t.properties.height),Eh(this.layoutVertexArray,y.x,y.y,_,v,0,2,f+=x),Eh(this.layoutVertexArray,y.x,y.y,_,v,0,3,f),Ah(this.VSArray,y.x,y.y,_,v,0,2,f,t.properties.height),Ah(this.VSArray,y.x,y.y,_,v,0,3,f,t.properties.height);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}}if(p.vertexLength+u>iu.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===Ih[t.type]){for(var w=[],k=[],T=p.vertexLength,I=0;I0){if(n.borders){n.vertexArrayOffset=this.centroidVertexArray.length;for(var L=n.borders,C=this.featuresOnBorder.push(n)-1,z=0;z<4;z++)L[z][0]!==Number.MAX_VALUE&&this.borders[z].push(C)}this.encodeCentroid(n.borders?void 0:n.centroid(),n)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,r)},Mh.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)},Mh.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=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;u0;if(E&&b>u){var P=f.dist(g);if(P>2*p){var M=f.sub(f.sub(g)._mult(p/P)._round());this.updateDistance(g,M),this.addCurrentVertex(M,v,0,0,h),g=M}}var L=g&&_,C=L?i:s?"butt":r;if(L&&"round"===C&&(Io&&(C="bevel"),"bevel"===C&&(I>2&&(C="flipbevel"),I100)w=x.mult(-1);else{var z=I*v.add(x).mag()/v.sub(x).mag();w._perp()._mult(z*(A?-1:1))}this.addCurrentVertex(f,w,0,0,h),this.addCurrentVertex(f,w.mult(-1),0,0,h)}else if("bevel"===C||"fakeround"===C){var D=-Math.sqrt(I*I-1),O=A?D:0,R=A?0:D;if(g&&this.addCurrentVertex(f,v,O,R,h),"fakeround"===C)for(var B=Math.round(180*S/Math.PI/20),F=1;F2*p){var Z=f.add(_.sub(f)._mult(p/G)._round());this.updateDistance(f,Z),this.addCurrentVertex(Z,x,0,0,h),f=Z}}}}},Gh.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)},Gh.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},Gh.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},Gh.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},ga("LineBucket",Gh,{omit:["layers","patternFeatures"]});var Zh=new Ps({"line-cap":new Is(Zt.layout_line["line-cap"]),"line-join":new Is(Zt.layout_line["line-join"]),"line-miter-limit":new Ts(Zt.layout_line["line-miter-limit"]),"line-round-limit":new Ts(Zt.layout_line["line-round-limit"]),"line-sort-key":new Is(Zt.layout_line["line-sort-key"])}),qh={paint:new Ps({"line-opacity":new Is(Zt.paint_line["line-opacity"]),"line-animate-enable":new Ts(Zt.paint_line["line-animate-enable"]),"line-animate-duration":new Ts(Zt.paint_line["line-animate-duration"]),"line-animate-interval":new Ts(Zt.paint_line["line-animate-interval"]),"line-animate-trailLength":new Ts(Zt.paint_line["line-animate-trailLength"]),"line-color":new Is(Zt.paint_line["line-color"]),"line-translate":new Ts(Zt.paint_line["line-translate"]),"line-translate-anchor":new Ts(Zt.paint_line["line-translate-anchor"]),"line-width":new Is(Zt.paint_line["line-width"]),"line-height":new Is(Zt.paint_line["line-height"]),"line-gap-width":new Is(Zt.paint_line["line-gap-width"]),"line-offset":new Is(Zt.paint_line["line-offset"]),"line-blur":new Is(Zt.paint_line["line-blur"]),"line-dasharray":new Ss(Zt.paint_line["line-dasharray"]),"line-pattern":new Ss(Zt.paint_line["line-pattern"]),"line-gradient":new As(Zt.paint_line["line-gradient"])}),layout:Zh},Xh=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 ms(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=v({},i,{zoom:Math.floor(i.zoom)}),t.prototype.evaluate.call(this,e,i,r,o)},e}(Is),Wh=new Xh(qh.paint.properties["line-width"].specification);Wh.useIntegerZoom=!0;var Hh=function(t){function e(e){t.call(this,e,qh),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 Ii,this.gradientVersion=(this.gradientVersion+1)%s}},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"]=Wh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Gh(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 Xl(this,t)},e.prototype.queryRadius=function(t){var e=t,i=Yh(wu("line-width",this,e),wu("line-gap-width",this,e)),r=wu("line-offset",this,e);return i/2+Math.abs(r)+ku(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,o,n,a){if(t.queryGeometry.isAboveHorizon)return!1;var s=Tu(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Yh(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=3)for(var n=0;n0},e}(tu);function Yh(t,e){return e>0?e+2*t:t}var Kh=Ds([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Jh=Ds([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ds([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Qh=Ds([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),$h=Ds([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ds([{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 tc=Ds([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ec=Ds([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ds([{name:"triangle",components:3,type:"Uint16"}]),Ds([{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"}]),Ds([{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"}]),Ds([{type:"Float32",name:"offsetX"}]),Ds([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var ic=24,rc=128;function oc(t,e){var i=e.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ms(t+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,o=i.interpolationType,n=0;n":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function pc(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function hc(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var cc=function(t,e,i,r,o){var n,a,s=8*o-r-1,l=(1<>1,p=-7,h=i?o-1:0,c=i?-1:1,f=t[e+h];for(h+=c,n=f&(1<<-p)-1,f>>=-p,p+=s;p>0;n=256*n+t[e+h],h+=c,p-=8);for(a=n&(1<<-p)-1,n>>=-p,p+=r;p>0;a=256*a+t[e+h],h+=c,p-=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)},fc=function(t,e,i,r,o,n){var a,s,l,u=8*n-o-1,p=(1<>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=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?c/l:c*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=p?(s=0,a=p):a+h>=1?(s=(e*l-1)*Math.pow(2,o),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;t[i+f]=255&s,f+=d,s/=256,o-=8);for(a=a<0;t[i+f]=255&a,f+=d,a/=256,u-=8);t[i+f-d]|=128*m},dc=mc;function mc(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}mc.Varint=0,mc.Fixed64=1,mc.Bytes=2,mc.Fixed32=5;var yc=4294967296,gc=1/yc,_c="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function vc(t){return t.type===mc.Bytes?t.readVarint()+t.pos:t.pos+1}function xc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function bc(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 wc(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function zc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Dc(t,e,i){e.glyphs=[],1===t&&i.readMessage(Oc,e)}function Oc(t,e,i){if(3===t){var r=i.readMessage(Rc,{}),o=r.width,n=r.height,a=r.left,s=r.top,l=r.advance;e.glyphs.push({id:r.id,bitmap:new cp({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 Rc(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 Bc(t){for(var e=0,i=0,r=0,o=t;r=0;c--){var f=a[c];if(!(h.w>f.w||h.h>f.h)){if(h.x=f.x,h.y=f.y,l=Math.max(l,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===f.w&&h.h===f.h){var d=a.pop();c>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=Lc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=zc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Lc(this.buf,this.pos)+Lc(this.buf,this.pos+4)*yc;return this.pos+=8,t},readSFixed64:function(){var t=Lc(this.buf,this.pos)+zc(this.buf,this.pos+4)*yc;return this.pos+=8,t},readFloat:function(){var t=cc(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=cc(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 xc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<3,o<128)return xc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<10,o<128)return xc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<17,o<128)return xc(t,r,e);if(r|=(127&(o=n[i.pos++]))<<24,o<128)return xc(t,r,e);if(r|=(1&(o=n[i.pos++]))<<31,o<128)return xc(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&&_c?function(t,e,i){return _c.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",o=e;o239?4:l>223?3:l>191?2:1;if(o+p>i)break;1===p?l<128&&(u=l):2===p?128==(192&(n=t[o+1]))&&(u=(31&l)<<6|63&n)<=127&&(u=null):3===p?(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===p&&(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,p=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),o+=p}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!==mc.Bytes)return t.push(this.readVarint(e));var i=vc(this);for(t=t||[];this.pos127;);else if(e===mc.Bytes)this.pos=this.readVarint()+this.pos;else if(e===mc.Fixed32)this.pos+=4;else{if(e!==mc.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;e268435455||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;n55295&&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&&bc(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),fc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),fc(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=128&&bc(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,mc.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,wc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,kc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Sc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Tc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Ic,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Ec,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ac,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Pc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Mc,e)},writeBytesField:function(t,e){this.writeTag(t,mc.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,mc.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,mc.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,mc.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,mc.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,mc.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,mc.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,mc.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,mc.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,mc.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Fc=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},Uc={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};Uc.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Uc.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Uc.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Fc.prototype,Uc);var jc=function(t,e){var i={},r={};this.haveRenderCallbacks=[];var o=[];this.addImages(t,i,o),this.addImages(e,r,o);var n=Bc(o),a=new fp({width:n.w||1,height:n.h||1});for(var s in t){var l=t[s],u=i[s].paddedRect;fp.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var p in e){var h=e[p],c=r[p].paddedRect,f=c.x+1,d=c.y+1,m=h.data.width,y=h.data.height;fp.copy(h.data,a,{x:0,y:0},{x:f,y:d},h.data),fp.copy(h.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:m,height:1}),fp.copy(h.data,a,{x:0,y:0},{x:f,y:d+y},{width:m,height:1}),fp.copy(h.data,a,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:y}),fp.copy(h.data,a,{x:0,y:0},{x:f+m,y:d},{width:1,height:y})}this.image=a,this.iconPositions=i,this.patternPositions=r};jc.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 Fc(n,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(r)}},jc.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)},jc.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]})}},ga("ImagePosition",Fc),ga("ImageAtlas",jc);var Nc={horizontal:1,vertical:2,horizontalOnly:3},Vc=function(){this.scale=1,this.fontStack="",this.imageName=null};Vc.forText=function(t,e){var i=new Vc;return i.scale=t||1,i.fontStack=e,i},Vc.forImage=function(t){var e=new Vc;return e.imageName=t,e};var Gc=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Zc(t,e,i,r,o,n,a,s,l,u,p,h,c,f,d,m){var y,g=Gc.fromFeature(t,o);h===Nc.vertical&&g.verticalizePunctuation(c&&"point"===f);var _=ds.processBidirectionalText,v=ds.processStyledBidirectionalText;if(_&&1===g.sections.length){y=[];for(var x=0,b=_(g.toString(),Qc(g,u,n,e,r,f,d));x0&&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?ic: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=$,z=(J-Q)/2*F),G=-J*F}else G=(E-F)*ic-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?tf(M,m,L,z,n*E/2):tf(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=$c(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=0&&r>=t&&qc[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(t,i),this.sectionIndex=this.sectionIndex.slice(t,i)},Gc.prototype.substring=function(t,e){var i=new Gc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i},Gc.prototype.toString=function(){return this.text},Gc.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,i){return Math.max(e,t.sections[i].scale)}),0)},Gc.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Vc.forText(t.scale,t.fontStack||e));for(var i=this.sections.length-1,r=0;r=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var qc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xc={};function Wc(t,e,i,r,o,n){if(e.imageName){var a=r[e.imageName];return a?a.displaySize[0]*e.scale*ic/n+o:0}var s=i[e.fontStack],l=s&&s.glyphs[t];return l?l.metrics.advance*e.scale+o:0}function Hc(t,e,i,r){var o=Math.pow(t-e,2);return r?t=0,h=0,c=0;c-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;sr;)u-=l.shift().angleDelta;if(u>o)return!1;a++,s+=p.dist(h)}return!0}function nf(t){for(var e=0,i=0;iu){var d=(u-l)/f,m=Si(h.x,c.x,d),y=Si(h.y,c.y,d),g=new rf(m,y,c.angleTo(h),p);return g._round(),!a||of(t,g,s,a,e)?g:void 0}l+=f}}function uf(t,e,i,r,o,n,a,s,l){var u=af(r,n,a),p=sf(r,o),h=p*a,c=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&x=0&&b=0&&c+u<=p){var w=new rf(x,b,_,d);w._round(),r&&!of(t,w,n,r,o)||f.push(w)}}h+=g}return s||f.length||a||(f=pf(t,h/2,i,r,o,n,a,!0,l)),f}function hf(t,e,i,o,n){for(var a=[],s=0;s=o&&c.x>=o||(h.x>=o?h=new r(o,h.y+(o-h.x)/(c.x-h.x)*(c.y-h.y))._round():c.x>=o&&(c=new r(o,h.y+(o-h.x)/(c.x-h.x)*(c.y-h.y))._round()),h.y>=n&&c.y>=n||(h.y>=n?h=new r(h.x+(n-h.y)/(c.y-h.y)*(c.x-h.x),n)._round():c.y>=n&&(c=new r(h.x+(n-h.y)/(c.y-h.y)*(c.x-h.x),n)._round()),u&&h.equals(u[u.length-1])||a.push(u=[h]),u.push(c)))))}return a}ga("Anchor",rf);var cf=mf,ff=mf,df=1e20;function mf(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 yf(t,e,i,r,o,n){for(var a=0;a-1);n[++l]=s,a[l]=u,a[l+1]=df}for(s=0,l=0;s65535)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]=[],vf.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;o0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};function Ef(t,e){return te?1:0}function Af(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;ua)&&(a=p.x),(!u||p.y>s)&&(s=p.y)}var h=Math.min(a-o,s-n),c=h/2,f=new Sf([],Pf);if(0===h)return new r(o,n);for(var d=o;dy.d||!y.d)&&(y=g),g.max-y.d<=e||(f.push(new Mf(g.p.x-(c=g.h/2),g.p.y-c,c,t)),f.push(new Mf(g.p.x+c,g.p.y-c,c,t)),f.push(new Mf(g.p.x-c,g.p.y+c,c,t)),f.push(new Mf(g.p.x+c,g.p.y+c,c,t)),4)}return y.p}function Pf(t,e){return e.max-t.max}function Mf(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;ot.y!=p.y>t.y&&t.x<(p.x-u.x)*(t.y-u.y)/(p.y-u.y)+u.x&&(i=!i),r=Math.min(r,gu(t,u,p))}return(i?1:-1)*Math.sqrt(r)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}Sf.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Sf.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}},Sf.prototype.peek=function(){return this.data[0]},Sf.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},Sf.prototype._down=function(t){for(var e=this.data,i=this.compare,r=this.length>>1,o=e[t];t=0)break;e[t]=a,t=n}e[t]=o};var Lf=Number.POSITIVE_INFINITY,Cf=Math.sqrt(2);function zf(t,e){return e[1]!==Lf?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/Cf;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 Df(t,e,i,r,o,n,a,s){t.createArrays(),t.tilePixelRatio=ru/(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 c=t.textSizeData,f=c.maxZoom;h.compositeTextSizes=[u["text-size"].possiblyEvaluate(new ms(c.minZoom),a),u["text-size"].possiblyEvaluate(new ms(f),a)]}if("composite"===t.iconSizeData.kind){var d=t.iconSizeData,m=d.maxZoom;h.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new ms(d.minZoom),a),u["icon-size"].possiblyEvaluate(new ms(m),a)]}h.layoutTextSize=u["text-size"].possiblyEvaluate(new ms(s+1),a),h.layoutIconSize=u["icon-size"].possiblyEvaluate(new ms(s+1),a),h.textMaxSize=u["text-size"].possiblyEvaluate(new ms(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),c=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)*ic,k=l.get("text-line-height").evaluate(n,{},a)*ic,T=function(t){for(var e=0,i=t;e=ru||p.y<0||p.y>=ru||function(t,e,i,r,o,n,a,s,l,u,p,h,c,f,d,m,y,g,_,v,x,b,w,k){var T,I,S,E,A,P,M,C,z=t.addToLineVertexArray(e,i),D=0,O=0,R=0,B=0,F=-1,U=-1,j={},N=kl(""),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*ic})))[0],G=T[1]):(V=s.layout.get("text-radial-offset").evaluate(v,{},w)*ic,G=Lf),t.allowVerticalPlacement&&r.vertical){var Z=r.vertical;if(f)M=jf(Z),a&&(C=jf(a));else{var q=s.layout.get("text-rotate").evaluate(v,{},w)+90;E=Uf(l,e,u,p,h,Z,c,q,d),a&&(A=Uf(l,e,u,p,h,a,y,q))}}if(o){var X=s.layout.get("icon-rotate").evaluate(v,{},w),W="none"!==s.layout.get("icon-text-fit"),H=xf(o,X,b,W),Y=a?xf(a,X,b,W):void 0;S=Uf(l,e,u,p,h,o,y,X),D=4*H.length;var K=t.iconSizeData,J=null;"source"===K.kind?(J=[rc*s.layout.get("icon-size").evaluate(v,{},w)])[0]>Rf&&L(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===K.kind&&((J=[rc*x.compositeIconSizes[0].evaluate(v,{},w),rc*x.compositeIconSizes[1].evaluate(v,{},w)])[0]>Rf||J[1]>Rf)&&L(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,H,J,_,g,v,!1,e,z.lineStartIndex,z.lineLength,-1,w),F=t.icon.placedSymbolArray.length-1,Y&&(O=4*Y.length,t.addSymbols(t.icon,Y,J,_,g,v,Nc.vertical,e,z.lineStartIndex,z.lineLength,-1,w),U=t.icon.placedSymbolArray.length-1)}for(var Q in r.horizontal){var $=r.horizontal[Q];I||(N=kl($.text),f?P=jf($):I=Uf(l,e,u,p,h,$,c,s.layout.get("text-rotate").evaluate(v,{},w),d));var tt=1===$.positionedLines.length;if(R+=Bf(t,e,$,n,s,f,v,d,z,r.vertical?Nc.horizontal:Nc.horizontalOnly,tt?Object.keys(r.horizontal):[Q],j,F,x,w),tt)break}r.vertical&&(B+=Bf(t,e,r.vertical,n,s,f,v,d,z,Nc.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(C,et))>-1?1:0;rt&&(et*=k/ic),t.glyphOffsetArray.length>=Yf.MAX_GLYPHS&&L("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,D,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=hf(e.geometry,0,0,ru,ru);P1){var U=lf(F,w,i.vertical||y,r,24,_);U&&A(F,U)}}else if("Polygon"===e.type)for(var j=0,N=Qp(e.geometry,0);j0?[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;fRf&&L(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===g.kind&&((_=[rc*d.compositeTextSizes[0].evaluate(s,{},m),rc*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>Rf||_[1]>Rf)&&L(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,_,l,a,s,p,e,u.lineStartIndex,u.lineLength,f,m);for(var v=0,x=h;v0?Math.max(10,e):null}function Nf(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])0)&&("constant"!==n.value.kind||n.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],l||u){for(var h=e.iconDependencies,c=e.glyphDependencies,f=e.availableImages,d=new ms(this.zoom),m=0,y=t;m=0;for(var C=0,z=T.sections;C=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=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:r),n=nc(this.textSizeData,t,o)/ic;return this.tilePixelRatio*n},Yf.prototype.getSymbolInstanceIconSize=function(t,e,i){var r=this.icon.placedSymbolArray.get(i),o=nc(this.iconSizeData,t,r);return this.tilePixelRatio*o},Yf.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)},Yf.prototype._updateTextDebugCollisionBoxes=function(t,e,i,r,o,n){for(var a=r;a0},Yf.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Yf.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},Yf.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},Yf.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},Yf.prototype.addIndicesForPlacedSymbol=function(t,e){for(var i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs,o=i.vertexStartIndex;o1||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=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)}},ga("SymbolBucket",Yf,{omit:["layers","collisionBoxArray","features","compareText"]}),Yf.MAX_GLYPHS=65535,Yf.addDynamicAttributes=qf;var Kf=new Ps({"symbol-placement":new Ts(Zt.layout_symbol["symbol-placement"]),"symbol-spacing":new Ts(Zt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ts(Zt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Is(Zt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ts(Zt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ts(Zt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ts(Zt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ts(Zt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ts(Zt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Is(Zt.layout_symbol["icon-size"]),"icon-text-fit":new Ts(Zt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ts(Zt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Is(Zt.layout_symbol["icon-image"]),"icon-rotate":new Is(Zt.layout_symbol["icon-rotate"]),"icon-padding":new Ts(Zt.layout_symbol["icon-padding"]),"icon-keep-upright":new Ts(Zt.layout_symbol["icon-keep-upright"]),"icon-offset":new Is(Zt.layout_symbol["icon-offset"]),"icon-anchor":new Is(Zt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ts(Zt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ts(Zt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ts(Zt.layout_symbol["text-rotation-alignment"]),"text-field":new Is(Zt.layout_symbol["text-field"]),"text-font":new Is(Zt.layout_symbol["text-font"]),"text-size":new Is(Zt.layout_symbol["text-size"]),"text-max-width":new Is(Zt.layout_symbol["text-max-width"]),"text-line-height":new Is(Zt.layout_symbol["text-line-height"]),"text-letter-spacing":new Is(Zt.layout_symbol["text-letter-spacing"]),"text-justify":new Is(Zt.layout_symbol["text-justify"]),"text-radial-offset":new Is(Zt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ts(Zt.layout_symbol["text-variable-anchor"]),"text-anchor":new Is(Zt.layout_symbol["text-anchor"]),"text-max-angle":new Ts(Zt.layout_symbol["text-max-angle"]),"text-writing-mode":new Ts(Zt.layout_symbol["text-writing-mode"]),"text-rotate":new Is(Zt.layout_symbol["text-rotate"]),"text-padding":new Ts(Zt.layout_symbol["text-padding"]),"text-keep-upright":new Ts(Zt.layout_symbol["text-keep-upright"]),"text-transform":new Is(Zt.layout_symbol["text-transform"]),"text-offset":new Is(Zt.layout_symbol["text-offset"]),"text-allow-overlap":new Ts(Zt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ts(Zt.layout_symbol["text-ignore-placement"]),"text-optional":new Ts(Zt.layout_symbol["text-optional"])}),Jf={paint:new Ps({"icon-opacity":new Is(Zt.paint_symbol["icon-opacity"]),"icon-color":new Is(Zt.paint_symbol["icon-color"]),"icon-halo-color":new Is(Zt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Is(Zt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Is(Zt.paint_symbol["icon-halo-blur"]),"icon-translate":new Ts(Zt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ts(Zt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Is(Zt.paint_symbol["text-opacity"]),"text-color":new Is(Zt.paint_symbol["text-color"],{runtimeType:re,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Is(Zt.paint_symbol["text-halo-color"]),"text-halo-width":new Is(Zt.paint_symbol["text-halo-width"]),"text-halo-blur":new Is(Zt.paint_symbol["text-halo-blur"]),"text-translate":new Ts(Zt.paint_symbol["text-translate"]),"text-translate-anchor":new Ts(Zt.paint_symbol["text-translate-anchor"])}),layout:Kf},Qf=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:$t,this.defaultValue=t};Qf.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},Qf.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Qf.prototype.outputDefined=function(){return!1},Qf.prototype.serialize=function(){return null},ga("FormatSectionOverride",Qf,{omit:["defaultValue"]});var $f=function(t){function e(e){t.call(this,e,Jf)}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;nthis._total||this.getTotalUsedThisFrame()>this._total&&(this.end(),!0)};var ud=function(){this._statsElements=new Array(sd.STAT_COUNT);for(var t=0;t-1&&!p.bufferView&&p.uri){var h=this.url+this.map._requestManager.normalizeImageLibURL(p.uri);this.externalImages.push(h)}}}}this.map.style._textureManager.loadImages(this.externalImages),this.bufferFilled=!0}},_d.prototype.populate=function(t,e,i){},_d.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))},_d.prototype.isEmpty=function(){return!1},_d.prototype.uploadPending=function(){return!this.uploaded||this.programConfig.needsUpload||this.programTextureConfig.needsUpload},_d.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=ad[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]):ad.default.albedo,e.metallic=ad.default.metallic,e.roughness=ad.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 p=this.modelData.getBufferView(s.bufferView),h=this.modelData.getBuffer(p.buffer),c=this.modelData.gltf.binChunks[p.buffer];if(h.byteLength===c.byteLength){var f=new Uint8Array(c.arrayBuffer,p.byteOffset+c.byteOffset,p.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;bthis._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&o},Id.convert=function(t){return!t||t instanceof Id?t:new Id(t)};var Sd=6371008.8,Ed={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Sd,metres:Sd,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:5825721.287490856},Ad={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/Sd,yards:1/1.0936},Pd={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 Md(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 Ld(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(!qd(t[0])||!qd(t[1]))throw new Error("coordinates must contain numbers");return Md({type:"Point",coordinates:t},e,i)}function Cd(t,e,i){void 0===i&&(i={});for(var r=0,o=t;r=0))throw new Error("length must be a positive number");return Fd(Ud(t,e),i)}function qd(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Xd(t){return!!t&&t.constructor===Object}function Wd(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 Hd(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 Yd(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 Kd(t){return"Feature"===t.type?t.geometry:t}var Jd=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;et&&(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 Qd(t,e,i,r){void 0===r&&(r={});var o=Wd(t),n=Gd(o[0]),a=Gd(o[1]),s=Gd(i),l=Ud(e,r.units),u=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return Ld([Vd(n+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(u))),Vd(u)],r.properties)}function $d(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;as||c>l||f>u)return a=n,s=i,l=c,u=f,void(o=0);var d=zd([a,n],t.properties);if(!1===e(d,i,r,f,o))return!1;o++,a=n}))&&void 0}}}))}function pm(t,e,i){var r=i,o=!1;return um(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 hm(t,e){if(!t)throw new Error("geojson is required");lm(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;nt[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]80*i){r=n=t[0],o=a=t[1];for(var d=i;dn&&(n=s),l>a&&(a=l);u=0!==(u=Math.max(n-r,a-o))?1/u:0}return _m(c,f,i,r,o,u),f}function ym(t,e,i,r,o){var n,a;if(o===jm(t,e,i,r)>0)for(n=e;n=e;n-=r)a=Bm(n,t[n],t[n+1],a);return a&&Lm(a,a.next)&&(Fm(a),a=a.next),a}function gm(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Lm(r,r.next)&&0!==Mm(r.prev,r,r.next))r=r.next;else{if(Fm(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function _m(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=Sm(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;e0||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?xm(t,r,o,n):vm(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Fm(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?_m(t=bm(gm(t),e,i),e,i,r,o,n,2):2===a&&wm(t,e,i,r,o,n):_m(gm(t),e,i,r,o,n,1);break}}}function vm(t){var e=t.prev,i=t,r=t.next;if(Mm(e,i,r)>=0)return!1;for(var o=t.next.next;o!==t.prev;){if(Am(e.x,e.y,i.x,i.y,r.x,r.y,o.x,o.y)&&Mm(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function xm(t,e,i,r){var o=t.prev,n=t,a=t.next;if(Mm(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=Sm(o.x=u&&c&&c.z<=p;){if(h!==t.prev&&h!==t.next&&Am(o.x,o.y,n.x,n.y,a.x,a.y,h.x,h.y)&&Mm(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,c!==t.prev&&c!==t.next&&Am(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Mm(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Am(o.x,o.y,n.x,n.y,a.x,a.y,h.x,h.y)&&Mm(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;c&&c.z<=p;){if(c!==t.prev&&c!==t.next&&Am(o.x,o.y,n.x,n.y,a.x,a.y,c.x,c.y)&&Mm(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function bm(t,e,i){var r=t;do{var o=r.prev,n=r.next.next;!Lm(o,n)&&Cm(o,r,r.next,n)&&Om(o,n)&&Om(n,o)&&(e.push(o.i/i),e.push(r.i/i),e.push(n.i/i),Fm(r),Fm(r.next),r=t=n),r=r.next}while(r!==t);return gm(r)}function wm(t,e,i,r,o,n){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Pm(a,s)){var l=Rm(a,s);return a=gm(a,a.next),l=gm(l,l.next),_m(a,e,i,r,o,n),void _m(l,e,i,r,o,n)}s=s.next}a=a.next}while(a!==t)}function km(t,e){return t.x-e.x}function Tm(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.x&&r.x>=p&&o!==r.x&&Am(ni.x||r.x===i.x&&Im(i,r)))&&(i=r,c=l)),r=r.next}while(r!==u);return i}(t,e),e){var i=Rm(e,t);gm(e,e.next),gm(i,i.next)}}function Im(t,e){return Mm(t.prev,t,e.prev)<0&&Mm(e.next,t,t.next)<0}function Sm(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 Em(t){var e=t,i=t;do{(e.x=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(n-s)-(o-a)*(r-s)>=0}function Pm(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&&Cm(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Om(t,e)&&Om(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)&&(Mm(t.prev,t,e.prev)||Mm(t,e.prev,e))||Lm(t,e)&&Mm(t.prev,t,t.next)>0&&Mm(e.prev,e,e.next)>0)}function Mm(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Lm(t,e){return t.x===e.x&&t.y===e.y}function Cm(t,e,i,r){var o=Dm(Mm(t,e,i)),n=Dm(Mm(t,e,r)),a=Dm(Mm(i,r,t)),s=Dm(Mm(i,r,e));return o!==n&&a!==s||!(0!==o||!zm(t,i,e))||!(0!==n||!zm(t,r,e))||!(0!==a||!zm(i,t,r))||!(0!==s||!zm(i,e,r))}function zm(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 Dm(t){return t>0?1:t<0?-1:0}function Om(t,e){return Mm(t.prev,t,t.next)<0?Mm(t,e,t.next)>=0&&Mm(t,t.prev,e)>=0:Mm(t,e,t.prev)<0||Mm(t,t.next,e)<0}function Rm(t,e){var i=new Um(t.i,t.x,t.y),r=new Um(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 Bm(t,e,i,r){var o=new Um(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 Fm(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 Um(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 jm(t,e,i,r){for(var o=0,n=e,a=i-r;n0&&i.holes.push(r+=t[o-1].length)}return i}(t),i=fm(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=t[0]&&e[3]>=t[1]}(r,a))return!1;"Polygon"===n&&(s=[s]);for(var l=!1,u=0;ut[1]!=u>t[1]&&t[0]<(l-a)*(t[1]-s)/(u-s)+a&&(r=!r)}return r}function qm(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Xm(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 Xm(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Hm(t);default:throw new Error("unknown GeoJSON type")}}function Xm(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=Wm(t.properties),e.geometry=Hm(t.geometry),e}function Wm(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})):Wm(r):r})),e):e}function Hm(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Hm(t)})),e):(e.coordinates=Ym(t.coordinates),e)}function Ym(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Ym(t)}))}function Km(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 nm(e,(function(e,i){var n=em(t,e);nl?a:l,s>u?s:u],i.push(p),r})),i}(i,t.properties);r.forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),Dd(e)}mm.deviation=function(t,e,i,r){var o=e&&e.length,n=Math.abs(jm(t,0,o?e[0]*i:t.length,i));if(o)for(var a=0,s=e.length;a0&&i.holes.push(r+=t[o-1].length)}return i},fm.default=dm;var Qm="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ty(t,e){return t(e={exports:{}},e.exports),e.exports}var ey=ty((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),p=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*p*(s-p)/s)*(l-s/2<0?-1:1);t(i,r,Math.max(o,Math.floor(r-l*p/s+h)),Math.min(n,Math.floor(r+(s-l)*p/s+h)),a)}var c=i[r],f=o,d=n;for(e(i,o,r),a(i[n],c)>0&&e(i,o,n);f0;)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 te?1:0}return function(e,r,o,n,a){t(e,r,o||0,n||e.length-1,a||i)}}()})),iy=oy,ry=oy;function oy(t,e){if(!(this instanceof oy))return new oy(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 ny(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function my(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function yy(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,ey(t,n,e,i,o),a.push(e,n,n,i))}oy.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!dy(t,e))return i;for(var o,n,a,s,l=[];e;){for(o=0,n=e.children.length;o=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=my(i.children.splice(n,i.children.length-n));a.height=i.height,a.leaf=i.leaf,ay(i,this.toBBox),ay(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=my([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ay(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,o,n,a,s,l,u,p,h,c,f,d,m,y;for(l=u=1/0,r=e;r<=i-e;r++)h=o=sy(t,0,r,this.toBBox),c=n=sy(t,r,i,this.toBBox),f=Math.max(h.minX,c.minX),d=Math.max(h.minY,c.minY),m=Math.min(h.maxX,c.maxX),y=Math.min(h.maxY,c.maxY),a=Math.max(0,m-f)*Math.max(0,y-d),s=hy(o)+hy(n),a=e;o--)n=t.children[o],ly(l,t.leaf?a(n):n),u+=cy(l);return u},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--)ly(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():ay(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]+"};")}},iy.default=ry;var gy=ty((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=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=p,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return c(h(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 p(h(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`")}}));$m(gy);var _y=ty((function(t,e){function i(t,e,r){if(null!==t)for(var o,n,a,s,l,u,p,h,c=0,f=0,d=t.type,m="FeatureCollection"===d,y="Feature"===d,g=m?t.features.length:1,_=0;_l||c>u||f>p)return s=i,l=r,u=c,p=f,void(n=0);var d=gy.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 line1 must only contain 2 coordinates");if(2!==r.length)throw new Error(" 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],p=r[1][0],h=r[1][1],c=(h-u)*(a-o)-(p-l)*(s-n);if(0===c)return null;var f=((p-l)*(n-u)-(h-u)*(o-l))/c,d=((a-o)*(n-u)-(s-n)*(o-l))/c;return f>=0&&f<=1&&d>=0&&d<=1?Ld([o+f*(a-o),n+f*(s-n)]):null}function Sy(t,e,i){void 0===i&&(i={});var r=Ld([1/0,1/0],{dist:1/0}),o=0;return lm(t,(function(t){for(var n=Hd(t),a=0;a0&&((m=d.features[0]).properties.dist=em(e,m,i),m.properties.location=o+em(s,m,i)),s.properties.dist0){e+=Math.abs(My(t[0]));for(var i=1;i2){for(a=0;a=o&&n===r.length-1);n++){if(o>=e){var a=e-o;if(a){var s=tm(r[n],r[n-1])-180;return Qd(r[n],a,s,i)}return Ld(r[n])}o+=em(r[n],r[n+1],i)}return Ld(r[r.length-1])}function zy(t,e){return void 0===e&&(e={}),pm(t,(function(t,i){var r=i.geometry.coordinates;return t+em(r[0],r[1],e)}),0)}function Dy(t){if(!t)throw new Error("geojson is required");var e=[];return lm(t,(function(t){e.push(t)})),Dd(e)}function Oy(t,e,i,r){if(!Xd(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,p=0,h=0;h=p&&h===o.length-1);h++){if(p>e&&0===n.length){if(!(a=e-p))return n.push(o[h]),zd(n);s=tm(o[h],o[h-1])-180,l=Qd(o[h],a,s,r),n.push(l.geometry.coordinates)}if(p>=i)return(a=i-p)?(s=tm(o[h],o[h-1])-180,l=Qd(o[h],a,s,r),n.push(l.geometry.coordinates),zd(n)):(n.push(o[h]),zd(n));if(p>=e&&n.push(o[h]),h===o.length-1)return zd(n);p+=em(o[h],o[h+1],r)}if(p180?-(360-r):r}function By(t,e){var i=Gd(t[1]),r=Gd(e[1]),o=Gd(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(Vd(Math.atan2(o,n))+360)%360}function Fy(t,e,i,r){void 0===r&&(r={});var o=e<0,n=Zd(Math.abs(e),r.units,"meters");o&&(n=-Math.abs(n));var a=Wd(t),s=function(t,e,i,r){var o=e/(r=void 0===r?Sd:Number(r)),n=t[0]*Math.PI/180,a=Gd(t[1]),s=Gd(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 p=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),h=Math.abs(p)>1e-11?l/p:Math.cos(a);return[(180*(n+o*Math.sin(s)/h)/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,Ld(s,r.properties)}function Uy(t,e,i){void 0===i&&(i={});var r=Wd(t),o=Wd(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?Sd: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 Zd(n,"meters",i.units)}function jy(t,e,i){if(!Xd(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 rm(t,(function(t){i+=t[0],r+=t[1],o++}),!0),Ld([i/o,r/o],e.properties)}(t)),!1!==o&&void 0!==o||(t=qm(t)),rm(t,(function(t){var i=Ry(r,t)+e,o=Uy(r,t),n=Hd(Fy(r,o,i));t[0]=n[0],t[1]=n[1]}))),t}function Ny(t,e,i){void 0===i&&(i={});for(var r=Wd(t),o=Hd(e),n=0;n=Math.abs(h)?p>0?a0?s=Math.abs(h)?p>0?a<=o&&o0?s<=n&&n=Math.abs(h)?p>0?a0?s=Math.abs(h)?p>0?a<=o&&o<=l:l<=o&&o<=a:h>0?s<=n&&n<=u:u<=n&&n<=s)}function Gy(t,e){var i=Kd(t),r=Kd(e),o=i.type,n=r.type,a=i.coordinates,s=r.coordinates;switch(o){case"Point":if("Point"===n)return qy(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;ie[0]||t[2]e[1]||t[3]0}var Wy,Hy=Object.prototype.toString,Yy=function(t){var e=Hy.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]"===Hy.call(t.callee)),i};if(!Object.keys){var Ky=Object.prototype.hasOwnProperty,Jy=Object.prototype.toString,Qy=Yy,$y=Object.prototype.propertyIsEnumerable,tg=!$y.call({toString:null},"toString"),eg=$y.call((function(){}),"prototype"),ig=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],rg=function(t){var e=t.constructor;return e&&e.prototype===t},og={$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},ng=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!og["$"+t]&&Ky.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{rg(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();Wy=function(t){var e=null!==t&&"object"==typeof t,i="[object Function]"===Jy.call(t),r=Qy(t),o=e&&"[object String]"===Jy.call(t),n=[];if(!e&&!i&&!r)throw new TypeError("Object.keys called on a non-object");var a=eg&&i;if(o&&t.length>0&&!Ky.call(t,0))for(var s=0;s0)for(var l=0;l1&&"boolean"!=typeof e)throw new wg('"allowMissing" argument must be a boolean');var i=Ng(t),r=i.length>0?i[0]:"",o=Vg("%"+r+"%",e),n=o.name,a=o.value,s=!1,l=o.alias;l&&(r=l[0],Rg(i,Og([0,1],l)));for(var u=1,p=!0;u=i.length){var d=Tg(a,h);a=(p=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[h]}else p=vg(a,h),a=a[h];p&&!s&&(zg[n]=a)}}return a},Zg=ty((function(t){var e=Gg("%Function.prototype.apply%"),i=Gg("%Function.prototype.call%"),r=Gg("%Reflect.apply%",!0)||_g.call(i,e),o=Gg("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(t){o=null}t.exports=function(){return r(_g,i,arguments)};var n=function(){return r(_g,e,arguments)};o?o(t.exports,"apply",{value:n}):t.exports.apply=n})),qg=Zg(Gg("String.prototype.indexOf")),Xg="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Wg=function(t,e){var i=Gg(t,!1);return"function"==typeof i&&qg(t,".prototype.")>-1?Zg(i):i}("Object.prototype.toString"),Hg=function(t){return!(Xg&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===Wg(t)},Yg=function(t){return!!Hg(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==Wg(t)&&"[object Function]"===Wg(t.callee)},Kg=function(){return Hg(arguments)}();Hg.isLegacyArguments=Yg;var Jg=Kg?Hg:Yg,Qg="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),$g=Object.prototype.toString,t_=Array.prototype.concat,e_=Object.defineProperty,i_=e_&&function(){var t={};try{for(var e in e_(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),r_=function(t,e,i,r){var o;(!(e in t)||"function"==typeof(o=r)&&"[object Function]"===$g.call(o)&&r())&&(i_?e_(t,e,{configurable:!0,enumerable:!1,value:i,writable:!0}):t[e]=i)},o_=function(t,e){var i=arguments.length>2?arguments[2]:{},r=hg(e);Qg&&(r=t_.call(r,Object.getOwnPropertySymbols(e)));for(var o=0;o1&&"boolean"!=typeof e)throw new TypeError('"allowMissing" argument must be a boolean');for(var i=C_(t),r=z_("%"+(i.length>0?i[0]:"")+"%",e),o=1;o=i.length){var n=w_(r,i[o]);if(!e&&!(i[o]in r))throw new b_("base intrinsic for "+t+" exists, but the property is not available.");r=n&&"get"in n&&!("originalValue"in n.get)?n.get:r[i[o]]}else r=r[i[o]];return r},O_=ty((function(t){var e=D_("%Function.prototype.apply%"),i=D_("%Function.prototype.call%"),r=D_("%Reflect.apply%",!0)||_g.call(i,e),o=D_("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(t){o=null}t.exports=function(){return r(_g,i,arguments)};var n=function(){return r(_g,e,arguments)};o?o(t.exports,"apply",{value:n}):t.exports.apply=n})),R_=Object,B_=TypeError,F_=function(){if(null!=this&&this!==R_(this))throw new B_("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},U_=n_.supportsDescriptors,j_=Object.getOwnPropertyDescriptor,N_=TypeError,V_=function(){if(!U_)throw new N_("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var t=j_(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof/a/.dotAll)return t.get}return F_},G_=n_.supportsDescriptors,Z_=Object.getOwnPropertyDescriptor,q_=Object.defineProperty,X_=TypeError,W_=Object.getPrototypeOf,H_=/a/,Y_=O_(F_);n_(Y_,{getPolyfill:V_,implementation:F_,shim:function(){if(!G_||!W_)throw new X_("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=V_(),e=W_(H_),i=Z_(e,"flags");return i&&i.get===t||q_(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var K_=Y_,J_=Date.prototype.getDay,Q_=Object.prototype.toString,$_="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,tv=function(t){return"object"==typeof t&&null!==t&&($_?function(t){try{return J_.call(t),!0}catch(t){return!1}}(t):"[object Date]"===Q_.call(t))},ev=Date.prototype.getTime;function iv(t){return null==t}function rv(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 ov=function t(e,i,r){var o=r||{};return!!(o.strict?d_(e,i):e===i)||(!e||!i||"object"!=typeof e&&"object"!=typeof i?o.strict?d_(e,i):e==i:function(e,i,r){var o,n;if(typeof e!=typeof i)return!1;if(iv(e)||iv(i))return!1;if(e.prototype!==i.prototype)return!1;if(Jg(e)!==Jg(i))return!1;var a=x_(e),s=x_(i);if(a!==s)return!1;if(a||s)return e.source===i.source&&K_(e)===K_(i);if(tv(e)&&tv(i))return ev.call(e)===ev.call(i);var l=rv(e),u=rv(i);if(l!==u)return!1;if(l||u){if(e.length!==i.length)return!1;for(o=0;o=0;o--)if(p[o]!=h[o])return!1;for(o=p.length-1;o>=0;o--)if(!t(e[n=p[o]],i[n],r))return!1;return!0}(e,i,o))};function nv(t,e){var i=Hd(e),r=Hd(t),o=r[0],n=r[r.length-1],a=t.geometry.coordinates;return ov(i[0],o)?a.unshift(i[1]):ov(i[0],n)?a.push(i[1]):ov(i[1],o)?a.unshift(i[0]):ov(i[1],n)&&a.push(i[0]),t}var av=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:uv};function sv(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function lv(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function uv(t,e){return ov(t,e,{strict:!0})}av.prototype.compare=function(t,e){if(t.type!==e.type||!lv(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=sv(t),o=sv(e);return r.every((function(t){return this.some((function(e){return i.compare(t,e)}))}),o)}}return!1},av.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i=0&&(i=[].concat(t.slice(r,t.length),t.slice(1,r+1))),i},av.prototype.comparePath=function(t,e){var i=this;return t.every((function(t,e){return i.compareCoord(t,this[e])}),e)},av.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},av.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)},av.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},av.prototype.removePseudo=function(t){return t};var pv=av;function hv(t,e){var i=Kd(t),r=Kd(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 pv({precision:6}).compare(t,e))return!1;var a=0;switch(o){case"MultiPoint":for(var s=0;s0}function cv(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=Ld(t):"Point"===t.type?t=Md(t):Yd(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=zd(e):"LineString"===e.type?e=Md(e):Yd(e,"LineString","line");var r=1/0,o=t.geometry.coordinates;return um(e,(function(t){var e=function(t,e,i,r){var o=[i[0]-e[0],i[1]-e[1]],n=fv([t[0]-e[0],t[1]-e[1]],o);if(n<=0)return dv(t,e,{method:r.method,units:"degrees"});var a=fv(o,o);if(a<=n)return dv(t,i,{method:r.method,units:"degrees"});var s=n/a;return dv(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);ee?1:t0))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 _v(t,e,i,r){var o=new mv(t,e);if(null===i)return o.left=o.right=null,o;var n=r(t,(i=gv(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 vv(t,e,i){var r=null,o=null;if(e){var n=i((e=gv(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 xv(t,e,i,r,o){if(t){r(e+(i?"└── ":"├── ")+o(t)+"\n");var n=e+(i?" ":"│ ");t.left&&xv(t.left,n,!1,r,o),t.right&&xv(t.right,n,!0,r,o)}}var bv=function(){function t(t){void 0===t&&(t=yv),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=_v(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var i=new mv(t,e);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,o=gv(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=gv(t,e,i)).key)?(null===e.left?r=e.right:(r=gv(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=gv(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=gv(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 mv(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&&Tv(t,e,0,r-1,o),null===this._root)this._root=wv(t,e,0,r),this._size=r;else{var n=function(t,e,i){for(var r=new mv(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 mv(null,null),r=i,o=0;o0){var n=i+Math.floor(o/2),a=new mv(t[n],e[n]);return a.left=wv(t,e,i,n),a.right=wv(t,e,n+1,r),a}return null}function kv(t,e,i){var r=i-e;if(r>0){var o=e+Math.floor(r/2),n=kv(t,e,o),a=t.head;return a.left=n,t.head=t.head.next,a.right=kv(t,o+1,i),a}return null}function Tv(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}Tv(t,e,i,s,o),Tv(t,e,s+1,r,o)}}function Iv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sv(t,e){for(var i=0;ie.x?1:t.ye.y?1:0}}]),Ev(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=0&&l>=0?au?-1:0:n<0&&l<0?au?1:0:ln?1:0}}}]),t}(),Zv=0,qv=function(){function t(e,i,r,o){Iv(this,t),this.id=++Zv,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 Ev(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(na&&s>l)return-1;var p=t.comparePoint(e.leftSE.point);if(p<0)return 1;if(p>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(i>r){if(as&&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(as)return 1;if(on){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}return o>n?1:ou?1:t.ide.id?1:0}}]),Ev(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:te?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.x0&&s.swapEvents(),Gv.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;e0){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;s0))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 Gv(o,!0),new Gv(n,!1),[r],[a])}}]),t}(),Xv=function(){function t(e,i,r){if(Iv(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=Ov.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;athis.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(qv.fromRing(n,o,this))}return Ev(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,i=this.segments.length;ethis.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 Ev(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,i=this.interiorRings.length;ethis.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 Ev(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,i=this.polys.length;e0&&(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}(),Kv=function(){function t(e){Iv(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ev(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;e1&&void 0!==arguments[1]?arguments[1]:qv.compare;Iv(this,t),this.queue=e,this.tree=new bv(i),this.segments=[]}return Ev(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 p=this._splitSafely(a,u),h=0,c=p.length;h0?(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 ")+"[".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;I1?i-1:0),o=1;o1?i-1:0),o=1;o0)for(var s=a.map((function(t){return r[t.index]=!0,e.remove({index:t.index},ox),t.geojson})),l=0,u=s.length;l=0))throw new Error("area must be a positive number");var r=Pd[e];if(!r)throw new Error("invalid original units");var o=Pd[i];if(!o)throw new Error("invalid final units");return t/r*o},convertDistance:Zd,convertLength:Zd,coordAll:function(t){var e=[];return rm(t,(function(t){e.push(t)})),e},coordEach:rm,coordReduce:function(t,e,i,r){var o=i;return rm(t,(function(t,r,n,a,s){o=0===r&&void 0===i?t:e(o,t,r,n,a,s)}),r),o},degrees2radians:Gd,degreesToRadians:Gd,distance:em,distanceToDegrees:jd,distanceToRadians:Ud,earthRadius:Sd,factors:Ed,feature:Md,featureCollection:Dd,featureEach:nm,featureReduce:function(t,e,i){var r=i;return nm(t,(function(t,o){r=0===o&&void 0===i?t:e(r,t,o)})),r},findPoint:function(t,e){if(!Xd(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 Ld(l,s,e);case"MultiPoint":return o<0&&(o=l.length+o),Ld(l[o],s,e);case"LineString":return a<0&&(a=l.length+a),Ld(l[a],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a),Ld(l[n][a],s,e);case"MultiLineString":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),Ld(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),Ld(l[o][n][a],s,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Xd(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),zd([l[a],l[a+1]],s,e);case"Polygon":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a-1),zd([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),zd([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),zd([l[o][n][a],l[o][n][a+1]],s,e)}throw new Error("geojson is invalid")},flatten:Dy,flattenEach:lm,flattenReduce:function(t,e,i){var r=i;return lm(t,(function(t,o,n){r=0===o&&0===n&&void 0===i?t:e(r,t,o,n)})),r},geomEach:am,geomReduce:sm,geometry:function(t,e,i){switch(t){case"Point":return Ld(e).geometry;case"LineString":return zd(e).geometry;case"Polygon":return Cd(e).geometry;case"MultiPoint":return Rd(e).geometry;case"MultiLineString":return Od(e).geometry;case"MultiPolygon":return Bd(e).geometry;default:throw new Error(t+" is invalid")}},geometryCollection:function(t,e,i){return void 0===i&&(i={}),Md({type:"GeometryCollection",geometries:t},e,i)},intersect:tx,isNumber:qd,isObject:Xd,length:zy,lengthToDegrees:jd,lengthToRadians:Ud,lineChunk:function(t,e,i){if(!Xd(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 lm(t,(function(t){o&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,i,r){var o=zy(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=0))throw new Error("precision must be a positive number");var i=Math.pow(10,e||0);return Math.round(t*i)/i},segmentEach:um,segmentReduce:pm,tesselate:Nm,transformRotate:jy,unitsFactors:Ad,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(!qd(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")}}),ax=6371008.8,sx=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=y(this.lng,-180,180)),(this.lat>90||this.lat<-90)&&(this.lat=y(this.lat,-90,90)))};sx.prototype.wrap=function(){return new sx(y(this.lng,-180,180),this.lat)},sx.prototype.toArray=function(){return[this.lng,this.lat]},sx.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},sx.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 ax*Math.acos(Math.min(o,1))},sx.prototype.distance=function(t){var e=Ld(this.toArray());if(t){var i=Ld(this.toArray());t.lng?i=Ld(t.toArray()):t.length>1&&(i=Ld(Sy(zd(t),e,{units:"kilometers"}).geometry.coordinates));var r=(1e3*em(i,e,{units:"kilometers"})).toFixed(2);return parseFloat(r)}},sx.prototype.getLng=function(){return this.lng},sx.prototype.getLat=function(){return this.lat},sx.prototype.equals=function(t){var e=!1;return t.lng==this.lng&&t.lat==this.lat&&(e=!0),e},sx.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 Id(new sx(this.lng-i,this.lat-e),new sx(this.lng+i,this.lat+e))},sx.convert=function(t){if(t instanceof sx)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new sx(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new sx(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var lx=2*Math.PI*ax;function ux(t){return lx}function px(t){return(180+t)/360}function hx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function cx(t,e){return t/ux()}function fx(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function dx(t,e){return t*ux()}var mx=function(t,e,i){void 0===i&&(i=0),this.x=+t,this.y=+e,this.z=+i};mx.fromLngLat=function(t,e){void 0===e&&(e=0);var i=sx.convert(t);return new mx(px(i.lng),hx(i.lat),cx(e))},mx.prototype.toLngLat=function(){return new sx(360*this.x-180,fx(this.y))},mx.prototype.toAltitude=function(){return dx(this.z)},mx.prototype.meterInMercatorCoordinateUnits=function(){return 1/lx*(t=fx(this.y),1/Math.cos(t*Math.PI/180));var t};var yx=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new cp({width:t,height:e}),this.positions={},this.uploaded=!1};yx.prototype.getDash=function(t,e){var i=this.getKey(t,e);return this.positions[i]},yx.prototype.trim=function(){var t=this.width,e=this.height=k(this.nextRow);this.image.resize({width:t,height:e})},yx.prototype.getKey=function(t,e){return t.join(",")+e},yx.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;l1&&(s=t[++a]);var u=Math.abs(l-s.left),p=Math.abs(l-s.right),h=Math.min(u,p),c=void 0,f=o/i*(r+1);if(s.isDash){var d=r-Math.abs(f);c=Math.sqrt(h*h+d*d)}else c=r-Math.sqrt(h*h+f*f);this.image.data[n+l]=Math.max(0,Math.min(255,c+128))}},yx.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],p=0;p1&&(u=t[++l]);var h=Math.abs(p-u.left),c=Math.abs(p-u.right),f=Math.min(h,c);this.image.data[s+p]=Math.max(0,Math.min(255,(u.isDash?f:-f)+e+128))}},yx.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 L("LineAtlas out of space"),null;0===t.length&&t.push(1);for(var a=0,s=0;s",targetMapId:r,sourceMapId:a.mapId})}}},bx.prototype.receive=function(t){var e=this,i=t.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if(""===i.type){var o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o.cancel()}else if(i.mustQueue||D()){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)},bx.prototype.processTask=function(t,e){var i=this;if(""===e.type){var r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(wa(e.error)):r(null,wa(e.data)))}else{var o=j(this.globalScope)?void 0:[],n=e.hasCallback?function(e,r){delete i.cancelCallbacks[t],i.target.postMessage({id:t,type:"",sourceMapId:i.mapId,error:e?ba(e):null,data:ba(r,o)},o)}:function(t){},a=wa(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))}},bx.prototype.remove=function(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)};var Tx=function(t,e,i){this.z=t,this.x=e,this.y=i,this.key=Ex(0,t,t,e,i)};Tx.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Tx.prototype.url=function(t,e){var i=wx(this.x,this.y,this.z),r=Ax(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)},Tx.prototype.getTileBBox=function(){return wx(this.x,this.y,this.z)},Tx.prototype.getQuadkey=function(){return Ax(this.z,this.x,this.y)},Tx.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new r((t.x*e-this.x)*ru,(t.y*e-this.y)*ru)},Tx.prototype.getTileVec3=function(t){var e=Math.pow(2,this.z);return Ru((t.x*e-this.x)*ru,(t.y*e-this.y)*ru,dx(t.z))},Tx.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Ix=function(t,e){this.wrap=t,this.canonical=e,this.key=Ex(t,e.z,e.z,e.x,e.y)},Sx=function(t,e,i,r,o){this.overscaledZ=t,this.wrap=e,this.canonical=new Tx(i,+r,+o),this.key=0===e&&t===i?this.canonical.key:Ex(e,t,i,r,o)};function Ex(t,e,i,r,o){var n=1<0;n--)o+=(e&(r=1<this.canonical.z?new Sx(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Sx(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Sx.prototype.calculateScaledKey=function(t,e){if(void 0===e&&(e=!0),this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return Ex(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-t;return Ex(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)},Sx.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>e&&t.canonical.y===this.canonical.y>>e},Sx.prototype.children=function(t){if(this.overscaledZ>=t)return[new Sx(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 Sx(e,this.wrap,e,i,r),new Sx(e,this.wrap,e,i+1,r),new Sx(e,this.wrap,e,i,r+1),new Sx(e,this.wrap,e,i+1,r+1)]},Sx.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.yr)o=!1;else if(e)if(this.expirationTimee[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 p=l;l=u,u=p}if(l>o&&(o=l),un)return null}return o}function Fx(t,e,i,r,o,n,a,s,l,u,p){var h=r-t,c=o-e,f=n-i,d=a-t,m=s-e,y=l-i,g=p[1]*y-p[2]*m,_=p[2]*d-p[0]*y,v=p[0]*m-p[1]*d,x=h*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*h-w*f,A=w*c-k*h,P=(p[0]*S+p[1]*E+p[2]*A)*b;return P<0||I+P>1?null:(d*S+m*E+y*A)*b}function Ux(t,e,i){return(t-e)/(i-e)}function jx(t,e,i,r,o,n,a,s,l){var u=1<=1;r/=2){var f=i[i.length-1];a=new Rx(r);for(var d=0;d0;){var f=c.pop(),d=f.idx,m=f.t,y=f.nodex,g=f.nodey,_=f.depth;if(this.leaves[d]){jx(y,g,_,t,e,i,r,p,h);var v=1<<_,x=(y+0)/v,b=(y+1)/v,w=(g+0)/v,k=(g+1)/v,T=Gx(x,w,this.dem)*a,I=Gx(b,w,this.dem)*a,S=Gx(b,k,this.dem)*a,E=Gx(x,k,this.dem)*a,A=Fx(p[0],p[1],T,h[0],p[1],I,h[0],h[1],S,o,n),P=Fx(h[0],h[1],S,p[0],h[1],E,p[0],p[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=Nu([],o,n,m);if(Vx(T,I,E,S,Ux(L[0],p[0],h[0]),Ux(L[1],p[1],h[1]))>=L[2])return m}else{for(var C=0,z=0;z=l[u[B]]&&(u.splice(B,0,z),R=!0);R||(u[C]=z),C++}}for(var F=0;F=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)},qx.prototype._unpackLKMap=function(t,e,i){return(256*t*256+256*e+i)/10-1e4},qx.prototype._unpackTerrarium=function(t,e,i){return 256*t+e+i/256-32768},qx.pack=function(t,e){var i=[0,0,0,0],r=qx.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},qx.prototype.getPixels=function(){return new fp({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},qx.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;uthis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},Wx.prototype.has=function(t){return t.wrapped().key in this.data},Wx.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},Wx.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},Wx.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},Wx.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},Wx.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},Wx.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},Wx.prototype.filter=function(t){var e=[];for(var i in this.data)for(var r=0,o=this.data[i];r1||(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 Sx(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(Zb(this._source.type)&&0!==n.length){for(var s={},l={},u=0,p=Object.keys(a);um;){_=_.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=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;n0||(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=q.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}(Gt);function Gb(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 Zb(t){return"raster"===t||"image"===t||"video"===t}Vb.maxOverzooming=10,Vb.maxUnderzooming=3;var qb=function(){},Xb={visibleDemTiles:{configurable:!0}};qb.prototype.getAtPointOrZero=function(t,e){return void 0===e&&(e=0),this.getAtPoint(t,e)||0},qb.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<=0&&p[3]>=0&&s.insert(a,p[0],p[1],p[2],p[3])}},Hb.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Th.VectorTile(new dc(this.rawTileData)).layers,this.sourceLayerCoder=new Px(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Hb.prototype.query=function(t,e,i,r){var o=this;this.loadVTLayers();var n=t.params||{},a=oo(n.filter),s=t.tileResult,l=t.transform,u=s.bufferedTilespaceBounds,p=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(function(t,e,i,r){return xu(s.bufferedTilespaceGeometry,t,e,i,r)}));p.sort(Kb);var h=null;l.elevation&&p.length>0&&(h=Wb.create(l.elevation,this.tileID));for(var c,f={},d=function(l){var u=p[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=au(e)),i.queryIntersectsFeature(s,e,r,m,o.z,t.transform,t.pixelPosMatrix,h,n)}))}},m=0;m=0)return!0;return!1}(r,c)){var f=this.sourceLayerCoder.decode(p),d=this.vtLayers[f].feature(u);if(i.needGeometry){var m=su(d,!0);if(!i.filter(new ms(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new ms(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),g=0;g=z.maxzoom||"none"!==z.visibility&&($b(C,this.zoom,i),(c[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:C,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(C.map((function(t){return t.id}))))}}}}f.trim();var D={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},O=E(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,D):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,p=e,F.call(n))}),void 0,!1,D):p={};var B=Object.keys(d.patternDependencies);function F(){if(l)return o(l);if(u&&p&&h){var t=new Jb(u),e=new jc(p,h);for(var r in c){var n=c[r];n instanceof Yf?($b(n.layers,this.zoom,i),Df(n,u,t.positions,p,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical,this.tileZoom)):n.hasPattern&&(n instanceof Gh||n instanceof ih||n instanceof Mh)&&($b(n.layers,this.zoom,i),n.addFeatures(d,this.tileID.canonical,e.patternPositions))}this.status="done",o(null,{buckets:_(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?p: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,h=e,F.call(n))}),void 0,!1,D):h={},F.call(this)};var tw=function(t){this.entries={},this.scheduler=t};function ew(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 Th.VectorTile(new dc(r)),rawData:r,cacheControl:o,expires:n})}));return function(){r.cancel(),e()}}),e)}tw.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;s0&&(r.resourceTiming=JSON.parse(JSON.stringify(a)))}e(null,v({rawTileData:p.slice(0)},i,h,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}(Gt),rw=function(t){return"function"==typeof t},ow=function(t){return null!==t&&"object"===Xo(t)},nw=function(t){return t&&"function"==typeof t[Symbol.iterator]},aw=function(t){return t&&"function"==typeof t[Symbol.asyncIterator]},sw=function(t){return"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json},lw=function(t){return"undefined"!=typeof Blob&&t instanceof Blob},uw=function(t){return function(t){return"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||ow(t)&&rw(t.tee)&&rw(t.cancel)&&rw(t.getReader)}(t)||function(t){return ow(t)&&rw(t.read)&&rw(t.pipe)&&function(t){return"boolean"==typeof t}(t.readable)}(t)},pw=function(){function t(e,i){Yn(this,t),this._fileOrBlob=e,this.bodyUsed=!1}var e,i,r;return Jn(t,[{key:"arrayBuffer",value:(r=qo(Vo.mark((function t(){var e,i;return Vo.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=qo(Vo.mark((function t(){var e,i;return Vo.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=qo(Vo.mark((function t(){return Vo.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 hw(t,e){return Promise.resolve(new pw(t,e))}function cw(t){return fw.apply(this,arguments)}function fw(){return(fw=qo(Vo.mark((function t(e){var i;return Vo.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 dw(t){return mw.apply(this,arguments)}function mw(){return mw=qo(Vo.mark((function t(e){var i,r,o=arguments;return Vo.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:{},!lw(e)){t.next=3;break}return t.abrupt("return",hw(e,i));case 3:return e=Vn(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,cw(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)}))),mw.apply(this,arguments)}var yw=function(){function t(){Yn(this,t)}return Jn(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}(),gw=function(){function t(){Yn(this,t),this.console=console}return Jn(t,[{key:"log",value:function(){for(var t,e=arguments,i=arguments.length,r=new Array(i),o=0;o3&&void 0!==arguments[3]?arguments[3]:null;return Tw(t,e,r),Iw(t,e,i)}function Tw(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_w,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:console;if(i)for(var o in e)"object"===Xo(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"))}function Iw(t,e,i){var r,o=xw({},t.options||{});return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(o,i),null===o.log&&(o.log=new yw),Sw(o,((r=ww()).globalOptions=r.globalOptions||xw({},_w),r.globalOptions)),Sw(o,e),o}function Sw(t,e){for(var i in e)i in e&&(t[i]=bw(e[i])&&bw(t[i])?xw(xw({},t[i]),e[i]):e[i])}function Ew(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 Aw(t){for(var e=arguments,i=1;i1&&void 0!==s[1]?s[1]:{}).chunkSize)?262144:e,r=0,o=new TextEncoder;case 4:if(!(r1&&void 0!==s[1]?s[1]:{}).chunkSize)?262144:e,r=0;case 3:if(!(r1&&void 0!==s[1]?s[1]:{}).chunkSize||Rw,r=0;case 3:if(!(r=10){if("function"==typeof t[Symbol.asyncIterator])return t;if("function"==typeof t.getIterator)return t.getIterator()}return Rn?function(t){return Vw.apply(this,arguments)}(t):function(t){return Gw.apply(this,arguments)}(t)}function Vw(){return(Vw=Xn(Vo.mark((function t(e){var i,r,o;return Vo.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.getReader(),t.prev=1;case 2:return t.next=5,Zn(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 Gw(){return(Gw=Xn(Vo.mark((function t(e){var i;return Vo.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Zn(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,Zn(Zw(e));case 13:t.next=3;break;case 15:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zw(t){return qw.apply(this,arguments)}function qw(){return(qw=qo(Vo.mark((function t(e){return Vo.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 Xw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t?zw(t,e):t instanceof ArrayBuffer?Ow(t,e):lw(t)?Bw(t,e):uw(t)?Nw(t):sw(t)?Nw(t.body):Mn(!1)}function Ww(t,e){var i=t instanceof ArrayBuffer?new Uint8Array(t):t,r=e instanceof ArrayBuffer?new Uint8Array(e):e,o=new Uint8Array(i.byteLength+r.byteLength);return o.set(i,0),o.set(r,i.byteLength),o}function Hw(t){return Yw.apply(this,arguments)}function Yw(){return(Yw=qo(Vo.mark((function t(e){var i,r,o,n,a,s,l,u,p;return Vo.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=new ArrayBuffer(0),r="",o=!0,n=!1,t.prev=4,s=Wn(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(p=u)?r+=p:i=Ww(i,p);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()}}),t,null,[[4,21,25,35],[26,,30,34]])})))).apply(this,arguments)}function Kw(t){return Jw.apply(this,arguments)}function Jw(){return(Jw=qo(Vo.mark((function t(e){var i;return Vo.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 Qw="Cannot convert supplied data type";function $w(t,e){return sw(t)?e=e||t.url:lw(e)&&(e=e.name),"string"==typeof e?e.replace(/\?.*/,""):e}function tk(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"===Xo(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(Qw)}function ek(t,e){return ik.apply(this,arguments)}function ik(){return ik=qo(Vo.mark((function t(e,i){var r,o;return Vo.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",tk(e,i));case 6:if(!lw(e)){t.next=10;break}return t.next=9,hw(e);case 9:e=t.sent;case 10:if(!sw(e)){t.next=24;break}return o=e,t.next=14,Kw(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(uw(e)&&(e=Xw(e)),!nw(e)&&!aw(e)){t.next=27;break}return t.abrupt("return",Hw(e));case 27:throw new Error(Qw);case 28:case"end":return t.stop()}}),t)}))),ik.apply(this,arguments)}function rk(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 ok(t){for(var e=arguments,i=1;i2&&void 0!==arguments[2]?arguments[2]:null;return i||(t=ok({fetch:t.fetch||dw},t),Array.isArray(t.loaders)||(t.loaders=null),t)}function ak(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($n(i),$n(r)):r}return i&&i.length?i:null}var sk=new Map,lk=0;function uk(t){(0,t.resolve)(t.data)}var pk=function(){function t(e){var i=e.source,r=e.name,o=void 0===r?"web-worker-".concat(lk++):r,n=e.onMessage;Yn(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=sk.get(t);if(!i){var r=new Blob([t],{type:"application/javascript"});i=URL.createObjectURL(r),sk.set(t,i)}return i}(i);this.worker=new Worker(a,{name:o}),this.name=o,this.onMessage=n||uk}var e;return Jn(t,[{key:"process",value:(e=qo(Vo.mark((function t(e){var i=this;return Vo.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}(),hk=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;Yn(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 Jn(t,[{key:"destroy",value:function(){this.idleQueue.forEach((function(t){return t.destroy()})),this.isDestroyed=!0}},{key:"process",value:(e=qo(Vo.mark((function t(e,i){var r=this;return Vo.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.count0&&void 0!==arguments[0]?arguments[0]:{},e={};return t.maxConcurrency&&(e.maxConcurrency=t.maxConcurrency),t.onDebug&&(e.onDebug=t.onDebug),gk||(gk=new ck({onMessage:_k})),gk.setProps(e),gk}(i);i=JSON.parse(JSON.stringify(i));var l=t.version!==dk?"(core version ".concat(dk,")"):"";return s.process(n,"".concat(a,"-worker@").concat(t.version).concat(l),{arraybuffer:fk(e),options:i,source:"loaders.gl@".concat(dk),type:"parse"})}var gk=null;function _k(t){return vk.apply(this,arguments)}function vk(){return(vk=qo(Vo.mark((function t(e){var i,r,o,n,a;return Vo.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,Fk(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 xk=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,bk=/^([-\w.]+\/[-\w.+]+)/;function wk(t){if("string"!=typeof t)return"";var e=t.match(xk);return e?e[1]:""}var kk=/\?.*/;function Tk(t){if(sw(t)){var e=function(t){if("string"!=typeof t)return"";var e=t.match(bk);return e?e[1]:t}(t.headers.get("content-type")),i=wk(t.url);return{url:Ik(t.url||""),type:e||i||null}}return lw(t)?{url:Ik(t.url||""),type:t.type||""}:"string"==typeof t?{url:Ik(t),type:wk(t)}:{url:"",type:""}}function Ik(t){return t.replace(kk,"")}function Sk(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 Ek(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)?Ek(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 Ek(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e&&!Array.isArray(e))return Mw(e);Lk(e=[].concat($n(e||[]),$n(Lw())));var o=Tk(t),n=o.url,a=o.type,s=Ck(e,n||r.url);if(!(s=(s=s||zk(e,a))||Dk(e,t))&&!i.nothrow)throw new Error(Mk(t,n));return s}function Mk(t,e,i){var r="No valid loader found";return t&&(r+=' 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)?Bk(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?Bk(t,0,e):""}(t),'"')),e&&(r+=" for ".concat(e)),r}function Lk(t){var e,i=Sk(t);try{for(i.s();!(e=i.n()).done;)Mw(e.value)}catch(t){i.e(t)}finally{i.f()}}function Ck(t,e){var i=e&&e.match(Ak),r=i&&i[1];return r&&function(t,e){e=e.toLowerCase();var i,r=Sk(t);try{for(r.s();!(i=r.n()).done;){var o,n=i.value,a=Sk(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)}function zk(t,e){var i,r=Sk(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}function Dk(t,e){if(!e)return null;var i,r=Sk(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;if("string"==typeof e){if(Ok(e,o))return o}else if(ArrayBuffer.isView(e)){if(Rk(e.buffer,e.byteOffset,o))return o}else if(e instanceof ArrayBuffer&&Rk(e,0,o))return o}}catch(t){r.e(t)}finally{r.f()}return null}function Ok(t,e){return e.testText&&e.testText(t)}function Rk(t,e,i){switch(Array.isArray(i.test)?"array":Xo(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===Bk(t,e,i.length)}));default:return!1}}function Bk(t,e,i){if(t.byteLength<=e+i)return"";for(var r=new DataView(t),o="",n=0;nkt&&(t.getActor().send("enforceCacheSizeLimit",wt),St=0)},t.circle=$d,t.clamp=m,t.clearTileCache=function(t){var e=n.caches.delete(bt);t&&e.catch(t).then((function(){return t()}))},t.clipLine=hf,t.clone=function(t){var e=new Au(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=P,t.collisionCircleLayout=ec,t.config=W,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 Au(16);return Au!=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=Pu,t.create$2=zu,t.create$3=Ju,t.createExpression=Zr,t.createFilter=oo,t.createLayout=Ds,t.createStyleLayer=function(t){return"custom"===t.type?new xd(t):new Td[t.type](t)},t.cross=Zu,t.deepEqual=a,t.degToRad=p,t.deserialize=Cx,t.distance=em,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=Gu,t.ease=d,t.easeCubicInOut=c,t.emitValidationErrors=Ro,t.endsWith=S,t.enforceCacheSizeLimit=function(t){Tt(),ut&&ut.then((function(e){e.keys().then((function(i){for(var r=0;rn&&(r+=(t[o]-n)*(t[o]-n)),e[o]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=Si,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=Fk,t.pbf=dc,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-1&&(e="&"),t+e+"ak="+W.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],p=e[9],h=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+p*r,t[6]=s*o+h*r,t[7]=l*o+c*r,t[8]=u*o-n*r,t[9]=p*o-a*r,t[10]=h*o-s*r,t[11]=c*o-l*r,t},t.rotateX$1=$u,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],p=e[9],h=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-p*r,t[2]=s*o-h*r,t[3]=l*o-c*r,t[8]=n*r+u*o,t[9]=a*r+p*o,t[10]=s*r+h*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],p=e[5],h=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+p*r,t[2]=s*o+h*r,t[3]=l*o+c*r,t[4]=u*o-n*r,t[5]=p*o-a*r,t[6]=h*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=ju,t.scaleAndAdd=Nu,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){wt=t,kt=e},t.setRTLTextPlugin=function(t,e,i){if(void 0===i&&(i=!1),ss===rs||ss===os||ss===ns)throw new Error("setRTLTextPlugin cannot be called multiple times.");ls=q.resolveURL(t),ss=rs,as=e,ps(),i||fs()},t.smoothstep=function(t,e,i){return(i=m((i-t)/(e-t),0,1))*i*(3-2*i)},t.spec=Zt,t.storeAuthState=function(t,e){e?xt.add(t):xt.delete(t)},t.sub=Wu,t.subtract=Fu,t.symbolSize=sc,t.tesselate=Nm,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=Ku,t.transformQuat=qu,t.transformRotate=jy,t.translate=function(t,e,i){var r,o,n,a,s,l,u,p,h,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],p=e[7],h=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]=p,t[8]=h,t[9]=c,t[10]=f,t[11]=d,t[12]=r*m+s*y+h*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+p*y+d*g+e[15]),t},t.triggerPluginCompletionEvent=us,t.uniqueId=b,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=zo,t.validateLight=Co,t.validateStyle=Lo,t.values=_,t.vectortile_emg=Th,t.warnOnce=L,t.window=n,t.wrap=y})),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=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}var h=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>31}function S(t,e){for(var i=t.loadGeometry(),r=t.type,o=0,n=0,a=i.length,s=0;s>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),p=.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+p)),Math.min(o,Math.floor(i+(a-s)*u/a+p)),n)}var h=e[2*i+n],c=r,f=o;for(M(t,e,r,i),e[2*o+n]>h&&M(t,e,r,o);ch;)f--}e[2*r+n]===h?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 z=function(t){return t[0]},D=function(t){return t[1]},O=function(t,e,i,r,o){void 0===e&&(e=z),void 0===i&&(i=D),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=i&&s<=o&&l>=r&&l<=n&&p.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&&p.push(t[m]);var y=(h+1)%2;(0===h?i<=s:r<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===h?o>=s:n>=l)&&(u.push(m+1),u.push(c),u.push(y))}}return p}(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(),p=a.pop(),h=a.pop();if(p-h<=n)for(var c=h;c<=p;c++)C(e[2*c],e[2*c+1],i,r)<=l&&s.push(t[c]);else{var f=Math.floor((h+p)/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(h),a.push(f-1),a.push(y)),(0===u?i+o>=d:r+o>=m)&&(a.push(f+1),a.push(p),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],p=t[i],h=t[i+1],c=e+3;cn)o=c,n=f;else if(f===n){var d=Math.abs(c-a);dr&&(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;r0&&(a+=r?(o*u-l*n)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-n,2))),o=l,n=u}var p=e.length-3;e[2]=1,Y(e,0,p,i),e[p+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function it(t,e,i,r){for(var o=0;o1?1:i}function nt(t,e,i,r,o,n,a,s){if(r/=e,n>=(i/=e)&&a=r)return null;for(var l=[],u=0;u=i&&d=r)){var m=[];if("Point"===c||"MultiPoint"===c)at(h,m,i,r,o);else if("LineString"===c)st(h,m,i,r,o,!1,s.lineMetrics);else if("MultiLineString"===c)ut(h,m,i,r,o,!1);else if("Polygon"===c)ut(h,m,i,r,o,!0);else if("MultiPolygon"===c)for(var y=0;y=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),p=0===o?ht:ct,h=t.start,c=0;ci&&(l=p(u,f,d,y,g,i),a&&(u.start=h+s*l)):_>r?v=i&&(l=p(u,f,d,y,g,i),x=!0),v>r&&_<=r&&(l=p(u,f,d,y,g,r),x=!0),!n&&x&&(a&&(u.end=h+s*l),e.push(u),u=lt(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(_=0===o?f:d)>=i&&_<=r&&pt(u,f,d,m),b=u.length-3,n&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&pt(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;aa.maxX&&(a.maxX=p),h>a.maxY&&(a.maxY=h)}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;s0&&e.size<(o?a:r))i.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(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;r0===e)for(r=0,o=t.length;r24)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=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=[],p=0,h=l.range(Z(i),q(n),Z(o),q(r));pe&&(c+=m.numPoints||1)}if(c>h&&c>=n){for(var y=l.x*h,g=l.y*h,_=o&&h>1?this._map(l,!0):null,v=(s<<5)+(e+1)+this.points.length,x=0,b=p;x1)for(var T=0,I=p;T>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 p=1<24)return null;var n=1<0;)l--,u=Math.floor(u/2),p=Math.floor(p/2),s=this.tiles[bt(l,u,p)];return s&&s.source?(this.splitTile(s.source,l,u,p,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 p=s.features.filter((function(t){return u.value.evaluate({zoom:0},t)}));s={type:"FeatureCollection",features:p}}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,p=l;u1?"@2x":"",u=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,s||(s=t,n=e,h())})),p=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),(function(t,e){p=null,s||(s=t,a=e,h())}));function h(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],p=u.width,h=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:p,height:h});t.RGBAImage.copy(i,v,{x:c,y:f},{x:0,y:0},{width:p,height:h}),o[l]={data:v,pixelRatio:m,sdf:d,stretchX:y,stretchY:g,content:_}}r(null,o)}}return{cancel:function(){u&&(u.cancel(),u=null),p&&(p.cancel(),p=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",h,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",h,!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=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;er.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=r.x?o[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(o[3]=this.cameraPoint)),t.bufferConvexPolygon(o,e)},M.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),p=e.tileID.getTileVec3(u),h=s.map((function(e){var i=t.sub(e,e,p);return t.normalize(i,i),new t.Ray(p,i)})),c=P(e,1,i.zoom);if(t.polygonIntersectsBox(a,0,0,t.EXTENT,t.EXTENT))return{queryGeometry:this,tilespaceGeometry:l,tilespaceRays:h,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}},M.prototype._bufferedScreenMercator=function(t,e){var i=L(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},M.prototype._bufferedCameraMercator=function(t,e){var i=L(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 z=function(e,i,r){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=r||24};z.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]},z.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=o&&e.y=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),B=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==D&&(D=t.window.OffscreenCanvas&&new t.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof t.window.createImageBitmap),D),u=1-(n.width-t.prevPowerOfTwo(n.width))/2;u<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));var p=l?n:t.exported.getImageData(n,u),h={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:p,encoding:this.encoding,padding:u};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",h,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+1i.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,U.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}(j),V=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,U.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];t0&&(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)},Z=function(e,i,r,o){var n=new G[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 q(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 X(t,e,i,r,o,n,a,s){void 0===s&&(s=!1);var l=t.tilesIn(r,a,s);l.sort(H);for(var u=[],p=0,h=l;p0?(o-a)/s:0;return this.points[n].mult(1-l).add(this.points[i].mult(l))};var ht=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;nthis.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;s0:a},ht.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},ht.prototype.query=function(t,e,i,r,o){return this._query(t,e,i,r,!1,o)},ht.prototype.hitTest=function(t,e,i,r,o){return this._query(t,e,i,r,!0,o)},ht.prototype.hitTestCircle=function(t,e,i,r){return this._queryCircle(t,e,i,!0,r)},ht.prototype._queryCell=function(t,e,i,r,o,n,a,s){var l=a.seenUids,u=this.boxCells[o];if(null!==u)for(var p=this.bboxes,h=0,c=u;h=p[d+0]&&r>=p[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return n.push(!0),!0;n.push({key:this.boxKeys[f],x1:p[d],y1:p[d+1],x2:p[d+2],y2:p[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})}}}},ht.prototype._queryCellCircle=function(t,e,i,r,o,n,a,s){var l=a.circle,u=a.seenUids,p=this.boxCells[o];if(null!==p)for(var h=this.bboxes,c=0,f=p;ca*a+s*s},ht.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,p=Math.abs(e-(o+u));if(p>u+i)return!1;if(l<=s||p<=u)return!0;var h=l-s,c=p-u;return h*h+c*c<=i*i};var ct=Math.tan(85*Math.PI/180);function ft(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 dt(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 mt(e,i,r){void 0===r&&(r=0);var o=[e.x,e.y,r,1];r?t.transformMat4$1(o,o,i):It(o,o,i);var n=o[3];return{point:new t.pointGeometry(o[0]/n,o[1]/n),signedDistanceFromCamera:n}}function yt(t,e){return Math.min(.5+t/e*.5,1.5)}function gt(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 _t(t,e,i,r,o,n,a,s,l,u,p,h,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),_=wt(t*y,i,r,o,n,a,s.segment,d,m,l,u,p,h,c,!0);if(!_)return null;var v=wt(t*g,i,r,o,n,a,s.segment,d,m,l,u,p,h,c,!0);return v?{first:_,last:v}:null}function vt(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.yct}(i,r,o)?1===e.flipState?{needsFlipping:!0}:null:i.x>r.x?{needsFlipping:!0}:null}function xt(e,i,r,o,n,a,s,l,u,p,h,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=_t(g,l,_,v,r,h,c,e,u,a,f,m);if(!k)return{notEnoughRoom:!0};var T=mt(k.first.point,s).point,I=mt(k.last.point,s).point;if(o&&!r){var S=vt(e,T,I,d);if(e.flipState=S&&S.needsFlipping?1:2,S)return S}y=[k.first];for(var E=e.glyphStartIndex+1;E0?L.point:bt(c,M,A,1,n),d);if(e.flipState=C&&C.needsFlipping?1:2,C)return C}var z=wt(g*l.getoffsetX(e.glyphStartIndex),_,v,r,h,c,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,m);if(!z)return{notEnoughRoom:!0};y=[z]}for(var D=0,O=y;D0?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(p.getx(e),p.gety(e))},P=function(){return bt(A(),E,b,T-w+1,h,f)};w+k<=T;){if((v+=g)=u)return null;if(b=x,I.push(x),d&&S.push(E||A()),void 0===(x=c[v])){var M=mt(E=new t.pointGeometry(p.getx(v),p.gety(v)),h,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(p.getx(v),p.gety(v)),c[v]=x=void 0===c[v]?x:P(),k=b.dist(x));var L=(T-w)/k,C=x.sub(b),z=C.mult(L)._add(b);r&&z._add(C._unit()._perp()._mult(r*g));var D,O,R,B,F=_+Math.atan2(x.y-b.y,x.x-b.x);return I.push(z),d&&(E=E||new t.pointGeometry(p.getx(v),p.gety(v)),S.push(new t.pointGeometry((D=S.length>0?S[S.length-1]:E).x*(B=1-(R=L))+(O=E).x*R,D.y*B+O.y*R))),{point:z,angle:F,path:I,tilePath:S}}var kt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Tt(t,e){for(var i=0;i0?_t(w,o,i.lineOffsetX*w,i.lineOffsetY*w,!1,k,_,i,r,s,{},y&&!p?g:null,p&&!!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 pt,C=T.first,z=T.last,D=[],O=C.path.length-1;O>=1;O--)D.push(C.path[O]);for(var R=1;R0){for(var j=D[0].clone(),N=D[0].clone(),V=1;V=P.x&&N.x<=M.x&&j.y>=P.y&&N.y<=M.y?[D]:N.xM.x||N.yM.y?[]:t.clipLine([D],P.x,P.y,M.x,M.y)}for(var G=0,Z=U;G0){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),k(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 It(a,a,e);return{point:new t.pointGeometry((a[0]/a[3]+1)/2*this.transform.width+St,(-a[1]/a[3]+1)/2*this.transform.height+St),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/a[3]*.5,1.5),signedDistanceFromCamera:a[3],aboveHorizon:s}},Et.prototype.isOffscreen=function(t,e,i,r){return i=this.screenRightBoundary||rthis.screenBottomBoundary},Et.prototype.isInsideGrid=function(t,e,i,r){return i>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(_=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:v,width:i,height:r,anchor:t,textScale:o,prevAnchor:_},this.markUsedJustification(f,t,h,d),f.allowVerticalPlacement&&(this.markUsedOrientation(f,d,h),this.placedOrientations[h.crossTileID]=d),{shift:x,placedGlyphBoxes:b}):void 0},Rt.prototype.placeLayerBucketPart=function(e,i,r){var o=this,n=e.parameters,a=n.bucket,s=n.layout,l=n.posMatrix,u=n.textLabelPlaneMatrix,p=n.labelToScreenMatrix,h=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 Mt(!1,!1,!1);else{var T,E=!1,A=!1,P=!0,M=null,L={box:null,offscreen:null},C={box:null,offscreen:null},z=null,D=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;o0&&(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,p=(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;_=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,h,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");z=o.collisionIndex.placeCollisionCircles(v,H,a.lineVertexArray,a.glyphOffsetArray,Y,l,u,p,r,w,y.predicate,e.collisionCircleDiameter,K,o.retainedQueryData[a.bucketInstanceId].tileID),E=v||z.circles.length>0&&!z.collisionDetected,P=P&&z.offscreen}if(f.iconFeatureIndex&&(B=f.iconFeatureIndex),f.iconBox){var J=function(e){F(e);var i=k&&M?Ot(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,h,l,y.predicate)};A=C&&C.box&&C.box.length&&f.verticalIconBox?(D=J(f.verticalIconBox)).box.length>0:(D=J(f.iconBox)).box.length>0,P=P&&D.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&&D&&o.collisionIndex.insertCollisionBox(D.box,s.get("icon-ignore-placement"),a.bucketInstanceId,B,y.ID),z&&(E&&o.collisionIndex.insertCollisionCircles(z.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 Lt);for(var it=0;it=0;--P){var M=A[P];E(a.symbolInstances.get(M),M,a.collisionArrays[M])}else for(var L=e.symbolInstanceStart;L=0&&(e.text.placedSymbolArray.get(l).crossTileID=n>=0&&l!==n?0:r.crossTileID)}},Rt.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];a0,_=o.placedOrientations[n.crossTileID],v=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=qt(y.text);d(e.text,s,v?Xt:b),d(e.text,l,x?Xt: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=qt(y.icon),S=!(c&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(d(e.icon,n.numIconVertices,S?I:Xt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=y.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,n.numVerticalIconVertices,S?Xt: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=Dt(M.anchor,M.width,M.height,M.textOffset,M.textScale),p&&A._rotate(h?o.transform.angle:-o.transform.angle)):P=!1}E.textBox&&Bt(e.textCollisionBox.collisionVertexArray,y.text.placed,!P||v,A.x,A.y),E.verticalTextBox&&Bt(e.textCollisionBox.collisionVertexArray,y.text.placed,!P||x,A.x,A.y)}var L=Boolean(!x&&E.verticalIconBox);E.iconBox&&Bt(e.iconCollisionBox.collisionVertexArray,y.icon.placed,L,c?A.x:0,c?A.y:0),E.verticalIconBox&&Bt(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!L,c?A.x:0,c?A.y:0)}}},y=0;yt},Rt.prototype.setStale=function(){this.stale=!0};var Ft=Math.pow(2,25),Ut=Math.pow(2,24),jt=Math.pow(2,17),Nt=Math.pow(2,16),Vt=Math.pow(2,9),Gt=Math.pow(2,8),Zt=Math.pow(2,1);function qt(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*Ft+e*Ut+i*jt+e*Nt+i*Vt+e*Gt+i*Zt+e}var Xt=0,Wt=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=[]};Wt.prototype.continuePlacement=function(t,e,i,r,o){for(var n=this._bucketParts;this._currentTileIndex2};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 Wt(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Ht.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Yt=512/t.EXTENT/2,Kt=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var r=0;rt.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 p=0;p-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;n0)for(var n=0,a=e.sprite.split(",");n0)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=Z(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-1&&u!=this._order.length-1&&(this._order.splice(u,1),this._order.push("VirtualSpace_custom_layer"));var p=[];this._order.forEach((function(t){t.indexOf("VirtualSpace_custom_Spring_")>-1&&p.push(t)})),this._order.filter((function(t){return t.indexOf("VirtualSpace_custom_Spring_")<0})),p.length>0&&(n=this._order).push.apply(n,p),this._layerOrderChanged=!0,this._layers[a]=s,0==a.indexOf("custom_")&&(this._customLayers[a]=s);var h=this._getLayerSourceCache(s);if(this._removedLayers[a]&&s.source&&h&&"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",h.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;n0){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 p in u)if(r[p]==s){e=this.map._customLayers[parseInt(p)],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=0;n--){var a=this._order[n];if(i(a)){r[a]=n;for(var s=0,l=t;s=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]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);le.getSourceType=function(t){return G[t]},le.setSourceType=function(t,e){G[t]=e},le.registerForPluginStateChange=t.registerForPluginStateChange;var ue="\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",pe="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;}",he={},ce={};he=ye("","\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),ce=ye("#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 fe=ye("#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."),de=ue,me={background:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("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:ye("#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:ye("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:ye("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:ye("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:ye("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:ye("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 start && 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:ye("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:ye("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:ye("#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:ye("#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:ye("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:ye("#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:ye("\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}",pe),skyboxGradient:ye("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}",pe),skyboxGradientCapture:ye("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:ye("\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:ye("\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:ye("\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:ye("\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:ye("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:ye("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:ye("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 ye(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=ue.match(o),u=s?s.concat(a):a;i||(he.staticUniforms&&(u=he.staticUniforms.concat(u)),ce.staticUniforms&&(u=ce.staticUniforms.concat(u))),u&&(u=u.concat(l));var p={};return{fragmentSource:t=t.replace(r,(function(t,e,i,r,o){return p[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 p[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 ge=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function _e(e,i,r,o,n,a,s){var l=e.context,u=l.gl,p=r.fbo;if(p){e.prepareDrawTile(i);var h=e.useProgram("hillshade");l.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,p.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,p,h,c=!e.options.moving;return{u_matrix:o||e.transform.calculateProjMatrix(i.tileID.toUnwrapped(),c),u_image:0,u_latrange:(u=i.tileID,p=Math.pow(2,u.canonical.z),h=u.canonical.y,[new t.MercatorCoordinate(0,h/p).toLngLat().lat,new t.MercatorCoordinate(0,(h+1)/p).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,h,i.toUnwrapped()),h.draw(l,u.TRIANGLES,n,a,s,t.CullFaceMode.disabled,c,o.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function ve(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 xe(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),ve(e,i,u),i.demTexture){i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);var p=u.dim;s.activeTexture.set(l.TEXTURE0);var h=i.fbo;if(!h){var c=new t.Texture(s,{width:p,height:p,data:null},l.RGBA);c.bind(l.LINEAR,l.CLAMP_TO_EDGE),(h=i.fbo=s.createFramebuffer(p,p,!0)).colorAttachment.set(c.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,p,p]),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}}}ge.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=1||!this._validOp(i);)if(!this._nextOp(i,t)){delete this.operations[e];break}}},ke.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)},ke.prototype._validOp=function(t){return t.from.hasData()&&t.to.hasData()};var Te=new ke,Ie={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"},Se=function(t){return{u_matrix:t}};function Ee(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(),p=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),c=h&&e.refreshedUponExpiration?1:t.clamp(h?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 Ae=function(e){function i(t){var i=Z("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new A($(),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),Pe=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),Me=function(e){function i(i,r){e.call(this),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};var o=function(e){var i=new t.StructArrayLayout4i8,r=new t.StructArrayLayout3ui6,o=131;i.reserve(17161),r.reserve(33800);for(var n=t.EXTENT/128,a=t.EXTENT+n/2,s=a+n,l=-n;la||l<0||l>a?24575:0,h=t.clamp(Math.round(u),0,t.EXTENT),c=t.clamp(Math.round(l),0,t.EXTENT);i.emplaceBack(h+p,c,h,c)}for(var f=function(t,e){var i=e*o+t;r.emplaceBack(i+1,i,i+o),r.emplaceBack(i+o,i+o+1,i+1)},d=1;d<129;d++)for(var m=1;m<129;m++)f(m,d);return[0,129].forEach((function(t){for(var e=0;e<130;e++)f(e,t),f(t,e)})),[i,r,32768]}(),n=o[0],a=o[1],s=o[2],l=i.context;this.gridBuffer=l.createVertexBuffer(n,U.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 Ae(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,p=this.proxyCoords=r.getIds().map((function(t){var e=r.getTileByID(t).tileID;return e.projMatrix=o.calculateProjMatrix(e.toUnwrapped()),e}));a=p,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<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,p=1;if(r&&r.morphing&&this._useVertexMorphing){var h=r.morphing.srcDemTile,c=r.morphing.dstDemTile;p=r.morphing.phase,h&&c&&(this._prepareDemTileUniforms(e,h,s,"_prev")&&(u=h),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=p):(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<i.renderCachePool.length){var r=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(var o=0;o=0;l--){var u=a[l];if(i.getTileByID(u.key),void 0!==i.proxyCachedFBO[u.key]){var p=t[u.key],h=this.proxyToSource[u.key],c=0,f=function(t){var e=h[t],i=p[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 h)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(p).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;xe[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;si.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,p=o;uu+m.max.x||s+lp+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],h.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 p=i.tileID.wrap-e.wrap<0?(s=(a=t.EXTENT>>u)*((i.tileID.canonical.x<=p){var h=e.canonical.z-p;i.getSource().reparseOverscaled?(s=Math.max(e.canonical.z+2,i.transform.tileZoom),a=new t.OverscaledTileID(s,e.wrap,p,e.canonical.x>>h,e.canonical.y>>h)):0!==h&&(a=new t.OverscaledTileID(s=p,e.wrap,p,e.canonical.x>>h,e.canonical.y>>h))}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(e){var i,r,o,n=new t.StructArrayLayout2ui4,a=131;for(r=1;r<129;r++){for(i=1;i<129;i++)n.emplaceBack(o=r*a+i,o+1),n.emplaceBack(o,o+a),n.emplaceBack(o+1,o+a),128===r&&n.emplaceBack(o+a,o+a+1);n.emplaceBack(o+1,o+1+a)}return n}();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 Le(t){for(var e=[],i=0;i>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}Ce.cacheKey=function(t,e,i){for(var r=""+t+(i?i.cacheKey:""),o=0,n=e;o0?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:$e(o.paint.get("raster-hue-rotate"))};var n,a};function $e(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 ti,ei=function(t,e,i,r,o,n,a,s,l,u){var p=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:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.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}},ii=function(e,i,r,o,n,a,s,l,u,p,h){var c=n.transform,f=c.cameraToCenterDistance,d=c._pitch;return t.extend(ei(e,i,r,o,n,a,s,l,u,p),{u_gamma_scale:o?f*Math.cos(n.terrain?0:d):1,u_device_pixel_ratio:t.exported.devicePixelRatio,u_is_halo:+h})},ri=function(t,e,i){return{u_matrix:t,u_opacity:e,u_color:i}},oi=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),p=r.tileSize*Math.pow(2,i.transform.tileZoom)/u,h=p*(r.tileID.canonical.x+r.tileID.wrap*u),c=p*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/P(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[65535&h,65535&c]}}(o,a,r,n),{u_matrix:e,u_opacity:i})},ni=function(t,e,i,r,o,n,a,s,l,u,p,h,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:p,u_brdf_lut:h,u_is_car:c||-1,u_is_blend_light:f}},ai=function(t,e,i,r,o,n,a,s,l,u,p,h,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:p,u_brdf_lut:h,u_is_blend_light:c}},si={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:be,terrainDepth:be,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 li(e,i,r,o,n,a,s){for(var l=e.context,u=l.gl,p=e.useProgram("collisionBox"),h=[],c=0,f=0,d=0;d0){var b=t.create(),w=_;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),h.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=c+=x.length/4}v&&(e.terrain&&e.terrain.setupElevationDraw(y,p),p.draw(l,u.LINES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,Ve(_,e.transform,y),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,v.collisionVertexBuffer,v.collisionVertexBufferExt))}}if(s&&h.length){var k=e.useProgram("collisionCircle"),T=new t.StructArrayLayout2f1f2i16;T.resize(4*c),T._trim();for(var I=0,S=0,E=h;S=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,p){var h=[[n?o:e,n?e:o,0],[n?o:i,n?i:o,0]],c=p<0?t.EXTENT+p:p,f=[n?c:(e+i)/2,n?(e+i)/2:c,0];return 0===o&&p<0||0!==o&&p>0?a.getForTilePoints(u,[f],!0,l):h.push(f),a.getForTilePoints(r,h,!0,s),Math.max(h[0][2],h[1][2],f[2])/a.exaggeration()},_=0;_<4;_++){var v=o.borders[_];if(0===v.length&&(o.borderDone[_]=!0),!o.borderDone[_]){var x=u=p[_](r),b=h(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;SA[0]+3);)b.borderDone[k]||b.encodeCentroid(void 0,P,!1),I++;if(P&&IA[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),z=_%2?t.EXTENT-1:0;y.x=g(C[0],Math.min(t.EXTENT-1,C[1]),z,_<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 yi=new t.Color(1,0,0,1),gi=new t.Color(0,1,0,1),_i=new t.Color(0,0,1,1),vi=new t.Color(1,0,1,1),xi=new t.Color(0,1,1,1);function bi(t,e,i,r){ki(t,0,e+i/2,t.transform.width,i,r)}function wi(t,e,i,r){ki(t,e-i/2,0,i,t.transform.height,r)}function ki(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 Ti(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,p=t.StencilMode.disabled,h=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,p,h,t.CullFaceMode.disabled,Ze(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,p,t.ColorMode.alphaBlended,t.CullFaceMode.disabled,Ze(a,t.Color.transparent,y),c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var Ii=t.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},{name:"a_pos_2f",components:2,type:"Float32"}]).members;function Si(t,e,i,r){t.emplaceBack(e,i,r)}var Ei=function(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,Si(this.vertexArray,-1,-1,1),Si(this.vertexArray,1,-1,1),Si(this.vertexArray,-1,1,1),Si(this.vertexArray,1,1,1),Si(this.vertexArray,-1,-1,-1),Si(this.vertexArray,1,-1,-1),Si(this.vertexArray,-1,1,-1),Si(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,Ii),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,36,12)};function Ai(t,e,i){t.emplaceBack(e,i)}var Pi=function(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,Ai(this.vertexArray,0,0),Ai(this.vertexArray,2,0),Ai(this.vertexArray,0,2),this.indices.emplaceBack(0,1,2),this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Ii),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,3,1)};function Mi(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 Ei(n)),n.activeTexture.set(a.TEXTURE0);var p=r.colorRampTexture;p||(p=r.colorRampTexture=new t.Texture(n,r.colorRamp,a.RGBA)),p.bind(a.LINEAR,a.CLAMP_TO_EDGE);var h=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,h,"skyboxGradientCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}function Li(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"),p=i.paint.get("sky-atmosphere-sun-intensity"),h=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,p,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,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}function Ci(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"),p=new Float64Array(16);t.identity(p),t.rotateY(p,p,.5*-Math.PI),zi(n,i,u,p,0,0),t.identity(p),t.rotateY(p,p,.5*Math.PI),zi(n,i,u,p,0,1),t.identity(p),t.rotateX(p,p,.5*-Math.PI),zi(n,i,u,p,0,2),t.identity(p),t.rotateX(p,p,.5*Math.PI),zi(n,i,u,p,0,3),t.identity(p),zi(n,i,u,p,0,4),t.identity(p),t.rotateY(p,p,Math.PI),zi(n,i,u,p,0,5),n.viewport.set([0,0,e.width,e.height])}function zi(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 Di(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"),p=new Float64Array(16);t.identity(p),t.rotateY(p,p,.5*-Math.PI),Oi(n,i,u,p,0,0),t.identity(p),t.rotateY(p,p,.5*Math.PI),Oi(n,i,u,p,0,1),t.identity(p),t.rotateX(p,p,.5*-Math.PI),Oi(n,i,u,p,0,2),t.identity(p),t.rotateX(p,p,.5*Math.PI),Oi(n,i,u,p,0,3),t.identity(p),Oi(n,i,u,p,0,4),t.identity(p),t.rotateY(p,p,Math.PI),Oi(n,i,u,p,0,5),n.viewport.set([0,0,e.width,e.height])}function Oi(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 Ri(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 Pi(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"),p={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,p,"skyboxBrdf",i.skyboxBrdfGeometry.vertexBuffer,i.skyboxBrdfGeometry.indexBuffer,i.skyboxBrdfGeometry.segment),n.viewport.set([0,0,e.width,e.height])}var Bi=function(t){void 0===t&&(t=!0),this.startTime=0,this.oldTime=0,this.running=!1,this.elapsedTime=0,this.autoStart=t};Bi.prototype.start=function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},Bi.prototype.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},Bi.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},Bi.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 Fi={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,p="map"===a,h=function(){var e=f[c],n=o.getTile(e),a=n.getBucket(r);if(a&&a.text&&a.text.segments.get().length){var h=t.evaluateSizeForZoom(a.textSizeData,l.zoom),d=P(n,1,i.transform.zoom),m=ft(e.projMatrix,p,u,i.transform,d),y="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();if(h){var g=Math.pow(2,l.zoom-n.tileID.overscaledZ),_=l.elevation;!function(e,i,r,o,n,a,s,l,u,p,h,c){var f=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,y={};d.clear();for(var g=0;g=0&&(y[_.associatedIconIndex]={shiftedAnchor:S,angle:E})}else Tt(_.numGlyphs,d)}if(h){m.clear();for(var P=e.icon.placedSymbolArray,M=0;M256&&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;s256&&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)},Ui.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)},Ui.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=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.currentLayer0?e.pop():null},Ui.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},Ui.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},Ui.prototype.useProgram=function(t,e,i){this.cache=this.cache||{};var r=i||[],o=this.currentGlobalDefines().concat(r),n=Ce.cacheKey(t,o,e);return this.cache[n]||(this.cache[n]=new Ce(this.context,t,me[t],e,si[t],o)),this.cache[n]},Ui.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()},Ui.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)},Ui.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))},Ui.prototype.destroy=function(){this._terrain&&this._terrain.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()},Ui.prototype.prepareDrawTile=function(t){this.terrain&&this.terrain.prepareDrawTile(t)},Ui.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))}}},Ui.prototype.setTileLoadedFlag=function(t){this.tileLoaded=t},Ui.prototype.saveCanvasCopy=function(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1},Ui.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},Ui.prototype.getCanvasCopiesAndTimestamps=function(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}},Ui.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(Ui.prototype,ji);var Ni=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 Vi(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Gi(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 Zi(e,i){var r=Vi(e,3);t.fromQuat(e,i),Gi(e,3,r)}function qi(t,e){Gi(t,3,[e[0],e[1],e[2],1])}function Xi(e,i){var r=t.identity$1([]);return t.rotateZ$1(r,r,-i),t.rotateX$1(r,r,-e),r}function Wi(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 Xi(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),s)}Ni.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},Ni.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)},Ni.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},Ni.prototype.clone=function(){return new Ni(this.top,this.bottom,this.left,this.right)},Ni.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var Hi=function(t,e){this.position=t,this.orientation=e},Yi={position:{configurable:!0}};Yi.position.get=function(){return this._position},Yi.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},Hi.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=Wi(a,i)}},Hi.prototype.setPitchBearing=function(e,i){this.orientation=Xi(t.degToRad(e),t.degToRad(-i))},Object.defineProperties(Hi.prototype,Yi);var Ki=function(e,i){this._transform=t.identity([]),this._orientation=t.identity$1([]),i&&(this._orientation=i,Zi(this._transform,this._orientation)),e&&qi(this._transform,e)},Ji={mercatorPosition:{configurable:!0},position:{configurable:!0},orientation:{configurable:!0}};Ji.mercatorPosition.get=function(){var e=this.position;return new t.MercatorCoordinate(e[0],e[1],e[2])},Ji.position.get=function(){var t=Vi(this._transform,3);return[t[0],t[1],t[2]]},Ji.position.set=function(t){qi(this._transform,t)},Ji.orientation.get=function(){return this._orientation},Ji.orientation.set=function(t){this._orientation=t,Zi(this._transform,this._orientation)},Ki.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])}},Ki.prototype.setPitchBearing=function(t,e){this._orientation=Xi(t,e),Zi(this._transform,this._orientation)},Ki.prototype.forward=function(){var t=Vi(this._transform,2);return[-t[0],-t[1],-t[2]]},Ki.prototype.up=function(){var t=Vi(this._transform,1);return[-t[0],-t[1],-t[2]]},Ki.prototype.right=function(){var t=Vi(this._transform,0);return[t[0],t[1],t[2]]},Ki.prototype.getCameraToWorld=function(e,i){var r=new Float64Array(16);return t.invert(r,this.getWorldToCamera(e,i)),r},Ki.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},Ki.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},Ki.prototype.getCameraToClipPerspective=function(e,i,r,o){var n=new Float64Array(16);return t.perspective(n,e,i,r,o),n},Ki.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]},Ki.prototype.clone=function(){return new Ki([].concat(this.position),[].concat(this.orientation))},Object.defineProperties(Ki.prototype,Ji);var Qi=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 Ni,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._camera=new Ki,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this.pointCoordinate3DCallBacks=[],this._horizonShift=.1},$i={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}};Qi.prototype.clone=function(t){void 0===t&&(t={pitch:!0,angle:!0});var e=new Qi(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},$i.elevation.get=function(){return this._elevation},$i.elevation.set=function(t){this._elevation!==t&&(this._elevation=t,t?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())},Qi.prototype.updateElevation=function(t){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),t&&this._constrainCameraAltitude(),this._calcMatrices()},$i.minZoom.get=function(){return this._minZoom},$i.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},$i.maxZoom.get=function(){return this._maxZoom},$i.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},$i.minPitch.get=function(){return this._minPitch},$i.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},$i.maxPitch.get=function(){return this._maxPitch},$i.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},$i.renderWorldCopies.get=function(){return this._renderWorldCopies},$i.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},$i.worldSize.get=function(){return this.tileSize*this.scale},$i.cameraWorldSize.get=function(){var t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))},$i.pixelsPerMeter.get=function(){return t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize},$i.cameraPixelsPerMeter.get=function(){return t.mercatorZfromAltitude(1,this.center.lat)*this.cameraWorldSize},$i.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},$i.size.get=function(){return new t.pointGeometry(this.width,this.height)},$i.bearing.get=function(){return-this.angle/Math.PI*180},$i.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))},$i.pitch.get=function(){return this._pitch/Math.PI*180},$i.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())},$i.fov.get=function(){return this._fov/Math.PI*180},$i.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())},$i.averageElevation.get=function(){return this._averageElevation},$i.averageElevation.set=function(t){this._averageElevation=t,this._calcFogMatrices()},$i.zoom.get=function(){return this._zoom},$i.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())},Qi.prototype._setZoom=function(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom},Qi.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)},Qi.prototype._updateCameraOnTerrain=function(){var e=this.cameraToCenterDistance/this.worldSize,i=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat);this._cameraZoom=this._zoomFromMercatorZ(i+e)},Qi.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;ae.maxzoom&&(r=e.maxzoom);var a=t.MercatorCoordinate.fromLngLat(this.center),s=1<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 z=0;z<4;z++){var D=(P<<1)+z%2,O=(M<<1)+(z>>1),R={aabb:A.aabb.quadrant(z),zoom:A.zoom+1,x:D,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,D,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<N&&0!==u){var p,h=i.calculateProjMatrix(e.tileID.toUnwrapped());n&&i._elevation&&(p=i._elevation.getMinMaxForTile(e.tileID)),p||(p={min:g,max:y});var c=t.furthestTileCorner(i.bearing),f=[c[0]*t.EXTENT,c[1]*t.EXTENT,p.max];t.transformMat4(f,f,h),l=(1-f[1])*i.height*.50)for(var i=0;is)return this.pointCoordinate(e);for(var l=.02*s,u=e.clone(),p=0;p<10&&s-a>l;p++){u.y=t.number(a,s,.66);var h=o.pointCoordinate(u);h?(s=u.y,n=h):a=u.y}return n?new t.MercatorCoordinate(n[0],n[1],n[2]):this.pointCoordinate(e)},Qi.prototype.isPointAboveHorizon=function(t){if(this.elevation)return!this.elevation.pointCoordinate(t);var e=this.horizonLineFromTop();return t.y0?new t.pointGeometry(n[0]/n[3],n[1]/n[3]):new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)},Qi.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)))},Qi.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)},Qi.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},Qi.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},Qi.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])},Qi.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},Qi.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]},Qi.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]},Qi.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},Qi.prototype.customLayerMercatorMatrix=function(){return this.customMercatorMatrix.slice()},Qi.prototype.customLayerClipMatrix=function(){return this.cameraToClip.slice()},Qi.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()}}}},Qi.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(na&&(o=a-y)}if(this.lngRange){var g=f.x,_=u.x/2;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=p,this._constraining=!1}},Qi.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)},Qi.prototype._maxCameraBoundsDistance=function(){return this._mercatorZfromZoom(this._minZoomForBounds())},Qi.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,p=l.y,h=Math.cos(Math.PI/2-this._pitch)*s+a,c=Math.min(1.01*h,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=p-Math.round(p)+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={}}},Qi.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)},Qi.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]}},Qi.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()},Qi.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()},Qi.prototype._worldSizeFromZoom=function(t){return Math.pow(2,t)*this.tileSize},Qi.prototype._mercatorZfromZoom=function(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)},Qi.prototype._minimumHeightOverTerrain=function(){var t=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+(this.maxDrapeOverZoom||2),this._maxZoom);return this._mercatorZfromZoom(t)},Qi.prototype._zoomFromMercatorZ=function(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))},Qi.prototype._terrainEnabled=function(){return!!this._elevation},Qi.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,p=0,h=s;pu||f.y>1)return!0}return!1},Qi.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))},Qi.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)},Qi.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))},Object.defineProperties(Qi.prototype,$i);var tr=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})};tr.prototype.setMap=function(t){this.addTo(t)},tr.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},tr.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},tr.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(),p="";if(p+=e?"/"+a+"/"+s+"/"+r:r+"/"+s+"/"+a,(l||u)&&(p+="/"+Math.round(10*l)/10),u&&(p+="/"+Math.round(u)),this._hashName){var h=this._hashName,c=!1,f=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===h?(c=!0,e+"="+p):t})).filter((function(t){return t}));return c||f.push(h+"="+p),"#"+f.join("&")}return"#"+p},tr.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("/")},tr.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},tr.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());t.window.history.replaceState(t.window.history.state,null,e)};var er={linearity:.3,easing:t.bezier(0,0,.3,1)},ir=t.extend({deceleration:2500,maxSpeed:1400},er),rr=t.extend({deceleration:20,maxSpeed:1400},er),or=t.extend({deceleration:1e3,maxSpeed:360},er),nr=t.extend({deceleration:1e3,maxSpeed:90},er),ar=function(t){this._map=t,this.clear()};function sr(t,e){(!t.duration||t.duration0&&i-e[0].time>160;)e.shift()},ar.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=this._clickTolerance||this._map.fire(new ur(t.type,this._map,t))},cr.prototype.dblclick=function(t){return this._firePreventable(new ur(t.type,this._map,t))},cr.prototype.mouseover=function(t){this._map.fire(new ur(t.type,this._map,t))},cr.prototype.mouseout=function(t){this._map.fire(new ur(t.type,this._map,t))},cr.prototype.touchstart=function(t){return this._firePreventable(new pr(t.type,this._map,t))},cr.prototype.touchmove=function(t){this._map.fire(new pr(t.type,this._map,t))},cr.prototype.touchend=function(t){this._map.fire(new pr(t.type,this._map,t))},cr.prototype.touchcancel=function(t){this._map.fire(new pr(t.type,this._map,t))},cr.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},cr.prototype.isEnabled=function(){return!0},cr.prototype.isActive=function(){return!1},cr.prototype.enable=function(){},cr.prototype.disable=function(){};var fr=function(t){this._map=t};fr.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},fr.prototype.mousemove=function(t){this._map.fire(new ur(t.type,this._map,t))},fr.prototype.mousedown=function(){this._delayContextMenu=!0},fr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ur("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},fr.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new ur(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},fr.prototype.isEnabled=function(){return!0},fr.prototype.isActive=function(){return!1},fr.prototype.enable=function(){},fr.prototype.disable=function(){};var dr=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function mr(t,e){for(var i={},r=0;rthis.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;r30)&&(this.aborted=!0)}}},yr.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 gr=function(t){this.singleTap=new yr(t),this.numTaps=t.numTaps,this.reset()};gr.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},gr.prototype.touchstart=function(t,e,i){this.singleTap.touchstart(t,e,i)},gr.prototype.touchmove=function(t,e,i){this.singleTap.touchmove(t,e,i)},gr.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 _r=function(){this._zoomIn=new gr({numTouches:1,numTaps:2}),this._zoomOut=new gr({numTouches:2,numTaps:1}),this.reset()};_r.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},_r.prototype.touchstart=function(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)},_r.prototype.touchmove=function(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)},_r.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},_r.prototype.touchcancel=function(){this.reset()},_r.prototype.enable=function(){this._enabled=!0},_r.prototype.disable=function(){this._enabled=!1,this.reset()},_r.prototype.isEnabled=function(){return this._enabled},_r.prototype.isActive=function(){return this._active};var vr={0:1,2:2},xr=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};xr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},xr.prototype._correctButton=function(t,e){return!1},xr.prototype._move=function(t,e){return{}},xr.prototype.mousedown=function(t,e){if(!this._lastPoint){var i=a.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}},xr.prototype.mousemoveWindow=function(t,e){var i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){var i=vr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)0&&(this._active=!0);var o=mr(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],p=this._touches[l];p&&(n._add(u),a._add(u.sub(p)),s++,o[l]=u)}if(this._touches=o,!(sMath.abs(t.x)}var Cr=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,Lr(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 Lr(t)&&Lr(e)&&n}},e}(Ir),zr={panStep:100,bearingStep:15,pitchStep:10},Dr=function(){var t=zr;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function Or(t){return t*(2-t)}Dr.prototype.reset=function(){this._active=!1},Dr.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:Or,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})}}}},Dr.prototype.enable=function(){this._enabled=!0},Dr.prototype.disable=function(){this._enabled=!1,this.reset()},Dr.prototype.isEnabled=function(){return this._enabled},Dr.prototype.isActive=function(){return this._active},Dr.prototype.disableRotation=function(){this._rotationDisabled=!0},Dr.prototype.enableRotation=function(){this._rotationDisabled=!1};var Rr=4.000244140625,Br=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)};Br.prototype.setZoomRate=function(t){this._defaultZoomRate=t},Br.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},Br.prototype.isEnabled=function(){return!!this._enabled},Br.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},Br.prototype.isZooming=function(){return!!this._zooming},Br.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},Br.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Br.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%Rr==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()}},Br.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},Br.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())}},Br.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)>Rr?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,p="number"==typeof this._targetZoom?this._targetZoom:r(),h=this._startZoom,c=this._easing,f=!1;if("wheel"===this._type&&h&&c){var d=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),m=c(d);u=t.number(h,p,m),d<1?this._frameId||(this._frameId=!0):f=!0}else u=p,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}}},Br.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},Br.prototype.reset=function(){this._active=!1};var Fr=function(t,e){this._clickZoom=t,this._tapZoom=e};Fr.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Fr.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Fr.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Fr.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var Ur=function(){this.reset()};Ur.prototype.reset=function(){this._active=!1},Ur.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})}}},Ur.prototype.enable=function(){this._enabled=!0},Ur.prototype.disable=function(){this._enabled=!1,this.reset()},Ur.prototype.isEnabled=function(){return this._enabled},Ur.prototype.isActive=function(){return this._active};var jr=function(){this._tap=new gr({numTouches:1,numTaps:1}),this.reset()};jr.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},jr.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))},jr.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)},jr.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)},jr.prototype.touchcancel=function(){this.reset()},jr.prototype.enable=function(){this._enabled=!0},jr.prototype.disable=function(){this._enabled=!1,this.reset()},jr.prototype.isEnabled=function(){return this._enabled},jr.prototype.isActive=function(){return this._active};var Nr=function(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i};Nr.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("lkmap-touch-drag-pan")},Nr.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("lkmap-touch-drag-pan")},Nr.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},Nr.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var Vr=function(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i};Vr.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},Vr.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},Vr.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},Vr.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var Gr=function(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0};Gr.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")},Gr.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("lkmap-touch-zoom-rotate")},Gr.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},Gr.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},Gr.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Gr.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()},Gr.prototype.disableTouchZoom=function(){this._touchZoom.disable()},Gr.prototype.enableTouchZoom=function(){this._touchZoom.enable()},Gr.prototype.isEnabledTouchZoom=function(){return this._touchZoom.isEnabled()},Gr.prototype.disableTouchRotate=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Gr.prototype.enableTouchRotate=function(){this._rotationDisabled=!1,this._touchRotate.enable()},Gr.prototype.isEnabledTouchRotate=function(){return this._touchRotate.isEnabled()};var Zr=function(t){return t.zoom||t.drag||t.pitch||t.rotate},qr=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),Xr=function(){this.constants=[1,1,.01],this.radius=0};function Wr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}Xr.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])},Xr.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 Hr=function(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ar(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Xr,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;o1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,r,!0)},Hr.prototype._fireEvents=function(e,i,r){var o=this,n=Zr(this._eventsInProgress),a=Zr(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 p in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(p,e[p].originalEvent);var h,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"]=h=i[m]||y)}for(var g in c)this._fireEvent(g,c[g]);var _=Zr(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._bearingSnapn?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(),p="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):a,h="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(p-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,p),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)},z=function(t){return w*((M(L)*(P(e=L+b*t)/M(e))-P(L))/E)/T;var e},D=(A(1)-L)/b;if(Math.abs(T)<1e-6||!isFinite(D)){if(Math.abs(w-k)<1e-6)return this.easeTo(e,i);var O=ke.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=c!==l,this._padding=!n.isPaddingEqual(f),this._prepareEase(i,!1),this._ease((function(e){var o=e*D,d=1/C(o);n.zoom=1===e?p:a+n.scaleZoom(d),r._rotating&&(n.bearing=t.number(s,h,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(z(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)180?-360:i<-180?360:0}},i}(t.Evented),Kr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Kr.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},Kr.prototype.onRemove=function(){a.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Kr.prototype.getDefaultPosition=function(){return"bottom-left"},Kr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Kr.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},Kr.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 Jr=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};function Qr(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)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}Jr.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},Jr.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,r=e?this._queue.concat(e):this._queue;i0&&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,eo[this._direction]+" translate("+this._labelTranslate.x+"px, "+this._labelTranslate.y+"px)"),function(t,e,i){var r=t.classList;for(var o in eo)r.remove("lkmap-marker-anchor-"+o);r.add("lkmap-marker-anchor-"+e)}(this._element,this._direction))}},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=0&&t.y=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),oo=function(t){this.jumpTo(t)};oo.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},oo.prototype.isEasing=function(t){return t>=this._startTime&&t<=this._endTime},oo.prototype.jumpTo=function(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t},oo.prototype.easeTo=function(t,e,i){this._start=this.getValue(e),this._end=t,this._startTime=e,this._endTime=e+i};var no={extend:function(t){var e,i,r,o,n=arguments;for(i=1,r=arguments.length;it.maxX||e.maxYt.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>>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,p,h,c,f,d,m,y=Array();for(t=function(t){t=t.toString().replace(/\x0d\x0a/g,"\n");for(var e="",i=0;i127&&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>>29,n}(t),c=1732584193,f=4023233417,d=2562383102,m=271733878,e=0;e0?this.request(e,t):t&&"function"==typeof t&&t()}},checkArrMdls:function(t){for(var e=0;e0?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(lo.supportLocalStorage){var s=lo.get("version");if(lo.check("version")&&s==t.config.version&&s==t.config.updateVersion){var l=[];for(var a in o)if(lo.check(o[a])){if(window.LKMap&&window.LKMap[o[a]])continue;_runLKCode(o[a],lo.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 lo.set("version",t.config.version),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=[],p=lo.get("version");if(lo.check("version")&&p==t.config.version&&p==t.config.updateVersion)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.sdkAPI+"/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){lo.supportLocalStorage&&lo.set(t,e),uo.checkCodesStatus(t,e)};var po={floorCenterIndex:2,maxFloor:5,position:"right-center",defaultFloor:"top",showButton:!0,showAllBg:!0,offset:[0,0]},ho=function(e,i){i=t.extend({},po,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)};ho.prototype.init=function(){this._getIndoorData("init"),this._getActivePiid("init")},ho.prototype._update=function(){this._getIndoorData(),this._getActivePiid()},ho.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))},ho.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=17?(this._setBtnDisplay(!0),this._updateScrollTop()):this._setBtnDisplay(!1),this._settingsIndoorFilter(o)):(this._activePiid=null,this._showButton&&(this._removeDom(),this._setBtnDisplay(!1)))}},ho.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=""},ho.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())},ho.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)},ho.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)}},ho.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()},ho.prototype.getDefaultPosition=function(){return this._position},ho.prototype.onAdd=function(t){return this._element},ho.prototype.clickFloorBtnEvent=function(t){var e=t.target.innerHTML;e.length>0&&this.setNamec(e)},ho.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())},ho.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())}},ho.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"))}},ho.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}}},ho.prototype._setBtnDisplay=function(t){void 0===t&&(t=!0),this._element.style.display=t?"block":"none"};var co=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)})))}))};co.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})}))},co.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)}}))},co.prototype.deleteVersion=function(t){return this.deleteDB(this.versionStoreName,t)},co.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})}}}))},co.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){}))},co.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)}}))},co.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)}}))},co.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)}}))},co.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)}}))},co.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)}}))},co.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)}}))},co.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)}}))},co.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)}},co.prototype.clearStore=function(t){var e=this.db.transaction([t],"readwrite").objectStore(t);return new Promise((function(t,i){e.openCursor().onsuccess=function(t){var e=t.target.result;e&&(e.delete(),e.continue())}}))},co.prototype.deleteDBAll=function(){var t=window.indexedDB.deleteDatabase(this.dbName);return new Promise((function(e,i){t.onerror=function(t){},t.onsuccess=function(t){}}))},co.prototype.closeDB=function(){this.db.close()};var fo={"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"},mo=function(){this.X=0,this.Y=0};mo.prototype.Size=function(){return Math.sqrt(this.X*this.X+this.Y*this.Y)},mo.AngleBetween=function(t,e){return 180*mo.RadBetween(t,e)/Math.PI},mo.RadBetween=function(t,e){return Math.atan2(t.X*e.Y-t.Y*e.X,t.X*e.X+t.Y*e.Y)},mo.MakeVector2=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=new mo;return i.X=t,i.Y=e,i};var yo=function(){this.modelData=void 0};yo.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 go=function(){this.X=0,this.Y=0,this.Z=0,this.W=1};go.MakeQuat=function(t,e,i,r){return{X:t,Y:e,Z:i,W:r}};var _o=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};_o.prototype.Multiply=function(t){return _o.MakeVector3(this.X*t,this.Y*t,this.Z*t)},_o.prototype.Subtract=function(t){return _o.MakeVector3(this.X-t.X,this.Y-t.Y,this.Z-t.Z)},_o.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}},_o.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},_o.prototype.ToLngLat=function(){return new t.LngLat(this.X,this.Y)},_o.prototype.ToVec3=function(){var e=t.create$2();return t.set(e,this.X,this.Y,this.Z),e},_o.prototype.set=function(t,e,i){return void 0===i&&(i=this.Z),this.X=t,this.Y=e,this.Z=i,this},_o.prototype.setScalar=function(t){return this.X=t,this.Y=t,this.X=t,this},_o.prototype.copy=function(t){return this.X=t.X,this.Y=t.Y,this.Z=t.Z,this},_o.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},_o.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},_o.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},_o.FromLngLat=function(t){return _o.MakeVector3(t.lng,t.lat,0)},_o.FromMercator=function(t){return _o.MakeVector3(t.x,t.y,t.z)},_o.MakeVector3=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0);var r=new _o;return r.X=t,r.Y=e,r.Z=i,r},_o.MakeVector3One=function(){var t=new _o;return t.X=1,t.Y=1,t.Z=1,t};var vo=function(t,e){void 0===t&&(t=new _o(1/0,1/0,1/0)),void 0===e&&(e=new _o(-1/0,-1/0,-1/0)),this.min=t,this.max=e};vo.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},vo.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;so&&(o=u),p>n&&(n=p),h>a&&(a=h)}return this.min.set(e,i,r),this.max.set(o,n,a),this},vo.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;so&&(o=u),p>n&&(n=p),h>a&&(a=h)}return this.min.set(e,i,r),this.max.set(o,n,a),this},vo.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.X||t.Ythis.max.Y||t.Zthis.max.Z)},vo.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},vo.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))},vo.prototype.intersectsBox=function(t){return!(t.max.Xthis.max.X||t.max.Ythis.max.Y||t.max.Zthis.max.Z)},vo.prototype.intersectsSphere=function(t){return this.clampPoint(t.center,bo),bo.distanceToSquared(t.center)<=t.radius*t.radius},vo.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},vo.prototype.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(Ao),Po.subVectors(this.max,Ao),wo.subVectors(t.a,Ao),ko.subVectors(t.b,Ao),To.subVectors(t.c,Ao),Io.subVectors(ko,wo),So.subVectors(To,ko),Eo.subVectors(wo,To);var e=[0,-Io.Z,Io.Y,0,-So.Z,So.Y,0,-Eo.Z,Eo.Y,Io.Z,0,-Io.X,So.Z,0,-So.X,Eo.Z,0,-Eo.X,-Io.Y,Io.X,0,-So.Y,So.X,0,-Eo.Y,Eo.X,0];return!!Co(e,wo,ko,To,Po)&&!!Co(e=[1,0,0,0,1,0,0,0,1],wo,ko,To,Po)&&(Mo.crossVectors(Io,So),Co(e=[_trianglenormal.X,_trianglenormal.Y,_trianglenormal.Z],wo,ko,To,Po))},vo.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},vo.prototype.distanceToPoint=function(t){return bo.copy(t).clamp(this.min,this.max).sub(t).length()},vo.prototype.getBoundingSphere=function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(bo).length(),t},vo.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},vo.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},vo.prototype.applyMatrix4=function(t){return this.isEmpty()||(xo[0].set(this.min.X,this.min.Y,this.min.Z).applyMatrix4(t),xo[1].set(this.min.X,this.min.Y,this.max.Z).applyMatrix4(t),xo[2].set(this.min.X,this.max.Y,this.min.Z).applyMatrix4(t),xo[3].set(this.min.X,this.max.Y,this.max.Z).applyMatrix4(t),xo[4].set(this.max.X,this.min.Y,this.min.Z).applyMatrix4(t),xo[5].set(this.max.X,this.min.Y,this.max.Z).applyMatrix4(t),xo[6].set(this.max.X,this.max.Y,this.min.Z).applyMatrix4(t),xo[7].set(this.max.X,this.max.Y,this.max.Z).applyMatrix4(t),this.setFromPoints(xo)),this},vo.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},vo.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},vo.prototype.isBox3=!0;var xo=[new _o,new _o,new _o,new _o,new _o,new _o,new _o,new _o],bo=new _o;new vo;var wo=new _o,ko=new _o,To=new _o,Io=new _o,So=new _o,Eo=new _o,Ao=new _o,Po=new _o,Mo=new _o,Lo=new _o;function Co(t,e,i,r,o){for(var n=0,a=t.length-3;n<=a;n+=3){Lo.fromArray(t,n);var s=o.x*Math.abs(Lo.x)+o.y*Math.abs(Lo.y)+o.z*Math.abs(Lo.z),l=e.dot(Lo),u=i.dot(Lo),p=r.dot(Lo);if(Math.max(-Math.max(l,u,p),Math.min(l,u,p))>s)return!1}return!0}var zo=function(){this.lkTypeName="SceneObject",this.lkTypeArray=[],this.box3d=new vo};zo.prototype.GetTypeName=function(){return this.lkTypeName},zo.prototype.SetTypeName=function(t){this.lkTypeArray.push(this.lkTypeName),this.lkTypeName=t},zo.prototype.IsType=function(t){return this.lkTypeName===t},zo.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 Do=function(){this.bufferSize=0,this.elementCount=0,this.bufferData=void 0},Oo=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}(zo),Ro=function(e){function i(){e.call(this),this.SetTypeName("SceneSegment"),this.indexBufferData=new Do,this.vertexBufferData=new Do,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}(zo),Bo=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}(zo),Fo=function(e){function i(){e.call(this),this.SetTypeName("SceneNode"),this.children=[],this.nodeMeshes=[],this.nodeQuat=new go,this.nodeLocation=new _o,this.nodeScale=_o.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}(zo),Uo=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}(zo),jo=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 vo};jo.prototype.InitRenderTree=function(){},jo.prototype.Render=function(t){for(var e in this.IdentityModelMat(),this.renderBuffers)this.renderBuffers[e].Render(t,this)},jo.prototype.IdentityModelMat=function(){this.modelMatQueue=[],t.identity(this.modelMat)},jo.prototype.PopModelMat=function(){var e=this.modelMatQueue.pop();null!=e?this.modelMat=e:t.identity(this.modelMat)},jo.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)},jo.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)}},jo.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 p=new Float64Array(16);t.identity(p),t.multiply(p,this.projectMat,this.viewMat),this.projectViewMat=p},jo.prototype.UpdateMatrixes=function(t){this.projectViewMat=t.transform.mercatorMatrix},jo.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)},jo.prototype.AddRenderBuffer=function(t){this.newlyBuffers.push(t)},jo.prototype.RemoveRenderBuffer=function(t){for(var e=-1,i=0;i0&&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))}},nn.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},nn.prototype.getBounds=function(){return this.getNewBounds(this.getLngLat())},nn.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},nn.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)},nn.prototype.getArea=function(){return this.ringArea()},nn.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)},nn.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]o&&(o=t[n][1]),t[n][1]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)},nn.prototype.getId=function(){return this.id},nn.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:""})},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,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()},nn.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()},nn.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)},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.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)},nn.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)},nn.prototype.getOptions=function(){return this.options},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.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},nn.prototype.getzIndex=function(){return this.options.zIndex};var an={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},sn=function(e){function i(i,r){e.call(this),this.options=t.extend(Object.create(an),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 _o,this.carFront=new _o(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)Qo(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 p=new Float64Array(3);t.set(p,a,a,a),t.scale(s,s,p),t.rotateX(s,s,Math.PI/2);var h=mo.MakeVector2(this.carFront.X,this.carFront.Y),c=Math.atan2(h.X,h.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}(qo),ln=function(t){this._naviPath=t,this._pathInfo=[],this._total=0};ln.prototype.calculation=function(){if(this._pathInfo=[],this._total=0,this._naviPath&&!(this._naviPath.length<2))for(var e,i=0;ithis.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))}},pn.Running.set=function(t){this.bRunning=t,this.bRunning||this.naviMgr._eventCallback("traceEnd")},un.prototype.ClearData=function(){this.naviPath=[],this.lineLength=0,this.mapLastUpdateTime=0,this.curPosition=new _o,this.curFront=new _o,this.pathLinePoints=[],this.bPlayEnd=!1,this.bHasData=!1},un.prototype.IsEnded=function(){return this.bPlayEnd},un.prototype.HasData=function(){return this.bHasData},un.prototype.HaverSin=function(t){var e=Math.sin(t/2);return e*e},un.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))},un.prototype.ConvertDegreesToRadians=function(t){return t*Math.PI/180},Object.defineProperties(un.prototype,pn);var hn=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 un(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),cn=function(e){this.mapInst=e,this.naviMgr=new hn(this,e),this.renderTree=new jo,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)};cn.prototype.getNaviMgr=function(){return this.naviMgr||(this.naviMgr=new hn(this,this.mapInst)),this.naviMgr},cn.prototype.UpdateMap=function(){return this.mapInst.style._updateSources(this.mapInst.transform),!0},cn.prototype.setTrackedModel=function(t){this._tracked=t},cn.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 sn(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 yo).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},cn.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},cn.prototype.onMapClick=function(t){this.models.forEach((function(t,e){}))},cn.prototype.getModels=function(t){var e=[];return this.models.forEach((function(t,i){e.push(t)})),e},cn.prototype.removeAllModel=function(){this.models.clear(),this.result=[]},cn.prototype.getModel=function(t){return this.models.get(t)},cn.prototype.hasModel=function(t){return this.modelDataCache.has(t)},cn.prototype.HasAnim=function(){return!!this.naviMgr.naviSim.bRunning||this.bHasAnim},cn.prototype.InitSceneMgr=function(t){t&&this.naviMgr.InitNavi()},cn.prototype.AddRenderBuffer=function(t){this.renderTree.AddRenderBuffer(t)},cn.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 nn({map:e.mapInst,path:u,cursor:"move",strokeWeight:2,strokeColor:"#0f0",fillOpacity:.5})}}))},cn.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()},cn.prototype.RenderScene=function(t){this.renderTree.Render(t)};var fn=t.window.HTMLImageElement,dn=t.window.HTMLElement,mn=t.window.ImageBitmap,yn=t.config.version,gn={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:"",mapVersion:"© 2019 eMapgo - GS (2020) 149号"},cursor:"grab",isHotspot:!1,isHotspotActive:!1,isHotspotTextColor:"#0037e4",enable3D:!1,enableNavi:!1,sky:!0,fog:!0,indoor:!1,indoorOptions:{},isWebGL2:!0},_n=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 dn&&(o.container=e),null!=(o=t.extend({},gn,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 Qi(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 Jr,this._domRenderTaskQueue=new Jr,this._mapId=t.uniqueId(),this._locale=t.extend({},fo,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._logoData="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",this._popup=null,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 ho(this,o.indoorOptions)),this.db=null,this.IndexDB=new co(this),o.enableNavi&&(o.enable3D=!0),o.enable3D?(this.modelBox=this._sceneMgr=new cn(this),this.modelBox.InitSceneMgr(o.enableNavi),this.tracePlayback=this.modelBox.getNaviMgr()):this.modelBox=null,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new oo(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 dn))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.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 Hr(this,o),this._hash=o.hash&&new tr("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 Kr,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='

您当前使用的浏览器版本过低,请升级或更换浏览器后重试。

'}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()=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()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&&ethis.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 ur(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 ur(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 ur(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-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_",mapvgl:"LKMapvgl-",clusterer:"LKClusterer_"},r=Object.keys(i);if(t&&r.indexOf(t)<0)return[];var o=this._markers.concat(this._texts,this._customLayers);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 Ui(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 p=this.transform.zoom,h=t.exported.now();this.style.zoomHistory.update(p,h);var c=new t.EvaluationParameters(p,{now:h,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 Kr&&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=0?e.split("/styles/")[1]:e;var a=t.config.API_URL+"/openplatform/v1/mapStyle/getStyle",s={styleId:o,type:0===r||1===r?r:1,AK:t.config.USER_AK};return new Promise((function(t,e){no.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||uo.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.mapVersion=t.data.recordationNumber?t.data.recordationNumber:""),i.setStyle(t.data.styleContent,{diff:!1})}else i._showErrorEvent(t),i.getStyleData(gn.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.mapVersion=e.data.recordationNumber?e.data.recordationNumber:""),i.setStyle(e.data.styleContent,{diff:!1})}),(function(t){}))}),(function(t){})),i.addMapAuditCode(),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.mapVersion=i.recordationNumber?i.recordationNumber:"",e.addMapAuditCode(),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;s0)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])a&&(a=parseFloat(t[1])),parseFloat(t[1])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.toArray(),zoom:this.transform.zoom,pitch:this.transform.pitch,bearing:this.transform.bearing};return t?JSON.stringify(e):e},Object.defineProperties(o.prototype,n),o}(Yr);function vn(t){t.parentNode&&t.parentNode.removeChild(t)}var xn={showCompass:!0,showZoom:!0,visualizePitch:!1},bn=function(e){var i=this;this.options=t.extend({},xn,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))};bn.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())},bn.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)}))},bn.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 wn(this._map,this._compass,this.options.visualizePitch)),this._container},bn.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},bn.prototype._createButton=function(t,e){var i=a.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i},bn.prototype._setButtonTitle=function(t,e){var i=this._map._getUIString("NavigationControl."+e);t.title=i,t.setAttribute("aria-label",i)};var wn=function(e,i,r){void 0===r&&(r=!1),this._clickTolerance=10,this.element=i,this.mouseRotate=new wr({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,r&&(this.mousePitch=new kr({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)};wn.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),a.disableDrag()},wn.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)}},wn.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()},wn.prototype.offTemp=function(){a.enableDrag(),a.removeEventListener(t.window,"mousemove",this.mousemove),a.removeEventListener(t.window,"mouseup",this.mouseup)},wn.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)},wn.prototype.mousemove=function(t){this.move(t,a.mousePos(this.element,t))},wn.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},wn.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))},wn.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))},wn.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)e.getEast()||i.latitudee.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&&Sn)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 ro(this._dotElement),this._circleElement=a.create("div","lkmap-user-location-accuracy-circle"),this._accuracyCircleMarker=new ro({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":In--,Sn=!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"),++In>1?(e={maximumAge:6e5,timeout:0},Sn=!0):(e=this.options.positionOptions,Sn=!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),An=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};An.prototype.getDefaultPosition=function(){return"bottom-right"},An.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},An.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},An.prototype._setElementTitle=function(t,e){var i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i)},An.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"))},An.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}];if(e){var r=i.reduce((function(t,e,r){return e.value&&(t+=e.key+"="+e.value+(r=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)}},An.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("lkmap-compact"):this._container.classList.remove("lkmap-compact","lkmap-compact-show")};var Pn={maxWidth:100,unit:"metric"},Mn=function(e){this.options=t.extend({},Pn,e),t.bindAll(["_onMove","setUnit"],this)};function Ln(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?Cn(e,r,l/5280,t._getUIString("ScaleControl.Miles"),t):Cn(e,r,l,t._getUIString("ScaleControl.Feet"),t)}else i&&"nautical"===i.unit?Cn(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles"),t):s>=1e3?Cn(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers"),t):Cn(e,r,s,t._getUIString("ScaleControl.Meters"),t)}function Cn(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+" "+r}))}Mn.prototype.getDefaultPosition=function(){return"bottom-left"},Mn.prototype._onMove=function(){Ln(this._map,this._container,this.options)},Mn.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},Mn.prototype.onRemove=function(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Mn.prototype.setUnit=function(t){this.options.unit=t,Ln(this._map,this._container,this.options)};var zn=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")};zn.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},zn.prototype.onRemove=function(){a.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},zn.prototype._checkFullscreenSupport=function(){return!(!t.window.document.fullscreenEnabled&&!t.window.document.webkitFullscreenEnabled)},zn.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)},zn.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},zn.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},zn.prototype._isFullscreen=function(){return this._fullscreen},zn.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())},zn.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 Dn={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},On=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Rn=function(e){function r(i){e.call(this),this.options=t.extend(Object.create(Dn),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._map&&this._map._popup&&this._map._popup.remove(),e._popup&&e._popup.remove(),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=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(){return this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map&&(this._map._popup=null,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),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="×",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="×",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=Qr(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=Bn(this.options.offset);if(this.options.offset&&(this.options.offset instanceof Array||(l=Bn([this.options.offset.x,this.options.offset.y]))),!s){var u,p=this._container.offsetWidth,h=this._container.offsetHeight;u=r.y+l.bottom.ythis._map.transform.height-h?["bottom"]:[],r.x

this._map.transform.width-p/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,$r[s]+" translate("+c.x+"px,"+c.y+"px)"),to(this._container,s,"popup")),this._container.style.willChange=null}},r.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(On);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,p=0;if(i/e>=3&&(p=50,l=-n/Math.cos(p)),!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("+p+"deg)";var h=t.window.document.createElement("div");h.className="topLeft",h.style.width=s+"px",h.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(h),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.xe-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.xi-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.xi&&(r+=t.x-i+20,this.checkStatus=!0),r},r.prototype._getPixelYone=function(t,e,i){var r=0;return t.yi-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.yi&&(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=0&&t.y=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=0&&t.y0&&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 Nn=new jn,Vn={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},Gn=function(e){this.options=t.extend(Object.create(Vn),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()};Gn.prototype.init=function(){this.setDataType(),this.creatCircleData()},Gn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Gn.prototype.getExtData=function(){return this.extData||this.options.extData},Gn.prototype.setDataType=function(){this.options.coordinates=this.options.center&&this.options.center.lng?[this.options.center.lng,this.options.center.lat]:this.options.center},Gn.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)},Gn.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)},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),this._map.off(t,this.lineGeojson.id,e)},Gn.prototype.getPath=function(){return this._circleData.geometry.coordinates[0]},Gn.prototype.getId=function(){return this.id},Gn.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())})))},Gn.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)},Gn.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())})))},Gn.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)},Gn.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()},Gn.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()},Gn.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)},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.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},Gn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},Gn.prototype.delete=function(){this._map.removeLayer(this.id)},Gn.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:""})},Gn.prototype.setCenter=function(t){this.options.center=t,this.setDataType(),this.updateSourceData()},Gn.prototype.getCenter=function(){return this.options.center},Gn.prototype.setRadius=function(t){this.options.radius=t,this.setDataType(),this.updateSourceData()},Gn.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))},Gn.prototype.getArea=function(){var t=this.options.radius;return t*t*3.14},Gn.prototype.getLayoutProperty=function(t){return this.geojson.paint[t]},Gn.prototype.getRadius=function(){return this.options.radius},Gn.prototype.getOptions=function(){return this.options},Gn.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)},Gn.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)},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={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},qn=function(e,i){this.options=t.extend(Object.create(Zn),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()};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.setLngLat=function(t){return this._LngLat=t&&t.lng?t:{lng:t[0],lat:t[1]},this.options.center=this._LngLat,this._LngLat},qn.prototype.setOffset=function(t){return this.options.offset=t&&(t.x||0==t.x)?t:{x:t[0],y:t[1]},this.options.offset},qn.prototype.getPath=function(t){return[[this._LngLat.lng,this._LngLat.lat]]},qn.prototype.getLngLat=function(t){return[[this._LngLat.lng,this._LngLat.lat]]},qn.prototype.getPosition=function(){return new i.LngLat(this._LngLat.lng,this._LngLat.lat)},qn.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)},qn.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)},qn.prototype.getCenter=function(){return this._LngLat},qn.prototype.getOptions=function(){return this.options},qn.prototype.getId=function(){return this.id},qn.prototype.remove=function(){this._map&&this._map.removeLayer(this.id),this._layers.one=""},qn.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()},qn.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))},qn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},qn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},qn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},qn.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},qn.prototype.setRadius=function(t){var e=parseInt(t,10);this.options.radius=e,this._map.setPaintProperty(this.id,"circle-radius",e)},qn.prototype.getRadius=function(){return this.options.radius},qn.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)},qn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible")},qn.prototype.hide=function(){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 Xn={content:"",position:[116.39636259768668,39.907768102373495]},Wn=function(e){this.options=t.extend(Object.create(Xn),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")};Wn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Wn.prototype.getExtData=function(){return this.extData||this.options.extData},Wn.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)},Wn.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)},Wn.prototype.closeOverlays=function(t){""!=this._mapOverlays.innerHTML&&(this._mapOverlays.innerHTML="",this._isOpen=!1,this.closeCallback&&"function"==typeof this.closeCallback&&this.closeCallback())},Wn.prototype.close=function(t){this.closeOverlays()},Wn.prototype.on=function(t,e){void 0===e&&(e=null),"close"==t&&e&&(this.closeCallback=e),"open"==t&&e&&(this.openCallback=e)},Wn.prototype.off=function(t,e){void 0===e&&(e=null),"close"==t&&e&&(this.closeCallback=null),"open"==t&&e&&(this.openCallback=null)},Wn.prototype.updataStyle=function(){var t=this._map.lngLatToContainer(this.lnglat);this.setStyle(t)},Wn.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)},Wn.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])))},Wn.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()}},Wn.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()},Wn.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()},Wn.prototype.setStyle=function(t){this._container.style.top=t.y+"px",this._container.style.left=t.x+"px",this._mapOverlays.appendChild(this._container)};var Hn={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},Yn=function(e,i){this.options=t.extend(Object.create(Hn),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()};Yn.prototype.init=function(){this.getCurvelinePath(),this.createGeojson(),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.getCurvelinePath=function(){var e=this.options.path;this.features=[];for(var i=0;ir&&(r=t[n][0]),t[n][0]o&&(o=t[n][1]),t[n][1]this.options.path.length&&cancelAnimationFrame(this.animateFun),this.animateFun=requestAnimationFrame(this.animate())},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)},Yn.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)},Yn.prototype.getOptions=function(){return this.options},Yn.prototype.setColor=function(t){this._map.setPaintProperty(this.id,"line-color",t)},Yn.prototype.setOpacity=function(t){this._map.setPaintProperty(this.id,"line-opacity",t)},Yn.prototype.setWeight=function(t){this._map.setPaintProperty(this.id,"line-width",t)},Yn.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},Yn.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this.options.showDir&&this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},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={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},Jn=function(e){this.options=t.extend(Object.create(Kn),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()};Jn.prototype.init=function(){this.setDataType(),this.getEllipseData(),this.creatSourceData(),this._map&&this.setMap(this._map)},Jn.prototype.setExtData=function(t){this.extData=this.options.extData=t},Jn.prototype.getExtData=function(){return this.extData||this.options.extData},Jn.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)])},Jn.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,p=r*l,h=o*l,c=6356725+21412*(90-o)/90,f=c*Math.cos(h),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+p)*u,(g/c+h)*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}))},Jn.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()},Jn.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)},Jn.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()}},Jn.prototype.setCenter=function(t){this.options.center=t,this.setDataType(),this.getEllipseData(),this.geojson.source.data=this._circleData,this.updateSourceData()},Jn.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},Jn.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)},Jn.prototype.getPath=function(){return this._circleData.geometry.coordinates[0]},Jn.prototype.getId=function(){return this.id},Jn.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())})))},Jn.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)},Jn.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())})))},Jn.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)},Jn.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()},Jn.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()},Jn.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)},Jn.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))},Jn.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},Jn.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},Jn.prototype.show=function(){this._map.getLayer(this.id)&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible"))},Jn.prototype.hide=function(){this._map.getLayer(this.id)&&(this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none"))},Jn.prototype.delete=function(){this._map.getLayer(this.id)&&(this._map.removeLayer(this.id),this._layers.one="")},Jn.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:""})},Jn.prototype.getCenter=function(){return this.options.center},Jn.prototype.setRadius=function(t){this.options.radius=t,this.setDataType(),this.getEllipseData(),this.geojson.source.data=this._circleData,this.updateSourceData()},Jn.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))},Jn.prototype.getArea=function(){return i.GeometryUtil.ringArea(this._circleData.geometry.coordinates[0])},Jn.prototype.getLayoutProperty=function(t){return this.geojson.paint[t]},Jn.prototype.getRadius=function(){return this.options.radius},Jn.prototype.getOptions=function(){return this.options},Jn.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)},Jn.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)},Jn.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},Jn.prototype.getzIndex=function(){return this.options.zIndex};var Qn=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()};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.createPolygon=function(){},Qn.prototype.importData=function(t){this.remove(),this.options.geoJSON=t,this.createGeojson(),this._map&&this.setMap(this._map)},Qn.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)}}},Qn.prototype.getPath=function(t){return void 0===t&&(t=null),"all"==t?this.getLngLat(this.options.path):this.options.path},Qn.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},Qn.prototype.getId=function(){return this.id},Qn.prototype.clearOverlays=function(){this.remove()},Qn.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={}}},Qn.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()},Qn.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()},Qn.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()},Qn.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)}},Qn.prototype.addOverlay=function(t){this._map&&(t.setMap(this._map),this.pushLayer(t))},Qn.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)}))},Qn.prototype.getOverlays=function(){return this._markerLayers.concat(this._polylineLayers,this._polygonLayers)},Qn.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},Qn.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}},Qn.prototype.removeOverlays=function(t){for(var e in t)this.removeOverlay(t[e])};var $n={url:"",bounds:null,zooms:[3,24],opacity:1,cursor:"",visible:!0,zIndex:50},ta=function(e,i){this.options=t.extend(Object.create($n),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()};ta.prototype.init=function(){this.createGeojson()},ta.prototype.setExtData=function(t){this.extData=this.options.extData=t},ta.prototype.getExtData=function(){return this.extData||this.options.extData},ta.prototype.getPath=function(){return this.geojson.source&&this.geojson.source.coordinates&&this.geojson.source.coordinates.length>0?this.geojson.source.coordinates:[]},ta.prototype.getBounds=function(){return this.options.bounds},ta.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))},ta.prototype.getZooms=function(){return this.options.zooms},ta.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.id,t[0],t[1]))},ta.prototype.getImageUrl=function(){return this.options.url},ta.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())},ta.prototype.getMap=function(){return this._map},ta.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},ta.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)},ta.prototype.getId=function(){return this.id},ta.prototype.remove=function(){this._map&&(this.status=!1,this._map.removeLayer(this.id),this._layers.one="")},ta.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())},ta.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])}))}},ta.prototype.getOptions=function(){return this.options},ta.prototype.show=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","visible")},ta.prototype.hide=function(){this.status&&this._map.setLayoutProperty(this.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};var ea={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:""},ia=function(e,i){this.options=t.extend(Object.create(ea),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)};ia.prototype.init=function(){this._addPolylineSource(),this.createGeojson()},ia.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)},ia.prototype.createGeojson=function(){this._createLineGeojson(),this.options.showBorder&&this._createBorderLine(),this.options.showDir&&this._creatDirLine(),this._addLayer(),this._addShowDirFun()},ia.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)},ia.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},ia.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},ia.prototype.setExtData=function(t){this.extData=this.options.extData=t},ia.prototype.getExtData=function(){return this.extData||this.options.extData},ia.prototype.getLength=function(){var e=t.lineString(this.options.path),i=t.length$2(e,{units:"kilometers"});return Math.round(1e3*i)},ia.prototype.getBounds=function(){return this.getNewBounds(this.options.path)},ia.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]o&&(o=t[n][1]),t[n][1]this.options.path.length&&cancelAnimationFrame(this.animateFun),this.animateFun=requestAnimationFrame(this.animate())},ia.prototype.on=function(t,e){void 0===e&&(e=null),this._map.on(t,this.id,e)},ia.prototype.off=function(t,e){void 0===e&&(e=null),this._map.off(t,this.id,e)},ia.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)},ia.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)},ia.prototype.getOptions=function(){return this.options},ia.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))},ia.prototype.setColor=function(t){this._map&&this._map.style.hasLayer(this.id)&&(this.options.strokeColor=t,this._map.setPaintProperty(this.id,"line-color",t))},ia.prototype.setOpacity=function(t){this._map&&this._map.style.hasLayer(this.id)&&(this.options.strokeOpacity=t,this._map.setPaintProperty(this.id,"line-opacity",t))},ia.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))},ia.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))},ia.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))},ia.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))},ia.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")},ia.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")},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},ia.prototype.showDir=function(){this.options.showDir=!0,this._creatDirLine(),this._addShowDirFun()},ia.prototype.removeDir=function(){this.options.showDir&&this._map.style.hasLayer(this.lineGeojson.id)&&this._map.removeLayer(this.lineGeojson.id)};var ra={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},oa=function(e,i){this.options=t.extend(Object.create(ra),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()};oa.prototype.init=function(){this.createGeojson()},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(t){return this.options.path},oa.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},oa.prototype.getBounds=function(){return this.options.bounds},oa.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))},oa.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)},oa.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)},oa.prototype.getId=function(){return this.id},oa.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:""})},oa.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())})))},oa.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)},oa.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())})))},oa.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)},oa.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()},oa.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()},oa.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)},oa.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))},oa.prototype._mouseenterCallbackFun=function(){this._map.setCursor(this.options.cursor)},oa.prototype._mouseleaveCallbackFun=function(){this._map.setCursor(this._mapStyleCursor)},oa.prototype.on=function(t,e){this._map.on(t,this.id,e)},oa.prototype.off=function(t,e){this._map.off(t,this.id,e)},oa.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)},oa.prototype.getOptions=function(){return this.options},oa.prototype.show=function(){this._map.setLayoutProperty(this.id,"visibility","visible"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","visible")},oa.prototype.hide=function(){this._map.setLayoutProperty(this.id,"visibility","none"),this._map.setLayoutProperty(this.lineGeojson.id,"visibility","none")},oa.prototype.contains=function(t){return this.isPointInRing(t,this.options.path)},oa.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)},oa.prototype.getArea=function(){return this.ringArea(this.options.path)},oa.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)}},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={url:"",bounds:null,zooms:[3,24],opacity:1,cursor:"",visible:!0,zIndex:50},aa=function(e,i){this.options=t.extend(Object.create(na),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()};aa.prototype.init=function(){this.createGeojson(),this._map&&this.setMap(this._map)},aa.prototype.setExtData=function(t){this.extData=this.options.extData=t},aa.prototype.getExtData=function(){return this.extData||this.options.extData},aa.prototype.getPath=function(){return this.geojson.source&&this.geojson.source.coordinates&&this.geojson.source.coordinates.length>0?this.geojson.source.coordinates:[]},aa.prototype.getBounds=function(){return this.options.bounds},aa.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))},aa.prototype.getZooms=function(){return this.options.zooms},aa.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.id,t[0],t[1]))},aa.prototype.getVideoUrl=function(){return this.options.url},aa.prototype.setVideoUrl=function(t){this.status&&(this.options.url=t,this.remove(),this.init())},aa.prototype.getElement=function(){if(this.status)return this._map.getSource(this.id).getVideo()},aa.prototype.getMap=function(){return this._map},aa.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]},aa.prototype.getId=function(){return this.id},aa.prototype.remove=function(){this._map&&(this.status=!1,this._map.removeLayer(this.id),this._layers.one="")},aa.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())},aa.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])}))},aa.prototype.getOptions=function(){return this.options},aa.prototype.show=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","visible")},aa.prototype.hide=function(){this.status&&this._map.setLayoutProperty(this.id,"visibility","none")},aa.prototype.pause=function(){this.status&&this._map.getSource(this.id).video.pause()},aa.prototype.play=function(){this.status&&this._map.getSource(this.id).video.play()},aa.prototype.setzIndex=function(t){this.options.zIndex=parseInt(t),this._map&&this._map.style.updateOverLayerzIndex(this)},aa.prototype.getzIndex=function(){return this.options.zIndex};var sa={visible:!0},la=function(e){this.matrix=new Float64Array(16),t.identity(this.matrix),this.indexData=[],this._options=e=t.extend(e=e||{},sa),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=2&&this.isEquals(e[o-1],e[o-2],r);)o--;for(var n=0;n1&&(t=1),t<0&&(t=0),this.options.opacity=t,this._map.setPaintProperty(this.id,"raster-opacity",this.options.opacity))},pa.prototype.getOpacity=function(){return this.options.opacity},pa.prototype.show=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.visible=!0)},pa.prototype.hide=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","none"),this.options.visible=!1)},pa.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)}},pa.prototype.getzIndex=function(){return this.options.zIndex},pa.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})},pa.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}},pa.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}},pa.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 ha={map:null,beforeId:"",tiles:[],url:"",attribution:"",maxzoom:24,minzoom:3,bounds:[],scheme:"xyz",volatile:!1,promoteId:null},ca=function(e){void 0===e&&(e={}),this.options=t.extend(Object.create(ha),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"],this),this._setDefaultData(),this._map&&this.init()};ca.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"]},ca.prototype.init=function(){this._addSourceFun()},ca.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)},ca.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)}},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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},ca.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)}}))}},ca.prototype._updateUserLayers=function(e){for(var i=this,r=null,o=0;o0&&(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 p=Object.keys(e.FillExtrusionStyle);p.length>0&&(r.FillExtrusionStyle=t.extend(r.FillExtrusionStyle,e.FillExtrusionStyle),p.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},ca.prototype.show=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"show")},ca.prototype.hide=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"hide")},ca.prototype.removeLayer=function(t){void 0===t&&(t=null),0!=this._layersId.length&&this._map&&this._updateListData(t,"remove")},ca.prototype.remove=function(t){void 0===t&&(t=null),this.removeLayer(t)},ca.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")}}))},ca.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},ca.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}},ca.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 fa={map:null,tileSize:256,errorUrl:"",getTileUrl: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,scheme:"xyz",bounds:null},da=function(e){this.options=t.extend(Object.create(fa),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()};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 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]},da.prototype.createGeojson=function(){this.source={type:"raster",tiles:[],tileSize:this.options.tileSize,scheme:this.options.scheme},this.options.bounds&&(this.source.bounds=this._getBounds()),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)},da.prototype.getId=function(){return this.id},da.prototype.remove=function(t){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.setTileUrl=function(t){this.status&&this._map&&t&&(this.options.getTileUrl=t,this.init(),this.remove(),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.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))}},da.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}},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=this._map.style._getOldLayer(this.options.zIndex);this._map.moveLayer(this.id,e.oldLayerID)}},da.prototype.getzIndex=function(){return this.options.zIndex},da.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}},da.WMS=pa,da.VECTOR=ca;var ma={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},ya=function(e){this.options=t.extend(Object.create(ma),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 ga(t,e){var i=JSON.parse(JSON.stringify(t));for(var r in e)i[r]=e[r];return i}ya.prototype.init=function(){this.createGeojson()},ya.prototype.getZooms=function(){return this.options.zooms},ya.prototype.setZooms=function(t){this.status&&(this.options.zooms=t,this._map.setLayerZoomRange(this.geojson.id,t[0],t[1]))},ya.prototype.setExtData=function(t){this.extData=this.options.extData=t},ya.prototype.getExtData=function(){return this.extData||this.options.extData},ya.prototype.getBounds=function(){return this.options.bounds},ya.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))},ya.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)},ya.prototype.getId=function(){return this.id},ya.prototype.remove=function(){this._map&&(this._map.getLayer(this.id)&&this._map.removeLayer(this.id),this.status=!1)},ya.prototype.reload=function(){this.status&&this._map&&(this.remove(),this.init(),this._addLayer())},ya.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()},ya.prototype._addLayer=function(){this.status=!0,this._map.addLayer(this.geojson,this.options.beforeId,this.options.zIndex)},ya.prototype.getElement=function(){return document.getElementById(this.options.canvasId)},ya.prototype.setCanvas=function(t){this.status&&this._map&&t&&(this.options.canvasId=t,this.reload())},ya.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))}},ya.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}},ya.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))},ya.prototype.getOpacity=function(){return this.options.opacity},ya.prototype.show=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","visible"),this.options.visible=!0)},ya.prototype.hide=function(){this.status&&this._map&&(this._map.setLayoutProperty(this.id,"visibility","none"),this.options.visible=!1)},ya.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)}},ya.prototype.getzIndex=function(){return this.options.zIndex};var _a=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=ga(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=1?o.map.transform.maxZoom=o.map._options.maxZoom:(h.position=i.MercatorCoordinate.fromLngLat({lng:p[0],lat:p[1]},s),h.lookAtPoint({lng:r[0],lat:r[1]}),o.map.setFreeCameraOptions(h))},this._startAnimationFrame(0)},r}(t.Evented);i&&(i.CameraAnimation=_a);var va=function(t,e){this._naviPath=t,this._speed=e,this._pathInfo=[],this._total=0};va.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)}},va.prototype.mercatorToLngLat=function(t,e){return[360*t-180,360/Math.PI*Math.atan(Math.exp((180-360*e)*(Math.PI/180)))-90]},va.prototype.calculation=function(){if(this._pathInfo=[],this._total=0,this._naviPath&&!(this._naviPath.length<2))for(var e=0;e180&&(i-=360),i},va.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=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].rotation:this._lerp(this._pathInfo[i-1].rotation,this._pathInfo[i].rotation,1-o),l=0==i?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 xa=function(t){this.flyPath=t,this.map=t._map,this.naviPath=[],this.EARTH_RADIUS=6371137,this.desIndex=0,this.lineLength=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},ba={Running:{configurable:!0}};xa.prototype.StartSim=function(){this.startTime=new Date,this.curTime=this.startTime.getTime(),this.lastTime=this.startTime.getTime(),this.bRunning=!0},xa.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)},xa.prototype.EndSim=function(){this.bRunning=!1},xa.prototype.setSpeed=function(t){this.options.speed=t,this.speed=1e3*t/3600},xa.prototype.getSpeed=function(){return this.options.speed},xa.prototype.setPath=function(t){this.ClearData(),this.options.path=t,this._updatePath()},xa.prototype.getPath=function(){return this.options.path},xa.prototype.setStartIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.startIndex=t,this._updatePath()},xa.prototype.setEndIndex=function(t){void 0===t&&(t=0),this.ClearData(),this.options.endIndex=t,this._updatePath()},xa.prototype.getStartIndex=function(){return this.options.startIndex},xa.prototype.getEndIndex=function(){return this.options.endIndex},xa.prototype._updatePath=function(){this.naviPath=this._getNaviPath(),this.pathInfo=new va(this.naviPath,this.speed),this.pathInfo.calculation(),this.lineLength=0,this.bHasData=!0},xa.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;r0?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,this.fire(new t.Event(e,i))},i}(t.Evented),ka={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([ka.getLineAllLngLat(e[0])]),t.area$1(i);var r=Math.round(n);t.polygon([ka.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?ka.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?ka.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?ka.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?[ka.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?ka.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?ka.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?[ka.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ka.getLineAllLngLat(i)]:[i.getPath()]);var n=t.booleanOverlap(r,o),a=t.booleanOverlap(o,r),s=ka.isRingInRing(e,i);return!!(n||a||s)},getRingIntersect:function(e,i){var r,o;return r=t.polygon(e instanceof Array?[ka.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ka.getLineAllLngLat(i)]:[i.getPath()]),t.intersect(r,o).geometry.coordinates[0]},ringRingClip:function(e,i){var r,o;r=t.polygon(e instanceof Array?[ka.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ka.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?[ka.getLineAllLngLat(e)]:[e.getPath()]),o=t.polygon(i instanceof Array?[ka.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?ka.getLineAllLngLat(e):e.getPath()),o=t.lineString(i instanceof Array?ka.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?ka.getLineAllLngLat(e):e.getPath()),o=t.lineString(i instanceof Array?ka.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([ka.getLineAllLngLat(e[0])]),o=t.polygon([ka.getLineAllLngLat(e[1])]);i=ka.ringArea(e[0])>ka.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=ka.ringArea(e.getPath()[0])>ka.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}},Ta={version:t.config.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:_n,NavigationControl:bn,GeolocateControl:En,AttributionControl:An,ScaleControl:Mn,FullscreenControl:zn,Popup:Rn,InforWindow:Rn,InfoWindow:Rn,Marker:ro,Text:Un,Style:le,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,FreeCameraOptions:Hi,Evented:t.Evented,config:t.config,Bounds:t.LngLatBounds,LKTurf:t.LKTurf,Size:$o,Pixel:tn,Icon:rn,GeometryUtil:ka,Msg:Nn,Polyline:ia,Circle:Gn,Polygon:nn,GeoJSON:Qn,CircleMarker:qn,Rectangle:oa,ContextMenu:Wn,CurveLine:Yn,Ellipse:Jn,ImageLayer:ta,VideoLayer:aa,Polyline3D:la,TileLayer:da,CanvasLayer:ya,CameraAnimation:_a,FlyPath:wa,UT:no,replaceRequestAK:t.replaceRequestAK,prewarm:function(){$().acquire(J)},clearPrewarmedResources:function(){var t=K;t&&t.isPreloaded()&&1===t.numActive()&&(t.release(J),K=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 Q.workerCount},set workerCount(t){Q.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 Ta})),i}));