@infinilabs/search-results 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # @infinilabs/search-results
2
2
 
3
- 搜索结果列表/宫格展示组件。
3
+ 搜索结果列表/图片组/视频组展示组件。
4
4
 
5
5
  - 支持列表结果(标题、摘要、面包屑、作者/时间、缩略图、文件类型徽标等)
6
- - 支持媒体宫格(图片/视频,支持分组、列数、底部动作)
7
- - 组件对外只接收单个 `section`,多分组由业务侧自行组合
6
+ - 支持媒体宫格(图片/视频,支持列数、底部动作)
7
+ - 对外提供 3 个组件:默认组件 + 图片组组件 + 视频组组件,业务侧自行选择使用哪个
8
+ - 单个组件只接收一个 `section` 入参;多段数据由业务侧自行 `map` 渲染多个组件
8
9
 
9
10
  ## 安装
10
11
 
@@ -17,76 +18,212 @@ pnpm add @infinilabs/search-results
17
18
  - `react`
18
19
  - `react-dom`
19
20
 
20
- ## 使用示例
21
+ ## 使用方式
21
22
 
22
- ### 1) 基础用法(单个 section)
23
+ ### 1) 业务侧选择组件(推荐)
24
+
25
+ 默认组件 `SearchResults` 的 `section` 类型最宽;当你明确知道当前数据是“图片组/视频组”时,推荐使用 `SearchResultsImageGroup` / `SearchResultsVideoGroup`,获得更好的类型约束。
23
26
 
24
27
  ```tsx
25
28
  import SearchResults, {
26
- type SearchResultListItem,
27
- type SearchResultsSection
29
+ SearchResultsImageGroup,
30
+ SearchResultsVideoGroup,
31
+ type SearchResultImageGroupItem,
32
+ type SearchResultVideoGroupItem,
33
+ type SearchResultsProps,
34
+ type SearchResultsRecord
35
+ } from "@infinilabs/search-results";
36
+
37
+ export function SectionRenderer({
38
+ section
39
+ }: {
40
+ section: SearchResultsProps["section"];
41
+ }) {
42
+ if (Array.isArray(section)) {
43
+ const first = section[0] as SearchResultsRecord | undefined;
44
+ const recordType = typeof first?.type === "string" ? first.type.toLowerCase() : undefined;
45
+ if (recordType === "image") return <SearchResultsImageGroup section={section as SearchResultsRecord[]} />;
46
+ if (recordType === "video") return <SearchResultsVideoGroup section={section as SearchResultsRecord[]} />;
47
+ }
48
+
49
+ if (typeof section === "object" && section && "type" in section) {
50
+ const t = (section as { type?: unknown }).type;
51
+ if (t === "imageGroup") return <SearchResultsImageGroup section={section as SearchResultImageGroupItem} />;
52
+ if (t === "videoGroup") return <SearchResultsVideoGroup section={section as SearchResultVideoGroupItem} />;
53
+ }
54
+
55
+ return <SearchResults section={section} />;
56
+ }
57
+ ```
58
+
59
+ ### 2) 传 `record` / `record[]`(最接近真实数据)
60
+
61
+ ```tsx
62
+ import SearchResults, {
63
+ SearchResultsImageGroup,
64
+ SearchResultsVideoGroup,
65
+ type SearchResultsRecord
28
66
  } from "@infinilabs/search-results";
29
67
 
30
- const listItems: SearchResultListItem[] = [
68
+ const doc: SearchResultsRecord = {
69
+ title: "Q3 Business Report",
70
+ type: "PDF",
71
+ category: "report",
72
+ url: "https://drive.google.com/file/d/abc123/view",
73
+ thumbnail: "https://example.com/images/report_thumbnail.jpg",
74
+ source: { name: "My Hugo Site", type: "connector", id: "e806831dacc3" }
75
+ };
76
+
77
+ const images: SearchResultsRecord[] = [
78
+ {
79
+ id: "img-0",
80
+ title: "黑色壁纸全屏",
81
+ type: "image",
82
+ thumbnail: "https://example.com/image_thumb_0.png",
83
+ url: "https://example.com/image_0.png",
84
+ source: { name: "壁纸", type: "connector", id: "wallpaper" }
85
+ }
86
+ ];
87
+
88
+ const videos: SearchResultsRecord[] = [
31
89
  {
32
- type: "result",
33
- id: "result-0",
34
- title: "云原生知识检索平台:接入与使用指南",
35
- href: "https://example.com/docs/search-guide",
36
- thumbnailUrl: "https://picsum.photos/seed/ai-summary-thumb/320/180",
37
- fileType: "doc",
38
- source: "Google",
39
- description: "AI 摘要:本文档介绍如何配置数据源、设置分类与权限..."
90
+ id: "video-0",
91
+ title: "城市夜景延时摄影",
92
+ type: "video",
93
+ thumbnail: "https://picsum.photos/seed/video-thumb-0/640/360",
94
+ url: "https://example.com/video/0",
95
+ source: { name: "视频库", type: "connector", id: "connector-video" }
40
96
  }
41
97
  ];
42
98
 
43
- const section: SearchResultsSection = {
44
- type: "section",
45
- layout: "list",
46
- title: "搜索结果",
47
- items: listItems
99
+ export default function Demo() {
100
+ return (
101
+ <div className="space-y-10">
102
+ <SearchResults
103
+ section={doc}
104
+ onRecordClick={(record) => {
105
+ if (record.url) window.open(record.url);
106
+ }}
107
+ />
108
+
109
+ <SearchResultsImageGroup
110
+ section={images}
111
+ footerAction={{ label: "所有图片 >", href: "/search?type=image" }}
112
+ onRecordClick={(record) => {
113
+ if (record.url) window.open(record.url);
114
+ }}
115
+ />
116
+
117
+ <SearchResultsVideoGroup
118
+ section={videos}
119
+ footerAction={{ label: "所有视频 >", href: "/search?type=video" }}
120
+ onRecordClick={(record) => {
121
+ if (record.url) window.open(record.url);
122
+ }}
123
+ />
124
+ </div>
125
+ );
126
+ }
127
+ ```
128
+
129
+ 说明:
130
+
131
+ - `onRecordClick` 用于业务侧接管点击(埋点/跳转/弹窗等),组件内部会让整条结果区域可点击
132
+ - 当 `onRecordClick` 存在时,组件会优先走回调,不再走默认 `href` 跳转
133
+
134
+ ### 3) 传 `imageGroup` / `videoGroup`(业务侧自己组装 items)
135
+
136
+ ```tsx
137
+ import {
138
+ SearchResultsImageGroup,
139
+ SearchResultsVideoGroup,
140
+ type SearchResultImageGroupItem,
141
+ type SearchResultVideoGroupItem
142
+ } from "@infinilabs/search-results";
143
+
144
+ const imageGroup: SearchResultImageGroupItem = {
145
+ type: "imageGroup",
146
+ id: "image-group-0",
147
+ title: "图片组",
148
+ columns: 3,
149
+ footerAction: { label: "所有图片 >", href: "/search?type=image" },
150
+ items: [
151
+ {
152
+ type: "image",
153
+ id: "img-group-0",
154
+ title: "黑色壁纸全屏",
155
+ imageUrl: "https://example.com/image_0.png",
156
+ subtitle: "壁纸",
157
+ onClick: () => console.log("clicked image item")
158
+ }
159
+ ]
160
+ };
161
+
162
+ const videoGroup: SearchResultVideoGroupItem = {
163
+ type: "videoGroup",
164
+ id: "video-group-0",
165
+ title: "视频组",
166
+ columns: 3,
167
+ footerAction: { label: "所有视频 >", href: "/search?type=video" },
168
+ items: [
169
+ {
170
+ type: "media",
171
+ id: "video-group-item-0",
172
+ mediaType: "video",
173
+ title: "城市夜景延时摄影",
174
+ href: "https://example.com/video/0",
175
+ thumbnailUrl: "https://picsum.photos/seed/video-thumb-0/640/360",
176
+ breadcrumbs: ["视频库", "视频"],
177
+ onClick: () => console.log("clicked video item")
178
+ }
179
+ ]
48
180
  };
49
181
 
50
182
  export default function Demo() {
51
- return <SearchResults section={section} />;
183
+ return (
184
+ <div className="space-y-10">
185
+ <SearchResultsImageGroup section={imageGroup} />
186
+ <SearchResultsVideoGroup section={videoGroup} />
187
+ </div>
188
+ );
52
189
  }
53
190
  ```
