Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 832
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
import{j as e}from"./client-wT6vtYO_.js";import{u as A,r as n,d as Q,G as E}from"./index-BdTwX--g.js";import{c as k}from"./index-DizoKcfL.js";import{a as z,l as K,u as T,br as X,bs as I,I as $,b8 as J,b9 as Y}from"./useSelectableClick-DSv4aXzQ.js";import{H as Z,S as V,a as ee}from"./hashtags-DlzQcrtL.js";import{S as se}from"./close-BsPe8EbX.js";import{D as w,d as ae}from"./initial_state-CaZA8Ule.js";import{c as te}from"./short_number-w3W5phxu.js";import{M as c}from"./message-UFwkQlnu.js";const v=Q({placeholder:{id:"search.placeholder",defaultMessage:"Search"},clearSearch:{id:"search.clear",defaultMessage:"Clear search"},placeholderSignedIn:{id:"search.search_or_paste",defaultMessage:"Search or paste URL"}}),ce=u=>{switch(u.type){case"account":return`@${u.q}`;case"hashtag":return`#${u.q}`;default:return u.q}},ne=({onClick:u,hasValue:p})=>{const y=A();return e.jsxs("div",{className:k("search__icon-wrapper",{"has-value":p}),children:[e.jsx($,{id:"search",icon:V,className:"search__icon"}),e.jsx("button",{type:"button",onClick:u,className:"search__icon search__icon--clear-button",tabIndex:p?void 0:-1,"aria-hidden":!p,children:e.jsx($,{id:"times-circle",icon:ee,"aria-label":y.formatMessage(v.clearSearch)})})]})},_e=({singleColumn:u,initialValue:p})=>{const y=A(),L=z(s=>s.search.recent),{signedIn:_}=K(),m=T(),l=te(),S=n.useRef(null),[M,x]=n.useState(p??""),F=M.length>0,[N,D]=n.useState(!1),[i,f]=n.useState(-1),[j,R]=n.useState([]);n.useEffect(()=>{x(p??""),R([])},[p]);const q=[],r=n.useCallback(()=>{var s,a;(a=(s=document.querySelector(".ui"))==null?void 0:s.parentElement)==null||a.focus(),D(!1)},[]);w&&q.push({key:"prompt-has",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"has:"})," ",e.jsx(E,{type:"disjunction",value:["media","poll","embed"]})]}),action:s=>{s.preventDefault(),h("has:")}},{key:"prompt-is",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"is:"})," ",e.jsx(E,{type:"disjunction",value:["reply","sensitive"]})]}),action:s=>{s.preventDefault(),h("is:")}},{key:"prompt-language",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"language:"})," ",e.jsx(c,{id:"search_popout.language_code",defaultMessage:"ISO language code"})]}),action:s=>{s.preventDefault(),h("language:")}},{key:"prompt-from",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"from:"})," ",e.jsx(c,{id:"search_popout.user",defaultMessage:"user"})]}),action:s=>{s.preventDefault(),h("from:")}},{key:"prompt-before",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"before:"})," ",e.jsx(c,{id:"search_popout.specific_date",defaultMessage:"specific date"})]}),action:s=>{s.preventDefault(),h("before:")}},{key:"prompt-during",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"during:"})," ",e.jsx(c,{id:"search_popout.specific_date",defaultMessage:"specific date"})]}),action:s=>{s.preventDefault(),h("during:")}},{key:"prompt-after",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"after:"})," ",e.jsx(c,{id:"search_popout.specific_date",defaultMessage:"specific date"})]}),action:s=>{s.preventDefault(),h("after:")}},{key:"prompt-in",label:e.jsxs(e.Fragment,{children:[e.jsx("mark",{children:"in:"})," ",e.jsx(E,{type:"disjunction",value:["all","library","public"]})]}),action:s=>{s.preventDefault(),h("in:")}});const C=L.map(s=>({key:`${s.type}/${s.q}`,label:ce(s),action:()=>{if(x(s.q),s.type==="account")l.push(`/@${s.q}`);else if(s.type==="hashtag")l.push(`/tags/${s.q}`);else{const a=new URLSearchParams({q:s.q});s.type&&a.set("type",s.type),l.push({pathname:"/search",search:a.toString()})}r()},forget:a=>{a.stopPropagation(),m(X(s))}})),d=F?j.concat(q):C.concat(j,q),h=s=>{x(a=>a===""?s:a.endsWith(" ")?`${a}${s}`:`${a} ${s}`)},b=n.useCallback((s,a)=>{m(I({q:s,type:a}));const t=new URLSearchParams({q:s});a&&t.set("type",a),l.push({pathname:"/search",search:t.toString()}),r()},[m,l,r]),O=n.useCallback(({target:{value:s}})=>{x(s);const a=s.trim(),t=[];a.length>0&&(a.startsWith("https://")&&!a.includes(" ")&&t.push({key:"open-url",label:e.jsx(c,{id:"search.quick_action.open_url",defaultMessage:"Open URL in Mastodon"}),action:async()=>{const o=await m(J({url:a}));Y(o)&&(o.payload.accounts[0]?l.push(`/@${o.payload.accounts[0].acct}`):o.payload.statuses[0]&&l.push(`/@${o.payload.statuses[0].account.acct}/${o.payload.statuses[0].id}`)),r()}}),(a.startsWith("#")&&a.length>1||a.match(Z))&&t.push({key:"go-to-hashtag",label:e.jsx(c,{id:"search.quick_action.go_to_hashtag",defaultMessage:"Go to hashtag {x}",values:{x:e.jsxs("mark",{children:["#",a.replace(/^#/,"")]})}}),action:()=>{const o=a.replace(/^#/,"");l.push(`/tags/${o}`),m(I({q:o,type:"hashtag"})),r()}}),/^@?[a-z0-9_-]+(@[^\s]+)?$/i.exec(a)&&t.push({key:"go-to-account",label:e.jsx(c,{id:"search.quick_action.go_to_account",defaultMessage:"Go to profile {x}",values:{x:e.jsxs("mark",{children:["@",a.replace(/^@/,"")]})}}),action:()=>{const o=a.replace(/^@/,"");l.push(`/@${o}`),m(I({q:o,type:"account"})),r()}}),w&&_&&t.push({key:"status-search",label:e.jsx(c,{id:"search.quick_action.status_search",defaultMessage:"Posts matching {x}",values:{x:e.jsx("mark",{children:a})}}),action:()=>{b(a,"statuses")}}),t.push({key:"account-search",label:e.jsx(c,{id:"search.quick_action.account_search",defaultMessage:"Profiles matching {x}",values:{x:e.jsx("mark",{children:a})}}),action:()=>{b(a,"accounts")}})),R(t)},[_,m,r,l,b]),P=n.useCallback(()=>{x(""),R([]),f(-1),r()},[r]),H=n.useCallback(s=>{var a;switch(s.key){case"Escape":s.preventDefault(),r();break;case"ArrowDown":s.preventDefault(),d.length>0&&f(Math.min(i+1,d.length-1));break;case"ArrowUp":s.preventDefault(),d.length>0&&f(Math.max(i-1,-1));break;case"Enter":s.preventDefault(),i===-1?b(M):d.length>0&&((a=d[i])==null||a.action(s));break;case"Delete":if(i>-1&&d.length>0){const t=d[i];typeof(t==null?void 0:t.forget)=="function"&&(s.preventDefault(),t.forget(s))}break}},[r,d,i,b,M]),G=n.useCallback(()=>{if(D(!0),f(-1),S.current&&!u){const{left:s,right:a}=S.current.getBoundingClientRect();(s<0||a>(window.innerWidth||document.documentElement.clientWidth))&&S.current.scrollIntoView()}},[D,f,u]),W=n.useCallback(()=>{f(-1)},[f]),B=n.useRef(null);return n.useEffect(()=>{if(N){let s=function(a){const t=B.current;t&&(t===a.target||t.contains(a.target))||D(!1)};return document.addEventListener("focusin",s),document.addEventListener("click",s),()=>{document.removeEventListener("focusin",s),document.removeEventListener("click",s)}}return()=>null},[N]),e.jsxs("form",{ref:B,className:k("search",{active:N}),children:[e.jsx("input",{ref:S,className:"search__input",type:"text",placeholder:y.formatMessage(_?v.placeholderSignedIn:v.placeholder),"aria-label":y.formatMessage(_?v.placeholderSignedIn:v.placeholder),value:M,onChange:O,onKeyDown:H,onFocus:G,onBlur:W}),e.jsx(ne,{hasValue:F,onClick:P}),e.jsxs("div",{className:"search__popout",tabIndex:-1,children:[!F&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:e.jsx(c,{id:"search_popout.recent",defaultMessage:"Recent searches"})}),e.jsx("div",{className:"search__popout__menu",children:C.length>0?C.map(({label:s,key:a,action:t,forget:g},U)=>e.jsxs("div",{tabIndex:0,role:"button",onMouseDown:t,className:k("search__popout__menu__item search__popout__menu__item--flex",{selected:i===U}),children:[e.jsx("span",{children:s}),e.jsx("button",{className:"icon-button",onMouseDown:g,children:e.jsx($,{id:"times",icon:se})})]},a)):e.jsx("div",{className:"search__popout__menu__message",children:e.jsx(c,{id:"search.no_recent_searches",defaultMessage:"No recent searches"})})})]}),j.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:e.jsx(c,{id:"search_popout.quick_actions",defaultMessage:"Quick actions"})}),e.jsx("div",{className:"search__popout__menu",children:j.map(({key:s,label:a,action:t},g)=>e.jsx("button",{onMouseDown:t,className:k("search__popout__menu__item",{selected:i===g}),children:a},s))})]}),e.jsx("h4",{children:e.jsx(c,{id:"search_popout.options",defaultMessage:"Search options"})}),w&&_?e.jsx("div",{className:"search__popout__menu",children:q.map(({key:s,label:a,action:t},g)=>e.jsx("button",{onMouseDown:t,className:k("search__popout__menu__item",{selected:i===(j.length||L.length)+g}),children:a},s))}):e.jsx("div",{className:"search__popout__menu__message",children:w?e.jsx(c,{id:"search_popout.full_text_search_logged_out_message",defaultMessage:"Only available when logged in."}):e.jsx(c,{id:"search_popout.full_text_search_disabled_message",defaultMessage:"Not available on {domain}.",values:{domain:ae}})})]})]})};export{_e as S};
//# sourceMappingURL=search-DNQglhtu.js.map