PageSourceSearch

https://www.politeianet.gr/assets/index.RSb9g9eS.js

js politeianet.gr collected 2026-09-24 09:27:07 UTC 11,318 bytes, 1 lines download raw bytes

1import{r as a,P as N,j as t,ag as be,ah as me,ai as Ce,aj as xe,d as Oe,a4 as je,ak as Pe}from"./index-KDcLenRU.js";import{_ as _e}from"./emotion-element-f0de968e.browser.esm.61_hlabn.js";import{_ as Me,a as m,h as Re,b as K,c as Le,u as ke,S as Ie,d as Ee,e as we}from"./react-select.esm.H5GyIIS6.js";import{P as Fe}from"./PageHeaderMeta.DcFtZHYi.js";import"./emotion-utils.browser.esm.PLmk2cuA.js";import"./memoize-one.esm.sgM6qpEC.js";import"./setPrototypeOf.ahVgEFUp.js";import"./hoist-non-react-statics.cjs.FLDqboxU.js";var Ae=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function Te(e){var n=e.defaultOptions,o=n===void 0?!1:n,l=e.cacheOptions,r=l===void 0?!1:l,c=e.loadOptions;e.options;var g=e.isLoading,M=g===void 0?!1:g,i=e.onInputChange,O=e.filterOption,p=O===void 0?null:O,y=Me(e,Ae),b=y.inputValue,d=a.useRef(void 0),u=a.useRef(!1),R=a.useState(Array.isArray(o)?o:void 0),v=m(R,2),j=v[0],P=v[1],I=a.useState(typeof b<"u"?b:""),f=m(I,2),h=f[0],s=f[1],C=a.useState(o===!0),_=m(C,2),V=_[0],x=_[1],$=a.useState(void 0),E=m($,2),w=E[0],F=E[1],L=a.useState([]),Z=m(L,2),re=Z[0],U=Z[1],le=a.useState(!1),G=m(le,2),ce=G[0],z=G[1],ie=a.useState({}),J=m(ie,2),A=J[0],X=J[1],ue=a.useState(void 0),ee=m(ue,2),de=ee[0],pe=ee[1],fe=a.useState(void 0),ae=m(fe,2),he=ae[0],ge=ae[1];r!==he&&(X({}),ge(r)),o!==de&&(P(Array.isArray(o)?o:void 0),pe(o)),a.useEffect(function(){return u.current=!0,function(){u.current=!1}},[]);var B=a.useCallback(function(T,k){if(!c)return k();var S=c(T,k);S&&typeof S.then=="function"&&S.then(k,function(){return k()})},[c]);a.useEffect(function(){o===!0&&B(h,function(T){u.current&&(P(T||[]),x(!!d.current))})},[]);var Se=a.useCallback(function(T,k){var S=Re(T,k,i);if(!S){d.current=void 0,s(""),F(""),U([]),x(!1),z(!1);return}if(r&&A[S])s(S),F(S),U(A[S]),x(!1),z(!1);else{var ye=d.current={};s(S),x(!0),z(!w),B(S,function(W){u&&ye===d.current&&(d.current=void 0,x(!1),F(S),U(W||[]),z(!1),X(W?K(K({},A),{},Le({},S,W)):A))})}},[r,B,w,A,i]),ve=ce?[]:h&&w?re:j||[];return K(K({},y),{},{options:ve,isLoading:V||M,onInputChange:Se,filterOption:p})}var Ne=a.forwardRef(function(e,n){var o=Te(e),l=ke(o);return a.createElement(Ie,_e({ref:n},l))}),Q=Ne;const De=500;function se({onVisible:e}){const n=a.useRef(null);return a.useEffect(()=>{const o=n.current,l=(o==null?void 0:o.closest('[class$="-menu-list"]'))??(o==null?void 0:o.parentElement);if(!o||typeof IntersectionObserver>"u"){e();return}const r=new IntersectionObserver(c=>{c.some(g=>g.isIntersecting)&&e()},{root:l,rootMargin:"80px 0px",threshold:0});return r.observe(o),()=>r.disconnect()},[e]),t.jsx("div",{ref:n,"aria-hidden":"true",style:{height:1}})}se.propTypes={onVisible:N.func.isRequired};const Y=({loadOptions:e,additional:n,debounceTimeout:o,defaultOptions:l,...r})=>{const[c,g]=a.useState(""),[M,i]=a.useState([]),[O,p]=a.useState(!1),[y,b]=a.useState(!0),d=a.useRef(n),u=a.useRef(!1),R=a.useRef(""),v=a.useRef([]),j=a.useCallback(async f=>{if(!u.current){u.current=!0,d.current=n,p(!0);try{const h=await e(f,[],n);v.current=h.options,i(h.options),b(h.hasMore),d.current=h.additional}catch{v.current=[],i([]),b(!1)}finally{p(!1),u.current=!1}}},[e,n]);a.useEffect(()=>{const h=setTimeout(()=>{R.current=c,j(c)},c?o:0);return()=>clearTimeout(h)},[c,o]);const P=a.useCallback(async()=>{if(!(!y||u.current)){u.current=!0,p(!0);try{const f=await e(R.current,v.current,d.current);v.current=[...v.current,...f.options],i(v.current),b(f.hasMore),d.current=f.additional}catch{b(!1)}finally{p(!1),u.current=!1}}},[y,e]),I=a.useMemo(()=>function({children:h,...s}){return t.jsxs(Ee.MenuList,{...s,children:[h,y&&t.jsx(se,{onVisible:P})]})},[y,P]);return t.jsx(we,{...r,inputValue:c,onInputChange:f=>g(f),options:M,isLoading:O,components:{MenuList:I},filterOption:null})};Y.propTypes={loadOptions:N.func.isRequired,additional:N.object,debounceTimeout:N.number,defaultOptions:N.bool};Y.defaultProps={additional:{},debounceTimeout:De,defaultOptions:!1};const H=20;function te(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}
1function Ve(e){const n=[e.ln,e.fn].filter(Boolean).join(" ");return{value:String(e.id),label:n||`#${e.id}`}}function $e(e){return{value:String(e.id),label:e.nm}}function ze(e){return{value:String(e.id),label:e.vtxt||e.cd||`#${e.id}`}}function D(e){return async(n,o,l)=>{const r=(l==null?void 0:l.page)??1,g=(await xe(e,n||"",H,r).catch(()=>[])||[]).map(Ve);return{options:g,hasMore:g.length===H,additional:{page:r+1}}}}const Ke=D("author"),qe=D("curator"),He=D("translator"),Ue=D("illustrator"),Be=D("publisher");async function We(e,n,o){const l=(o==null?void 0:o.page)??1,c=(await be("pubtype",e||"",H,l).catch(()=>[])||[]).map(ze);return{options:c,hasMore:c.length===H,additional:{page:l+1}}}function oe(e){let n=null;return async o=>{if(n||(n=(await e()||[]).map($e)),!o)return n;const l=te(o);return n.filter(r=>te(r.label).includes(l))}}const Qe=oe(()=>me());function ne(e){return oe(()=>Ce(e))}const q={control:(e,n)=>({...e,minHeight:44,height:44,borderRadius:8,borderColor:n.isFocused?"#00499b":"#d3cac3",backgroundColor:"#fff",boxShadow:n.isFocused?"0 0 0 1px #00499b":"none",fontFamily:"Manrope, sans-serif",fontSize:"14px","&:hover":{borderColor:n.isFocused?"#00499b":"#b0a69e"}}),menu:e=>({...e,borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:10}),option:(e,n)=>({...e,backgroundColor:n.isSelected?"#00499b":n.isFocused?"#f2f7fa":"#fff",color:n.isSelected?"#fff":"#1a1818",fontFamily:"Manrope, sans-serif",fontSize:"14px",cursor:"pointer",":active":{backgroundColor:"#00499b",color:"#fff"}}),placeholder:e=>({...e,color:"#999",fontFamily:"Manrope, sans-serif",fontSize:"14px"}),singleValue:e=>({...e,fontFamily:"Manrope, sans-serif",fontSize:"14px",color:"#1a1818"}),input:e=>({...e,fontFamily:"Manrope, sans-serif",fontSize:"14px"}),valueContainer:e=>({...e,height:"100%",padding:"0 8px",display:"flex",alignItems:"center",flexWrap:"nowrap"}),indicatorsContainer:e=>({...e,height:"100%"}),indicatorSeparator:()=>({display:"none"}),dropdownIndicator:(e,n)=>({...e,color:"#808080",transform:n.selectProps.menuIsOpen?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease","&:hover":{color:"#1a1818"}}),clearIndicator:e=>({...e,color:"#808080","&:hover":{color:"#1a1818"}}),noOptionsMessage:e=>({...e,fontFamily:"Manrope, sans-serif",fontSize:"14px",color:"#666"}),loadingMessage:e=>({...e,fontFamily:"Manrope, sans-serif",fontSize:"14px",color:"#666"})},Ye=[{key:"author",labelKey:"advancedSearch.author",loadOptions:Ke},{key:"curator",labelKey:"advancedSearch.curator",loadOptions:qe},{key:"translator",labelKey:"advancedSearch.translator",loadOptions:He},{key:"illustrator",labelKey:"advancedSearch.illustrator",loadOptions:Ue},{key:"publisher",labelKey:"advancedSearch.publisher",loadOptions:Be},{key:"editions",labelKey:"advancedSearch.editions",loadOptions:We}],Ze={publisher:"f:publisher",author:"f:author",illustrator:"f:illustrator",curator:"f:curator",translator:"f:translator",editions:"f:attributes|Εκδόσεις"},Ge="advanced-search",ra=()=>{var f,h;const{t:e}=Oe(),n=je(),[o,l]=a.useState(""),[r,c]=a.useState(""),[g,M]=a.useState(""),[i,O]=a.useState({}),p=a.useCallback((s,C)=>{O(_=>({..._,[s]:C||null}))},[]),y=a.useCallback(s=>{p("section",s),p("category",null),p("subcategory",null)},[p]),b=a.useCallback(s=>{p("category",s),p("subcategory",null)},[p]),d=(f=i.section)==null?void 0:f.value,u=(h=i.category)==null?void 0:h.value,R=a.useMemo(()=>d?ne(d):()=>Promise.resolve([]),[d]),v=a.useMemo(()=>u?ne(u):()=>Promise.resolve([]),[u]),j=a.useCallback(()=>{var x,$,E;const s=new URLSearchParams,C=[o.trim(),r.trim(),g.trim()].filter(Boolean);C.length>0&&s.set("query",C.join(" "));for(const[w,F]of Object.entries(Ze)){const L=i[w];L!=null&&L.label&&s.set(F,L.label)}const _=((x=i.subcategory)==null?void 0:x.label)||(($=i.category)==null?void 0:$.label)||((E=i.section)==null?void 0:E.label);_&&s.set("f:category",_),!s.has("query")&&s.size>0&&s.set("query",Ge);const V=s.toString();V&&window.location.assign(Pe(`/search-results?${V}`,n))},[o,r,g,i,n]),P=a.useCallback(()=>{l(""),c(""),M(""),O({})},[]),I=a.useCallback(s=>{s.key==="Enter"&&j()},[j]);return t.jsxs(t.Fragment,{children:[t.jsx(Fe,{page_title:e("advancedSearch.title")}),t.jsx("div",{id:"advanced-search",children:t.jsxs("div",{className:"content-wrapper",children:[t.jsx("h1",{className:"heading",children:e("advancedSearch.title")}),t.jsxs("div",{className:"search-form",onKeyDown:I,children:[t.jsxs("div",{className:"form-field full-width",children:[t.jsx("label",{htmlFor:"adv-keywords",children:e("advancedSearch.keywords")}),t.jsx("span",{className:"field-hint",children:e("advancedSearch.keywordsHint")}),t.jsx("input",{id:"adv-keywords",type:"text",value:o,onChange:s=>l(s.target.value),placeholder:e("advancedSearch.keywordsPlaceholder")})]}),Ye.map(s=>t.jsxs("div",{className:"form-field",children:[t.jsx("label",{children:e(s.labelKey)}),t.jsx(Y,{value:i[s.key]||null,loadOptions:s.loadOptions,additional:{page:1},defaultOptions:!0,debounceTimeout:500,onChange:C=>p(s.key,C),isClearable:!0,placeholder:e("advancedSearch.searchPlaceholder"),noOptionsMessage:()=>e("advancedSearch.noResults"),loadingMessage:()=>e("advancedSearch.loading"),styles:q})]},s.key)),t.jsxs("div",{className:"form-field",children:[t.jsx("label",{children:e("advancedSearch.section")}),t.jsx(Q,{value:i.section||null,loadOptions:Qe,defaultOptions:!0,onChange:y,isClearable:!0,placeholder:e("advancedSearch.selectPlaceholder"),noOptionsMessage:()=>e("advancedSearch.noResults"),loadingMessage:()=>e("advancedSearch.loading"),styles:q})]}),t.jsxs("div",{className:"form-field",children:[t.jsx("label",{children:e("advancedSearch.category")}),t.jsx(Q,{value:i.category||null,loadOptions:R,defaultOptions:!0,onChange:b,isClearable:!0,isDisabled:!d,placeholder:e(d?"advancedSearch.selectPlaceholder":"advancedSearch.selectSectionFirst"),noOptionsMessage:()=>e("advancedSearch.noResults"),loadingMessage:()=>e("advancedSearch.loading"),styles:q},`category-${d||"none"}`)]}),t.jsxs("div",{className:"form-field",children:[t.jsx("label",{children:e("advancedSearch.subcategory")}),t.jsx(Q,{value:i.subcategory||null,loadOptions:v,defaultOptions:!0,onChange:s=>p("subcategory",s),isClearable:!0,isDisabled:!u,placeholder:e(u?"advancedSearch.selectPlaceholder":"advancedSearch.selectCategoryFirst"),noOptionsMessage:()=>e("advancedSearch.noResults"),loadingMessage:()=>e("advancedSearch.loading"),styles:q},`subcategory-${u||"none"}`)]}),t.jsxs("div",{className:"form-field",children:[t.jsx("label",{htmlFor:"adv-isbn",children:e("advancedSearch.isbn")}),t.jsx("input",{id:"adv-isbn",type:"text",value:r,onChange:s=>c(s.target.value),placeholder:e("advancedSearch.isbnPlaceholder")})]}),t.jsxs("div",{className:"form-field",children:[t.jsx("label",{htmlFor:"adv-code",children:e("advancedSearch.politeiaCode")}),t.jsx("input",{id:"adv-code",type:"text",value:g,onChange:s=>M(s.target.value),placeholder:e("advancedSearch.codePlaceholder")})]}),t.jsxs("div",{className:"form-actions",children:[t.jsx("button",{type:"button",className:"clear-button",onClick:P,children:e("advancedSearch.clear")}),t.jsx("button",{type:"button",className:"search-button",onClick:j,children:e("advancedSearch.search")})]})]})]})})]})};export{ra as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.