54
191
 
55
- ### 2) 多个 section(业务侧自行组合)
192
+ ### 4) 多段数据(业务侧 `map` 渲染多个组件)
56
193
 
57
194
  ```tsx
58
195
  import SearchResults, {
59
- itemsToSections,
60
- recordsToItems,
61
- type SearchResultsRecord,
62
- type SearchResultsItem
196
+ SearchResultsImageGroup,
197
+ SearchResultsVideoGroup,
198
+ type SearchResultsProps
63
199
  } from "@infinilabs/search-results";
64
200
 
65
- export default function Demo({
66
- items,
67
- records
68
- }: {
69
- items?: SearchResultsItem[];
70
- records?: SearchResultsRecord[];
71
- }) {
72
- const normalizedItems = items ?? recordsToItems(records ?? []);
73
- const sections = itemsToSections(normalizedItems, 3);
201
+ export default function Demo({ data }: { data: Array<SearchResultsProps[\"section\"]> }) {
74
202
  return (
75
203
  <div className="space-y-10">
76
- {sections.map((section, index) => (
77
- <SearchResults key={`${section.title ?? section.layout}-${index}`} section={section} />
78
- ))}
204
+ {data.map((section, index) => {
205
+ if (Array.isArray(section)) {
206
+ const first = section[0] as { type?: unknown } | undefined;
207
+ const recordType = typeof first?.type === "string" ? first.type.toLowerCase() : undefined;
208
+ if (recordType === "image") return <SearchResultsImageGroup key={index} section={section} />;
209
+ if (recordType === "video") return <SearchResultsVideoGroup key={index} section={section} />;
210
+ }
211
+ return <SearchResults key={index} section={section} />;
212
+ })}
79
213
  </div>
80
214
  );
81
215
  }
82
216
  ```
83
217
 
84
- ### 3) 点击事件(埋点/接管跳转)
218
+ ### 5) 点击事件(埋点/统一处理)
85
219
 
86
220
  组件内部触发点击时,会先调用 item 自身的 `onClick`(如果有),再调用 `onItemClick`。
87
221
 
88
222
  ```tsx
89
- import SearchResults, { type SearchResultListItem, type SearchResultsItem } from "@infinilabs/search-results";
223
+ import SearchResults, {
224
+ type SearchResultListItem,
225
+ type SearchResultsItem
226
+ } from "@infinilabs/search-results";
90
227
 
91
228
  export default function Demo({ items }: { items: SearchResultsItem[] }) {
92
229
  const listItems = items.filter((i): i is SearchResultListItem => i.type === "result");
@@ -102,6 +239,13 @@ export default function Demo({ items }: { items: SearchResultsItem[] }) {
102
239
  }
103
240
  ```
104
241
 
242
+ ### 6) 底部动作(“查看全部”)
243
+
244
+ `footerAction` 可以写在:
245
+
246
+ - `SearchResults` / `SearchResultsImageGroup` / `SearchResultsVideoGroup` 的 `footerAction` prop 上(如果 section 本身没提供,会自动补上)
247
+ - `SearchResultsSection.footerAction` / `imageGroup.footerAction` / `videoGroup.footerAction` 上(优先级更高)
248
+
105
249
  ## 参数说明(Props)
106
250
 
107
251
  ```ts
@@ -110,20 +254,31 @@ import type { SearchResultsProps } from "@infinilabs/search-results";
110
254
 
111
255
  | 参数 | 类型 | 说明 |
112
256
  |---|---|---|
113
- | `section` | `SearchResultsSection` | 单个分组(单个 layout) |
257
+ | `section` | `SearchResultsProps["section"]` | 输入数据(section / item / record / 数组) |
114
258
  | `className` | `string` | 根容器 class |
259
+ | `footerAction` | `SearchResultsAction` | 底部“查看全部”动作(可选) |
260
+ | `onRecordClick` | `(record: SearchResultsRecord, index: number) => void` | record 输入时的点击回调 |
115
261
  | `onItemClick` | `(item: SearchResultsItem) => void` | 统一点击回调 |
116
262
 
263
+ ## 工具函数
264
+
265
+ ```ts
266
+ import { itemsToSections, recordsToItems } from "@infinilabs/search-results";
267
+ ```
268
+
117
269
  ## 类型导出
118
270
 
119
271
  ```ts
120
272
  import type {
273
+ SearchResultsAction,
121
274
  SearchResultsItem,
122
275
  SearchResultsSection,
123
276
  SearchResultsRecord,
124
277
  SearchResultListItem,
125
278
  SearchResultImageItem,
126
279
  SearchResultMediaItem,
280
+ SearchResultImageGroupItem,
281
+ SearchResultVideoGroupItem,
127
282
  SearchResultFileType
128
283
  } from "@infinilabs/search-results";
