(()=>{"use strict";var e={},t={};function a(i){var n=t[i];if(void 0!==n)return n.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,a),r.exports}a.rv=()=>"1.4.5",a.ruid="bundler=rspack@1.4.5",lizMap.events.on({uicreated:function(e){var t,a,i=lizMap.config;lizMap.layers;var n=!1,r=0,m=0;if(!("timemanagerLayers"in i))return -1;r=Object.keys(lizMap.config.timemanagerLayers).length,$("#timemanager-menu button.btn-timemanager-clear").click(function(){$("#button-timemanager").click()}),lizMap.events.on({minidockopened:function(e){"timemanager"!=e.id||n||($("#timemanager-menu").show(),function(){var e=1/0,t=-1/0;for(var n in i.timemanagerLayers)!function(e,t){var a=e.startAttribute;if(e.endAttribute&&""!=e.endAttribute&&e.endAttribute!=e.startAttribute&&(a+=","+e.endAttribute),"min_timestamp"in e&&e.min_timestamp&&""!=e.min_timestamp&&"max_timestamp"in e&&e.max_timestamp&&""!=e.max_timestamp)return t(e.min_timestamp,e.max_timestamp);var i={request:"getMinAndMaxValues",layerId:e.layerId,fieldname:a,filter:""};$.get(globalThis.filterConfigData.url,i,function(e){if(!e)return!1;if("status"in e&&"error"==e.status)return console.log(e.title+": "+e.detail),!1;var a=null,i=null;for(var n in e){var r=e[n];a=r.min,i=r.max}t(a,i)},"json")}(i.timemanagerLayers[n],function(l,u){i.timemanagerLayers[n].min=l,i.timemanagerLayers[n].max=u;var f=moment(l).startOf(c.slice(0,-1)),d=moment(u).endOf(c.slice(0,-1));f&&f<e&&(e=f),d&&d>t&&(t=d),s=moment(e),o=moment(t),a=moment(s),$("#tmCurrentValue").html(x(s,c)),$("#tmNextValue").html(x(o,c)),g(),$("#tmSlider").slider({min:s.valueOf(),max:o.startOf(c.slice(0,-1)).valueOf(),value:s.valueOf()}),function(e){if(e)y()}((m+=1)==r)});y()}(),n=!0)},minidockclosed:function(e){"timemanager"==e.id&&n&&(b(!0),$("#timemanager-menu").hide(),n=!1,function(){for(var e in lizMap.config.timemanagerLayers)lizMap.deactivateMaplayerFilter(e),lizMap.config.layers[e].request_params.filtertoken=null,lizMap.events.triggerEvent("layerFilterParamChanged",{featureType:e,filter:null,updateDrawing:!1})}())}}),$("#tmSlider").slider();var l=null,s=-1/0,o=1/0,u=i.options.tmTimeFrameSize,c=i.options.tmTimeFrameType,f=i.options.tmAnimationFrameLength;function d(e,t,a,i,n){var r=moment(e).startOf(a),m=i*u*n;return r.add(m,a),r}function v(){var e=d(a,u,c,1,1);if(e.startOf(c.slice(0,-1))<=o.startOf(c.slice(0,-1)))p(e,d(a,u,c,2,1));else b(!0),y()}function g(){var e=$("#tmCurrentValue").text()==$("#tmNextValue").text();$("#tmNextValue").toggle(!e),$("#tmNextValue").prev("span").toggle(!e)}function p(e,t){for(var n in t.subtract(1,"milliseconds"),i.timemanagerLayers)l=function(e,t,a){var i=[];if(t==e.min&&a==e.max)return e.data={min_date:null,max_date:null},e.filter=null,null;var n=e.startAttribute,r=e.endAttribute,m=e.attributeResolution;if(t&&Date.parse(t)){var l='( "'+n+"\" >= '"+x(t,m)+"'";r&&""!=r&&r!=n&&(l+=' OR  "'+r+"\" >= '"+x(t,m)+"'"),l+=" )",i.push(l)}else t=null;if(a&&Date.parse(a)){var s='( "'+n+"\" <= '"+x(a,m)+"'";r&&""!=r&&r!=n&&(s+=' OR  "'+r+"\" <= '"+x(a,m)+"'"),s+=" )",i.push(s)}else a=null;var o=null;return i.length&&(o=" ( "+i.join(" AND ")+" ) "),e.data={min_date:t,max_date:a},e.filter=o,o}(i.timemanagerLayers[n],e,t),lizMap.triggerLayerFilter(n,l);a=moment(e),$("#tmCurrentValue").html(x(a,c)),$("#tmNextValue").html(x(moment(t),c)),g(),$("#tmSlider").slider("option","value",a.valueOf())}function y(){var e=moment($("#tmSlider").slider("option","value")),t=e=e.startOf(c.slice(0,-1)),a=d(t,u,c,1,1);p(t,a)}function b(e){if(window.clearInterval(t),t=null,$("#tmTogglePlay").html(lizDict["timemanager.toolbar.play"]),!0===e){a=moment(s),$("#tmCurrentValue").html(x(a,c)),$("#tmSlider").slider("option","value",a.valueOf());var i=d(a,u,c,1,1);$("#tmNextValue").html(x(i,c)),g()}}function x(e,t){var a=moment(e),i=null;switch(t){case"milliseconds":case"seconds":i="YYYY-MM-DD HH:mm:ss";break;case"minutes":i="YYYY-MM-DD HH:mm:00";break;case"hours":i="YYYY-MM-DD HH:00";break;case"days":case"weeks":i="YYYY-MM-DD";break;case"months":i="YYYY-MM";break;case"years":i="YYYY"}return a.format(i)}f<1e3&&(f=1e3),$("#tmSlider").on("slide",function(e,t){$("#tmSlider").slider("option","value")}),$("#tmSlider").on("slidestop",function(e,t){y()}),$("#tmTogglePlay").click(function(){$(this).html()==lizDict["timemanager.toolbar.play"]?(t&&b(!0),$("#tmTogglePlay").html(lizDict["timemanager.toolbar.pause"]),a||(a=s),t=window.setInterval(function(){v()},f)):b()}),$("#tmPrev").click(function(){b(!1),function(){var e=d(a,u,c,1,-1);if(e.startOf(c.slice(0,-1))>=s.startOf(c.slice(0,-1)))p(e,moment(a));else b(!0),y()}()}),$("#tmNext").click(function(){b(!1),v()})}})})();
//# sourceMappingURL=timemanager.js.map