@infinilabs/search-results 0.0.7 → 0.0.9
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 +35 -2
- package/dist/index.d.ts +8 -4
- package/dist/search-results.cjs +2 -7
- package/dist/search-results.js +325 -569
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -198,7 +198,7 @@ import SearchResults, {
|
|
|
198
198
|
type SearchResultsProps
|
|
199
199
|
} from "@infinilabs/search-results";
|
|
200
200
|
|
|
201
|
-
export default function Demo({ data }: { data: Array<SearchResultsProps[
|
|
201
|
+
export default function Demo({ data }: { data: Array<SearchResultsProps["section"]> }) {
|
|
202
202
|
return (
|
|
203
203
|
<div className="space-y-10">
|
|
204
204
|
{data.map((section, index) => {
|
|
@@ -255,11 +255,43 @@ import type { SearchResultsProps } from "@infinilabs/search-results";
|
|
|
255
255
|
| 参数 | 类型 | 说明 |
|
|
256
256
|
|---|---|---|
|
|
257
257
|
| `section` | `SearchResultsProps["section"]` | 输入数据(section / item / record / 数组) |
|
|
258
|
-
| `className` | `string` | 根容器
|
|
258
|
+
| `className` | `string` | 根容器 `className` |
|
|
259
|
+
| `theme` | `"light" \| "dark" \| "auto"` | 组件主题(可选) |
|
|
259
260
|
| `footerAction` | `SearchResultsAction` | 底部“查看全部”动作(可选) |
|
|
260
261
|
| `onRecordClick` | `(record: SearchResultsRecord, index: number) => void` | record 输入时的点击回调 |
|
|
261
262
|
| `onItemClick` | `(item: SearchResultsItem) => void` | 统一点击回调 |
|
|
262
263
|
|
|
264
|
+
## 主题适配(light / dark)
|
|
265
|
+
|
|
266
|
+
组件随包产出样式(业务侧无需安装 Tailwind)。暗色样式基于 `.dark` class 驱动(语义等同于 Tailwind `dark:` 变体)。
|
|
267
|
+
|
|
268
|
+
你有两种接入方式:
|
|
269
|
+
|
|
270
|
+
### 方式 1:跟随业务侧主题(推荐)
|
|
271
|
+
|
|
272
|
+
业务侧在外层容器挂载/移除 `dark` class(例如放在页面根节点或局部容器),组件会自动跟随:
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
<div className={isDark ? "dark" : ""}>
|
|
276
|
+
<SearchResults section={data} />
|
|
277
|
+
</div>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### 方式 2:组件级主题开关
|
|
281
|
+
|
|
282
|
+
通过 `theme` 让组件在自身根节点挂载 `dark` class(不依赖外层):
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
<SearchResults section={data} theme="light" />
|
|
286
|
+
<SearchResults section={data} theme="dark" />
|
|
287
|
+
<SearchResults section={data} theme="auto" />
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
说明:
|
|
291
|
+
|
|
292
|
+
- `theme="auto"` 会根据 `prefers-color-scheme` 自动选择 light/dark
|
|
293
|
+
- 如果业务侧把 `dark` 挂在 `html` 上,组件无法在局部“强制 light”;想局部控制请把 `dark` 放到局部容器
|
|
294
|
+
|
|
263
295
|
## 工具函数
|
|
264
296
|
|
|
265
297
|
```ts
|
|
@@ -271,6 +303,7 @@ import { itemsToSections, recordsToItems } from "@infinilabs/search-results";
|
|
|
271
303
|
```ts
|
|
272
304
|
import type {
|
|
273
305
|
SearchResultsAction,
|
|
306
|
+
SearchResultsTheme,
|
|
274
307
|
SearchResultsItem,
|
|
275
308
|
SearchResultsSection,
|
|
276
309
|
SearchResultsRecord,
|
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
|
|
|
@@ -30,6 +30,7 @@ export declare type SearchResultImageItem = SearchResultCommon & {
|
|
|
30
30
|
imageUrl: string;
|
|
31
31
|
imageAlt?: string;
|
|
32
32
|
subtitle?: string;
|
|
33
|
+
breadcrumbs?: string[];
|
|
33
34
|
onClick?: () => void;
|
|
34
35
|
};
|
|
35
36
|
|
|
@@ -62,7 +63,7 @@ export declare type SearchResultMediaItem = SearchResultCommon & {
|
|
|
62
63
|
onClick?: () => void;
|
|
63
64
|
};
|
|
64
65
|
|
|
65
|
-
declare function SearchResults({ section, className, footerAction, onRecordClick, onItemClick }: SearchResultsProps):
|
|
66
|
+
declare function SearchResults({ section, className, theme, footerAction, onRecordClick, onItemClick }: SearchResultsProps): JSX_2.Element;
|
|
66
67
|
export default SearchResults;
|
|
67
68
|
|
|
68
69
|
export declare type SearchResultsAction = {
|
|
@@ -73,7 +74,7 @@ export declare type SearchResultsAction = {
|
|
|
73
74
|
onClick?: () => void;
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
export declare function SearchResultsImageGroup(props: SearchResultsImageGroupProps):
|
|
77
|
+
export declare function SearchResultsImageGroup(props: SearchResultsImageGroupProps): JSX_2.Element;
|
|
77
78
|
|
|
78
79
|
export declare type SearchResultsImageGroupProps = Omit<SearchResultsProps, "section"> & {
|
|
79
80
|
section: SearchResultImageGroupItem | SearchResultsRecord[] | SearchResultsSection;
|
|
@@ -84,6 +85,7 @@ export declare type SearchResultsItem = SearchResultListItem | SearchResultImage
|
|
|
84
85
|
export declare type SearchResultsProps = {
|
|
85
86
|
section: SearchResultsSection | SearchResultsItem | SearchResultsRecord | Array<SearchResultsItem | SearchResultsRecord>;
|
|
86
87
|
className?: string;
|
|
88
|
+
theme?: SearchResultsTheme;
|
|
87
89
|
footerAction?: SearchResultsAction;
|
|
88
90
|
onRecordClick?: (record: SearchResultsRecord, index: number) => void;
|
|
89
91
|
onItemClick?: (item: SearchResultsItem) => void;
|
|
@@ -173,7 +175,9 @@ export declare type SearchResultsSection = {
|
|
|
173
175
|
className?: string;
|
|
174
176
|
};
|
|
175
177
|
|
|
176
|
-
export declare
|
|
178
|
+
export declare type SearchResultsTheme = "light" | "dark" | "auto";
|
|
179
|
+
|
|
180
|
+
export declare function SearchResultsVideoGroup(props: SearchResultsVideoGroupProps): JSX_2.Element;
|
|
177
181
|
|
|
178
182
|
export declare type SearchResultsVideoGroupProps = Omit<SearchResultsProps, "section"> & {
|
|
179
183
|
section: SearchResultVideoGroupItem | SearchResultsRecord[] | SearchResultsSection;
|
package/dist/search-results.cjs
CHANGED
|
@@ -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}.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 me=require("react"),p=require("clsx"),h=require("lucide-react");var A={exports:{}},N={};var V;function pe(){if(V)return N;V=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,l,i){var o=null;if(i!==void 0&&(o=""+i),l.key!==void 0&&(o=""+l.key),"key"in l){i={};for(var m in l)m!=="key"&&(i[m]=l[m])}else i=l;return l=i.ref,{$$typeof:e,type:n,key:o,ref:l!==void 0?l:null,props:i}}return N.Fragment=t,N.jsx=s,N.jsxs=s,N}var w={};var q;function xe(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ue?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case re:return"Profiler";case te:return"StrictMode";case le:return"Suspense";case ie:return"SuspenseList";case ce:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case ee:return"Portal";case ne:return r.displayName||"Context";case se:return(r._context.displayName||"Context")+".Consumer";case ae:var c=r.render;return r=r.displayName,r||(r=c.displayName||c.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case oe:return c=r.displayName||null,c!==null?c:e(r.type)||"Memo";case R:c=r._payload,r=r._init;try{return e(r(c))}catch{}}return null}function t(r){return""+r}function s(r){try{t(r);var c=!1}catch{c=!0}if(c){c=console;var u=c.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return u.call(c,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),t(r)}}function n(r){if(r===k)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===R)return"<...>";try{var c=e(r);return c?"<"+c+">":"<...>"}catch{return"<...>"}}function l(){var r=C.A;return r===null?null:r.getOwner()}function i(){return Error("react-stack-top-frame")}function o(r){if(U.call(r,"key")){var c=Object.getOwnPropertyDescriptor(r,"key").get;if(c&&c.isReactWarning)return!1}return r.key!==void 0}function m(r,c){function u(){B||(B=!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)",c))}u.isReactWarning=!0,Object.defineProperty(r,"key",{get:u,configurable:!0})}function x(){var r=e(this.type);return Y[r]||(Y[r]=!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.")),r=this.props.ref,r!==void 0?r:null}function g(r,c,u,f,_,I){var d=u.ref;return r={$$typeof:$,type:r,key:c,props:u,_owner:f},(d!==void 0?d:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:x}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function v(r,c,u,f,_,I){var d=c.children;if(d!==void 0)if(f)if(fe(d)){for(f=0;f<d.length;f++)y(d[f]);Object.freeze&&Object.freeze(d)}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 y(d);if(U.call(c,"key")){d=e(r);var j=Object.keys(c).filter(function(de){return de!=="key"});f=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",z[d+f]||(j=0<j.length?"{"+j.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} />`,f,d,j,d),z[d+f]=!0)}if(d=null,u!==void 0&&(s(u),d=""+u),o(c)&&(s(c.key),d=""+c.key),"key"in c){u={};for(var O in c)O!=="key"&&(u[O]=c[O])}else u=c;return d&&m(u,typeof r=="function"?r.displayName||r.name||"Unknown":r),g(r,d,u,l(),_,I)}function y(r){b(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===R&&(r._payload.status==="fulfilled"?b(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function b(r){return typeof r=="object"&&r!==null&&r.$$typeof===$}var E=me,$=Symbol.for("react.transitional.element"),ee=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),se=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),le=Symbol.for("react.suspense"),ie=Symbol.for("react.suspense_list"),oe=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),C=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,fe=Array.isArray,S=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(r){return r()}};var B,Y={},D=E.react_stack_bottom_frame.bind(E,i)(),M=S(n(i)),z={};w.Fragment=k,w.jsx=function(r,c,u){var f=1e4>C.recentlyCreatedOwnerStacks++;return v(r,c,u,!1,f?Error("react-stack-top-frame"):D,f?S(n(r)):M)},w.jsxs=function(r,c,u){var f=1e4>C.recentlyCreatedOwnerStacks++;return v(r,c,u,!0,f?Error("react-stack-top-frame"):D,f?S(n(r)):M)}})()),w}var W;function ye(){return W||(W=1,process.env.NODE_ENV==="production"?A.exports=pe():A.exports=xe()),A.exports}var a=ye();function X(e,t){const s=t==="_blank"?"noreferrer noopener":"";return e?s?[...new Set([...e.split(" "),...s.split(" ")].filter(Boolean))].join(" "):e:s||void 0}function F({href:e,target:t,rel:s,onClick:n,className:l,children:i}){const o=l?`${l} cursor-pointer`:"cursor-pointer";return e?a.jsx("a",{href:e,target:t,rel:X(s,t),className:o,onClick:()=>n?.(),children:i}):a.jsx("button",{type:"button",className:o,onClick:n,children:i})}function ge({item:e,onItemClick:t}){const s=e.onClick?void 0:e.href;return a.jsxs(F,{href:s,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:p("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:[a.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:a.jsx("div",{className:"relative aspect-video bg-slate-100",children:a.jsx("img",{src:e.imageUrl,alt:e.imageAlt??e.title,className:"absolute inset-0 h-full w-full object-cover",loading:"lazy"})})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"truncate text-sm font-semibold text-[#333]",children:e.title}),e.subtitle?a.jsx("div",{className:"mt-1 truncate text-sm text-[#666]",children:e.subtitle}):null]})]})}function he({author:e,date:t}){return!e&&!t?null:a.jsxs("div",{className:"flex-none truncate text-xs",children:[e?a.jsx("span",{className:"",children:e}):null,e&&t?a.jsx("span",{className:"mx-1",children:"·"}):null,t?a.jsx("span",{className:"",children:t}):null]})}function Z({breadcrumbs:e}){return e?.length?a.jsx("div",{className:"min-w-0 truncate text-xs",children:e.map((t,s)=>a.jsxs("span",{children:[s>0?a.jsx("span",{className:"mx-1",children:">"}):null,a.jsx("span",{className:"",children:t})]},`${t}-${s}`))}):null}function ve({meta:e}){return e?.length?a.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-[#333]",children:e.map((t,s)=>a.jsx("span",{className:"inline-flex items-center rounded border border-slate-200 bg-white px-3 py-1",children:t},`${t}-${s}`))}):null}function be(e){const t=e.trim().toLowerCase();return t?t==="google"?"G":e.trim().slice(0,1).toUpperCase():""}function T({title:e,titleIcon:t,titleIconBgColor:s,source:n,className:l,titleClassName:i}){return!e&&!t&&!n?null:a.jsxs("div",{className:p("mb-2 flex min-w-0 items-center gap-2",l),children:[t?s?a.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md text-white",style:{backgroundColor:s},children:t}):a.jsx("span",{className:"flex-none",children:t}):null,e?a.jsx("div",{className:p("min-w-0 text-xl font-semibold cursor-pointer hover:underline hover:underline-offset-2 group-hover:underline group-hover:underline-offset-2",i),children:e}):null,n?a.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md",title:n,children:be(n)}):null]})}function je(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 Ne(e){switch(e){case"xls":return a.jsx(h.FileSpreadsheet,{className:"h-5 w-5"});case"ppt":return a.jsx(h.Presentation,{className:"h-5 w-5"});case"pdf":case"doc":case"word":case"text":return a.jsx(h.FileText,{className:"h-5 w-5"});default:return a.jsx(h.File,{className:"h-5 w-5"})}}function J({fileType:e,typeIcon:t}){return t?a.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center",children:t}):e?a.jsx("span",{className:p("inline-flex h-6 w-6 items-center justify-center rounded-md",je(e)),children:Ne(e)}):null}function we({item:e,onItemClick:t}){const s=e.typeIcon?a.jsx(J,{typeIcon:e.typeIcon}):e.fileType?a.jsx(J,{fileType:e.fileType}):null,n=e.onClick||t?()=>{e.onClick?.(),t?.(e)}:void 0,l=e.onClick?void 0:e.href,i=a.jsxs("div",{className:"w-full py-2",children:[a.jsx("div",{className:"flex min-w-0 items-center gap-2",children:a.jsx(T,{className:"mb-0 w-full",title:e.title,titleIcon:s,source:e.source,titleClassName:"truncate text-[#1A0CAB]"})}),a.jsxs("div",{className:"mt-2 flex gap-3",children:[e.thumbnailUrl?a.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"}):a.jsx("div",{className:"h-[90px] w-[160px] flex-none rounded-lg bg-slate-100 ring-1 ring-slate-200"}),a.jsxs("div",{className:"min-w-0 flex-1 flex flex-col justify-between",children:[e.description?a.jsx("div",{className:"line-clamp-2 text-sm text-[#666]",children:e.description}):null,e.breadcrumbs?.length||e.author||e.date?a.jsxs("div",{className:"mt-2 flex min-w-0 items-center gap-3 text-[#666]",children:[a.jsx(Z,{breadcrumbs:e.breadcrumbs}),a.jsx("span",{className:"h-3 w-px flex-none bg-[#666]","aria-hidden":"true"}),a.jsxs("div",{className:"flex flex-none items-center gap-2",children:[a.jsx(he,{author:e.author,date:e.date}),e.href?a.jsx("span",{className:"flex-none text-[#007EFF]",children:a.jsx(h.ExternalLink,{className:"h-3 w-3"})}):null]})]}):a.jsx(ve,{meta:e.meta})]})]})]});return!l&&!n?i:a.jsx(F,{href:l,target:e.target,rel:e.rel,onClick:n,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:i})}function Ee({item:e,onItemClick:t}){const s=e.breadcrumbs??[e.sourceLabel,e.categoryLabel].filter(Boolean),n=e.onClick?void 0:e.href;return a.jsxs(F,{href:n,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:p("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:[a.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200",children:a.jsxs("div",{className:"relative aspect-4/3 bg-slate-100",children:[a.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"?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.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:a.jsx(h.Play,{className:"h-5 w-5 translate-x-px"})})}):null]})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"truncate text-sm font-medium",children:e.title}),e.matchCountText?a.jsx("div",{className:"mt-1 truncate text-xs text-[#666]",children:e.matchCountText}):null,s.length?a.jsx("div",{className:"mt-2 text-[#666]",children:a.jsx(Z,{breadcrumbs:s})}):null]})]})}function _e({action:e,className:t}){const s=p("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?a.jsx("a",{className:s,href:e.href,target:e.target,rel:X(e.rel,e.target),onClick:()=>e.onClick?.(),children:e.label}):a.jsx("button",{className:s,type:"button",onClick:e.onClick,children:e.label})}function P({action:e}){return e?a.jsxs("div",{className:"mt-3 flex w-full items-center",children:[a.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"}),a.jsx(_e,{action:e,className:p("rounded-full border border-[#E8E8E8] bg-white px-4 py-2 text-sm font-medium text-[#333] transition","hover:border-[#E8E8E8] hover:bg-[#F5F5F5]")}),a.jsx("span",{className:"h-px flex-1 bg-[#E8E8E8]","aria-hidden":"true"})]}):null}function Ae(e,t){if(e.layout==="list")return a.jsxs("div",{className:p("space-y-6",e.className),children:[a.jsx(T,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),e.items.map(l=>a.jsx(we,{item:l,onItemClick:t},l.id)),a.jsx(P,{action:e.footerAction})]});if(e.layout==="mediaGrid"){const l=e.columns??3,i=l===2?"grid-cols-2":l===4?"grid-cols-4":"grid-cols-3";return a.jsxs("div",{className:p(e.className),children:[a.jsx(T,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),a.jsx("div",{className:p("grid gap-3",i),children:e.items.map(o=>a.jsx(Ee,{item:o,onItemClick:t},o.id))}),a.jsx(P,{action:e.footerAction})]})}const s=e.columns??3,n=s===2?"grid-cols-2":s===4?"grid-cols-4":"grid-cols-3";return a.jsxs("div",{className:p(e.className),children:[a.jsx(T,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),a.jsx("div",{className:p("grid gap-3",n),children:e.items.map(l=>a.jsx(ge,{item:l,onItemClick:t},l.id))}),a.jsx(P,{action:e.footerAction})]})}function Te(e){if(!e)return;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function ke(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 G(e,t,s){const n=e.thumbnail??e.cover??e.metadata?.thumbnail_link,l=e.summary??e.content,i=ke(e.metadata?.file_extension??e.type),o=e.source?.name,m=e.category??e.categories?.join(" / ")??"Categories",x=[o,m].filter(Boolean),g=e.last_updated_by?.user?.username??e.owner?.username,v=Te(e.last_updated_by?.timestamp??e.metadata?.last_reviewed),y=e.metadata?.icon_link??e.icon,b=y?a.jsx("img",{src:y,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:l,thumbnailUrl:n,fileType:i,typeIcon:b,breadcrumbs:x.length?x:void 0,author:g,date:v,onClick:s}}function L({section:e,className:t,footerAction:s,onRecordClick:n,onItemClick:l}){const i=Re(Q(e,n),s);return a.jsx("div",{className:p(t),children:Ae(i,l)})}function Re(e,t){return!t||e.footerAction?e:e.layout==="list"?{...e,footerAction:t}:e.layout==="mediaGrid"?{...e,footerAction:t}:{...e,footerAction:t}}function Ce(e){return a.jsx(L,{...e})}function Se(e){return a.jsx(L,{...e})}function Q(e,t){if(Array.isArray(e))return Ie(e,t);if(Pe(e))return e;const s=e;if(s.type==="imageGroup"&&Array.isArray(s.items)){const l=s;return l.items[0]?.type==="media"?{type:"section",title:l.title,layout:"mediaGrid",items:l.items.filter(o=>typeof o=="object"&&!!o&&o.type==="media"),columns:l.columns,footerAction:l.footerAction,className:l.className}:{type:"section",title:l.title,layout:"imageGrid",items:l.items.filter(o=>typeof o=="object"&&!!o&&o.type==="image"),columns:l.columns,footerAction:l.footerAction,className:l.className}}if(s.type==="videoGroup"&&Array.isArray(s.items)){const l=s;return{type:"section",title:l.title,layout:"mediaGrid",items:l.items,columns:l.columns,footerAction:l.footerAction,className:l.className}}if(s.type==="result")return{type:"section",layout:"list",items:[e]};if(s.type==="media")return{type:"section",layout:"mediaGrid",items:[e]};if(s.type==="image"&&typeof s.imageUrl=="string")return{type:"section",layout:"imageGrid",items:[e]};const n=typeof s.type=="string"?s.type.trim().toLowerCase():void 0;if(n==="image"||n==="video"){const l=typeof s.id=="string"?s.id:void 0,i=typeof s.thumbnail=="string"?s.thumbnail:typeof s.cover=="string"?s.cover:typeof s.metadata=="object"&&s.metadata&&typeof s.metadata.thumbnail_link=="string"?s.metadata.thumbnail_link:void 0;if(i){const o=typeof s.category=="string"?s.category:Array.isArray(s.categories)?s.categories.filter(y=>typeof y=="string").join(" / "):void 0,m=typeof s.title=="string"?s.title:"Untitled",x=typeof s.url=="string"?s.url:void 0,g=typeof s.source=="object"&&s.source&&typeof s.source.name=="string"?s.source.name:void 0;return{type:"section",layout:"mediaGrid",items:[{type:"media",id:l??`${x??m}-0`,mediaType:n==="video"?"video":"image",title:m,href:t?void 0:x,thumbnailUrl:i,sourceLabel:g,categoryLabel:o,breadcrumbs:[g,o].filter(Boolean),...t?{onClick:()=>t(e,0)}:{}}]}}}return{type:"section",layout:"list",items:[G(e,0,t?()=>t(e,0):void 0)]}}function Ie(e,t){if(!e.length)return{type:"section",layout:"list",items:[]};if(e.every(K)){if(e.every(i=>i.type==="result"))return{type:"section",layout:"list",items:e};if(e.every(i=>i.type==="media"))return{type:"section",layout:"mediaGrid",items:e};if(e.every(i=>i.type==="image"&&"imageUrl"in i))return{type:"section",layout:"imageGrid",items:e};if(e.length===1)return Q(e[0],t)}const s=[],n=[];for(const[i,o]of e.entries()){const m=Oe(o,i,t);m?s.push(m):n.push(G(o,i,t?()=>t(o,i):void 0))}return s.length&&!n.length?{type:"section",title:H(e,o=>o.category??o.source?.name),layout:"mediaGrid",items:s}:{type:"section",title:H(e,i=>i.category??i.source?.name),layout:"list",items:n}}function K(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 Oe(e,t,s){const n=e,l=typeof n.type=="string"?n.type.trim().toLowerCase():void 0;if(l!=="image"&&l!=="video")return;const i=typeof n.id=="string"?n.id:void 0,o=typeof n.thumbnail=="string"?n.thumbnail:typeof n.cover=="string"?n.cover:typeof n.metadata=="object"&&n.metadata&&typeof n.metadata.thumbnail_link=="string"?n.metadata.thumbnail_link:void 0;if(!o)return;const m=typeof n.category=="string"?n.category:Array.isArray(n.categories)?n.categories.filter(b=>typeof b=="string").join(" / "):void 0,x=typeof n.title=="string"?n.title:"Untitled",g=typeof n.url=="string"?n.url:void 0,v=typeof n.source=="object"&&n.source&&typeof n.source.name=="string"?n.source.name:void 0,y=!!s&&!K(e);return{type:"media",id:i??`${g??x}-0`,mediaType:l==="video"?"video":"image",title:x,href:y?void 0:g,thumbnailUrl:o,sourceLabel:v,categoryLabel:m,breadcrumbs:[v,m].filter(Boolean),...y?{onClick:()=>s(e,t)}:{}}}function H(e,t){const s=e[0],n=t(s);if(n){for(const l of e)if(t(l)!==n)return;return n}}function Pe(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 Fe(e,t){const s=[];for(const n of e){const l=s.length?s[s.length-1]:void 0;if(n.type==="imageGroup"){n.items[0]?.type==="media"?s.push({type:"section",title:n.title,titleIcon:a.jsx(h.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:n.items.filter(o=>o.type==="media"),columns:n.columns??t,footerAction:n.footerAction,className:n.className}):s.push({type:"section",title:n.title,titleIcon:a.jsx(h.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB]",layout:"imageGrid",items:n.items.filter(o=>o.type==="image"),columns:n.columns??t,footerAction:n.footerAction,className:n.className});continue}if(n.type==="videoGroup"){s.push({type:"section",title:n.title,titleIcon:a.jsx(h.Video,{className:"h-4 w-4"}),titleIconBgColor:"#1784FC",titleClassName:"text-[#1A0CAB]",layout:"mediaGrid",items:n.items,columns:n.columns??t,footerAction:n.footerAction,className:n.className});continue}if(n.type==="result"){if(l?.layout==="list"){l.items.push(n);continue}s.push({type:"section",layout:"list",items:[n]});continue}if(n.type==="media"){if(l?.layout==="mediaGrid"){l.items.push(n);continue}s.push({type:"section",layout:"mediaGrid",...t?{columns:t}:{},items:[n]});continue}if(l?.layout==="imageGrid"){l.items.push(n);continue}s.push({type:"section",layout:"imageGrid",...t?{columns:t}:{},items:[n]})}return s}function Ge(e){return e.map((t,s)=>G(t,s))}exports.SearchResultsImageGroup=Ce;exports.SearchResultsVideoGroup=Se;exports.default=L;exports.itemsToSections=Fe;exports.recordsToItems=Ge;
|
|
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-leading:initial;--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-sky-400:oklch(74.6% .16 232.661);--color-sky-600:oklch(58.8% .158 241.966);--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-400:oklch(70.4% .04 256.788);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--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-1{margin-bottom:calc(var(--spacing)*1)}.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}.justify-end{justify-content:flex-end}.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-slate-200{border-color:var(--color-slate-200)}.border-slate-700{border-color:var(--color-slate-700)}.border-transparent{border-color:#0000}.bg-\\[\\#027FFE\\]{background-color:#027ffe}.bg-\\[\\#E02E2E\\]{background-color:#e02e2e}.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-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-950{background-color:var(--color-slate-950)}.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-2{padding:calc(var(--spacing)*2)}.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-1\\.5{padding-block:calc(var(--spacing)*1.5)}.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))}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.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-\\[\\#333\\]{color:#333}.text-\\[\\#666\\]{color:#666}.text-sky-600{color:var(--color-sky-600)}.text-slate-100{color:var(--color-slate-100)}.text-slate-200{color:var(--color-slate-200)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-900{color:var(--color-slate-900)}.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))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;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-slate-200:hover{border-color:var(--color-slate-200)}.hover\\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\\:bg-slate-100\\/70:hover{background-color:#f1f5f9b3}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-slate-100\\/70:hover{background-color:color-mix(in oklab,var(--color-slate-100)70%,transparent)}}.hover\\:bg-slate-800:hover{background-color:var(--color-slate-800)}.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)}.focus-visible\\:ring-slate-600:focus-visible{--tw-ring-color:var(--color-slate-600)}.dark\\:border-slate-700:where(.dark,.dark *){border-color:var(--color-slate-700)}.dark\\:bg-slate-700:where(.dark,.dark *){background-color:var(--color-slate-700)}.dark\\:bg-slate-800:where(.dark,.dark *){background-color:var(--color-slate-800)}.dark\\:bg-slate-900:where(.dark,.dark *){background-color:var(--color-slate-900)}.dark\\:text-\\[\\#8AB4F8\\]:where(.dark,.dark *){color:#8ab4f8}.dark\\:text-sky-400:where(.dark,.dark *){color:var(--color-sky-400)}.dark\\:text-slate-100:where(.dark,.dark *){color:var(--color-slate-100)}.dark\\:text-slate-200:where(.dark,.dark *){color:var(--color-slate-200)}.dark\\:text-slate-300:where(.dark,.dark *){color:var(--color-slate-300)}.dark\\:text-slate-400:where(.dark,.dark *){color:var(--color-slate-400)}.dark\\:ring-slate-700:where(.dark,.dark *){--tw-ring-color:var(--color-slate-700)}@media(hover:hover){.dark\\:hover\\:border-slate-600:where(.dark,.dark *):hover{border-color:var(--color-slate-600)}.dark\\:hover\\:border-slate-700:where(.dark,.dark *):hover{border-color:var(--color-slate-700)}.dark\\:hover\\:bg-slate-800:where(.dark,.dark *):hover{background-color:var(--color-slate-800)}.dark\\:hover\\:bg-slate-800\\/60:where(.dark,.dark *):hover{background-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-slate-800\\/60:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-slate-800)60%,transparent)}}}.dark\\:focus-visible\\:ring-slate-600:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-slate-600)}}@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-leading{syntax:"*";inherits:false}@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 r=require("react/jsx-runtime"),o=require("clsx"),u=require("lucide-react");function h({breadcrumbs:e}){return e?.length?r.jsx("div",{className:"min-w-0 truncate text-xs",children:e.map((t,s)=>r.jsxs("span",{children:[s>0?r.jsx("span",{className:"mx-1",children:">"}):null,r.jsx("span",{className:"",children:t})]},`${t}-${s}`))}):null}function w(e,t){const s=t==="_blank"?"noreferrer noopener":"";return e?s?[...new Set([...e.split(" "),...s.split(" ")].filter(Boolean))].join(" "):e:s||void 0}function b({href:e,target:t,rel:s,onClick:l,className:i,children:a}){const n=i?`${i} cursor-pointer`:"cursor-pointer";return e?r.jsx("a",{href:e,target:t,rel:w(s,t),className:n,onClick:()=>l?.(),children:a}):r.jsx("button",{type:"button",className:n,onClick:l,children:a})}function I({item:e,onItemClick:t}){const s=e.onClick?void 0:e.href,l=e.breadcrumbs??[];return r.jsxs(b,{href:s,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:o("group block w-full rounded-xl border border-transparent p-2 text-left no-underline transition-colors","hover:border-slate-200 hover:bg-slate-100/70 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300","dark:hover:border-slate-700 dark:hover:bg-slate-800/60 dark:focus-visible:ring-slate-600"),children:[r.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200 dark:ring-slate-700",children:r.jsx("div",{className:"relative aspect-video bg-slate-100 dark:bg-slate-800",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-slate-900 dark:text-slate-100",children:e.title}),e.subtitle?r.jsx("div",{className:"mt-1 truncate text-sm text-slate-600 dark:text-slate-300",children:e.subtitle}):null,l.length?r.jsx("div",{className:"mt-2 text-slate-600 dark:text-slate-300",children:r.jsx(h,{breadcrumbs:l})}):null]})]})}function T({author:e,date:t}){return!e&&!t?null:r.jsxs("div",{className:"flex-none truncate text-xs",children:[e?r.jsx("span",{className:"",children:e}):null,e&&t?r.jsx("span",{className:"mx-1",children:"·"}):null,t?r.jsx("span",{className:"",children:t}):null]})}function G({meta:e}){return e?.length?r.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-slate-700 dark:text-slate-200",children:e.map((t,s)=>r.jsx("span",{className:"inline-flex items-center rounded border border-slate-200 bg-white px-3 py-1 dark:border-slate-700 dark:bg-slate-900",children:t},`${t}-${s}`))}):null}function B(e){const t=e.trim().toLowerCase();return t?t==="google"?"G":e.trim().slice(0,1).toUpperCase():""}function g({title:e,titleIcon:t,titleIconBgColor:s,source:l,className:i,titleClassName:a}){return!e&&!t&&!l?null:r.jsxs("div",{className:o("mb-2 flex min-w-0 items-center gap-2",i),children:[t?r.jsx("span",{className:o("inline-flex h-6 w-6 flex-none items-center justify-center",s&&"rounded-md text-white"),style:s?{backgroundColor:s}:void 0,children:t}):null,e?r.jsx("div",{className:o("min-w-0 cursor-pointer text-xl font-semibold leading-6 hover:underline hover:underline-offset-2 group-hover:underline group-hover:underline-offset-2",a),children:e}):null,l?r.jsx("span",{className:"inline-flex h-6 w-6 flex-none items-center justify-center rounded-md bg-slate-100 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:l,children:B(l)}):null]})}function F(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 dark:bg-slate-800 dark:text-slate-200"}}function S(e){switch(e){case"xls":return r.jsx(u.FileSpreadsheet,{className:"h-5 w-5"});case"ppt":return r.jsx(u.Presentation,{className:"h-5 w-5"});case"pdf":case"doc":case"word":case"text":return r.jsx(u.FileText,{className:"h-5 w-5"});default:return r.jsx(u.File,{className:"h-5 w-5"})}}function N({fileType:e,typeIcon:t}){return t?r.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center",children:t}):e?r.jsx("span",{className:o("inline-flex h-6 w-6 items-center justify-center rounded-md",F(e)),children:S(e)}):null}function L({item:e,onItemClick:t}){const s=e.typeIcon?r.jsx(N,{typeIcon:e.typeIcon}):e.fileType?r.jsx(N,{fileType:e.fileType}):null,l=e.onClick||t?()=>{e.onClick?.(),t?.(e)}:void 0,i=e.onClick?void 0:e.href,a=r.jsxs("div",{className:"w-full py-2",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2",children:r.jsx(g,{className:"mb-0 w-full",title:e.title,titleIcon:s,source:e.source,titleClassName:"truncate text-[#1A0CAB] dark:text-[#8AB4F8]"})}),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 dark:ring-slate-700",loading:"lazy"}):null,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-slate-600 dark:text-slate-400",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] dark:text-slate-400",children:[r.jsx(h,{breadcrumbs:e.breadcrumbs}),r.jsx("span",{className:"h-3 w-px flex-none bg-slate-300 dark:bg-slate-700","aria-hidden":"true"}),r.jsxs("div",{className:"flex flex-none items-center gap-2",children:[r.jsx(T,{author:e.author,date:e.date}),e.href?r.jsx("span",{className:"flex-none text-sky-600 dark:text-sky-400",children:r.jsx(u.ExternalLink,{className:"h-3 w-3"})}):null]})]}):r.jsx(G,{meta:e.meta})]})]})]});return!i&&!l?a:r.jsx(b,{href:i,target:e.target,rel:e.rel,onClick:l,className:o("group block w-full rounded-xl border border-transparent px-3 py-2 text-left no-underline transition-colors","hover:border-slate-200 hover:bg-slate-100/70 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300","dark:hover:border-slate-700 dark:hover:bg-slate-800/60 dark:focus-visible:ring-slate-600"),children:a})}function U({item:e,onItemClick:t}){const s=e.breadcrumbs??[e.sourceLabel,e.categoryLabel].filter(Boolean),l=e.onClick?void 0:e.href;return r.jsxs(b,{href:l,target:e.target,rel:e.rel,onClick:()=>{e.onClick?.(),t?.(e)},className:o("group block w-full rounded-xl border border-transparent p-2 text-left no-underline transition-colors","hover:border-slate-200 hover:bg-slate-100/70 focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300","dark:hover:border-slate-700 dark:hover:bg-slate-800/60 dark:focus-visible:ring-slate-600"),children:[r.jsx("div",{className:"overflow-hidden rounded-lg ring-1 ring-slate-200 dark:ring-slate-700",children:r.jsxs("div",{className:"relative aspect-4/3 bg-slate-100 dark:bg-slate-800",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(u.Play,{className:"h-5 w-5 translate-x-px"})})}):null]})}),r.jsxs("div",{className:"mt-2",children:[r.jsx("div",{className:"mb-1 truncate text-sm font-medium text-[#333] dark:text-slate-100",children:e.title}),e.matchCountText?r.jsx("div",{className:"mb-1 truncate text-xs text-[#666] dark:text-slate-400",children:e.matchCountText}):null,s.length?r.jsxs("div",{className:"text-[#666] dark:text-slate-400",children:[r.jsx(h,{breadcrumbs:s})," "]}):null]})]})}function _({action:e,className:t}){const s=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","dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200 dark:hover:border-slate-600 dark:hover:bg-slate-800 dark:focus-visible:ring-slate-600",t);return e.href?r.jsx("a",{className:s,href:e.href,target:e.target,rel:w(e.rel,e.target),onClick:()=>e.onClick?.(),children:e.label}):r.jsx("button",{className:s,type:"button",onClick:e.onClick,children:e.label})}function y({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-slate-200 dark:bg-slate-700","aria-hidden":"true"}),r.jsx(_,{action:e,className:o("px-4")}),r.jsx("span",{className:"h-px flex-1 bg-slate-200 dark:bg-slate-700","aria-hidden":"true"})]}):null}function $(e,t){if(e.layout==="list")return r.jsxs("div",{className:o("space-y-6",e.className),children:[r.jsx(g,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),e.items.map(i=>r.jsx(L,{item:i,onItemClick:t},i.id)),r.jsx(y,{action:e.footerAction})]});if(e.layout==="mediaGrid"){const i=e.columns??3,a=i===2?"grid-cols-2":i===4?"grid-cols-4":"grid-cols-3";return r.jsxs("div",{className:o(e.className),children:[r.jsx(g,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),r.jsx("div",{className:o("grid gap-3",a),children:e.items.map(n=>r.jsx(U,{item:n,onItemClick:t},n.id))}),r.jsx(y,{action:e.footerAction})]})}const s=e.columns??3,l=s===2?"grid-cols-2":s===4?"grid-cols-4":"grid-cols-3";return r.jsxs("div",{className:o(e.className),children:[r.jsx(g,{title:e.title,titleIcon:e.titleIcon,titleIconBgColor:e.titleIconBgColor,titleClassName:e.titleClassName}),r.jsx("div",{className:o("grid gap-3",l),children:e.items.map(i=>r.jsx(I,{item:i,onItemClick:t},i.id))}),r.jsx(y,{action:e.footerAction})]})}function M(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,s){const l=e.thumbnail??e.cover??e.metadata?.thumbnail_link,i=e.summary??e.content,a=z(e.metadata?.file_extension??e.type),n=e.source?.name,c=e.category??e.categories?.join(" / ")??"Categories",d=[n,c].filter(Boolean),m=e.last_updated_by?.user?.username??e.owner?.username,x=M(e.last_updated_by?.timestamp??e.metadata?.last_reviewed),f=e.metadata?.icon_link??e.icon,p=f?r.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:i,thumbnailUrl:l,fileType:a,typeIcon:p,breadcrumbs:d.length?d:void 0,author:m,date:x,onClick:s}}function j({section:e,className:t,theme:s,footerAction:l,onRecordClick:i,onItemClick:a}){const n=H(A(e,i),l),c=E(s);return r.jsx("div",{className:o(c==="dark"&&"dark",t),children:$(n,a)})}function E(e){if(e)return e==="light"?"light":e==="dark"||typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function H(e,t){return!t||e.footerAction?e:e.layout==="list"?{...e,footerAction:t}:e.layout==="mediaGrid"?{...e,footerAction:t}:{...e,footerAction:t}}function V(e){return r.jsx(j,{...e})}function q(e){return r.jsx(j,{...e})}function A(e,t){if(Array.isArray(e))return D(e,t);if(O(e))return e;const s=e;if(s.type==="imageGroup"&&Array.isArray(s.items)){const i=s;return i.items[0]?.type==="media"?{type:"section",title:i.title,layout:"mediaGrid",items:i.items.filter(n=>typeof n=="object"&&!!n&&n.type==="media"),columns:i.columns,footerAction:i.footerAction,className:i.className}:{type:"section",title:i.title,layout:"imageGrid",items:i.items.filter(n=>typeof n=="object"&&!!n&&n.type==="image"),columns:i.columns,footerAction:i.footerAction,className:i.className}}if(s.type==="videoGroup"&&Array.isArray(s.items)){const i=s;return{type:"section",title:i.title,layout:"mediaGrid",items:i.items,columns:i.columns,footerAction:i.footerAction,className:i.className}}if(s.type==="result")return{type:"section",layout:"list",items:[e]};if(s.type==="media")return{type:"section",layout:"mediaGrid",items:[e]};if(s.type==="image"&&typeof s.imageUrl=="string")return{type:"section",layout:"imageGrid",items:[e]};const l=typeof s.type=="string"?s.type.trim().toLowerCase():void 0;if(l==="image"||l==="video"){const i=typeof s.id=="string"?s.id:void 0,a=typeof s.thumbnail=="string"?s.thumbnail:typeof s.cover=="string"?s.cover:typeof s.metadata=="object"&&s.metadata&&typeof s.metadata.thumbnail_link=="string"?s.metadata.thumbnail_link:void 0;if(a){const n=typeof s.category=="string"?s.category:Array.isArray(s.categories)?s.categories.filter(f=>typeof f=="string").join(" / "):void 0,c=typeof s.title=="string"?s.title:"Untitled",d=typeof s.url=="string"?s.url:void 0,m=typeof s.source=="object"&&s.source&&typeof s.source.name=="string"?s.source.name:void 0;return{type:"section",layout:"mediaGrid",items:[{type:"media",id:i??`${d??c}-0`,mediaType:l==="video"?"video":"image",title:c,href:t?void 0:d,thumbnailUrl:a,sourceLabel:m,categoryLabel:n,breadcrumbs:[m,n].filter(Boolean),...t?{onClick:()=>t(e,0)}:{}}]}}}return{type:"section",layout:"list",items:[v(e,0,t?()=>t(e,0):void 0)]}}function D(e,t){if(!e.length)return{type:"section",layout:"list",items:[]};if(e.every(C)){if(e.every(a=>a.type==="result"))return{type:"section",layout:"list",items:e};if(e.every(a=>a.type==="media"))return{type:"section",layout:"mediaGrid",items:e};if(e.every(a=>a.type==="image"&&"imageUrl"in a))return{type:"section",layout:"imageGrid",items:e};if(e.length===1)return A(e[0],t)}const s=[],l=[];for(const[a,n]of e.entries()){const c=P(n,a,t);c?s.push(c):l.push(v(n,a,t?()=>t(n,a):void 0))}return s.length&&!l.length?{type:"section",title:k(e,n=>n.category??n.source?.name),layout:"mediaGrid",items:s}:{type:"section",title:k(e,a=>a.category??a.source?.name),layout:"list",items:l}}function C(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 P(e,t,s){const l=e,i=typeof l.type=="string"?l.type.trim().toLowerCase():void 0;if(i!=="image"&&i!=="video")return;const a=typeof l.id=="string"?l.id:void 0,n=typeof l.thumbnail=="string"?l.thumbnail:typeof l.cover=="string"?l.cover:typeof l.metadata=="object"&&l.metadata&&typeof l.metadata.thumbnail_link=="string"?l.metadata.thumbnail_link:void 0;if(!n)return;const c=typeof l.category=="string"?l.category:Array.isArray(l.categories)?l.categories.filter(p=>typeof p=="string").join(" / "):void 0,d=typeof l.title=="string"?l.title:"Untitled",m=typeof l.url=="string"?l.url:void 0,x=typeof l.source=="object"&&l.source&&typeof l.source.name=="string"?l.source.name:void 0,f=!!s&&!C(e);return{type:"media",id:a??`${m??d}-0`,mediaType:i==="video"?"video":"image",title:d,href:f?void 0:m,thumbnailUrl:n,sourceLabel:x,categoryLabel:c,breadcrumbs:[x,c].filter(Boolean),...f?{onClick:()=>s(e,t)}:{}}}function k(e,t){const s=e[0],l=t(s);if(l){for(const i of e)if(t(i)!==l)return;return l}}function O(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 R(e,t){const s=[];for(const l of e){const i=s.length?s[s.length-1]:void 0;if(l.type==="imageGroup"){l.items[0]?.type==="media"?s.push({type:"section",title:l.title,titleIcon:r.jsx(u.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB] dark:text-[#8AB4F8]",layout:"mediaGrid",items:l.items.filter(n=>n.type==="media"),columns:l.columns??t,footerAction:l.footerAction,className:l.className}):s.push({type:"section",title:l.title,titleIcon:r.jsx(u.Image,{className:"h-4 w-4"}),titleIconBgColor:"#FFAF36",titleClassName:"text-[#1A0CAB] dark:text-[#8AB4F8]",layout:"imageGrid",items:l.items.filter(n=>n.type==="image"),columns:l.columns??t,footerAction:l.footerAction,className:l.className});continue}if(l.type==="videoGroup"){s.push({type:"section",title:l.title,titleIcon:r.jsx(u.Video,{className:"h-4 w-4"}),titleIconBgColor:"#1784FC",titleClassName:"text-[#1A0CAB] dark:text-[#8AB4F8]",layout:"mediaGrid",items:l.items,columns:l.columns??t,footerAction:l.footerAction,className:l.className});continue}if(l.type==="result"){if(i?.layout==="list"){i.items.push(l);continue}s.push({type:"section",layout:"list",items:[l]});continue}if(l.type==="media"){if(i?.layout==="mediaGrid"){i.items.push(l);continue}s.push({type:"section",layout:"mediaGrid",...t?{columns:t}:{},items:[l]});continue}if(i?.layout==="imageGrid"){i.items.push(l);continue}s.push({type:"section",layout:"imageGrid",...t?{columns:t}:{},items:[l]})}return s}function J(e){return e.map((t,s)=>v(t,s))}exports.SearchResultsImageGroup=V;exports.SearchResultsVideoGroup=q;exports.default=j;exports.itemsToSections=R;exports.recordsToItems=J;
|