var __awaiter=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function l(e){try{s(i.next(e))}catch(e){o(e)}}function a(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(l,a)}s((i=i.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,i,r,o,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return l.label++,{value:o[1],done:!1};case 5:l.label++,i=o[1],o=[0];continue;case 7:o=l.ops.pop(),l.trys.pop();continue;default:if(!(r=(r=l.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){l=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){l.label=o[1];break}if(6===o[0]&&l.label<r[1]){l.label=r[1],r=o;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(o);break}r[2]&&l.ops.pop(),l.trys.pop();continue}o=t.call(e,l)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};webmapgl.loadBundle("mp3x7j6o",["exports","./chunk-962dfafc.js"],function(e,t){var n=window.webmapgl.h,i=function(){function e(){this.toggle=!1,this.widget="item"}return e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return this.handleStyleId(),[2]})})},e.prototype.handleStyleId=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,this.getStyle()];case 1:return(e=t.sent())&&this.update(e.json),[2]}})})},e.prototype.handleStyleAdded=function(e){e.detail.id===this.styleId&&this.update(e.detail.json)},e.prototype.handleStyleUpdated=function(e){e.detail.id===this.styleId&&this.update(e.detail.json)},e.prototype.getStyle=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return(e=document.querySelector("gl-style#"+this.styleId))?[4,e.componentOnReady()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2,e]}})})},e.prototype.getVisible=function(e){var n=t.toArray(this.layers);if(!n||!n.length)return!0;if(!e.layers||!e.layers.length)return!1;for(var i=0,r=e.layers;i<r.length;i++){var o=r[i];if(-1!==n.indexOf(o.id))return!o.layout||"none"!==o.layout.visibility}},e.prototype.setVisible=function(e){return __awaiter(this,void 0,void 0,function(){var n,i,r;return __generator(this,function(o){switch(o.label){case 0:return this.visible===e?[2]:(n=t.toArray(this.layers),[4,this.getStyle()]);case 1:return(i=o.sent())?((r=Object.assign({},i.json)).layers=(r.layers||[]).map(function(t){return-1!==n.indexOf(t.id)&&(t.layout=t.layout||{},t.layout.visibility=e?"visible":"none"),t}),i.json=r,[2]):[2]}})})},e.prototype.update=function(e){e&&(this.visible=this.getVisible(e))},e.prototype.render=function(){var e=this,t=[];return this.image&&t.push(n("ion-thumbnail",{slot:"start"},n("img",{src:this.image,alt:this.el.textContent}))),t.push(n("ion-label",null,n("slot",null))),this.toggle&&t.push(n("ion-toggle",{slot:"end",checked:this.visible,onIonChange:function(t){return e.setVisible(t.detail.checked)}})),n("divider"===this.widget?"ion-item-divider":"ion-item",null,t)},Object.defineProperty(e,"is",{get:function(){return"gl-legend-item"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{el:{elementRef:!0},image:{type:String,attr:"image"},layers:{type:String,attr:"layers"},styleId:{type:String,attr:"style-id",watchCallbacks:["handleStyleId"]},toggle:{type:Boolean,attr:"toggle"},visible:{state:!0},widget:{type:String,attr:"widget"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"listeners",{get:function(){return[{name:"body:glStyleElementAdded",method:"handleStyleAdded"},{name:"body:glStyleElementModified",method:"handleStyleUpdated"}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"gl-legend-item .item ion-thumbnail{height:40px;width:40px}"},enumerable:!0,configurable:!0}),e}();e.GlLegendItem=i,Object.defineProperty(e,"__esModule",{value:!0})});