PageSourceSearch

https://www.iprbookshop.ru/build/assets/TasksSearch-AzvQwSYh.js

js iprbookshop.ru collected 2026-10-01 13:14:11 UTC 4,549 bytes, 1 lines download raw bytes

1import{r as a,j as t}from"./app-vjiAmbD7.js";import{T as N,S as T}from"./config-Bey0yUbZ.js";import{u as w}from"./useManualBooksWithChapters-CVKmgQye.js";import D from"./SourceSelector-u8kDV4b-.js";import{CrossIcon as H}from"./svg-CVL0lyRo.js";import K from"./AutoWidthInput-BLLwPwPf.js";import U from"./PrefilledAutoWidthInput-mCJUDanw.js";import Y from"./RequiredFieldsBanner-3I0RAYWD.js";import{u as z}from"./useRequiredFieldsValidation-BjtjRkBw.js";import{i as h,b as G}from"./inlineValidation-BRY-SvzL.js";import{s as e}from"./aiAssistant.module-C8LuTZr5.js";import"./roles.types-CcPEwc3b.js";import"./debounce-8yVczaAz.js";import"./fetchOrganizationBooks-CUad1TEH.js";import"./search.api-D6vd99gO.js";import"./search.payload-BPQmPT1S.js";import"./search.types-DnTHdovN.js";import"./entities.types-CepQKrx9.js";import"./ManualBooksWithChapters-CsnzX9rj.js";import"./BookSearchOption-Dud4lbeY.js";import"./utils-C7XG1vJ3.js";import"./prefilledInput-BGWOu7mO.js";const l="название темы";function be({onSearch:L}){const[k,j]=a.useState("10"),[f,I]=a.useState(N[0]),[g,m]=a.useState(!1),[i,O]=a.useState(l),{showRequiredFieldsError:S,requiredFieldsMessage:P,triggerRequiredFieldsError:_,clearRequiredFieldsError:p}=z(),[c,b]=a.useState(T[0]),[R,d]=a.useState(!1),n=w(),v=a.useRef(null),C=a.useRef(null),x=a.useRef(null);a.useEffect(()=>{const s=r=>{v.current&&!v.current.contains(r.target)&&m(!1),C.current&&!C.current.contains(r.target)&&d(!1),x.current&&!x.current.contains(r.target)&&n.closeAll()};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[n.closeAll]);const B=()=>{j("10"),I(N[0]),m(!1),O(l),p(),b(T[0]),d(!1),n.reset()},q=s=>{s.preventDefault();const r=h(i,l),E=n.items.filter(o=>o.book).map(o=>o.book.value).map(o=>{const u=Number(o);return Number.isFinite(u)?u:o}),y=c.value==="manual"&&E.length<1;if(r||y){const o=[];r&&o.push({field:"тема",kind:"text"}),y&&o.push({field:"книги",kind:"books"}),_(G(o));return}p();const A=Number(k);if(!Number.isFinite(A)||A<1)return;const F=n.items.filter(o=>o.book).map(o=>{let u=o.book.title;return o.chapter&&(u+=` (глава: ${o.chapter.content})`),u}),V=c.value==="manual"&&F.length>0?` на основе источников: ${F.join(", ")}`:" на основе рекомендуемых источников",W=`Составь ${k} заданий типа "${f.label}" по теме "${i}"${V}`;L(W,{source_mode:c.value==="manual"?"manual":"recommended",...c.value==="manual"?{selected_book_ids:E}:{}}),B()},$=S&&h(i,l),M=S&&c.value==="manual"&&n.items.filter(s=>s.book).length<1;return t.jsxs("div",{className:e.bookSearchContainer,children:[S&&t.jsx(Y,{message:P}),t.jsxs("div",{className:`${e.bookSearchInput} ${e.bookSearchInputFilled} ${e.curriculumInput}`,children:[t.jsxs("div",{className:e.bookInputContent,children:[t.jsx("span",{className:e.bookLabel,children:"Составь"})," ",t.jsx(K,{type:"number",className:e.curriculumNumberInput,value:k,onChange:s=>j(s.target.value),min:"1"})," ",t.jsx("span",{className:e.bookLabel,children:"заданий типа"})," ",t.jsxs("div",{ref:v,className:e.curriculumSelectWrapper,children:[t.jsx("button",{type:"button",className:e.sourceSelectBtn,onClick:()=>m(!g),children:f.label}),g&&t.jsx("div",{className:e.chapterDropdown,children:N.map(s=>t.jsx("button",{type:"button",className:`${e.bookOption} ${f.value===s.value?e.bookOptionActive:""}`,onClick:()=>{I(s),m(!1)},children:t.jsx("div",{className:e.bookOptionTitle,children:s.label})},s.value))})]})," ",t.jsx("span",{className:e.bookLabel,children:"по теме"})," ",t.jsx(U,{type:"text",className:`${e.bookInlineInput} ${$?e.bookInlineInputInvalid:""}`,placeholder:l,invalid:$,value:i,onValueChange:s=>{O(s),h(s,l)||p()}}),t.jsx(D,{source:c,isSourceSelectOpen:R,onToggleSourceSelect:()=>d(!R),onSelectSource:s=>{b(s),d(!1)},sourceSelectRef:C,withChapters:!0,invalidManualBooks:M,manualBooksWithChapters:{items:n.items,containerRef:x,onBookSearchChange:n.onBookSearchChange,onOpenBookSelect:n.openBookSelect,onSelectBook:(s,r)=>{n.selectBook(s,r),b(T[1]),h(i,l)||p()},onOpenChapterSelect:n.openChapterSelect,onSelectChapter:n.selectChapter,onClearChapter:n.clearChapter,onRemove:n.remove,onAdd:n.add}})]}),t.jsxs("div",{className:e.bookActions,children:[t.jsxs("button",{type:"button",className:e.resetBtn,onClick:B,children:[t.jsx(H,{className:e.resetIcon}),"Сбросить"]}),t.jsx("button",{type:"button",className:e.searchBtn,onClick:q,children:"Найти"})]})]})]})}export{be 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.