129
284
  ```
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { default as default_2 } from 'react';
2
- import { JSX } from 'react/jsx-runtime';
2
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
 
4
4
  export declare function itemsToSections(items: SearchResultsItem[], imageGridColumns?: 2 | 3 | 4): SearchResultsSection[];
5
5
 
@@ -58,13 +58,14 @@ export declare type SearchResultMediaItem = SearchResultCommon & {
58
58
  matchCountText?: string;
59
59
  sourceLabel?: string;
60
60
  categoryLabel?: string;
61
+ breadcrumbs?: string[];
61
62
  onClick?: () => void;
62
63
  };
63
64
 
64
- declare function SearchResults({ section, className, onItemClick }: SearchResultsProps): JSX.Element;
65
+ declare function SearchResults({ section, className, footerAction, onRecordClick, onItemClick }: SearchResultsProps): JSX_2.Element;
65
66
  export default SearchResults;
66
67
 
67
- declare type SearchResultsAction = {
68
+ export declare type SearchResultsAction = {
68
69
  label: string;
69
70
  href?: string;
70
71
  target?: string;
@@ -72,11 +73,19 @@ declare type SearchResultsAction = {
72
73
  onClick?: () => void;
73
74
  };
74
75
 
76
+ export declare function SearchResultsImageGroup(props: SearchResultsImageGroupProps): JSX_2.Element;
77
+
78
+ export declare type SearchResultsImageGroupProps = Omit<SearchResultsProps, "section"> & {
79
+ section: SearchResultImageGroupItem | SearchResultsRecord[] | SearchResultsSection;
80
+ };
81
+
75
82
  export declare type SearchResultsItem = SearchResultListItem | SearchResultImageItem | SearchResultMediaItem | SearchResultImageGroupItem | SearchResultVideoGroupItem;
76
83
 
77
84
  export declare type SearchResultsProps = {
78
- section: SearchResultsSection;
85
+ section: SearchResultsSection | SearchResultsItem | SearchResultsRecord | Array<SearchResultsItem | SearchResultsRecord>;
79
86
  className?: string;
87
+ footerAction?: SearchResultsAction;
88
+ onRecordClick?: (record: SearchResultsRecord, index: number) => void;
80
89
  onItemClick?: (item: SearchResultsItem) => void;
81
90
  };
82
91
 
@@ -164,6 +173,12 @@ export declare type SearchResultsSection = {
164
173
  className?: string;
165
174
  };
166
175
 
176
+ export declare function SearchResultsVideoGroup(props: SearchResultsVideoGroupProps): JSX_2.Element;
177
+
178
+ export declare type SearchResultsVideoGroupProps = Omit<SearchResultsProps, "section"> & {
179
+ section: SearchResultVideoGroupItem | SearchResultsRecord[] | SearchResultsSection;
180
+ };
181
+
167
182
  export declare type SearchResultVideoGroupItem = {
168
183
  type: "videoGroup";
169
184
  id: string;
@@ -1,7 +1,2 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-700:oklch(37.2% .044 257.287);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.flex{display:flex}.grid{display:grid}.inline-flex{display:inline-flex}.aspect-4\\/3{aspect-ratio:4/3}.aspect-video{aspect-ratio:var(--aspect-video)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\\[90px\\]{height:90px}.h-full{height:100%}.h-px{height:1px}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-10{width:calc(var(--spacing)*10)}.w-\\[160px\\]{width:160px}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.flex-none{flex:none}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x)var(--tw-translate-y)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*10)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*10)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-\\[\\#E8E8E8\\]{border-color:#e8e8e8}.border-slate-200{border-color:var(--color-slate-200)}.bg-\\[\\#027FFE\\]{background-color:#027ffe}.bg-\\[\\#666\\]{background-color:#666}.bg-\\[\\#E02E2E\\]{background-color:#e02e2e}.bg-\\[\\#E8E8E8\\]{background-color:#e8e8e8}.bg-black\\/55{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.bg-black\\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-12{padding-inline:calc(var(--spacing)*12)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.text-left{text-align:left}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#1A0CAB\\]{color:#1a0cab}.text-\\[\\#007EFF\\]{color:#007eff}.text-\\[\\#333\\]{color:#333}.text-\\[\\#666\\]{color:#666}.text-slate-700{color:var(--color-slate-700)}.text-white{color:var(--color-white)}.no-underline{text-decoration-line:none}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-slate-200{--tw-ring-color:var(--color-slate-200)}.ring-white\\/30{--tw-ring-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.ring-white\\/30{--tw-ring-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.group-hover\\:underline:is(:where(.group):hover *){text-decoration-line:underline}.group-hover\\:underline-offset-2:is(:where(.group):hover *){text-underline-offset:2px}.hover\\:border-\\[\\#E8E8E8\\]:hover{border-color:#e8e8e8}.hover\\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\\:bg-\\[\\#F5F5F5\\]:hover{background-color:#f5f5f5}.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\\:text-\\[\\#007EFF\\]:hover{color:#007eff}.hover\\:no-underline:hover{text-decoration-line:none}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:underline-offset-2:hover{text-underline-offset:2px}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-slate-300:focus-visible{--tw-ring-color:var(--color-slate-300)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ie=require("react"),m=require("clsx"),x=require("lucide-react");var y={exports:{}},b={};var z;function oe(){if(z)return b;z=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function l(s,a,c){var d=null;if(c!==void 0&&(d=""+c),a.key!==void 0&&(d=""+a.key),"key"in a){c={};for(var p in a)p!=="key"&&(c[p]=a[p])}else c=a;return a=c.ref,{$$typeof:e,type:s,key:d,ref:a!==void 0?a:null,props:c}}return b.Fragment=n,b.jsx=l,b.jsxs=l,b}var j={};var q;function ce(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===se?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case H:return"Profiler";case X:return"StrictMode";case ee:return"Suspense";case te:return"SuspenseList";case ne:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case J:return"Portal";case Q:return t.displayName||"Context";case Z:return(t._context.displayName||"Context")+".Consumer";case K:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case re:return i=t.displayName||null,i!==null?i:e(t.type)||"Memo";case k:i=t._payload,t=t._init;try{return e(t(i))}catch{}}return null}function n(t){return""+t}function l(t){try{n(t);var i=!1}catch{i=!0}if(i){i=console;var o=i.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return o.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),n(t)}}function s(t){if(t===A)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===k)return"<...>";try{var i=e(t);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function a(){var t=C.A;return t===null?null:t.getOwner()}function c(){return Error("react-stack-top-frame")}function d(t){if(B.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function p(t,i){function o(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}o.isReactWarning=!0,Object.defineProperty(t,"key",{get:o,configurable:!0})}function T(){var t=e(this.type);return Y[t]||(Y[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function R(t,i,o,u,w,I){var f=o.ref;return t={$$typeof:$,type:t,key:i,props:o,_owner:u},(f!==void 0?f:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:T}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function g(t,i,o,u,w,I){var f=i.children;if(f!==void 0)if(u)if(le(f)){for(u=0;u<f.length;u++)v(f[u]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(f);if(B.call(i,"key")){f=e(t);var h=Object.keys(i).filter(function(ae){return ae!=="key"});u=0<h.length?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}",M[f+u]||(h=0<h.length?"{"+h.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
3
- let props = %s;
4
- <%s {...props} />
5
- React keys must be passed directly to JSX without using spread:
6
- let props = %s;
7
- <%s key={someKey} {...props} />`,u,f,h,f),M[f+u]=!0)}if(f=null,o!==void 0&&(l(o),f=""+o),d(i)&&(l(i.key),f=""+i.key),"key"in i){o={};for(var O in i)O!=="key"&&(o[O]=i[O])}else o=i;return f&&p(o,typeof t=="function"?t.displayName||t.name||"Unknown":t),R(t,f,o,a(),w,I)}function v(t){F(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===k&&(t._payload.status==="fulfilled"?F(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function F(t){return typeof t=="object"&&t!==null&&t.$$typeof===$}var N=ie,$=Symbol.for("react.transitional.element"),J=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),C=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,le=Array.isArray,S=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(t){return t()}};var L,Y={},U=N.react_stack_bottom_frame.bind(N,c)(),D=S(s(c)),M={};j.Fragment=A,j.jsx=function(t,i,o){var u=1e4>C.recentlyCreatedOwnerStacks++;return g(t,i,o,!1,u?Error("react-stack-top-frame"):U,u?S(s(t)):D)},j.jsxs=function(t,i,o){var u=1e4>C.recentlyCreatedOwnerStacks++;return g(t,i,o,!0,u?Error("react-stack-top-frame"):U,u?S(s(t)):D)}})()),j}var G;function ue(){return G||(G=1,process.env.NODE_ENV==="production"?y.exports=oe():y.exports=ce()),y.exports}var r=ue();function _(e,n){const l=n==="_blank"?"noreferrer noopener":"";return e?l?[...new Set([...e.split(" "),...l.split(" ")].filter(Boolean))].join(" "):e:l||void 0}function V({href:e,target:n,rel:l,onClick:s,className:a,children:c}){return e?r.jsx("a",{href:e,target:n,rel:_(l,n),className:a,onClick:()=>s?.(),children:c}):r.jsx("button",{type:"button",className:a,onClick:s,children:c})}function fe({item:e,onItemClick:n}){return r.jsxs(V,{href:e.href,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),n?.(e)},className:m("group w-full rounded-xl bg-white text-left transition","hover:border-slate-300 hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300"),children:[r.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:r.jsx("div",{className:"relative aspect-video bg-slate-100",children:r.jsx("img",{src:e.imageUrl,alt:e.imageAlt??e.title,className:"absolute inset-0 h-full w-full object-cover",loading:"lazy"})})}),r.jsxs("div",{className:"mt-2",children:[r.jsx("div",{className:"truncate text-sm font-semibold text-[#333]",children:e.title}),e.subtitle?r.jsx("div",{className:"mt-1 truncate text-sm text-[#666]",children:e.subtitle}):null]})]})}function de({author:e,date:n}){return!e&&!n?null:r.jsxs("div",{className:"flex-none truncate text-xs",children:[e?r.jsx("span",{className:"",children:e}):null,e&&n?r.jsx("span",{className:"mx-1",children:"·"}):null,n?r.jsx("span",{className:"",children:n}):null]})}function me({breadcrumbs:e}){return e?.length?r.jsx("div",{className:"min-w-0 truncate text-xs",children:e.map((n,l)=>r.jsxs("span",{children:[l>0?r.jsx("span",{className:"mx-1",children:">"}):null,r.jsx("span",{className:"",children:n})]},`${n}-${l}`))}):null}function xe({meta:e}){return e?.length?r.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-[#333]",children:e.map((n,l)=>r.jsx("span",{className:"inline-flex items-center rounded border border-slate-200 bg-white px-3 py-1",children:n},`${n}-${l}`))}):null}function pe(e){const n=e.trim().toLowerCase();return n?n==="google"?"G":e.trim().slice(0,1).toUpperCase():""}function E({title:e,titleIcon:n,titleIconBgColor:l,source:s,className:a,titleClassName:c}){return!e&&!n&&!s?null:r.jsxs("div",{className:m("mb-2 flex min-w-0 items-center gap-2",a),children:[n?l?r.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md text-white",style:{backgroundColor:l},children:n}):r.jsx("span",{className:"flex-none",children:n}):null,e?r.jsx("div",{className:m("min-w-0 text-xl font-semibold cursor-pointer hover:underline hover:underline-offset-2 group-hover:underline group-hover:underline-offset-2",c),children:e}):null,s?r.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md",title:s,children:pe(s)}):null]})}function he({href:e,target:n,rel:l,onClick:s,children:a}){return e?r.jsx("a",{href:e,target:n,rel:_(l,n),onClick:()=>s?.(),className:"group flex w-full min-w-0 items-center gap-2",children:a}):s?r.jsx("button",{type:"button",onClick:s,className:"group flex w-full min-w-0 items-center gap-2 text-left",children:a}):r.jsx("div",{className:"flex w-full min-w-0 items-center gap-2",children:a})}function ge(e){switch(e){case"doc":case"word":return"bg-[#027FFE] text-white";case"pdf":return"bg-[#E02E2E] text-white";default:return"bg-slate-100 text-slate-700"}}function be(e){switch(e){case"xls":return r.jsx(x.FileSpreadsheet,{className:"h-5 w-5"});case"ppt":return r.jsx(x.Presentation,{className:"h-5 w-5"});case"pdf":case"doc":case"word":case"text":return r.jsx(x.FileText,{className:"h-5 w-5"});default:return r.jsx(x.File,{className:"h-5 w-5"})}}function W({fileType:e,typeIcon:n}){return n?r.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center",children:n}):e?r.jsx("span",{className:m("inline-flex h-6 w-6 items-center justify-center rounded-md",ge(e)),children:be(e)}):null}function je({item:e,onItemClick:n}){const l=e.typeIcon?r.jsx(W,{typeIcon:e.typeIcon}):e.fileType?r.jsx(W,{fileType:e.fileType}):null;return r.jsxs("div",{className:"w-full py-2",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2",children:r.jsx(he,{href:e.href,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),n?.(e)},children:r.jsx(E,{className:"mb-0 w-full",title:e.title,titleIcon:l,source:e.source,titleClassName:"truncate text-[#1A0CAB]"})})}),r.jsxs("div",{className:"mt-2 flex gap-3",children:[e.thumbnailUrl?r.jsx("img",{src:e.thumbnailUrl,alt:e.thumbnailAlt??e.title,className:"h-[90px] w-[160px] flex-none rounded-lg object-cover ring-1 ring-slate-200",loading:"lazy"}):r.jsx("div",{className:"h-[90px] w-[160px] flex-none rounded-lg bg-slate-100 ring-1 ring-slate-200"}),r.jsxs("div",{className:"min-w-0 flex-1 flex flex-col justify-between",children:[e.description?r.jsx("div",{className:"line-clamp-2 text-sm text-[#666]",children:e.description}):null,e.breadcrumbs?.length||e.author||e.date?r.jsxs("div",{className:"mt-2 flex min-w-0 items-center gap-3 text-[#666]",children:[r.jsx(me,{breadcrumbs:e.breadcrumbs}),r.jsx("span",{className:"h-3 w-px flex-none bg-[#666]","aria-hidden":"true"}),r.jsxs("div",{className:"flex flex-none items-center gap-2",children:[r.jsx(de,{author:e.author,date:e.date}),e.href?r.jsx("a",{href:e.href,target:e.target,rel:_(e.rel,e.target),className:"flex-none text-[#007EFF] hover:text-[#007EFF]",children:r.jsx(x.ExternalLink,{className:"h-3 w-3"})}):null]})]}):r.jsx(xe,{meta:e.meta})]})]})]})}function ve({text:e}){return r.jsx("span",{className:"inline-flex items-center rounded-md border border-slate-200 bg-white px-2 py-1 text-xs text-slate-700",children:e})}function Ne({item:e,onItemClick:n}){const l=[e.sourceLabel,e.categoryLabel].filter(Boolean);return r.jsxs(V,{href:e.href,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),n?.(e)},className:m("group w-full rounded-xl bg-white text-left transition","hover:border-slate-300 hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300"),children:[r.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:r.jsxs("div",{className:"relative aspect-4/3 bg-slate-100",children:[r.jsx("img",{src:e.thumbnailUrl,alt:e.thumbnailAlt??e.title,className:"absolute inset-0 h-full w-full object-cover",loading:"lazy"}),e.mediaType==="video"?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-black/55 text-white ring-1 ring-white/30",children:r.jsx(x.Play,{className:"h-5 w-5 translate-x-px"})})}):null]})}),r.jsxs("div",{className:"mt-2",children:[r.jsx("div",{className:"truncate text-sm font-medium",children:e.title}),e.matchCountText?r.jsx("div",{className:"mt-1 truncate text-xs text-[#666]",children:e.matchCountText}):null,l.length?r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:l.map(s=>r.jsx(ve,{text:s},s))}):null]})]})}function we({action:e,className:n}){const l=m("flex-none inline-flex items-center justify-center rounded-full border border-slate-200 bg-white","h-9 px-12 text-sm font-medium text-slate-700 no-underline transition","hover:border-slate-300 hover:bg-slate-50 hover:no-underline","focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300",n);return e.href?r.jsx("a",{className:l,href:e.href,target:e.target,rel:_(e.rel,e.target),onClick:()=>e.onClick?.(),children:e.label}):r.jsx("button",{className:l,type:"button",onClick:e.onClick,children:e.label})}function P({action:e}){return e?r.jsxs("div",{className:"mt-3 flex w-full items-center",children:[r.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"}),r.jsx(we,{action:e,className:m("rounded-full border border-[#E8E8E8] bg-white px-4 py-2 text-sm font-medium text-[#333] transition","hover:border-[#E8E8E8] hover:bg-[#F5F5F5]")}),r.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"})]}):null}function ye(e,n){if(e.layout==="list")return r.jsxs("div",{className:m("space-y-6",e.className),children:[r.jsx(E,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),e.items.map(a=>r.jsx(je,{item:a,onItemClick:n},a.id)),r.jsx(P,{action:e.footerAction})]});if(e.layout==="mediaGrid"){const a=e.columns??3,c=a===2?"grid-cols-2":a===4?"grid-cols-4":"grid-cols-3";return r.jsxs("div",{className:m(e.className),children:[r.jsx(E,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),r.jsx("div",{className:m("grid gap-3",c),children:e.items.map(d=>r.jsx(Ne,{item:d,onItemClick:n},d.id))}),r.jsx(P,{action:e.footerAction})]})}const l=e.columns??3,s=l===2?"grid-cols-2":l===4?"grid-cols-4":"grid-cols-3";return r.jsxs("div",{className:m(e.className),children:[r.jsx(E,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),r.jsx("div",{className:m("grid gap-3",s),children:e.items.map(a=>r.jsx(fe,{item:a,onItemClick:n},a.id))}),r.jsx(P,{action:e.footerAction})]})}function Ee({section:e,className:n,onItemClick:l}){return r.jsx("div",{className:m(n),children:ye(e,l)})}function _e(e,n){const l=[];for(const s of e){const a=l.length?l[l.length-1]:void 0;if(s.type==="imageGroup"){s.items[0]?.type==="media"?l.push({type:"section",title:s.title,titleIcon:r.jsx(x.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:s.items.filter(d=>d.type==="media"),columns:s.columns??n,footerAction:s.footerAction,className:s.className}):l.push({type:"section",title:s.title,titleIcon:r.jsx(x.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"imageGrid",items:s.items.filter(d=>d.type==="image"),columns:s.columns??n,footerAction:s.footerAction,className:s.className});continue}if(s.type==="videoGroup"){l.push({type:"section",title:s.title,titleIcon:r.jsx(x.Video,{className:"h-4 w-4"}),titleIconBgColor:"#1784FC",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:s.items,columns:s.columns??n,footerAction:s.footerAction,className:s.className});continue}if(s.type==="result"){if(a?.layout==="list"){a.items.push(s);continue}l.push({type:"section",layout:"list",items:[s]});continue}if(s.type==="media"){if(a?.layout==="mediaGrid"){a.items.push(s);continue}l.push({type:"section",layout:"mediaGrid",...n?{columns:n}:{},items:[s]});continue}if(a?.layout==="imageGrid"){a.items.push(s);continue}l.push({type:"section",layout:"imageGrid",...n?{columns:n}:{},items:[s]})}return l}function Te(e){if(!e)return;const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toISOString().slice(0,10)}function Re(e){const n=e?.trim().toLowerCase();if(n)return n==="pdf"?"pdf":n==="doc"||n==="docx"||n==="word"?"doc":n==="ppt"||n==="pptx"?"ppt":n==="xls"||n==="xlsx"||n==="excel"?"xls":n==="link"||n==="url"||n==="html"?"link":n==="txt"||n==="text"?"text":"unknown"}function Ae(e,n){const l=e.thumbnail??e.cover??e.metadata?.thumbnail_link,s=e.summary??e.content,a=Re(e.metadata?.file_extension??e.type),c=e.source?.name,d=e.category??e.categories?.join(" / ")??"Categories",p=[c,d].filter(Boolean),T=e.last_updated_by?.user?.username??e.owner?.username,R=Te(e.last_updated_by?.timestamp??e.metadata?.last_reviewed),g=e.metadata?.icon_link??e.icon,v=g?r.jsx("img",{src:g,alt:"",className:"h-5 w-5 rounded-sm object-contain"}):void 0;return{type:"result",id:`${e.source?.id??e.url??e.title}-${n}`,title:e.title,href:e.url,description:s,thumbnailUrl:l,fileType:a,typeIcon:v,breadcrumbs:p.length?p:void 0,author:T,date:R}}function ke(e){return e.map((n,l)=>Ae(n,l))}exports.default=Ee;exports.itemsToSections=_e;exports.recordsToItems=ke;
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-700:oklch(37.2% .044 257.287);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.inline-flex{display:inline-flex}.aspect-4\\/3{aspect-ratio:4/3}.aspect-video{aspect-ratio:var(--aspect-video)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\\[90px\\]{height:90px}.h-full{height:100%}.h-px{height:1px}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-10{width:calc(var(--spacing)*10)}.w-\\[160px\\]{width:160px}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.flex-none{flex:none}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x)var(--tw-translate-y)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*10)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*10)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-\\[\\#E8E8E8\\]{border-color:#e8e8e8}.border-slate-200{border-color:var(--color-slate-200)}.bg-\\[\\#027FFE\\]{background-color:#027ffe}.bg-\\[\\#666\\]{background-color:#666}.bg-\\[\\#E02E2E\\]{background-color:#e02e2e}.bg-\\[\\#E8E8E8\\]{background-color:#e8e8e8}.bg-black\\/55{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.bg-black\\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-12{padding-inline:calc(var(--spacing)*12)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.text-left{text-align:left}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#1A0CAB\\]{color:#1a0cab}.text-\\[\\#007EFF\\]{color:#007eff}.text-\\[\\#333\\]{color:#333}.text-\\[\\#666\\]{color:#666}.text-slate-700{color:var(--color-slate-700)}.text-white{color:var(--color-white)}.no-underline{text-decoration-line:none}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-slate-200{--tw-ring-color:var(--color-slate-200)}.ring-white\\/30{--tw-ring-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.ring-white\\/30{--tw-ring-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.group-hover\\:underline:is(:where(.group):hover *){text-decoration-line:underline}.group-hover\\:underline-offset-2:is(:where(.group):hover *){text-underline-offset:2px}.hover\\:border-\\[\\#E8E8E8\\]:hover{border-color:#e8e8e8}.hover\\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\\:bg-\\[\\#F5F5F5\\]:hover{background-color:#f5f5f5}.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\\:no-underline:hover{text-decoration-line:none}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:underline-offset-2:hover{text-underline-offset:2px}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-slate-300:focus-visible{--tw-ring-color:var(--color-slate-300)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),o=require("clsx"),u=require("lucide-react");function w(e,t){const i=t==="_blank"?"noreferrer noopener":"";return e?i?[...new Set([...e.split(" "),...i.split(" ")].filter(Boolean))].join(" "):e:i||void 0}function h({href:e,target:t,rel:i,onClick:r,className:n,children:l}){const a=n?`${n} cursor-pointer`:"cursor-pointer";return e?s.jsx("a",{href:e,target:t,rel:w(i,t),className:a,onClick:()=>r?.(),children:l}):s.jsx("button",{type:"button",className:a,onClick:r,children:l})}function G({item:e,onItemClick:t}){const i=e.onClick?void 0:e.href;return s.jsxs(h,{href:i,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:o("group w-full rounded-xl text-left transition","hover:border-slate-300 hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300"),children:[s.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:s.jsx("div",{className:"relative aspect-video bg-slate-100",children:s.jsx("img",{src:e.imageUrl,alt:e.imageAlt??e.title,className:"absolute inset-0 h-full w-full object-cover",loading:"lazy"})})}),s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"truncate text-sm font-semibold text-[#333]",children:e.title}),e.subtitle?s.jsx("div",{className:"mt-1 truncate text-sm text-[#666]",children:e.subtitle}):null]})]})}function T({author:e,date:t}){return!e&&!t?null:s.jsxs("div",{className:"flex-none truncate text-xs",children:[e?s.jsx("span",{className:"",children:e}):null,e&&t?s.jsx("span",{className:"mx-1",children:"·"}):null,t?s.jsx("span",{className:"",children:t}):null]})}function A({breadcrumbs:e}){return e?.length?s.jsx("div",{className:"min-w-0 truncate text-xs",children:e.map((t,i)=>s.jsxs("span",{children:[i>0?s.jsx("span",{className:"mx-1",children:">"}):null,s.jsx("span",{className:"",children:t})]},`${t}-${i}`))}):null}function F({meta:e}){return e?.length?s.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-[#333]",children:e.map((t,i)=>s.jsx("span",{className:"inline-flex items-center rounded border border-slate-200 bg-white px-3 py-1",children:t},`${t}-${i}`))}):null}function k(e){const t=e.trim().toLowerCase();return t?t==="google"?"G":e.trim().slice(0,1).toUpperCase():""}function p({title:e,titleIcon:t,titleIconBgColor:i,source:r,className:n,titleClassName:l}){return!e&&!t&&!r?null:s.jsxs("div",{className:o("mb-2 flex min-w-0 items-center gap-2",n),children:[t?i?s.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md text-white",style:{backgroundColor:i},children:t}):s.jsx("span",{className:"flex-none",children:t}):null,e?s.jsx("div",{className:o("min-w-0 text-xl font-semibold cursor-pointer hover:underline hover:underline-offset-2 group-hover:underline group-hover:underline-offset-2",l),children:e}):null,r?s.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md",title:r,children:k(r)}):null]})}function B(e){switch(e){case"doc":case"word":return"bg-[#027FFE] text-white";case"pdf":return"bg-[#E02E2E] text-white";default:return"bg-slate-100 text-slate-700"}}function S(e){switch(e){case"xls":return s.jsx(u.FileSpreadsheet,{className:"h-5 w-5"});case"ppt":return s.jsx(u.Presentation,{className:"h-5 w-5"});case"pdf":case"doc":case"word":case"text":return s.jsx(u.FileText,{className:"h-5 w-5"});default:return s.jsx(u.File,{className:"h-5 w-5"})}}function b({fileType:e,typeIcon:t}){return t?s.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center",children:t}):e?s.jsx("span",{className:o("inline-flex h-6 w-6 items-center justify-center rounded-md",B(e)),children:S(e)}):null}function E({item:e,onItemClick:t}){const i=e.typeIcon?s.jsx(b,{typeIcon:e.typeIcon}):e.fileType?s.jsx(b,{fileType:e.fileType}):null,r=e.onClick||t?()=>{e.onClick?.(),t?.(e)}:void 0,n=e.onClick?void 0:e.href,l=s.jsxs("div",{className:"w-full py-2",children:[s.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.jsx(p,{className:"mb-0 w-full",title:e.title,titleIcon:i,source:e.source,titleClassName:"truncate text-[#1A0CAB]"})}),s.jsxs("div",{className:"mt-2 flex gap-3",children:[e.thumbnailUrl?s.jsx("img",{src:e.thumbnailUrl,alt:e.thumbnailAlt??e.title,className:"h-[90px] w-[160px] flex-none rounded-lg object-cover ring-1 ring-slate-200",loading:"lazy"}):s.jsx("div",{className:"h-[90px] w-[160px] flex-none rounded-lg bg-slate-100 ring-1 ring-slate-200"}),s.jsxs("div",{className:"min-w-0 flex-1 flex flex-col justify-between",children:[e.description?s.jsx("div",{className:"line-clamp-2 text-sm text-[#666]",children:e.description}):null,e.breadcrumbs?.length||e.author||e.date?s.jsxs("div",{className:"mt-2 flex min-w-0 items-center gap-3 text-[#666]",children:[s.jsx(A,{breadcrumbs:e.breadcrumbs}),s.jsx("span",{className:"h-3 w-px flex-none bg-[#666]","aria-hidden":"true"}),s.jsxs("div",{className:"flex flex-none items-center gap-2",children:[s.jsx(T,{author:e.author,date:e.date}),e.href?s.jsx("span",{className:"flex-none text-[#007EFF]",children:s.jsx(u.ExternalLink,{className:"h-3 w-3"})}):null]})]}):s.jsx(F,{meta:e.meta})]})]})]});return!n&&!r?l:s.jsx(h,{href:n,target:e.target,rel:e.rel,onClick:r,className:"group block w-full rounded-xl px-3 text-left no-underline transition hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300",children:l})}function L({item:e,onItemClick:t}){const i=e.breadcrumbs??[e.sourceLabel,e.categoryLabel].filter(Boolean),r=e.onClick?void 0:e.href;return s.jsxs(h,{href:r,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:o("group w-full rounded-xl text-left transition","hover:border-slate-300 hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300"),children:[s.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:s.jsxs("div",{className:"relative aspect-4/3 bg-slate-100",children:[s.jsx("img",{src:e.thumbnailUrl,alt:e.thumbnailAlt??e.title,className:"absolute inset-0 h-full w-full object-cover",loading:"lazy"}),e.mediaType==="video"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-black/55 text-white ring-1 ring-white/30",children:s.jsx(u.Play,{className:"h-5 w-5 translate-x-px"})})}):null]})}),s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"truncate text-sm font-medium",children:e.title}),e.matchCountText?s.jsx("div",{className:"mt-1 truncate text-xs text-[#666]",children:e.matchCountText}):null,i.length?s.jsx("div",{className:"mt-2 text-[#666]",children:s.jsx(A,{breadcrumbs:i})}):null]})]})}function U({action:e,className:t}){const i=o("flex-none inline-flex items-center justify-center rounded-full border border-slate-200 bg-white","h-9 px-12 text-sm font-medium text-slate-700 no-underline transition","cursor-pointer hover:border-slate-300 hover:bg-slate-50 hover:no-underline","focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300",t);return e.href?s.jsx("a",{className:i,href:e.href,target:e.target,rel:w(e.rel,e.target),onClick:()=>e.onClick?.(),children:e.label}):s.jsx("button",{className:i,type:"button",onClick:e.onClick,children:e.label})}function g({action:e}){return e?s.jsxs("div",{className:"mt-3 flex w-full items-center",children:[s.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"}),s.jsx(U,{action:e,className:o("rounded-full border border-[#E8E8E8] bg-white px-4 py-2 text-sm font-medium text-[#333] transition","hover:border-[#E8E8E8] hover:bg-[#F5F5F5]")}),s.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"})]}):null}function _(e,t){if(e.layout==="list")return s.jsxs("div",{className:o("space-y-6",e.className),children:[s.jsx(p,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),e.items.map(n=>s.jsx(E,{item:n,onItemClick:t},n.id)),s.jsx(g,{action:e.footerAction})]});if(e.layout==="mediaGrid"){const n=e.columns??3,l=n===2?"grid-cols-2":n===4?"grid-cols-4":"grid-cols-3";return s.jsxs("div",{className:o(e.className),children:[s.jsx(p,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),s.jsx("div",{className:o("grid gap-3",l),children:e.items.map(a=>s.jsx(L,{item:a,onItemClick:t},a.id))}),s.jsx(g,{action:e.footerAction})]})}const i=e.columns??3,r=i===2?"grid-cols-2":i===4?"grid-cols-4":"grid-cols-3";return s.jsxs("div",{className:o(e.className),children:[s.jsx(p,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),s.jsx("div",{className:o("grid gap-3",r),children:e.items.map(n=>s.jsx(G,{item:n,onItemClick:t},n.id))}),s.jsx(g,{action:e.footerAction})]})}function $(e){if(!e)return;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function z(e){const t=e?.trim().toLowerCase();if(t)return t==="pdf"?"pdf":t==="doc"||t==="docx"||t==="word"?"doc":t==="ppt"||t==="pptx"?"ppt":t==="xls"||t==="xlsx"||t==="excel"?"xls":t==="link"||t==="url"||t==="html"?"link":t==="txt"||t==="text"?"text":"unknown"}function v(e,t,i){const r=e.thumbnail??e.cover??e.metadata?.thumbnail_link,n=e.summary??e.content,l=z(e.metadata?.file_extension??e.type),a=e.source?.name,c=e.category??e.categories?.join(" / ")??"Categories",d=[a,c].filter(Boolean),m=e.last_updated_by?.user?.username??e.owner?.username,x=$(e.last_updated_by?.timestamp??e.metadata?.last_reviewed),f=e.metadata?.icon_link??e.icon,y=f?s.jsx("img",{src:f,alt:"",className:"h-5 w-5 rounded-sm object-contain"}):void 0;return{type:"result",id:`${e.source?.id??e.url??e.title}-${t}`,title:e.title,href:e.url,description:n,thumbnailUrl:r,fileType:l,typeIcon:y,breadcrumbs:d.length?d:void 0,author:m,date:x,onClick:i}}function j({section:e,className:t,footerAction:i,onRecordClick:r,onItemClick:n}){const l=M(C(e,r),i);return s.jsx("div",{className:o(t),children:_(l,n)})}function M(e,t){return!t||e.footerAction?e:e.layout==="list"?{...e,footerAction:t}:e.layout==="mediaGrid"?{...e,footerAction:t}:{...e,footerAction:t}}function H(e){return s.jsx(j,{...e})}function V(e){return s.jsx(j,{...e})}function C(e,t){if(Array.isArray(e))return q(e,t);if(P(e))return e;const i=e;if(i.type==="imageGroup"&&Array.isArray(i.items)){const n=i;return n.items[0]?.type==="media"?{type:"section",title:n.title,layout:"mediaGrid",items:n.items.filter(a=>typeof a=="object"&&!!a&&a.type==="media"),columns:n.columns,footerAction:n.footerAction,className:n.className}:{type:"section",title:n.title,layout:"imageGrid",items:n.items.filter(a=>typeof a=="object"&&!!a&&a.type==="image"),columns:n.columns,footerAction:n.footerAction,className:n.className}}if(i.type==="videoGroup"&&Array.isArray(i.items)){const n=i;return{type:"section",title:n.title,layout:"mediaGrid",items:n.items,columns:n.columns,footerAction:n.footerAction,className:n.className}}if(i.type==="result")return{type:"section",layout:"list",items:[e]};if(i.type==="media")return{type:"section",layout:"mediaGrid",items:[e]};if(i.type==="image"&&typeof i.imageUrl=="string")return{type:"section",layout:"imageGrid",items:[e]};const r=typeof i.type=="string"?i.type.trim().toLowerCase():void 0;if(r==="image"||r==="video"){const n=typeof i.id=="string"?i.id:void 0,l=typeof i.thumbnail=="string"?i.thumbnail:typeof i.cover=="string"?i.cover:typeof i.metadata=="object"&&i.metadata&&typeof i.metadata.thumbnail_link=="string"?i.metadata.thumbnail_link:void 0;if(l){const a=typeof i.category=="string"?i.category:Array.isArray(i.categories)?i.categories.filter(f=>typeof f=="string").join(" / "):void 0,c=typeof i.title=="string"?i.title:"Untitled",d=typeof i.url=="string"?i.url:void 0,m=typeof i.source=="object"&&i.source&&typeof i.source.name=="string"?i.source.name:void 0;return{type:"section",layout:"mediaGrid",items:[{type:"media",id:n??`${d??c}-0`,mediaType:r==="video"?"video":"image",title:c,href:t?void 0:d,thumbnailUrl:l,sourceLabel:m,categoryLabel:a,breadcrumbs:[m,a].filter(Boolean),...t?{onClick:()=>t(e,0)}:{}}]}}}return{type:"section",layout:"list",items:[v(e,0,t?()=>t(e,0):void 0)]}}function q(e,t){if(!e.length)return{type:"section",layout:"list",items:[]};if(e.every(I)){if(e.every(l=>l.type==="result"))return{type:"section",layout:"list",items:e};if(e.every(l=>l.type==="media"))return{type:"section",layout:"mediaGrid",items:e};if(e.every(l=>l.type==="image"&&"imageUrl"in l))return{type:"section",layout:"imageGrid",items:e};if(e.length===1)return C(e[0],t)}const i=[],r=[];for(const[l,a]of e.entries()){const c=D(a,l,t);c?i.push(c):r.push(v(a,l,t?()=>t(a,l):void 0))}return i.length&&!r.length?{type:"section",title:N(e,a=>a.category??a.source?.name),layout:"mediaGrid",items:i}:{type:"section",title:N(e,l=>l.category??l.source?.name),layout:"list",items:r}}function I(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="result"||t.type==="media"||t.type==="imageGroup"||t.type==="videoGroup"||t.type==="image"&&typeof e.imageUrl=="string"}function D(e,t,i){const r=e,n=typeof r.type=="string"?r.type.trim().toLowerCase():void 0;if(n!=="image"&&n!=="video")return;const l=typeof r.id=="string"?r.id:void 0,a=typeof r.thumbnail=="string"?r.thumbnail:typeof r.cover=="string"?r.cover:typeof r.metadata=="object"&&r.metadata&&typeof r.metadata.thumbnail_link=="string"?r.metadata.thumbnail_link:void 0;if(!a)return;const c=typeof r.category=="string"?r.category:Array.isArray(r.categories)?r.categories.filter(y=>typeof y=="string").join(" / "):void 0,d=typeof r.title=="string"?r.title:"Untitled",m=typeof r.url=="string"?r.url:void 0,x=typeof r.source=="object"&&r.source&&typeof r.source.name=="string"?r.source.name:void 0,f=!!i&&!I(e);return{type:"media",id:l??`${m??d}-0`,mediaType:n==="video"?"video":"image",title:d,href:f?void 0:m,thumbnailUrl:a,sourceLabel:x,categoryLabel:c,breadcrumbs:[x,c].filter(Boolean),...f?{onClick:()=>i(e,t)}:{}}}function N(e,t){const i=e[0],r=t(i);if(r){for(const n of e)if(t(n)!==r)return;return r}}function P(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="section"&&(t.layout==="list"||t.layout==="imageGrid"||t.layout==="mediaGrid")&&Array.isArray(t.items)}function O(e,t){const i=[];for(const r of e){const n=i.length?i[i.length-1]:void 0;if(r.type==="imageGroup"){r.items[0]?.type==="media"?i.push({type:"section",title:r.title,titleIcon:s.jsx(u.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:r.items.filter(a=>a.type==="media"),columns:r.columns??t,footerAction:r.footerAction,className:r.className}):i.push({type:"section",title:r.title,titleIcon:s.jsx(u.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"imageGrid",items:r.items.filter(a=>a.type==="image"),columns:r.columns??t,footerAction:r.footerAction,className:r.className});continue}if(r.type==="videoGroup"){i.push({type:"section",title:r.title,titleIcon:s.jsx(u.Video,{className:"h-4 w-4"}),titleIconBgColor:"#1784FC",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:r.items,columns:r.columns??t,footerAction:r.footerAction,className:r.className});continue}if(r.type==="result"){if(n?.layout==="list"){n.items.push(r);continue}i.push({type:"section",layout:"list",items:[r]});continue}if(r.type==="media"){if(n?.layout==="mediaGrid"){n.items.push(r);continue}i.push({type:"section",layout:"mediaGrid",...t?{columns:t}:{},items:[r]});continue}if(n?.layout==="imageGrid"){n.items.push(r);continue}i.push({type:"section",layout:"imageGrid",...t?{columns:t}:{},items:[r]})}return i}function R(e){return e.map((t,i)=>v(t,i))}exports.SearchResultsImageGroup=H;exports.SearchResultsVideoGroup=V;exports.default=j;exports.itemsToSections=O;exports.recordsToItems=R;