var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n["throw"](t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return u([t,e])}}function u(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-b236363f.system.js","./p-1939e1c4.system.js","./p-9089e441.system.js"],function(t){"use strict";var e,r,n,i;return{setters:[function(t){e=t.r;r=t.h},function(t){n=t._},function(t){i=t.g}],execute:function(){var o=function(){function t(t){e(this,t);this.data={};this.batchSize=20;this.display="visible";this.features=[];this.item=true;this.loadingSpinner="bubbles";this.loadingText=n("webmapgl.feature-list.loading");this.order="asc"}t.prototype.componentWillLoad=function(){var t=this;this.handleSourceId();var e=this.getMap();if(e)e.on("moveend",function(){return t.filter()})};t.prototype.handleInfiniteScroll=function(t){this.limit+=this.batchSize;t.target.complete()};t.prototype.handleStyleUpdated=function(t){if(t.detail.id===this.styleId)this.handleSourceId()};t.prototype.handleSourceId=function(){return __awaiter(this,void 0,void 0,function(){var t,e,r,n;return __generator(this,function(i){switch(i.label){case 0:t=document.querySelector("#"+this.styleId);if(!t||!t.json.sources)return[2];e=t.json.sources[this.sourceId].data;if(!(typeof e==="string"))return[3,3];return[4,fetch(e)];case 1:r=i.sent();n=this;return[4,r.json()];case 2:n.data=i.sent();return[3,4];case 3:this.data=e;i.label=4;case 4:this.filter();return[2]}})})};t.prototype.getMap=function(){return i(this.mapId).map};t.prototype.filter=function(){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){if(!this.data.features)return[2];if(this.display==="all"){t=this.data.features}else{e=this.getMap().getBounds();t=this.data.features.filter(function(t){var r=t.geometry.coordinates,n=r[0],i=r[1];return n>=e.getWest()&&n<=e.getEast()&&i>=e.getSouth()&&i<=e.getNorth()})}this.limit=this.batchSize;this.features=this.sort(t);return[2]})})};t.prototype.sort=function(t){var e=this;if(this.order==="none"||!this.orderBy)return t;t.sort(function(t,r){var n=t.properties[e.orderBy];var i=r.properties[e.orderBy];if(n<i)return e.order==="asc"?-1:1;if(n>i)return e.order==="asc"?1:-1;return 0});return t};t.prototype.render=function(){var t=this;var e=this.component;var n=this.limit?this.features.slice(0,this.limit):this.features;var i=n.length<this.features.length;var o=n.map(function(n){var i=r(e,Object.assign({feature:n},t.componentOptions));return t.item?r("ion-item",null,i):i});return[r("ion-list",null,r("slot",{name:"start"}),o,r("slot",{name:"end"})),r("ion-infinite-scroll",{disabled:!i},r("ion-infinite-scroll-content",{"loading-spinner":this.loadingSpinner,"loading-text":this.loadingText}))]};Object.defineProperty(t,"watchers",{get:function(){return{styleId:["handleSourceId"],sourceId:["handleSourceId"]}},enumerable:true,configurable:true});return t}();t("gl_feature_list",o)}}});