File size: 23,629 Bytes
9923f3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
import { c as create_ssr_component, b as createEventDispatcher, a as subscribe, s as setContext, r as set_store_value, d as add_attribute, e as escape, v as validate_component, j as getContext, t as hasContext, h as each } from './ssr-6MZFlfLu.js';
import { w as writable } from './index2-f61NAEsz.js';
import './ProgressBar.svelte_svelte_type_style_lang-H22V2Yrx.js';

const gatheringKey = {};
const GatheringRound = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  setContext(gatheringKey, true);
  return `${slots.default ? slots.default({}) : ``}`;
});
const getDimensionName = (horizontal) => horizontal ? "height" : "width";
const css$2 = {
  code: 'div.splitpanes--horizontal.splitpanes--dragging{cursor:row-resize}div.splitpanes--vertical.splitpanes--dragging{cursor:col-resize}.splitpanes{display:flex;width:100%;height:100%}.splitpanes--vertical{flex-direction:row}.splitpanes--horizontal{flex-direction:column}.splitpanes--dragging *{-webkit-user-select:none;-moz-user-select:none;user-select:none}.splitpanes__pane{width:100%;height:100%;overflow:hidden}.splitpanes--vertical .splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal .splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--vertical>.splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal>.splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--dragging .splitpanes__pane{transition:none;pointer-events:none}.splitpanes--freeze .splitpanes__pane{transition:none}.splitpanes__splitter{touch-action:none}.splitpanes--vertical>.splitpanes__splitter{min-width:1px}.splitpanes--horizontal>.splitpanes__splitter{min-height:1px}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;box-sizing:border-box;position:relative;flex-shrink:0}.splitpanes.default-theme .splitpanes__splitter:before,.splitpanes.default-theme .splitpanes__splitter:after{content:"";position:absolute;top:50%;left:50%;background-color:rgba(0, 0, 0, 0.15);transition:background-color 0.3s}.splitpanes.default-theme .splitpanes__splitter:hover:before,.splitpanes.default-theme .splitpanes__splitter:hover:after{background-color:rgba(0, 0, 0, 0.25)}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme.splitpanes--vertical>.splitpanes__splitter,.default-theme .splitpanes--vertical>.splitpanes__splitter{width:7px;border-left:1px solid #eee;cursor:col-resize}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{transform:translateY(-50%);width:1px;height:30px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter,.default-theme .splitpanes--horizontal>.splitpanes__splitter{height:7px;border-top:1px solid #eee;cursor:row-resize}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{transform:translateX(-50%);width:30px;height:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}',
  map: null
};
const KEY = {};
const Splitpanes = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey;
  let $showFirstSplitter, $$unsubscribe_showFirstSplitter;
  let $isHorizontal, $$unsubscribe_isHorizontal;
  let { id = void 0 } = $$props;
  let { horizontal = false } = $$props;
  let { pushOtherPanes = true } = $$props;
  let { dblClickSplitter = true } = $$props;
  let { rtl = "auto" } = $$props;
  let { firstSplitter = false } = $$props;
  let { style = null } = $$props;
  let { theme = "default-theme" } = $$props;
  let { class: clazz = "" } = $$props;
  createEventDispatcher();
  let container;
  new Array();
  let isHorizontal = writable(horizontal);
  $$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value);
  const showFirstSplitter = writable(firstSplitter);
  $$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value);
  const veryFirstPaneKey = writable(void 0);
  $$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value);
  let ssrPaneDefinedSizeSum = 0;
  let ssrPaneUndefinedSizeCount = 0;
  function ssrRegisterPaneSize(size) {
    if (size == null) {
      ++ssrPaneUndefinedSizeCount;
    } else {
      ssrPaneDefinedSizeSum += size;
    }
  }
  const onPaneInit = (key) => {
    if ($veryFirstPaneKey === void 0) {
      set_store_value(veryFirstPaneKey, $veryFirstPaneKey = key, $veryFirstPaneKey);
    }
    return {
      undefinedPaneInitSize: (100 - ssrPaneDefinedSizeSum) / ssrPaneUndefinedSizeCount
    };
  };
  setContext(KEY, {
    showFirstSplitter,
    veryFirstPaneKey,
    isHorizontal,
    ssrRegisterPaneSize: ssrRegisterPaneSize,
    onPaneInit,
    clientOnly: void 0
  });
  if ($$props.id === void 0 && $$bindings.id && id !== void 0)
    $$bindings.id(id);
  if ($$props.horizontal === void 0 && $$bindings.horizontal && horizontal !== void 0)
    $$bindings.horizontal(horizontal);
  if ($$props.pushOtherPanes === void 0 && $$bindings.pushOtherPanes && pushOtherPanes !== void 0)
    $$bindings.pushOtherPanes(pushOtherPanes);
  if ($$props.dblClickSplitter === void 0 && $$bindings.dblClickSplitter && dblClickSplitter !== void 0)
    $$bindings.dblClickSplitter(dblClickSplitter);
  if ($$props.rtl === void 0 && $$bindings.rtl && rtl !== void 0)
    $$bindings.rtl(rtl);
  if ($$props.firstSplitter === void 0 && $$bindings.firstSplitter && firstSplitter !== void 0)
    $$bindings.firstSplitter(firstSplitter);
  if ($$props.style === void 0 && $$bindings.style && style !== void 0)
    $$bindings.style(style);
  if ($$props.theme === void 0 && $$bindings.theme && theme !== void 0)
    $$bindings.theme(theme);
  if ($$props.class === void 0 && $$bindings.class && clazz !== void 0)
    $$bindings.class(clazz);
  $$result.css.add(css$2);
  set_store_value(isHorizontal, $isHorizontal = horizontal, $isHorizontal);
  set_store_value(showFirstSplitter, $showFirstSplitter = firstSplitter, $showFirstSplitter);
  $$unsubscribe_veryFirstPaneKey();
  $$unsubscribe_showFirstSplitter();
  $$unsubscribe_isHorizontal();
  return `<div${add_attribute("id", id, 0)} class="${[
    escape(`splitpanes ${theme || ""} ${clazz || ""}`, true),
    (horizontal ? "splitpanes--horizontal" : "") + " " + (!horizontal ? "splitpanes--vertical" : "") + " " + ("") + " splitpanes--freeze"
  ].join(" ").trim()}"${add_attribute("style", style, 0)}${add_attribute("this", container, 0)}>${`${validate_component(GatheringRound, "GatheringRound").$$render($$result, {}, {}, {
    default: () => {
      return `${slots.default ? slots.default({}) : ``}`;
    }
  })}` } ${slots.default ? slots.default({}) : ``} </div>`;
});
const Pane = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let dimension;
  let style;
  let $isHorizontal, $$unsubscribe_isHorizontal;
  let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey;
  let $showFirstSplitter, $$unsubscribe_showFirstSplitter;
  const { ssrRegisterPaneSize, onPaneInit, clientOnly: clientOnlyContext, isHorizontal, showFirstSplitter, veryFirstPaneKey } = getContext(KEY);
  $$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value);
  $$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value);
  $$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value);
  let { size = null } = $$props;
  let { minSize = 0 } = $$props;
  let { maxSize = 100 } = $$props;
  let { snapSize = 0 } = $$props;
  let { class: clazz = "" } = $$props;
  const key = {};
  const gathering = hasContext(gatheringKey);
  const { undefinedPaneInitSize } = !gathering ? onPaneInit(key) : {};
  let element;
  let sz = size ?? undefinedPaneInitSize;
  if (gathering) {
    ssrRegisterPaneSize(size);
  }
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.minSize === void 0 && $$bindings.minSize && minSize !== void 0)
    $$bindings.minSize(minSize);
  if ($$props.maxSize === void 0 && $$bindings.maxSize && maxSize !== void 0)
    $$bindings.maxSize(maxSize);
  if ($$props.snapSize === void 0 && $$bindings.snapSize && snapSize !== void 0)
    $$bindings.snapSize(snapSize);
  if ($$props.class === void 0 && $$bindings.class && clazz !== void 0)
    $$bindings.class(clazz);
  dimension = getDimensionName($isHorizontal);
  style = `${dimension}: ${sz}%;`;
  $$unsubscribe_isHorizontal();
  $$unsubscribe_veryFirstPaneKey();
  $$unsubscribe_showFirstSplitter();
  return `${!gathering ? ` ${$veryFirstPaneKey !== key || $showFirstSplitter ? `   <div class="${"splitpanes__splitter " + escape("", true)}"></div>` : ``}     <div${add_attribute("class", `splitpanes__pane ${clazz || ""}`, 0)}${add_attribute("style", style, 0)}${add_attribute("this", element, 0)}>${slots.default ? slots.default({}) : ``}</div>` : ``}`;
});
class SearchResultsSorter {
  static findDateInText(text) {
    const dateStringRegex = /\b\d{1,2}\.\d{1,2}\.\d{4}\b/g;
    const matches = text.match(dateStringRegex);
    if (matches && matches.length > 0) {
      const dateString = matches[0];
      const [day, month, year] = dateString.split(".").map(Number);
      return new Date(year, month - 1, day);
    }
    return null;
  }
  static sortByRelevanceAndDate(data) {
    return data.sort((a, b) => {
      const relevanceComparison = b.relevance - a.relevance;
      if (relevanceComparison !== 0) {
        return relevanceComparison;
      }
      const dateA = SearchResultsSorter.findDateInText(a.title);
      const dateB = SearchResultsSorter.findDateInText(b.title);
      if (dateA && dateB) {
        return dateB.getTime() - dateA.getTime();
      } else if (dateA) {
        return -1;
      } else if (dateB) {
        return 1;
      } else {
        return 0;
      }
    });
  }
  static sortByDate(dataArray) {
    const entriesWithDates = dataArray.filter((item) => SearchResultsSorter.findDateInText(item.title));
    const entriesWithoutDates = dataArray.filter((item) => !SearchResultsSorter.findDateInText(item.title));
    const sortedEntriesWithDates = entriesWithDates.sort((a, b) => {
      const dateA = SearchResultsSorter.findDateInText(a.title);
      const dateB = SearchResultsSorter.findDateInText(b.title);
      if (dateA && dateB) {
        return dateB.getTime() - dateA.getTime();
      } else if (dateA) {
        return -1;
      } else if (dateB) {
        return 1;
      } else {
        return 0;
      }
    });
    const resultArray = [];
    let indexWithoutDates = 0;
    for (const entry of dataArray) {
      if (SearchResultsSorter.findDateInText(entry.title)) {
        let val = sortedEntriesWithDates.shift();
        if (val)
          resultArray.push(val);
      } else {
        resultArray.push(entriesWithoutDates[indexWithoutDates]);
        indexWithoutDates++;
      }
    }
    return resultArray;
  }
  static sortByRelevance(data) {
    return data.sort((a, b) => {
      if (a.relevance && b.relevance) {
        return b.relevance - a.relevance;
      } else if (a.relevance) {
        return -1;
      } else if (b.relevance) {
        return 1;
      } else {
        return 0;
      }
    });
  }
  static identifyDocumentType(data) {
    const regexps = [
      { regexp: /(ФАС |АС |КС |ВС |[Сс]удебн|[Сс]уд)|(\(Судебный документ\))/, docType: "Решение суда" },
      { regexp: /[Пп]исьмо [Мм]инфина/, docType: "Письмо Минфина" },
      { regexp: /[Пп]исьмо (ФНС|фнс)/, docType: "Письмо ФНС" },
      { regexp: /(НКРФ)|(НК РФ)/, docType: "Налоговый кодекс" },
      { regexp: /(ГКРФ)|(ГК РФ)/, docType: "Гражданский кодекс" },
      { regexp: /(ТКРФ)|(ТК РФ)/, docType: "Трудовой кодекс" },
      { regexp: /Приказ ФНС РФ/, docType: "Приказ ФНС РФ" },
      { regexp: /Постановление Правительства РФ/, docType: "Постановление Правительства РФ" },
      { regexp: /Решение Коллегии Евразийской экономической комиссии/, docType: "Решение Коллегии ЕЭК" },
      { regexp: /Федеральный закон/, docType: "Федеральные законы" },
      { regexp: /\(Внутренний документ\)|\(ВНД\)/, docType: "Внутренние документы" }
    ];
    return data.map((result) => {
      for (const { regexp, docType } of regexps) {
        if (regexp.test(result.title)) {
          result.docType = docType;
          return result;
        }
      }
      result.docType = "Другие документы";
      return result;
    });
  }
  static mergeResultsByTitle(data) {
    const regex = /(ст\.\d+)\s(НКРФ|НК РФ|ГКРФ|ГК РФ|ТКРФ|ТК РФ)$/;
    const grouped = {};
    const mergedResults = [];
    const extractArticleAndCode = (title) => {
      const match = title.match(regex);
      return match ? match[0] : null;
    };
    data.forEach((item) => {
      const key = extractArticleAndCode(item.title);
      if (key) {
        if (grouped[key]) {
          grouped[key].relevance = Math.max(
            grouped[key].relevance,
            item.relevance
          );
          const existingTitle = grouped[key].title.match(/п[\w\.]+/g) || [];
          const newTitle = item.title.match(/п[\w\.]+/g) || [];
          const combinedTitle = [.../* @__PURE__ */ new Set([...existingTitle, ...newTitle])].join(", ");
          grouped[key].title = `${combinedTitle} ст.${key.split(" ")[0].split(".")[1]} ${key.split(" ")[1]}`;
          grouped[key].text += `
${item.title}
${item.text}`;
          if (item.text_for_llm) {
            grouped[key].text_for_llm += `
${item.title}
${item.text_for_llm}`;
          }
        } else {
          grouped[key] = { ...item };
        }
      } else {
        mergedResults.push(item);
      }
    });
    Object.keys(grouped).forEach((key) => {
      mergedResults.push(grouped[key]);
    });
    return mergedResults;
  }
}
const css$1 = {
  code: ".search-result.svelte-vfddhm{margin-bottom:20px}.title.svelte-vfddhm{font-weight:bold}.annotation.svelte-vfddhm{overflow:hidden;display:-webkit-box;line-clamp:5;-webkit-line-clamp:5;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}a.svelte-vfddhm{cursor:pointer}.full-text.svelte-vfddhm{display:block;white-space:normal}.title.svelte-vfddhm{color:#1a0dab}",
  map: null
};
const SearchResultsItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { value } = $$props;
  let { showFullText = Array(10).fill(false) } = $$props;
  let { useSearchResult } = $$props;
  let { index } = $$props;
  let { enableDocumentDb = false } = $$props;
  let { documentDbUrl = "" } = $$props;
  let { enableSearchResultSelection = false } = $$props;
  let text = "";
  if ($$props.value === void 0 && $$bindings.value && value !== void 0)
    $$bindings.value(value);
  if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
    $$bindings.showFullText(showFullText);
  if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0)
    $$bindings.useSearchResult(useSearchResult);
  if ($$props.index === void 0 && $$bindings.index && index !== void 0)
    $$bindings.index(index);
  if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0)
    $$bindings.enableDocumentDb(enableDocumentDb);
  if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0)
    $$bindings.documentDbUrl(documentDbUrl);
  if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0)
    $$bindings.enableSearchResultSelection(enableSearchResultSelection);
  $$result.css.add(css$1);
  text = value ? value.text_for_llm || value.text : "";
  return `<div class="search-result svelte-vfddhm"><div class="title svelte-vfddhm"><label style="cursor:pointer">${enableSearchResultSelection ? `<input type="checkbox"${add_attribute("checked", useSearchResult[value.title], 1)}>` : ``} ${escape(value.title)}</label></div> ${showFullText[index] ? `<div class="annotation full-text svelte-vfddhm">${each(text.split("\n"), (line) => {
    return `<p>${escape(line)}</p>`;
  })}</div>` : `<div class="annotation svelte-vfddhm">${escape(value.teaser)}</div>`} ${enableDocumentDb && documentDbUrl ? `<a href="${escape(documentDbUrl, true) + "s/" + escape(encodeURIComponent(value.title), true)}" target="_blank" style="font-weight: 500" class="svelte-vfddhm">Открыть документ</a>` : ``} ${text.length > 100 ? `<button class="btn-link ml-3">${showFullText[index] ? `
				свернуть <i class="fa fa-angle-up text-xs"></i> ` : `
				развернуть <i class="fa fa-angle-down text-xs"></i> `}</button>` : ``} </div>`;
});
const css = {
  code: ".search-result.svelte-1egz4bg{margin-bottom:20px}.title.svelte-1egz4bg{font-weight:bold}.annotation.svelte-1egz4bg{overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}.full-text.svelte-1egz4bg{display:block;white-space:normal}.title.svelte-1egz4bg{color:#1a0dab}.search-results.svelte-1egz4bg{flex:1;overflow-y:auto;padding:1rem}.settings-bar.svelte-1egz4bg{margin-bottom:10px}.blinking.svelte-1egz4bg{animation:svelte-1egz4bg-blink-animation 0.5s ease-in-out infinite alternate}@keyframes svelte-1egz4bg-blink-animation{0%{opacity:1}100%{opacity:0.2}}",
  map: null
};
const SearchResults = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let enableSearchResultSelectionStateClass;
  let groupByCheckedStateClass;
  let { enableDocumentDb = false } = $$props;
  let { documentDbUrl = "" } = $$props;
  let { showFullText = Array(10).fill(false) } = $$props;
  let { useSearchResult } = $$props;
  let { searchInTransactionLedger = false } = $$props;
  let { searchResults = [] } = $$props;
  let { usedSearchResults = [] } = $$props;
  let displaySearchResults = [];
  let { enableSearchResultSelection = false } = $$props;
  let { showOnlyLlmUsed = false } = $$props;
  let isBlinking = false;
  const blinkButton = () => {
    isBlinking = true;
    setTimeout(
      () => {
        isBlinking = false;
      },
      5e3
    );
  };
  if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0)
    $$bindings.enableDocumentDb(enableDocumentDb);
  if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0)
    $$bindings.documentDbUrl(documentDbUrl);
  if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
    $$bindings.showFullText(showFullText);
  if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0)
    $$bindings.useSearchResult(useSearchResult);
  if ($$props.searchInTransactionLedger === void 0 && $$bindings.searchInTransactionLedger && searchInTransactionLedger !== void 0)
    $$bindings.searchInTransactionLedger(searchInTransactionLedger);
  if ($$props.searchResults === void 0 && $$bindings.searchResults && searchResults !== void 0)
    $$bindings.searchResults(searchResults);
  if ($$props.usedSearchResults === void 0 && $$bindings.usedSearchResults && usedSearchResults !== void 0)
    $$bindings.usedSearchResults(usedSearchResults);
  if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0)
    $$bindings.enableSearchResultSelection(enableSearchResultSelection);
  if ($$props.showOnlyLlmUsed === void 0 && $$bindings.showOnlyLlmUsed && showOnlyLlmUsed !== void 0)
    $$bindings.showOnlyLlmUsed(showOnlyLlmUsed);
  if ($$props.blinkButton === void 0 && $$bindings.blinkButton && blinkButton !== void 0)
    $$bindings.blinkButton(blinkButton);
  $$result.css.add(css);
  let $$settled;
  let $$rendered;
  let previous_head = $$result.head;
  do {
    $$settled = true;
    $$result.head = previous_head;
    {
      {
        {
          displaySearchResults = SearchResultsSorter.sortByRelevance(displaySearchResults);
        }
      }
    }
    {
      if (useSearchResult === void 0) {
        useSearchResult = {};
      }
    }
    enableSearchResultSelectionStateClass = enableSearchResultSelection ? "variant-filled-primary" : "variant-soft-primary";
    groupByCheckedStateClass = "variant-soft-primary";
    showOnlyLlmUsed = usedSearchResults.length !== 0 && showOnlyLlmUsed;
    displaySearchResults = showOnlyLlmUsed ? usedSearchResults : searchResults;
    $$rendered = `<div class="search-results svelte-1egz4bg">${searchResults && searchResults.length > 0 ? `<div class="w-full flex space-x-2 items-center mb-4"><button class="${[
      "chip " + escape(
        showOnlyLlmUsed ? "variant-filled-primary" : "variant-soft-primary",
        true
      ) + " svelte-1egz4bg",
      isBlinking ? "blinking" : ""
    ].join(" ").trim()}" ${usedSearchResults.length == 0 ? "disabled" : ""}><i class="fa-solid fa-check"></i> 
				${escape(showOnlyLlmUsed ? "Выбрано LLM" : "Все результаты")}</button> <button class="${"chip " + escape(enableSearchResultSelectionStateClass, true) + " svelte-1egz4bg"}" ${searchInTransactionLedger ? "disabled" : ""}>${enableSearchResultSelection ? `<span data-svelte-h="svelte-104b754"><i class="fa-solid fa-check"></i></span>` : ``} <span data-svelte-h="svelte-u1xxg4">Выбрать источники для LLM</span></button> <button class="${"chip " + escape(groupByCheckedStateClass, true) + " svelte-1egz4bg"}">Группировать по типу</button></div>` : ``} ${`${each(displaySearchResults, (result, index) => {
      return `${validate_component(SearchResultsItem, "SearchResultsItem").$$render(
        $$result,
        {
          index,
          enableSearchResultSelection,
          useSearchResult,
          showFullText,
          enableDocumentDb,
          documentDbUrl,
          value: result
        },
        {
          value: ($$value) => {
            result = $$value;
            $$settled = false;
          }
        },
        {}
      )}`;
    })}`}</div> ${``}`;
  } while (!$$settled);
  return $$rendered;
});

export { Pane as P, Splitpanes as S, SearchResults as a };
//# sourceMappingURL=SearchResults-bzu8BmOk.js.map