const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BDDwtokW.js","./pwa-viewport-D2m4FCVR.js"])))=>i.map(i=>d[i]); import{$ as e,$t as t,Bt as n,Et as r,F as i,Ht as a,Jt as o,Ot as s,Tt as c,Vt as l,W as u,Wt as d,Yt as f,Z as p,cn as m,d as h,gt as g,h as _,n as v}from"./pwa-viewport-D2m4FCVR.js";import{B as y,Dt as b,G as x,Ot as S,Q as C,Z as w,ct as T,gt as E,ht as D,o as O,st as k,ut as A,w as j,wt as M,z as N}from"./ScheduledAtField-Crk-z6KL.js";import{a as P,t as ee}from"./main-BRo5yFiv.js";import{t as F}from"./__vite-browser-external-BDDwtokW.js";var I;function L(e,t,n){let r=typeof n,i=typeof e;if(r!==`undefined`){if(i!==`undefined`){if(n){if(i===`function`&&r===i)return function(t){return e(n(t))};if(t=e.constructor,t===n.constructor){if(t===Array)return n.concat(e);if(t===Map){var a=new Map(n);for(var o of e)a.set(o[0],o[1]);return a}if(t===Set){o=new Set(n);for(a of e.values())o.add(a);return o}}}return e}return n}return i===`undefined`?t:e}function R(e,t){return e===void 0?t:e}function z(){return Object.create(null)}function B(e){return typeof e==`string`}function te(e){return typeof e==`object`}function ne(e,t){if(B(t))e=e[t];else for(let n=0;e&&n1?this.addMatcher(e,t):(this.mapper||=new Map,this.mapper.set(e,t),this.cache&&H(this),this)},I.addMatcher=function(e,t){return typeof e==`object`?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||=new Map,this.matcher.set(e,t),this.h+=(this.h?`|`:``)+e,this.J=null,this.cache&&H(this),this)},I.addReplacer=function(e,t){return typeof e==`string`?this.addMatcher(e,t):(this.replacer||=[],this.replacer.push(e,t),this.cache&&H(this),this)},I.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(H,50,this);this.normalize&&(e=typeof this.normalize==`function`?this.normalize(e):se?e.normalize(`NFKD`).replace(se,``).toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(ae,`$1 $2`).replace(oe,`$1 $2`).replace(ie,`$1 `));let n=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),r=[],i=z(),a,o,s=this.split||this.split===``?e.split(this.split):[e];for(let e=0,l,u;ethis.maxlength)){if(t){if(i[l])continue;i[l]=1}else{if(a===l)continue;a=l}if(n)r.push(l);else if(!this.filter||(typeof this.filter==`function`?this.filter(l):!this.filter.has(l))){if(this.cache&&l.length<=this.I)if(this.F){var c=this.D.get(l);if(c||c===``){c&&r.push(c);continue}}else this.F=setTimeout(H,50,this);if(this.stemmer){this.K||=RegExp(`(?!^)(`+this.A+`)$`);let e;for(;e!==l&&l.length>2;)e=l,l=l.replace(this.K,e=>this.stemmer.get(e))}if(l&&(this.mapper||this.dedupe&&l.length>1)){c=``;for(let e=0,t=``,n,r;e1&&(this.J||=RegExp(`(`+this.h+`)`,`g`),l=l.replace(this.J,e=>this.matcher.get(e))),l&&this.replacer)for(c=0;l&&cthis.L&&(this.D.clear(),this.I=this.I/1.1|0)),l){if(l!==u)if(t){if(i[l])continue;i[l]=1}else{if(o===l)continue;o=l}r.push(l)}}}return this.finalize&&(r=this.finalize(r)||r),this.cache&&e.length<=this.H&&(this.B.set(e,r),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),r};function H(e){e.F=null,e.B.clear(),e.D.clear()}function ce(e,t,n){n||(t||typeof e!=`object`?typeof t==`object`&&(n=t,t=0):n=e),n&&(e=n.query||e,t=n.limit||t);let r=``+(t||0);n&&(r+=(n.offset||0)+!!n.context+!!n.suggest+(n.resolve!==!1)+(n.resolution||this.resolution)+(n.boost||0)),e=(``+e).toLowerCase(),this.cache||=new U;let i=this.cache.get(e+r);if(!i){let a=n&&n.cache;a&&(n.cache=!1),i=this.search(e,t,n),a&&(n.cache=a),this.cache.set(e+r,i)}return i}function U(e){this.limit=e&&e!==!0?e:1e3,this.cache=new Map,this.h=``}U.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},U.prototype.get=function(e){let t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},U.prototype.remove=function(e){for(let t of this.cache){let n=t[0];t[1].includes(e)&&this.cache.delete(n)}},U.prototype.clear=function(){this.cache.clear(),this.h=``};var le={normalize:!1,numeric:!1,dedupe:!1},W={},G=new Map([[`b`,`p`],[`v`,`f`],[`w`,`f`],[`z`,`s`],[`x`,`s`],[`d`,`t`],[`n`,`m`],[`c`,`k`],[`g`,`k`],[`j`,`k`],[`q`,`k`],[`i`,`e`],[`y`,`e`],[`u`,`o`]]),ue=new Map([[`ae`,`a`],[`oe`,`o`],[`sh`,`s`],[`kh`,`k`],[`th`,`t`],[`ph`,`f`],[`pf`,`f`]]),de=[/([^aeo])h(.)/g,`$1$2`,/([aeo])h([^aeo]|$)/g,`$1$2`,/(.)\1+/g,`$1`],fe={a:``,e:``,i:``,o:``,u:``,y:``,b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6},pe={Exact:le,Default:W,Normalize:W,LatinBalance:{mapper:G},LatinAdvanced:{mapper:G,matcher:ue,replacer:de},LatinExtra:{mapper:G,replacer:de.concat([/(?!^)[aeo]/g,``]),matcher:ue},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let n=0;n=o.length)t-=o.length;else{t=o[r?`splice`:`slice`](t,n);let a=t.length;if(a&&(i=i.length?i.concat(t):t,n-=a,r&&(e.length-=a),!n))break;t=0}return i}function he(e){if(!this||this.constructor!==he)return new he(e);this.index=e?[e]:[],this.length=e?e.length:0;let t=this;return new Proxy([],{get(e,n){if(n===`length`)return t.length;if(n===`push`)return function(e){t.index[t.index.length-1].push(e),t.length++};if(n===`pop`)return function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()};if(n===`indexOf`)return function(e){let n=0;for(let r=0,i,a;r=0)return n+a;n+=i.length}return-1};if(n===`includes`)return function(e){for(let n=0;n32?(this.B=ge,this.A=BigInt(e)):(this.B=J,this.A=e)}K.prototype.get=function(e){let t=this.index[this.B(e)];return t&&t.get(e)},K.prototype.set=function(e,t){var n=this.B(e);let r=this.index[n];r?(n=r.size,r.set(e,t),(n-=r.size)&&this.size++):(this.index[n]=r=new Map([[e,t]]),this.h.push(r),this.size++)};function q(e=8){if(!this||this.constructor!==q)return new q(e);this.index=z(),this.h=[],this.size=0,e>32?(this.B=ge,this.A=BigInt(e)):(this.B=J,this.A=e)}q.prototype.add=function(e){var t=this.B(e);let n=this.index[t];n?(t=n.size,n.add(e),(t-=n.size)&&this.size++):(this.index[t]=n=new Set([e]),this.h.push(n),this.size++)},I=K.prototype,I.has=q.prototype.has=function(e){let t=this.index[this.B(e)];return t&&t.has(e)},I.delete=q.prototype.delete=function(e){let t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},I.clear=q.prototype.clear=function(){this.index=z(),this.h=[],this.size=0},I.values=q.prototype.values=function*(){for(let e=0;e=this.priority*this.priority*3:(ye=setTimeout(Se,0),be=Date.now()),xe){let n=this;return new Promise(r=>{setTimeout(function(){r(n[e+`Async`].apply(n,t))},0)})}let i=this[e].apply(this,t);return n=i.then?i:new Promise(e=>e(i)),r&&n.then(r),n}}var we=0;function Te(e={},t){function n(n){function o(e){e=e.data||e;let t=e.id,n=t&&a.h[t];n&&(n(e.msg),delete a.h[t])}if(this.worker=n,this.h=z(),this.worker)return i?this.worker.on(`message`,o):this.worker.onmessage=o,e.config?new Promise(function(t){we>1e9&&(we=0),a.h[++we]=function(){t(a)},a.worker.postMessage({id:we,task:`init`,factory:r,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:`init`,factory:r,options:e}),this)}if(!this||this.constructor!==Te)return new Te(e);let r=typeof self<`u`?self._factory:typeof window<`u`?window._factory:null;r&&=r.toString();let i=typeof window>`u`,a=this,o=De(r,i,e.worker);return o.then?o.then(function(e){return n.call(a,e)}):n.call(this,o)}Ee(`add`),Ee(`append`),Ee(`search`),Ee(`update`),Ee(`remove`),Ee(`clear`),Ee(`export`),Ee(`import`),Te.prototype.searchCache=ce,X(Te.prototype);function Ee(e){Te.prototype[e]=function(){let t=this,n=[].slice.call(arguments);var r=n[n.length-1];let i;return typeof r==`function`&&(i=r,n.pop()),r=new Promise(function(r){e===`export`&&typeof n[0]==`function`&&(n[0]=null),we>1e9&&(we=0),t.h[++we]=r,t.worker.postMessage({task:e,id:we,args:n})}),i?(r.then(i),this):r}}function De(e,t,n){return t?typeof module<`u`?new(F()).Worker(__dirname+`/worker/node.js`):_(()=>import(`./__vite-browser-external-BDDwtokW.js`).then(e=>m(e.t(),1)).then(function(e){return new e.Worker(import.meta.dirname+`/node/node.mjs`)}),__vite__mapDeps([0,1]),import.meta.url):e?new window.Worker(URL.createObjectURL(new Blob([`onmessage=`+ve.toString()],{type:`text/javascript`}))):new window.Worker(typeof n==`string`?n:import.meta.url.replace(`/worker.js`,`/worker/worker.js`).replace(`flexsearch.bundle.module.min.js`,`module/worker/worker.js`).replace(`flexsearch.bundle.module.min.mjs`,`module/worker/worker.js`),{type:`module`})}Ge.prototype.add=function(e,t,n){if(te(e)&&(t=e,e=ne(t,this.key)),t&&(e||e===0)){if(!n&&this.reg.has(e))return this.update(e,t);for(let a=0,o;at?e.slice(n,n+t):e,r?We.call(this,e):e;let i=[];for(let a=0,o,s;a=s){n-=s;continue}o=o.slice(n,n+t),s=o.length,n=0}if(s>t&&(o=o.slice(0,t),s=t),!i.length&&s>=t)return r?We.call(this,o):o;if(i.push(o),t-=s,!t)break}return i=i.length>1?[].concat.apply([],i):i[0],r?We.call(this,i):i}function je(e,t,n,r){var i=r[0];if(i[0]&&i[0].query)return e[t].apply(e,i);if(!(t!==`and`&&t!==`not`||e.result.length||e.await||i.suggest))return r.length>1&&(i=r[r.length-1]),(r=i.resolve)?e.await||e.result:e;let a=[],o=0,s=0,c,l,u,d,f;for(t=0;t1&&(n=n[t].apply(n,e.slice(1))),n}Z.prototype.or=function(){return je(this,`or`,Ne,arguments)};function Ne(e,t,n,r,i,a,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=Be(e,t,n,!1,this.h),n=0)),i&&(this.await=null),i?this.resolve(t,n,r,o):this}Z.prototype.and=function(){return je(this,`and`,Pe,arguments)};function Pe(e,t,n,r,i,a,o){if(!a&&!this.result.length)return i?this.result:this;let s;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let r=0;for(let t=0,n,i;t1?w.join(` `):w[0];let e;if(w&&C){for(var T=C.length,E=(P.split?C.replace(P.split,``):C).length-w.length,D=``,O=0,k=0;k-1&&(D=(A?C.substring(0,A):``)+o+C.substring(A,A+j)+s+(A+j=c)break}if(x=t.length*(a.length-2),p||m||c&&g.length-x>c)if(x=c+x-f*2,S=b-y,p>0&&(S+=p),m>0&&(S+=m),S<=x)_=p?y-(p>0?p:0):y-((x-S)/2|0),v=m?b+(m>0?m:0):_+x,l||(_>0&&g.charAt(_)!==` `&&g.charAt(_-1)!==` `&&(_=g.indexOf(` `,_),_<0&&(_=0)),v=v.length-1){if(n>=v.length){S[e+1]=1,n>=_.length&&(x[e+1]=1);continue}T-=f}if(g=v[n].text,j=m&&w[e])if(j>0){if(g.length>j)if(S[e+1]=1,l)g=g.substring(0,j);else continue;(j-=g.length)||(j=-1),w[e]=j}else{S[e+1]=1;continue}if(T+g.length+1<=c)g=` `+g,b[e]+=g;else if(l)M=c-T-1,M>0&&(g=` `+g.substring(0,M),b[e]+=g),S[e+1]=1;else{S[e+1]=1;continue}}else{if(S[e])continue;if(n-=E,y[n]){T-=f,S[e]=1,x[e]=1;continue}if(n<=0){if(n<0){S[e]=1,x[e]=1;continue}T-=f}if(g=v[n].text,j=p&&C[e])if(j>0){if(g.length>j)if(S[e]=1,l)g=g.substring(g.length-j);else continue;(j-=g.length)||(j=-1),C[e]=j}else{S[e]=1;continue}if(T+g.length+1<=c)g+=` `,b[e]=g+b[e];else if(l)M=g.length+1-(c-T),M>=0&&M=_.length-1||n1?Be(c,n,r,o,a):(c=c[0])&&n&&c.length>n||r?c.slice(r,n+r):c;else{if(en||r)&&(c=c.slice(r,n+r));else{i=[];for(let e=0,t;er)r-=t.length;else if((n&&t.length>n||r)&&(t=t.slice(r,n+r),n-=t.length,r&&(r-=t.length)),i.push(t),!n)break}c=i}}return c}function Be(e,t,n,r,i){let a=[],o=z(),s;var c=e.length;let l;if(r){for(i=c-1;i>=0;i--)if(l=(r=e[i])&&r.length){for(c=0;c=0;u--){d=e[u];for(let e=0;e1?ze(i,1,0,0,c,l):i[0],e)})}return p?i:new Z(i.length>1?ze(i,1,0,0,c,l):i[0],this)}}p||o||!(d||=this.field)||(B(d)?o=d:(d.constructor===Array&&d.length===1&&(d=d[0]),o=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||=this.field;let x;v=(this.worker||this.db)&&!r&&[];for(let o=0,s,l,C;o0&&((n&&t>n||r)&&(e=e.slice(r,r+n)),i&&(e=We.call(this,e))),e)}function We(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);let t=Array(e.length);for(let n=0,r;n1?n:n[0]}I.append=function(e,t){return this.add(e,t,!0)},I.update=function(e,t){return this.remove(e).add(e,t)},I.remove=function(e){te(e)&&(e=ne(e,this.key));for(var t of this.index.values())t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let n of this.tag.values())for(let r of n){t=r[0];let i=r[1],a=i.indexOf(e);a>-1&&(i.length>1?i.splice(a,1):n.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},I.clear=function(){let e=[];for(let t of this.index.values()){let n=t.clear();n.then&&e.push(n)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},I.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},I.cleanup=function(){for(let e of this.index.values())e.cleanup();return this},I.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},I.set=function(e,t){return typeof e==`object`&&(t=e,e=ne(t,this.key)),this.store.set(e,t),this},I.searchCache=ce,I.export=tt,I.import=nt,X(Ge.prototype);function Je(e,t=0){let n=[],r=[];t&&=25e4/t*5e3|0;for(let i of e.entries())r.push(i),r.length===t&&(n.push(r),r=[]);return r.length&&n.push(r),n}function Ye(e,t){t||=new Map;for(let n=0,r;n2?n[0]:``;if(n=n.length>2?n[2]:n[1],this.worker&&r)return this.index.get(r).import(e);if(t){if(typeof t==`string`&&(t=JSON.parse(t)),r)return this.index.get(r).import(n,t);switch(n){case`reg`:this.fastupdate=!1,this.reg=$e(t,this.reg);for(let e=0,t;e=0&&r.splice(t,1)}}else it(this.map,e),this.depth&&it(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&dt(this)),this.cache&&this.cache.remove(e),this};function it(e,t){let n=0;var r=t===void 0;if(e.constructor===Array){for(let i=0,a,o,s;i=0){if(a.length>1)return a.splice(o,1),1;if(delete e[i],n)return 1;s=1}else{if(s)return 1;n++}}}else for(let i of e.entries())r=i[0],it(i[1],t)?n++:e.delete(r);return n}var at={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:`forward`},score:{resolution:9,context:{depth:2,resolution:3}}};$.prototype.add=function(e,t,n,r){if(t&&(e||e===0)){if(!r&&!n&&this.reg.has(e))return this.update(e,t);r=this.depth,t=this.encoder.encode(t,!r);let l=t.length;if(l){let u=z(),d=z(),f=this.resolution;for(let p=0;p2){for(let t=1,r,s,c,l;t2){for(let r=0,c;rr;a--){o=m.substring(r,a),c=this.rtl?i-1-r:r;var s=this.score?this.score(t,m,p,o,c):ot(f,l,p,i,c);Q(this,d,o,s,e,n)}break}case`bidirectional`:case`reverse`:if(i>1){for(s=i-1;s>0;s--){o=m[this.rtl?i-1-s:s]+o;var c=this.score?this.score(t,m,p,o,s):ot(f,l,p,i,s);Q(this,d,o,c,e,n)}o=``}case`forward`:if(i>1){for(s=0;s1&&po;let r=this.score?this.score(t,o,p,m,s-1):ot(i+(l/2>i?0:1),l,p,a-1,s-1);Q(this,u,c?o:m,r,e,n,c?m:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(n?{ins:e}:{del:e}),this.M&&dt(this)),this};function Q(e,t,n,r,i,a,o){let s,c;if(!(s=t[n])||o&&!s[o]){if(o?(t=s||(t[n]=z()),t[o]=1,c=e.ctx,(s=c.get(o))?c=s:c.set(o,c=e.keystore?new K(e.keystore):new Map)):(c=e.map,t[n]=1),(s=c.get(n))?c=s:c.set(n,c=s=[]),a){for(let n=0,a;n1?t+(r||0)<=e?n+(i||0):(e-1)/(t+(r||0))*(n+(i||0))+1|0:0}$.prototype.search=function(e,t,n){if(n||(t||typeof e!=`object`?typeof t==`object`&&(n=t,t=0):(n=e,e=``)),n&&n.cache)return n.cache=!1,e=this.searchCache(e,t,n),n.cache=!0,e;let r=[],i,a,o,s=0,c,l,u,d,f;n&&(e=n.query||e,t=n.limit||t,s=n.offset||0,a=n.context,o=n.suggest,f=(c=n.resolve)&&n.enrich,u=n.boost,d=n.resolution,l=this.db&&n.tag),c===void 0&&(c=this.resolve),a=this.depth&&a!==!1;let p=this.encoder.encode(e,!a);if(i=p.length,t||=c?100:0,i===1)return ct.call(this,p[0],``,t,s,c,f,l);if(i===2&&a&&!o)return ct.call(this,p[1],p[0],t,s,c,f,l);let m=z(),h=0,g;if(a&&(g=p[0],h=1),d||d===0||(d=g?this.N:this.resolution),this.db){if(this.db.search&&(n=this.db.search(this,p,t,s,o,c,f,l),n!==!1))return n;let e=this;return async function(){for(let t,n;h1)c=ze(e,t,n,r,i,a,o);else if(s===1)return o?Ae.call(null,e[0],n,r):new Z(e[0],this);return o?c:new Z(c,this)}function ct(e,t,n,r,i,a,o){return e=ut(this,e,t,n,r,i,a,o),this.db?e.then(function(e){return i?e||[]:new Z(e,this)}):e&&e.length?i?Ae.call(this,e,n,r):new Z(e,this):i?[]:new Z([],this)}function lt(e,t,n,r){let i=[];if(e&&e.length){if(e.length<=r){t.push(e);return}for(let t=0,n;tn)&&(c=n,n=t,t=c),e.db?e.db.get(t,n,r,i,a,o,s):(e=n?(e=e.ctx.get(n))&&e.get(t):e.map.get(t),e)}function $(e,t){if(!this||this.constructor!==$)return new $(e);if(e){var n=B(e)?e:e.preset;n&&(e=Object.assign({},at[n],e))}else e={};n=e.context;let r=n===!0?{depth:1}:n||{},i=B(e.encoder)?pe[e.encoder]:e.encode||e.encoder||{};this.encoder=i.encode?i:typeof i==`object`?new V(i):{encode:i},this.resolution=e.resolution||9,this.tokenize=n=(n=e.tokenize)&&n!==`default`&&n!==`exact`&&n||`strict`,this.depth=n===`strict`&&r.depth||0,this.bidirectional=r.bidirectional!==!1,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(n=e.keystore||0)&&(this.keystore=n),this.map=n?new K(n):new Map,this.ctx=n?new K(n):new Map,this.reg=t||(this.fastupdate?n?new K(n):new Map:n?new q(n):new Set),this.N=r.resolution||3,this.rtl=i.rtl||e.rtl||!1,this.cache=(n=e.cache||null)&&new U(n),this.resolve=e.resolve!==!1,(n=e.db)&&(this.db=this.mount(n)),this.M=e.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}I=$.prototype,I.mount=function(e){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),e.mount(this)},I.commit=function(){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),this.db.commit(this)},I.destroy=function(){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),this.db.destroy()};function dt(e){e.commit_timer||=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1)}I.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},I.append=function(e,t){return this.add(e,t,!0)},I.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},I.update=function(e,t){let n=this,r=this.remove(e);return r&&r.then?r.then(()=>n.add(e,t)):this.add(e,t)},I.cleanup=function(){return this.fastupdate?(it(this.map),this.depth&&it(this.ctx),this):this},I.searchCache=ce,I.export=function(e,t,n=0,r=0){let i,a;switch(r){case 0:i=`reg`,a=Qe(this.reg);break;case 1:i=`cfg`,a=null;break;case 2:i=`map`,a=Je(this.map,this.reg.size);break;case 3:i=`ctx`,a=Xe(this.ctx,this.reg.size);break;default:return}return et.call(this,e,t,i,a,n,r)},I.import=function(e,t){if(t)switch(typeof t==`string`&&(t=JSON.parse(t)),e=e.split(`.`),e[e.length-1]===`json`&&e.pop(),e.length===3&&e.shift(),e=e.length>1?e[1]:e[0],e){case`reg`:this.fastupdate=!1,this.reg=$e(t,this.reg);break;case`map`:this.map=Ye(t,this.map);break;case`ctx`:this.ctx=Ze(t,this.ctx)}},I.serialize=function(e=!0){let t=``,n=``,r=``;if(this.reg.size){let e;for(var i of this.reg.keys())e||=typeof i,t+=(t?`,`:``)+(e===`string`?`"`+i+`"`:i);t=`index.reg=new Set([`+t+`]);`,n=rt(this.map,e),n=`index.map=new Map([`+n+`]);`;for(let t of this.ctx.entries()){i=t[0];let n=rt(t[1],e);n=`new Map([`+n+`])`,n=`["`+i+`",`+n+`]`,r+=(r?`,`:``)+n}r=`index.ctx=new Map([`+r+`]);`}return e?`function inject(index){`+t+n+r+`}`:t+n+r},X($.prototype);var ft=typeof window<`u`&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),pt=[`map`,`ctx`,`tag`,`reg`,`cfg`],mt=z();function ht(e,t={}){if(!this||this.constructor!==ht)return new ht(e,t);typeof e==`object`&&(t=e,e=e.name),e||console.info(`Default storage space was used, because a name was not passed.`),this.id=`flexsearch`+(e?`:`+e.toLowerCase().replace(/[^a-z0-9_\-]/g,``):``),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,``):``,this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}I=ht.prototype,I.mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},I.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),mt[e.id]||(mt[e.id]=[]),mt[e.id].push(e.field);let t=ft.open(e.id,1);return t.onupgradeneeded=function(){let t=e.db=this.result;for(let n=0,r;n=a.length){r-=a.length;continue}let e=n?r+Math.min(a.length-r,n):a.length;for(let n=r;n=e.length?[]:!t&&!n?e:(e=e.slice(n,n+t),r?i.enrich(e):e)})},I.enrich=function(e){typeof e!=`object`&&(e=[e]);let t=this.db.transaction(`reg`,`readonly`).objectStore(`reg`),n=[];for(let r=0;r=0)if(i=1,o.length>1)o.splice(a,1);else{r[e]=[];break}a+=o.length}if(n)break}a?i&&e.update(r):e.delete(),e.continue()}I.remove=function(e){return typeof e!=`object`&&(e=[e]),Promise.all([this.transaction(`map`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e)}}),this.transaction(`ctx`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e)}}),this.transaction(`tag`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e,!0)}}),this.transaction(`reg`,`readwrite`,function(t){for(let n=0;n{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,n(this.result)},e.onerror=e.onblocked=r,e=null})}var vt={Index:$,Charset:pe,Encoder:V,Document:Ge,Worker:Te,Resolver:Z,IndexedDB:ht,Language:{}};``+new URL(`year-in-posts-B2lywqdx.png`,import.meta.url).href;var yt=`year-in-posts-list`;function bt(){try{let e=u.account.get(yt)||{};return Object.entries(e).map(([e,t])=>({year:parseInt(e),...t})).sort((e,t)=>t.year-e.year)}catch{return[]}}async function xt(t){try{let n=`${e()}-${t}`;await j.yearInPosts.del(n);let r=u.account.get(yt)||{};return delete r[t],u.account.set(yt,r),!0}catch(e){throw e}}function St(e,t){let n=new Date(e),r=new Date(t,0,1),i=new Date(t,11,31,23,59,59,999);return n>=r&&n<=i}async function Ct(t){let{masto:n,instance:r}=i(),a=[],o=!1,s=p();if(!s)throw Error(`No current account`);let c=s.info.id,l=s.info.acct,d=new Date(t,0,1),f=new Date(t,11,31,23,59,59,999),m=await P(r),h=null;if(m)try{let e=await n.v1.accounts.$select(c).statuses.list({limit:1,exclude_replies:!1,exclude_reblogs:!1}).values().next();if(e?.value?.length){let r=e.value[0];if(!St(r.createdAt,t)){let e=`${t+1}-01-02`;try{let t=await n.v2.search.list({q:`from:${l} before:${e}`,type:`statuses`,limit:1});t?.statuses?.length&&(h=t.statuses[0].id)}catch{}}}}catch{}let g=n.v1.accounts.$select(c).statuses.list({limit:40,exclude_replies:!1,exclude_reblogs:!1,max_id:h||void 0}).values(),_=!0;fetchLoop:for(;;)try{let{value:e,done:t}=await g.next();if(t||!e?.length)break fetchLoop;let n=!1;for(let t of e){let e=new Date(t.createdAt);e>f||(_=!1,e>=d&&(a.push(t),n=!0))}if(!n&&!_)break fetchLoop;await new Promise(e=>setTimeout(e,500))}catch{break fetchLoop}if(a.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt)),a.length>0)try{let e=a[0].id,t=n.v1.accounts.$select(c).statuses.list({limit:40,min_id:e,exclude_replies:!1,exclude_reblogs:!1}).values();gapFillLoop:for(;;)try{let{value:e,done:n}=await t.next();if(n||!e?.length)break gapFillLoop;let r=!1;for(let t of e){let e=new Date(t.createdAt);ee.id===t.id)||(a.push(t),o=!0),r=!0)}if(!r)break gapFillLoop;await new Promise(e=>setTimeout(e,500))}catch{break gapFillLoop}o&&a.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt))}catch{}let v=0;try{v=new TextEncoder().encode(JSON.stringify(a)).length}catch{}let y=`${e()}-${t}`,b=new Date().getTimezoneOffset();await j.yearInPosts.set(y,{id:y,posts:a,count:a.length,year:t,size:v,fetchedAt:Date.now(),timezoneOffset:b});let x=u.account.get(yt)||{};return x[t]={count:a.length,size:v,fetchedAt:Date.now(),timezoneOffset:b},u.account.set(yt,x),{posts:a,searchEnabled:m,gapsFilled:o}}var wt=2005;function Tt(){let e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate();return n===0&&r<=30?t-1:t}function Et(e){let t=e<=0?`+`:`-`,n=Math.abs(e),r=Math.floor(n/60),i=n%60;return`UTC${t}${r}${i>0?`:${String(i).padStart(2,`0`)}`:``}`}function Dt(){return new Date().getTimezoneOffset()}var Ot={all:`All`,original:`Original`,replies:`Replies`,quotes:`Quotes`,boosts:`Boosts`,media:`Media`},kt=[{key:`relevance`,condition:`searchQuery`},{key:`createdAt`},{key:`repliesCount`},{key:`favouritesCount`},{key:`reblogsCount`}];function At(e,t,n=`short`){let r=new Date(2e3,e,1);return E(t,{month:n}).format(r)}function jt(e){return e=parseInt(e,10),e>=wt&&e<=new Date().getFullYear()?e:null}function Mt(e){return e=parseInt(e,10),e>=0&&e<=11?e:null}var Nt=30;function Pt(){let{i18n:s}=r(),[c,l]=g(),u=c.get(`year`),p=c.get(`month`),[m,_]=d(`all`),[x,E]=d(``),P=jt(u),F=Mt(p);v(x?`Year in Posts ${P} - Search: ${x}`:P?F===null?`Year in Posts ${P}`:`Year in Posts ${P} - ${At(F,s.locale)}`:`Year in Posts`,`/yip`);let{instance:I}=i(),[L,R]=d(`default`),[z,B]=d([]),[te,ne]=d([]),[re,ie]=d(!0),[ae,oe]=d(!!x),[se,V]=d(Nt),[H,ce]=d(x?`relevance`:`createdAt`),[U,le]=d(`asc`),W=n(null),G=n(null),ue=a(()=>e(),[]);S([`Slash`,`/`],e=>{ae?W.current?.focus():(oe(!0),setTimeout(()=>{W.current?.focus()},100))},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>{let t=!!document.querySelector(`#modal-container > *`),n=[`INPUT`,`TEXTAREA`].includes(e.target.tagName);return e.key===`/`?!1:t||n||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}});let de=z.length;o(()=>{x||W.current?.isFocused()||oe(!1)},[x,p,m,H,U]);function fe(){ne(bt())}o(()=>{P||fe()},[P]);let pe=async e=>{e.preventDefault();let t=jt(e.target.elements.year.value);if(t)try{let e=`${ue}-${t}`,n=await j.yearInPosts.get(e);n&&n.year===t?l({year:t}):(R(`generating`),await Ct(t),l({year:t}))}catch{R(`error`),b(`Unable to generate year posts. Please try again.`)}finally{L===`generating`&&R(`default`)}else b(`Invalid year.`)};async function me(e){try{R(`generating`),await Ct(e),l({year:e})}catch{R(`error`),b(`Unable to regenerate year posts. Please try again.`)}finally{L===`generating`&&R(`default`)}}async function he(e){if(confirm(`Remove year ${e} posts?`))try{await xt(e),ne(t=>t.filter(t=>t.year!==e))}catch{alert(`Failed to remove year data`)}}let K=a(()=>{let e={};z.forEach(t=>{let n=new Date(t.createdAt),r=n.getMonth(),i=n.getDate();e[r]||(e[r]={}),e[r][i]||(e[r][i]={total:0,original:0,reply:0,quote:0,boost:0});let a=e[r][i];a.total++,t.reblog?a.boost++:N()&&(t.quote?.id||t.quote?.quotedStatus?.id)?a.quote++:t.inReplyToId?a.reply++:a.original++});let t={};return Object.keys(e).forEach(n=>{let r=e[n],i=Math.max(...Object.values(r).map(e=>e.total)),a=new Date(P,parseInt(n),1).getDay(),o=[];for(let e=0;e0?n/i:0;o.push({day:e,count:n,ratio:a,original:t?.original||0,reply:t?.reply||0,quote:t?.quote||0,boost:t?.boost||0})}t[n]=o}),t},[z,P]),q=a(()=>{if(m!==`media`)return{};let e={};return z.forEach(t=>{let n=new Date(t.createdAt),r=n.getMonth(),i=n.getDate();e[r]||(e[r]={}),e[r][i]||(e[r][i]=[]),e[r][i].push(t)}),Object.keys(e).forEach(t=>{let n=e[t],r=new Date(P,parseInt(t),1).getDay(),i=[];for(let e=0;e0){let e=t.filter(e=>{let t=e.reblog||e;return!e.reblog&&t.mediaAttachments?.some(e=>e.previewUrl||e.url||e.previewRemoteUrl||e.remoteUrl)});e.length>0&&(r=e.reduce((e,t)=>{let n=t,r=(n.favouritesCount||0)+(n.reblogsCount||0)+(n.repliesCount||0)+(n.quotesCount||0),i=e?(e.favouritesCount||0)+(e.reblogsCount||0)+(e.repliesCount||0)+(e.quotesCount||0):-1;return r>i?t:r===i?e||t:e},null),a=!0)}i.push(r?{post:r,hasMedia:a}:{hasMedia:a})}e[t]=i}),e},[z,P,m]),J=a(()=>{let e={},t={};return z.forEach(n=>{let r=new Date(n.createdAt).getMonth();e[r]=(e[r]||0)+1,t[r]||(t[r]={original:0,reply:0,quote:0,boost:0}),n.reblog?t[r].boost++:N()&&(n.quote?.id||n.quote?.quotedStatus?.id)?t[r].quote++:n.inReplyToId?t[r].reply++:t[r].original++}),Object.entries(e).map(([e,n])=>{let r=t[e];return{month:parseInt(e),count:n,heatmap:K[e]||[],mediaGrid:q[e]||[],original:r.original,reply:r.reply,quote:r.quote,boost:r.boost}}).sort((e,t)=>e.month-t.month)},[z,K,q]),ge=n(null);o(()=>{if(de>0){let e=new vt.Document({preset:`match`,document:{id:`id`,index:[`content`,`spoilerText`,`poll`,`media`,`card`]}});z.forEach(t=>{let n=t.reblog||t,r=n.poll?.options?.map(e=>e.title).join(` `),i=n.mediaAttachments?.map(e=>e.description).join(` `),a=n.card?`${n.card.title} ${n.card.description} ${n.card.url}`:``;e.add({id:t.id,content:A(n.content),spoilerText:n.spoilerText,poll:r,media:i,card:a})}),ge.current=e}},[z]);let _e=a(()=>{if(!x)return z;if(!ge.current)return[];console.time(`search: '${x}'`);let e=ge.current.search(x,{limit:de});console.timeEnd(`search: '${x}'`);let t=e.flatMap(e=>e.result),n=[...new Set(t)],r=new Map(z.map(e=>[e.id,e]));return n.map(e=>r.get(e)).filter(Boolean)},[z,x]);o(()=>{V(Nt),x?[`relevance`,`createdAt`].includes(H)||ce(`relevance`):H===`relevance`&&ce(`createdAt`)},[x,H]);let[Y,ve]=a(()=>{let e=_e.filter(e=>{if(x)return!0;let t=new Date(e.createdAt).getMonth();return F!==null&&t===F}),t={all:e.length,original:0,replies:0,quotes:0,boosts:0,media:0};return e.forEach(e=>{e.reblog?t.boosts++:N()&&(e.quote?.id||e.quote?.quotedStatus?.id)?t.quotes++:e.inReplyToId?t.replies++:t.original++;let n=e.reblog||e;!e.reblog&&n.mediaAttachments?.length>0&&t.media++}),[t,e]},[_e,F,x]),[X,ye]=a(()=>{let e=ve.filter(e=>{if(m===`boosts`)return!!e.reblog;if(m===`media`){let t=e.reblog||e;return!e.reblog&&t.mediaAttachments?.length>0}else if(m===`quotes`)return N()&&(e.quote?.id||e.quote?.quotedStatus?.id);else if(m===`replies`)return!!e.inReplyToId;else if(m===`original`)return!e.reblog&&!(N()&&(e.quote?.id||e.quote?.quotedStatus?.id))&&!e.inReplyToId;return!0}),t=e;return H!==`relevance`&&(t=[...e].sort((e,t)=>{let n=e.reblog||e,r=t.reblog||t,i,a;return H===`createdAt`?(i=new Date(e.createdAt),a=new Date(t.createdAt)):(i=n[H]||0,a=r[H]||0),U===`asc`?i>a?1:-1:a>i?1:-1})),x?[t.slice(0,se),t.length>se]:[t,!1]},[ve,m,x,se,H,U]);o(()=>{x&&m!==`all`&&X.length===0&&Y.all>0&&_(`all`)},[x,m,X.length,Y.all]);let be=J.findIndex(e=>e.month===F),xe=be>0?J[be-1]:null,Se=be{if(!P){R(`default`),B([]);return}(async()=>{R(`loading`);try{let e=`${ue}-${P}`;console.time(`fetchYearPosts-${P}`);let t=await j.yearInPosts.get(e);console.timeEnd(`fetchYearPosts-${P}`),t&&t.year===P?(t.posts.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt)),B(t.posts),R(`results`)):R(`no-data`)}catch{R(`error`)}})()},[P]),o(()=>{if(F!==null&&L===`results`){let e=document.querySelector(`.calendar-bar .month-filter[data-month="${F}"]`);e?.focus(),e?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}},[F,L===`results`]),f(`div`,{ref:G,id:`year-in-posts-page`,class:`deck-container`,tabIndex:`-1`,style:{"--month":F||0},children:[f(`div`,{class:`timeline-deck deck`,children:[f(`header`,{class:L===`loading`?`loading`:``,onClick:e=>{e.target.closest(`a, button`)||G.current?.scrollTo({top:0,behavior:`smooth`})},children:f(`div`,{class:`header-grid`,children:[f(`div`,{class:`header-side`,children:[f(ee,{}),P&&F!==null?f(k,{to:`/yip?year=${P}`,class:`button plain`,onClick:()=>{E(``)},children:f(T,{icon:`grid`,size:`l`,alt:`Year in Posts`})}):P?f(k,{to:`/yip`,class:`button plain`,onClick:()=>{E(``)},children:f(T,{icon:`month`,size:`l`,alt:`Year in Posts`})}):f(k,{to:`/`,class:`button plain`,children:f(T,{icon:`home`,size:`l`,alt:`Home`})})]}),P&&f(t,{children:ae?f(Rt,{ref:W,placeholder:`Search posts in ${P}…`,searchQuery:x,onSearch:e=>{E(e),V(Nt)},onEscape:()=>{x.trim()||(oe(!1),E(``))}}):f(`h1`,{class:`header-double-lines`,children:[f(`b`,{children:P}),L===`results`&&f(`div`,{children:F===null?`${z.length} posts`:`${At(F)} – ${J[F].count} posts`})]})}),f(`div`,{class:`header-side`,children:P&&f(t,{children:[f(`button`,{type:`button`,class:`plain ${ae?`is-active`:``}`,onClick:()=>{ae?(oe(!1),E(``)):(oe(!0),setTimeout(()=>{W.current?.focus()},100))},children:f(T,{icon:`search`,size:`l`,alt:`Search`})}),f(C,{align:`end`,menuButton:f(`button`,{type:`button`,class:`plain`,children:f(T,{icon:`more`,size:`l`,alt:`More`})}),children:f(M,{type:`checkbox`,checked:m===`media`,onClick:()=>{_(m===`media`?`all`:`media`)},children:[f(T,{icon:`check-circle`,alt:`☑️`}),` `,f(`span`,{class:`menu-grow`,children:`Media only`})]})})]})})]})}),f(`main`,{children:[!P&&f(`div`,{class:`year-in-posts-start`,children:[L===`generating`?f(`div`,{class:`ui-state year-in-posts-start`,children:[f(h,{abrupt:!0}),f(`p`,{class:`insignificant`,children:`Generating Year in Posts…`}),f(`p`,{class:`insignificant`,children:`This might take a while.`})]}):f(t,{children:[f(`h1`,{children:[`Year in Posts `,f(`sup`,{children:`beta`})]}),f(`p`,{children:`A year-at-a-glance view of your posts.`}),f(`details`,{children:[f(`summary`,{children:`What is this?`}),f(`p`,{children:`Year in Posts is a simple, searchable archive of your posts, offering a year-at-a-glance view with calendar visualizations and straight-forward interface to sort and filter through posts.`}),f(`img`,{src:``+new URL(`year-in-posts-B2lywqdx.png`,import.meta.url).href,width:`1200`,height:`900`,alt:`Preview of Year in Posts UI`}),f(`p`,{children:f(`button`,{type:`button`,onClick:e=>{e.target.closest(`details`).open=!1},children:`Let's explore my posts`})})]}),f(`form`,{class:`year-generate`,onSubmit:pe,children:[f(`label`,{children:f(`input`,{type:`number`,min:wt,max:new Date().getFullYear(),name:`year`,defaultValue:Tt(),disabled:L===`generating`})}),f(`button`,{type:`submit`,disabled:L===`generating`,children:f(T,{icon:`arrow-right`,alt:`Generate`,size:`l`})})]}),f(`div`,{class:`insignificant`,children:f(`small`,{children:[f(`p`,{children:`This downloads your posts (excluding media files) from the server and saves them locally. It may take a longer time and require more disk space.`}),f(`p`,{children:`Once archived, updated or deleted posts are not reflected in the archive until regenerated.`})]})}),!re&&f(`p`,{class:`insignificant`,children:f(`small`,{children:`⚠️ Your server doesn't support advanced search, this will make more requests to the server and take much longer time.`})})]}),te.length>0&&L!==`generating`&&f(`div`,{class:`year-selection`,children:[f(`p`,{children:`Archived Year in Posts:`}),f(`ul`,{children:te.map(({year:e,count:t,fetchedAt:n,size:r,timezoneOffset:i})=>{let a=Dt(),o=i!==void 0&&i!==a;return f(`li`,{children:[f(k,{to:`/yip?year=${e}`,class:`year-card available`,children:[f(T,{icon:`month`}),` `,e]}),` `,f(`small`,{class:`ib insignificant`,children:[t,` posts`,` `]}),` `,r&&f(`small`,{class:`tag insignificant collapsed`,title:`${r.toLocaleString(s.locale||void 0)} bytes`,children:[`~`,y(r)]}),` `,f(w,{align:`end`,confirmLabel:f(`span`,{children:[`Regenerate `,e,` posts?`]}),onClick:()=>{me(e)},children:f(`button`,{type:`button`,class:`light small`,disabled:L===`loading`,title:n,children:[f(T,{icon:`refresh`,size:`s`,class:`insignificant`}),` `,f(`span`,{class:`insignificant`,children:new Date(n).toLocaleDateString(s.locale,{year:`numeric`,month:`short`,day:`numeric`})}),` `,i!==void 0&&f(`small`,{class:`tag insignificant collapsed ${o?`warn`:``}`,title:o?`Generated in ${Et(i)}, current timezone is ${Et(a)}`:Et(i),children:[o&&f(T,{icon:`time`}),Et(i)]})]})}),f(`button`,{type:`button`,class:`light danger small`,onClick:t=>{t.preventDefault(),he(e)},children:f(T,{icon:`x`,alt:`Remove`})})]},e)})})]})]}),P&&L===`loading`&&f(`div`,{class:`ui-state year-in-posts-start`,children:f(h,{abrupt:!0})}),P&&L===`results`&&f(t,{children:[!x&&J.length>0&&f(t,{children:[f(It,{year:P,month:F,monthsWithPosts:J,postType:m}),F===null&&f(Lt,{})]}),(F!==null||x)&&f(`div`,{class:`post-type-filters`,children:Object.entries(Ot).map(([e,t])=>Y[e]>0&&f(`button`,{type:`button`,class:`filter-cat plain ${m===e?`is-active`:``}`,onClick:()=>_(e),children:[t,` `,f(`span`,{class:`count`,children:Y[e]})]},e))}),(F!==null||x)&&X.length>1&&f(`div`,{class:`sort-controls`,children:[f(`span`,{class:`filter-label`,children:`Sort`}),` `,f(`fieldset`,{class:`radio-field-group`,children:kt.filter(e=>e.key===`relevance`?!!x:e.key===`createdAt`?!0:!x).map(({key:e})=>f(`label`,{class:`filter-sort`,onClick:t=>{H===e&&e!==`relevance`&&(t.preventDefault(),t.stopPropagation(),le(U===`asc`?`desc`:`asc`))},children:[f(`input`,{type:`radio`,name:`filter-sort-cat`,checked:H===e,onChange:()=>{ce(e),le(/(replies|favourites|reblogs)/.test(e)?`desc`:`asc`)}}),{relevance:`Relevance`,createdAt:`Date`,repliesCount:`Replies`,favouritesCount:`Likes`,reblogsCount:`Boosts`}[e],H===e&&e!==`relevance`&&(U===`asc`?` ↑`:` ↓`)]},e))})]}),(F!==null||x)&&f(t,{children:[f(`ul`,{class:`timeline`,children:X.length===0?f(`p`,{class:`ui-state insignificant`,children:`…`}):X.map((e,n)=>{let r=new Date(e.createdAt),i=X[n-1],a=i?new Date(i.createdAt):null;return f(t,{children:[H===`createdAt`&&(!a||r.toDateString()!==a.toDateString())&&f(`li`,{class:`date-header`,children:f(`h2`,{children:[f(`span`,{children:D(e.createdAt,{hideTime:!0,formatOpts:{year:void 0}})}),` `,f(`small`,{class:`insignificant bidi-isolate`,children:D(e.createdAt,{forceOpts:{weekday:`long`}})})]})},e.createdAt),f(`li`,{children:de>20?f(Ft,{root:G.current,post:e,instance:I,defaultShow:n<3},e.id):f(k,{class:`status-link timeline-item`,to:e.reblog?`/${I}/s/${e.reblog.id}`:`/${I}/s/${e.id}`,children:f(O,{status:e,instance:I,size:`m`,showCommentCount:!0,showQuoteCount:!0})})},e.id)]})})}),x&&ye&&f(`div`,{class:`ui-state`,children:f(`button`,{type:`button`,class:`plain6 block`,onClick:()=>V(e=>e+Nt),children:`More…`})}),!x&&f(`div`,{class:`year-in-posts-nav`,children:[xe?f(k,{to:`/yip?year=${P}&month=${xe.month}`,class:`button light`,onClick:()=>{G.current?.scrollTo({top:0,behavior:`instant`})},children:[f(T,{icon:`arrow-left`}),` `,At(xe.month,s.locale,`long`)]}):f(`span`,{}),Se&&f(k,{to:`/yip?year=${P}&month=${Se.month}`,class:`button light`,onClick:()=>{G.current?.scrollTo({top:0,behavior:`instant`})},children:[At(Se.month,s.locale,`long`),` `,f(T,{icon:`arrow-right`})]})]})]})]})]})]}),f(`div`,{class:`tron-grid ${F===null?`animated`:``}`})]})}var Ft=({root:e,post:r,instance:i,defaultShow:a})=>{let s=n(),[c,l]=d(a);o(()=>{if(a)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&(queueMicrotask(()=>l(!0)),t.unobserve(s.current))},{root:e,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&t.observe(s.current),()=>{s.current&&t.unobserve(s.current)}},[a]);let u=r.reblog?.id||r.id;return f(`li`,{ref:s,style:{height:c?void 0:`10em`},children:c?f(k,{class:`status-link timeline-item`,to:`/${i}/s/${u}`,children:f(O,{status:r,instance:i,size:`m`,showCommentCount:!0,showQuoteCount:!0})}):f(t,{children:`\xA0`})})};function It({year:e,month:t,monthsWithPosts:n,postType:i}){let{i18n:a}=r();return f(`div`,{class:`calendar-bar ${t===null?`grid`:`horizontal`} ${i===`media`?`media-grid`:``}`,children:n.map(({month:n,count:r,heatmap:o,mediaGrid:s,original:c,reply:l,quote:u,boost:d})=>{let p=r>0?c/r:0,m=r>0?l/r:0,h=r>0?u/r:0,g=r>0?d/r:0;return f(k,{to:`/yip?year=${e}&month=${n}${i===`all`?``:`&postType=${i}`}`,class:`button plain ${t===n?`is-active month-filter`:`month-filter`}`,style:{"--month-original-ratio":p,"--month-reply-ratio":m,"--month-quote-ratio":h,"--month-boost-ratio":g},"data-month":n,children:[f(`div`,{class:`month-name`,children:At(n,a.locale)}),i===`media`?s.length>0&&f(`div`,{class:`month-media-grid`,children:s.map((e,t)=>{if(!e)return f(`span`,{class:`media-day empty`},t);if(!e.hasMedia)return f(`span`,{class:`media-day no-media`},t);let n=e.post.mediaAttachments?.[0];return f(`span`,{class:`media-day`,children:f(`img`,{src:n.previewUrl||n.url,loading:`lazy`,decoding:`async`,onError:e=>{let{src:t}=e.target;t===n.previewUrl||t===n.url?e.target.src=n.previewRemoteUrl||n.remoteUrl:e.target.remove()},alt:``})},t)})}):o.length>0&&f(`div`,{class:`month-heatmap`,children:o.map((e,t)=>{let n=e.count||0,r=n>0?e.original/n:0,i=n>0?e.reply/n:0,a=n>0?e.quote/n:0,o=n>0?e.boost/n:0;return f(`span`,{class:`heatmap-day ${e.day===null?`empty`:``} ${t%7==0||t%7==6?`weekend`:``}`,"data-ratio":e.ratio,style:{"--ratio":e.ratio,"--original-ratio":r,"--reply-ratio":i,"--quote-ratio":a,"--boost-ratio":o}},t)})}),f(`div`,{class:`month-metadata`,children:[r,` posts `]})]},n)})})}function Lt(){return f(`div`,{class:`calendar-bar-legends`,children:[f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-original`}),` `,f(c,{id:`HxF6Fk`})]}),` `,f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-reply`}),` `,f(c,{id:`N8UzTV`})]}),` `,N()&&f(t,{children:[f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-quote`}),` `,f(c,{id:`eWLklq`})]}),` `]}),f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-boost`}),` `,f(c,{id:`puY2t0`})]})]})}var Rt=s(({searchQuery:e,onSearch:t,placeholder:r,onEscape:i},a)=>{let o=n(null);l(a,()=>({focus:()=>{o.current?.focus()},setValue:e=>{o.current.value=e},isFocused:()=>document.activeElement===o.current}));let s=x(t,150);return f(`form`,{class:`search-field`,onSubmit:e=>{e.preventDefault();let t=o.current.value.trim();s?.cancel(),s(t)},children:f(`input`,{ref:o,type:`search`,name:`q`,class:`block`,placeholder:r||`Search posts…`,defaultValue:e,dir:`auto`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellCheck:`false`,enterKeyHint:`search`,onInput:e=>{let t=e.target.value;s(t)},onKeyDown:e=>{e.key===`Escape`&&!e.target.value.trim()&&i?.()}})})});export{Pt as default}; //# sourceMappingURL=year-in-posts-CCySMT55.js.map