luoxu-api-pub/html/assets/index-7c45f9bd.js
2024-03-30 13:45:42 +00:00

5 lines
19 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var qe=Object.defineProperty;var Ie=(t,e,n)=>e in t?qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var re=(t,e,n)=>(Ie(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&l(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function l(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function F(){}function Me(t){return t()}function ye(){return Object.create(null)}function B(t){t.forEach(Me)}function Ue(t){return typeof t=="function"}function ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ne;function J(t,e){return t===e?!0:(ne||(ne=document.createElement("a")),ne.href=e,t===ne.href)}function Pe(t){return Object.keys(t).length===0}function g(t,e){t.appendChild(e)}function U(t,e,n){t.insertBefore(e,n||null)}function O(t){t.parentNode&&t.parentNode.removeChild(t)}function Ne(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function v(t){return document.createElement(t)}function H(t){return document.createTextNode(t)}function R(){return H(" ")}function _e(){return H("")}function j(t,e,n,l){return t.addEventListener(e,n,l),()=>t.removeEventListener(e,n,l)}function Be(t){return function(e){return e.preventDefault(),t.call(this,e)}}function h(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function He(t){return Array.from(t.childNodes)}function x(t,e){e=""+e,t.data!==e&&(t.data=e)}function Q(t,e){t.value=e??""}function ve(t,e,n){for(let l=0;l<t.options.length;l+=1){const s=t.options[l];if(s.__value===e){s.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function Xe(t){const e=t.querySelector(":checked");return e&&e.__value}function se(t,e,n){t.classList.toggle(e,!!n)}let ee;function $(t){ee=t}function de(){if(!ee)throw new Error("Function called outside component initialization");return ee}function je(t){de().$$.on_mount.push(t)}function Ke(t,e){return de().$$.context.set(t,e),e}function ue(t){return de().$$.context.get(t)}const G=[],te=[];let V=[];const fe=[],ze=Promise.resolve();let ce=!1;function Ge(){ce||(ce=!0,ze.then(Fe))}function oe(t){V.push(t)}function Ve(t){fe.push(t)}const ie=new Set;let z=0;function Fe(){if(z!==0)return;const t=ee;do{try{for(;z<G.length;){const e=G[z];z++,$(e),We(e.$$)}}catch(e){throw G.length=0,z=0,e}for($(null),G.length=0,z=0;te.length;)te.pop()();for(let e=0;e<V.length;e+=1){const n=V[e];ie.has(n)||(ie.add(n),n())}V.length=0}while(G.length);for(;fe.length;)fe.pop()();ce=!1,ie.clear(),$(t)}function We(t){if(t.fragment!==null){t.update(),B(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oe)}}function Je(t){const e=[],n=[];V.forEach(l=>t.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),V=e}const le=new Set;let X;function Se(){X={r:0,c:[],p:X}}function Te(){X.r||B(X.c),X=X.p}function P(t,e){t&&t.i&&(le.delete(t),t.i(e))}function W(t,e,n,l){if(t&&t.o){if(le.has(t))return;le.add(t),X.c.push(()=>{le.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function Y(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Qe(t,e){t.d(1),e.delete(t.key)}function Ye(t,e,n,l,s,i,o,r,u,_,p,c){let d=t.length,w=i.length,a=d;const m={};for(;a--;)m[t[a].key]=a;const k=[],N=new Map,L=new Map,E=[];for(a=w;a--;){const y=c(s,i,a),A=n(y);let M=o.get(A);M?l&&E.push(()=>M.p(y,e)):(M=_(A,y),M.c()),N.set(A,k[a]=M),A in m&&L.set(A,Math.abs(a-m[A]))}const q=new Set,C=new Set;function D(y){P(y,1),y.m(r,p),o.set(y.key,y),p=y.first,w--}for(;d&&w;){const y=k[w-1],A=t[d-1],M=y.key,T=A.key;y===A?(p=y.first,d--,w--):N.has(T)?!o.has(M)||q.has(M)?D(y):C.has(T)?d--:L.get(M)>L.get(T)?(C.add(M),D(y)):(q.add(T),d--):(u(A,o),d--)}for(;d--;){const y=t[d];N.has(y.key)||u(y,o)}for(;w;)D(k[w-1]);return B(E),k}function Ze(t,e,n){const l=t.$$.props[e];l!==void 0&&(t.$$.bound[l]=n,n(t.$$.ctx[l]))}function Re(t){t&&t.c()}function pe(t,e,n){const{fragment:l,after_update:s}=t.$$;l&&l.m(e,n),oe(()=>{const i=t.$$.on_mount.map(Me).filter(Ue);t.$$.on_destroy?t.$$.on_destroy.push(...i):B(i),t.$$.on_mount=[]}),s.forEach(oe)}function he(t,e){const n=t.$$;n.fragment!==null&&(Je(n.after_update),B(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function $e(t,e){t.$$.dirty[0]===-1&&(G.push(t),Ge(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ge(t,e,n,l,s,i,o=null,r=[-1]){const u=ee;$(t);const _=t.$$={fragment:null,ctx:[],props:i,update:F,not_equal:s,bound:ye(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:ye(),dirty:r,skip_bound:!1,root:e.target||u.$$.root};o&&o(_.root);let p=!1;if(_.ctx=n?n(t,e.props||{},(c,d,...w)=>{const a=w.length?w[0]:d;return _.ctx&&s(_.ctx[c],_.ctx[c]=a)&&(!_.skip_bound&&_.bound[c]&&_.bound[c](a),p&&$e(t,c)),d}):[],_.update(),p=!0,B(_.before_update),_.fragment=l?l(_.ctx):!1,e.target){if(e.hydrate){const c=He(e.target);_.fragment&&_.fragment.l(c),c.forEach(O)}else _.fragment&&_.fragment.c();e.intro&&P(t.$$.fragment),pe(t,e.target,e.anchor),Fe()}$(u)}class me{constructor(){re(this,"$$");re(this,"$$set")}$destroy(){he(this,1),this.$destroy=F}$on(e,n){if(!Ue(n))return F;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const s=l.indexOf(n);s!==-1&&l.splice(s,1)}}$set(e){this.$$set&&!Pe(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const xe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(xe);function et(t){let e,n,l,s,i,o,r,u=(t[0].from_name||" ")+"",_,p,c,d=t[0].html+"",w,a,m=t[1][t[0].group_id][1]+"",k,N,L,E,q;return{c(){e=v("div"),n=v("img"),i=R(),o=v("div"),r=v("div"),_=H(u),p=R(),c=v("div"),w=R(),a=v("div"),k=H(m),N=R(),L=v("a"),E=v("time"),q=H(t[3]),h(n,"class","avatar svelte-trlp67"),J(n.src,l=ue("LUOXU_URL")+"/avatar/"+t[0].from_id+".jpg")||h(n,"src",l),h(n,"height","64"),h(n,"width","64"),h(n,"alt",s=t[0].from_name+" 的头像"),h(r,"class","name svelte-trlp67"),h(c,"class","text svelte-trlp67"),h(E,"datetime",t[4]),h(E,"title",t[2]),h(L,"href",t[5]),h(L,"class","svelte-trlp67"),h(a,"class","time svelte-trlp67"),h(o,"class","content svelte-trlp67"),h(e,"class","message svelte-trlp67")},m(C,D){U(C,e,D),g(e,n),g(e,i),g(e,o),g(o,r),g(r,_),g(o,p),g(o,c),c.innerHTML=d,g(o,w),g(o,a),g(a,k),g(a,N),g(a,L),g(L,E),g(E,q)},p(C,[D]){D&1&&!J(n.src,l=ue("LUOXU_URL")+"/avatar/"+C[0].from_id+".jpg")&&h(n,"src",l),D&1&&s!==(s=C[0].from_name+" 的头像")&&h(n,"alt",s),D&1&&u!==(u=(C[0].from_name||" ")+"")&&x(_,u),D&1&&d!==(d=C[0].html+"")&&(c.innerHTML=d),D&3&&m!==(m=C[1][C[0].group_id][1]+"")&&x(k,m)},i:F,o:F,d(C){C&&O(e)}}}function tt(t,e){const n={year:31536e6,month:2628e6,day:864e5,hour:36e5,minute:6e4,second:1e3},l=new Intl.RelativeTimeFormat,s=t.valueOf()-e.valueOf();for(const[i,o]of Object.entries(n))if(Math.abs(s)>o||i==="second")return l.format(Math.round(s/o),i)}function nt(t,e,n){let{msg:l}=e,{groupinfo:s}=e,{now:i}=e;const r=new Intl.DateTimeFormat(void 0,{timeStyle:"full",dateStyle:"full",hour12:!1}).format;let u=new Date(l.t*1e3),_=l.edited?new Date(l.edited*1e3):null,p=r(u)+(_?`
最后编辑于:${r(_)}`:""),c=tt(u,i),d=u.toISOString(),w=s[l.group_id][0]?`https://t.me/${s[l.group_id][0]}/${l.id}`:`tg://privatepost?channel=${l.group_id}&post=${l.id}`;return t.$$set=a=>{"msg"in a&&n(0,l=a.msg),"groupinfo"in a&&n(1,s=a.groupinfo),"now"in a&&n(6,i=a.now)},[l,s,p,c,d,w,i]}class lt extends me{constructor(e){super(),ge(this,e,nt,et,ae,{msg:0,groupinfo:1,now:6})}}function ke(t,e,n){const l=t.slice();return l[25]=e[n],l[27]=n,l}function Ee(t,e){let n,l,s,i=e[25][1]+"",o,r,u,_;return{key:t,first:null,c(){n=v("li"),l=v("img"),o=H(i),r=R(),J(l.src,s=e[6]+"/avatar/"+e[25][0]+".jpg")||h(l,"src",s),h(l,"alt","avatar"),h(l,"class","svelte-1xopsdo"),h(n,"data-idx",u=e[27]),h(n,"title",_=e[25][1]),h(n,"class","svelte-1xopsdo"),se(n,"selected",e[27]===e[1]),this.first=n},m(p,c){U(p,n,c),g(n,l),g(n,o),g(n,r)},p(p,c){e=p,c&4&&!J(l.src,s=e[6]+"/avatar/"+e[25][0]+".jpg")&&h(l,"src",s),c&4&&i!==(i=e[25][1]+"")&&x(o,i),c&4&&u!==(u=e[27])&&h(n,"data-idx",u),c&4&&_!==(_=e[25][1])&&h(n,"title",_),c&6&&se(n,"selected",e[27]===e[1])},d(p){p&&O(n)}}}function st(t){let e,n,l,s,i,o,r,u=[],_=new Map,p,c,d=Y(t[2]);const w=a=>a[25];for(let a=0;a<d.length;a+=1){let m=ke(t,d,a),k=w(m);_.set(k,u[a]=Ee(k,m))}return{c(){e=v("div"),n=v("input"),l=R(),s=v("img"),o=R(),r=v("ul");for(let a=0;a<u.length;a+=1)u[a].c();h(n,"type","text"),h(n,"class","svelte-1xopsdo"),h(s,"class","selected-avatar svelte-1xopsdo"),h(s,"alt",""),J(s.src,i=t[6]+"/avatar/"+(t[0]?t[0]:"nobody")+".jpg")||h(s,"src",i),h(r,"class","svelte-1xopsdo"),se(r,"hidden",t[2].length===0||t[5]),h(e,"id","namebox"),h(e,"class","svelte-1xopsdo")},m(a,m){U(a,e,m),g(e,n),t[14](n),g(e,l),g(e,s),g(e,o),g(e,r);for(let k=0;k<u.length;k+=1)u[k]&&u[k].m(r,null);t[18](r),p||(c=[j(window,"resize",t[7]),j(n,"input",t[15]),j(n,"focus",t[16]),j(n,"blur",t[17]),j(n,"keydown",t[11]),j(r,"click",t[9]),j(r,"mousedown",Be(ot))],p=!0)},p(a,[m]){m&1&&!J(s.src,i=a[6]+"/avatar/"+(a[0]?a[0]:"nobody")+".jpg")&&h(s,"src",i),m&70&&(d=Y(a[2]),u=Ye(u,m,w,1,a,d,_,r,Qe,Ee,null,ke)),m&36&&se(r,"hidden",a[2].length===0||a[5])},i:F,o:F,d(a){a&&O(e),t[14](null);for(let m=0;m<u.length;m+=1)u[m].d();t[18](null),p=!1,B(c)}}}const ot=()=>{};function rt(t,e,n){let{group:l}=e,{selected:s}=e,{selected_init:i}=e,o="",r,u,_=[],p=ue("LUOXU_URL"),c,d,w=!1,a=new AbortController;je(()=>{const f=c.getBoundingClientRect();n(4,d.style.top=`${f.height-1}px`,d),n(4,d.style.width=`${f.width-2}px`,d)});function m(){const f=c.getBoundingClientRect();n(4,d.style.width=`${f.width-2}px`,d)}function k(){u&&clearTimeout(u),u=setTimeout(function(){N()},300)}async function N(){if(c.value){n(1,r=null),a.abort(),a=new AbortController;try{const b=await(await fetch(`${p}/names?g=${l}&q=${c.value}`,{signal:a.signal})).json();a.signal.aborted||n(2,_=b.names)}catch(f){f instanceof DOMException&&f.name==="AbortError"||console.error(f)}}}function L(f){let b=f.target;b.tagName==="IMG"&&(b=b.parentNode),b.tagName=="LI"&&(n(1,r=parseInt(b.dataset.idx)),E(),c.focus(),n(5,w=!0))}function E(){n(0,s=_[r][0]),o=_[r][1],n(3,c.value=o,c),n(12,i=null)}function q(){!s||s===i||(c.value?n(3,c.value=o,c):(n(0,s=i),o=""))}function C(f){f.key==="ArrowDown"||f.key==="n"&&f.altKey?(D(1),f.preventDefault()):f.key==="ArrowUp"||f.key==="p"&&f.altKey?(D(-1),f.preventDefault()):f.key==="Enter"&&(E(),f.preventDefault())}function D(f){typeof r=="number"?f>0?n(1,r=(r+1)%_.length):n(1,r=(r-1)%_.length):f>0?n(1,r=0):n(1,r=_.length-1)}function y(f){te[f?"unshift":"push"](()=>{c=f,n(3,c)})}const A=()=>{n(5,w=!1),k()},M=()=>n(5,w=!1),T=()=>{n(5,w=!0),q()};function S(f){te[f?"unshift":"push"](()=>{d=f,n(4,d)})}return t.$$set=f=>{"group"in f&&n(13,l=f.group),"selected"in f&&n(0,s=f.selected),"selected_init"in f&&n(12,i=f.selected_init)},[s,r,_,c,d,w,p,m,k,L,q,C,i,l,y,A,M,T,S]}class it extends me{constructor(e){super(),ge(this,e,rt,st,ae,{group:13,selected:0,selected_init:12})}}function ut(t){return new Promise((n,l)=>{setTimeout(n,t)})}function Le(t,e,n){const l=t.slice();return l[25]=e[n],l}function Ce(t,e,n){const l=t.slice();return l[2]=e[n],l}function ft(t){let e,n,l,s,i=t[10]&&at(),o=Y(t[0]),r=[];for(let u=0;u<o.length;u+=1)r[u]=De(Ce(t,o,u));return{c(){e=v("select"),i&&i.c(),n=_e();for(let u=0;u<r.length;u+=1)r[u].c();h(e,"class","svelte-1rpa33b"),t[2]===void 0&&oe(()=>t[17].call(e))},m(u,_){U(u,e,_),i&&i.m(e,null),g(e,n);for(let p=0;p<r.length;p+=1)r[p]&&r[p].m(e,null);ve(e,t[2],!0),l||(s=[j(e,"change",t[17]),j(e,"change",t[13])],l=!0)},p(u,_){if(_&1){o=Y(u[0]);let p;for(p=0;p<o.length;p+=1){const c=Ce(u,o,p);r[p]?r[p].p(c,_):(r[p]=De(c),r[p].c(),r[p].m(e,null))}for(;p<r.length;p+=1)r[p].d(1);r.length=o.length}_&5&&ve(e,u[2])},d(u){u&&O(e),i&&i.d(),Ne(r,u),l=!1,B(s)}}}function ct(t){let e,n;return{c(){e=v("select"),n=v("option"),n.textContent="正在加载群组信息...",n.selected=!0,n.__value="正在加载群组信息...",Q(n,n.__value),h(e,"class","svelte-1rpa33b")},m(l,s){U(l,e,s),g(e,n)},p:F,d(l){l&&O(e)}}}function at(t){let e;return{c(){e=v("option"),e.textContent="全部",e.__value="",Q(e,e.__value)},m(n,l){U(n,e,l)},d(n){n&&O(e)}}}function De(t){let e,n=t[2].name+"",l,s;return{c(){e=v("option"),l=H(n),e.__value=s=t[2].group_id,Q(e,e.__value)},m(i,o){U(i,e,o),g(e,l)},p(i,o){o&1&&n!==(n=i[2].name+"")&&x(l,n),o&1&&s!==(s=i[2].group_id)&&(e.__value=s,Q(e,e.__value))},d(i){i&&O(e)}}}function _t(t){let e;return{c(){e=v("div"),e.innerHTML=`<p>搜索消息时,搜索字符串不区分简繁(会使用 OpenCC
自动转换),也不进行分词(请手动将可能不连在一起的词语以空格分开)。</p> <p>搜索字符串支持以下功能:</p> <ul><li>以空格分开的多个搜索词是「与」的关系</li> <li>使用 OR全大写来表达「或」条件</li> <li>使用 - 来表达排除,如 落絮 - 测试</li> <li>使用小括号来分组</li></ul> <p>人名补全支持上下方向键和 Alt+N/P 进行选择。</p> <p>搜索结果右下角的时间,悬停可查看绝对时间、最后编辑时间(如编辑过),点击可跳转到
Telegram 中展示该消息。</p>`},m(n,l){U(n,e,l)},p:F,i:F,o:F,d(n){n&&O(e)}}}function dt(t){let e,n,l=Y(t[4].messages),s=[];for(let o=0;o<l.length;o+=1)s[o]=Oe(Le(t,l,o));const i=o=>W(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();e=_e()},m(o,r){for(let u=0;u<s.length;u+=1)s[u]&&s[u].m(o,r);U(o,e,r),n=!0},p(o,r){if(r&48){l=Y(o[4].messages);let u;for(u=0;u<l.length;u+=1){const _=Le(o,l,u);s[u]?(s[u].p(_,r),P(s[u],1)):(s[u]=Oe(_),s[u].c(),P(s[u],1),s[u].m(e.parentNode,e))}for(Se(),u=l.length;u<s.length;u+=1)i(u);Te()}},i(o){if(!n){for(let r=0;r<l.length;r+=1)P(s[r]);n=!0}},o(o){s=s.filter(Boolean);for(let r=0;r<s.length;r+=1)W(s[r]);n=!1},d(o){o&&O(e),Ne(s,o)}}}function Oe(t){let e,n;return e=new lt({props:{msg:t[25],groupinfo:t[4].groupinfo,now:t[5]}}),{c(){Re(e.$$.fragment)},m(l,s){pe(e,l,s),n=!0},p(l,s){const i={};s&16&&(i.msg=l[25]),s&16&&(i.groupinfo=l[4].groupinfo),s&32&&(i.now=l[5]),e.$set(i)},i(l){n||(P(e.$$.fragment,l),n=!0)},o(l){W(e.$$.fragment,l),n=!1},d(l){he(e,l)}}}function pt(t){let e,n;function l(r,u){if(r[3])return bt;if(r[4]&&r[4].messages.length===0)return mt;if(r[4]&&!r[4].has_more)return gt}let s=l(t),i=s&&s(t),o=t[4]&&t[4].has_more&&Ae(t);return{c(){i&&i.c(),e=R(),o&&o.c(),n=_e()},m(r,u){i&&i.m(r,u),U(r,e,u),o&&o.m(r,u),U(r,n,u)},p(r,u){s===(s=l(r))&&i?i.p(r,u):(i&&i.d(1),i=s&&s(r),i&&(i.c(),i.m(e.parentNode,e))),r[4]&&r[4].has_more?o?o.p(r,u):(o=Ae(r),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},d(r){r&&(O(e),O(n)),i&&i.d(r),o&&o.d(r)}}}function ht(t){let e;return{c(){e=v("div"),e.innerHTML='<p class="svelte-1rpa33b">正在加载...</p>',h(e,"class","info svelte-1rpa33b")},m(n,l){U(n,e,l)},p:F,d(n){n&&O(e)}}}function gt(t){let e;return{c(){e=v("div"),e.innerHTML='<p class="svelte-1rpa33b">到底了。</p>',h(e,"class","info svelte-1rpa33b")},m(n,l){U(n,e,l)},p:F,d(n){n&&O(e)}}}function mt(t){let e;return{c(){e=v("div"),e.innerHTML='<p class="svelte-1rpa33b">没有匹配的消息。</p>',h(e,"class","info svelte-1rpa33b")},m(n,l){U(n,e,l)},p:F,d(n){n&&O(e)}}}function bt(t){let e,n;return{c(){e=v("p"),n=H(t[3]),h(e,"class","error svelte-1rpa33b")},m(l,s){U(l,e,s),g(e,n)},p(l,s){s&8&&x(n,l[3])},d(l){l&&O(e)}}}function Ae(t){let e,n,l,s;return{c(){e=v("div"),n=v("button"),n.textContent="加载更多",h(n,"class","svelte-1rpa33b"),h(e,"class","info svelte-1rpa33b")},m(i,o){U(i,e,o),g(e,n),l||(s=j(n,"click",t[14]),l=!0)},p:F,d(i){i&&O(e),l=!1,s()}}}function wt(t){let e,n,l,s,i,o,r,u,_,p,c,d,w,a,m,k;function N(f,b){return f[0].length===0?ct:ft}let L=N(t),E=L(t);function q(f){t[21](f)}let C={group:t[2],selected_init:t[8]};t[7]!==void 0&&(C.selected=t[7]),o=new it({props:C}),te.push(()=>Ze(o,"selected",q));const D=[dt,_t],y=[];function A(f,b){return f[4]?0:!f[6]&&!f[3]?1:-1}~(c=A(t))&&(d=y[c]=D[c](t));function M(f,b){return f[6]?ht:pt}let T=M(t),S=T(t);return{c(){e=v("main"),n=v("div"),E.c(),l=R(),s=v("input"),i=R(),Re(o.$$.fragment),u=R(),_=v("button"),_.textContent="搜索",p=R(),d&&d.c(),w=R(),S.c(),h(s,"type","search"),h(s,"class","svelte-1rpa33b"),h(_,"class","svelte-1rpa33b"),h(n,"id","searchbox"),h(n,"class","svelte-1rpa33b"),h(e,"class","svelte-1rpa33b")},m(f,b){U(f,e,b),g(e,n),E.m(n,null),g(n,l),g(n,s),Q(s,t[1]),g(n,i),pe(o,n,null),g(n,u),g(n,_),g(e,p),~c&&y[c].m(e,null),g(e,w),S.m(e,null),a=!0,m||(k=[j(window,"hashchange",t[16]),j(s,"input",t[18]),j(s,"input",t[19]),j(s,"keydown",t[20]),j(_,"click",t[22])],m=!0)},p(f,[b]){L===(L=N(f))&&E?E.p(f,b):(E.d(1),E=L(f),E&&(E.c(),E.m(n,l))),b&2&&s.value!==f[1]&&Q(s,f[1]);const I={};b&4&&(I.group=f[2]),b&256&&(I.selected_init=f[8]),!r&&b&128&&(r=!0,I.selected=f[7],Ve(()=>r=!1)),o.$set(I);let K=c;c=A(f),c===K?~c&&y[c].p(f,b):(d&&(Se(),W(y[K],1,1,()=>{y[K]=null}),Te()),~c?(d=y[c],d?d.p(f,b):(d=y[c]=D[c](f),d.c()),P(d,1),d.m(e,w)):d=null),T===(T=M(f))&&S?S.p(f,b):(S.d(1),S=T(f),S&&(S.c(),S.m(e,null)))},i(f){a||(P(o.$$.fragment,f),P(d),a=!0)},o(f){W(o.$$.fragment,f),W(d),a=!1},d(f){f&&O(e),E.d(),he(o),~c&&y[c].d(),S.d(),m=!1,B(k)}}}const Z="https://search-pub.xtaolabs.com/luoxu";function yt(){const t=location.hash;if(t)return new URLSearchParams(t.substring(1))}function vt(t,e,n){const l=Z.startsWith("http://localhost");let s=[],i,o,r,u,_=new Date,p=!1,c=!1,d,w,a=!1,m=new AbortController;Ke("LUOXU_URL",Z),je(async()=>{for(k();;)try{const f=await fetch(`${Z}/groups`);n(0,s=(await f.json()).groups),n(15,c=!0),i||n(2,i="");break}catch(f){console.error("failed to fetch group info, will retry",f),await ut(1e3)}});function k(){const f=yt();f&&(n(1,o=""),n(2,i=""),n(4,u=null),f.has("g")&&n(2,i=f.get("g")),f.has("q")&&n(1,o=f.get("q")),f.has("sender")&&(n(7,d=f.get("sender")),n(8,w=d)),(i||l)&&o&&(n(4,u=null),L()))}let N=0;async function L(f){N+=1;try{if(m.abort(),m=new AbortController,!i&&!l){n(3,r="请选择要搜索的群组");return}if(!o&&!l&&!d){n(3,r="请输入搜索关键字");return}n(3,r=""),n(9,a=!0),console.log(`searching ${o} for group ${i}, older than ${f}, from ${d}`);const b=new URLSearchParams;i&&b.append("g",i),o&&b.append("q",o),d&&b.append("sender",d);let I;const K=b.toString();f?I=`${Z}/search?${b}&end=${f}`:(location.hash=`#${K}`,n(15,c=!0),u&&n(4,u.messages=[],u),I=`${Z}/search?${K}`),n(5,_=new Date),n(6,p=!0);try{const we=await(await fetch(I,{signal:m.signal})).json();if(n(6,p=!1),m.signal.aborted)return[];if(f)return we;n(4,u=we)}catch(be){N<=1&&(n(3,r=be),n(6,p=!1))}n(9,a=!1)}finally{N-=1}}async function E(){n(3,r=""),o&&await L()}async function q(){const f=u.messages[u.messages.length-1].t,b=u.messages,I=await L(f);n(4,u.messages=[...b,...I.messages],u),n(4,u.has_more=I.has_more,u)}const C=()=>{a||k()};function D(){i=Xe(this),n(2,i),n(0,s)}function y(){o=this.value,n(1,o)}const A=()=>n(3,r=""),M=f=>{f.key==="Enter"&&L()};function T(f){d=f,n(7,d)}const S=()=>L();return t.$$.update=()=>{if(t.$$.dirty&32775&&c&&s){let f;for(const b of s)b.group_id===i&&(f=b.name);o&&f?document.title=`搜索:${o}${f} - 落絮`:o?document.title=`搜索:${o} - 落絮`:f?document.title=`搜索 ${f} - 落絮`:document.title="落絮",n(15,c=!1)}},[s,o,i,r,u,_,p,d,w,a,l,k,L,E,q,c,C,D,y,A,M,T,S]}class kt extends me{constructor(e){super(),ge(this,e,vt,wt,ae,{})}}new kt({target:document.body});