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