!function(){"use strict";const t={parseDateTime:function(t){if(!t)return null;let e=Date.parse(t);if(isNaN(e)){const n=t.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/);if(n){const[,t,i,a,r,o,s]=n;e=new Date(t,i-1,a,r,o,s).getTime()}}return isNaN(e)?null:e},getRelativeTime:function(t){const e=Date.now(),n=Math.floor((e-t)/1e3),i=this.getLocale();if(n<0)return this.i18n("just now");if(n<60)return this.i18n("just now");if(n<3600){const t=Math.floor(n/60);return this.formatRelativeTime(-t,"minute",i)}if(n<86400){const t=Math.floor(n/3600);return this.formatRelativeTime(-t,"hour",i)}const a=new Date(t),r=new Date(e-864e5);if(n<172800&&a.getDate()===r.getDate()&&a.getMonth()===r.getMonth()&&a.getFullYear()===r.getFullYear())return this.i18n("yesterday");if(n<604800){const t=Math.floor(n/86400);return this.formatRelativeTime(-t,"day",i)}return this.formatAbsoluteDate(t,!1)},formatAbsoluteDate:function(t,e){void 0===e&&(e=!0);const n=new Date(t),i=e?{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}:{day:"numeric",month:"short",year:"numeric"},a=this.getLocale();return n.toLocaleString(a,i)},getTimezoneAbbreviation:function(){const t=new Date,e=t.toString().match(/\(([^)]+)\)$/);if(e)return e[1];const n=this.getLocale(),i=t.toLocaleTimeString(n,{timeZoneName:"short"}).match(/\s([A-Z]{3,5})$/);return i?i[1]:"UTC"},getLocale:function(){const t=document.documentElement.lang;if(t)return t;if(window.wp&&window.wp.i18n&&window.wp.i18n.getLocaleData){const t=window.wp.i18n.getLocaleData();if(t&&t[""]&&t[""].lang)return t[""].lang}return"nl-NL"},formatRelativeTime:function(t,e,n){try{return new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(t,e)}catch(n){const i=Math.abs(t);return i+" "+e+" geleden"}},i18n:function(t){this.getLocale().startsWith("nl");return{"just now":"zojuist",yesterday:"gisteren",Uploaded:"Geüpload","Timestamp unavailable":"Tijdstempel niet beschikbaar"}[t]||t},createTimeElement:function(t){const e=document.createElement("span");if(e.className="botsauto-overview-file-time",!t)return e.textContent="—",e.setAttribute("aria-label",this.i18n("Timestamp unavailable")),e;let n;if("string"==typeof t?n=this.parseDateTime(t):"number"==typeof t&&(n=t<1e10?1e3*t:t),!n)return e.textContent="—",e.setAttribute("aria-label",this.i18n("Timestamp unavailable")),e;e.dataset.timestamp=Math.floor(n/1e3);const i=this.getRelativeTime(n);e.textContent=i;const a=this.formatAbsoluteDate(n,!0)+" ("+this.getTimezoneAbbreviation()+")";return e.title=a,e.setAttribute("aria-label",this.i18n("Uploaded")+": "+a),e},updateTimeElements:function(e){if(!e)return;e.querySelectorAll(".botsauto-overview-file-time[data-timestamp]").forEach(function(e){const n=parseInt(e.dataset.timestamp,10);if(!n)return;const i=n<1e10?1e3*n:n,a=t.getRelativeTime(i);e.textContent!==a&&(e.textContent=a)})},initAutoRefresh:function(e){if(!e)return;if("true"===e.dataset.timeRefreshActive)return;e.dataset.timeRefreshActive="true";const n=setInterval(function(){t.updateTimeElements(e)},6e4);e.dataset.timeRefreshInterval=n}};window.BOTS_TimeFormatter=t}();