wimui 0.43.0 → 0.45.0

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.ja.md CHANGED
@@ -307,7 +307,7 @@ peer 依存コンポーネントは**コンポーネント別の専用サブパ
307
307
  | Markdown | `wimui/data-display/markdown` | `react-markdown` `remark-gfm` |
308
308
  | QRCode | `wimui/data-display/qr-code` | `qrcode.react` |
309
309
  | NodeGraph | `wimui/data-display/node-graph` | `@xyflow/react` |
310
- | ScheduleView | `wimui/data-display/schedule-view` | `@fullcalendar/core` `@fullcalendar/react` `@fullcalendar/daygrid` `@fullcalendar/timegrid` `@fullcalendar/interaction` |
310
+ | ScheduleView | `wimui/data-display/schedule-view` | `@fullcalendar/core` `@fullcalendar/react` `@fullcalendar/daygrid` `@fullcalendar/timegrid` `@fullcalendar/interaction`(`^6`。@6 を付けて入れてください。FullCalendar 7 には対応しておらず、pnpm は版を指定しないと core と react の最新(7)を入れます) |
311
311
  | JsonDiffViewer | `wimui/data-display/json-diff-viewer` | `diff` |
312
312
  | StreamingText | `wimui/ai/streaming-text` | `react-markdown` `remark-gfm` |
313
313
  | MarkdownRenderer | `wimui/ai/markdown-renderer` | `react-markdown` `remark-gfm` |
package/README.md CHANGED
@@ -305,7 +305,7 @@ Each peer-dependent component has its **own subpath** whose name documents its p
305
305
  | Markdown | `wimui/data-display/markdown` | `react-markdown` `remark-gfm` |
306
306
  | QRCode | `wimui/data-display/qr-code` | `qrcode.react` |
307
307
  | NodeGraph | `wimui/data-display/node-graph` | `@xyflow/react` |
308
- | ScheduleView | `wimui/data-display/schedule-view` | `@fullcalendar/core` `@fullcalendar/react` `@fullcalendar/daygrid` `@fullcalendar/timegrid` `@fullcalendar/interaction` |
308
+ | ScheduleView | `wimui/data-display/schedule-view` | `@fullcalendar/core` `@fullcalendar/react` `@fullcalendar/daygrid` `@fullcalendar/timegrid` `@fullcalendar/interaction` (`^6`. Install them with @6: FullCalendar 7 is not supported, and pnpm installs the latest core and react (7) unless you pin them) |
309
309
  | JsonDiffViewer | `wimui/data-display/json-diff-viewer` | `diff` |
310
310
  | StreamingText | `wimui/ai/streaming-text` | `react-markdown` `remark-gfm` |
311
311
  | MarkdownRenderer | `wimui/ai/markdown-renderer` | `react-markdown` `remark-gfm` |
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/chevron-right.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../../hooks/useMergedRef.cjs"),a=require("../Table/Table.cjs"),o=require("./layoutPivot.cjs"),s=require("./pivot-table.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=(e,t=[])=>{for(let n of e)n.children?.length&&(t.push(n.key),d(n.children,t));return t},f=c.default.forwardRef(({rows:e,columns:f,getValue:p,rowAxisLabel:m,caption:h,expandedValues:g,defaultExpandedValues:_,onExpandedChange:v,maxHeight:y,stickyHeader:b=!1,stickyRowHeaders:ee=!1,columnSubtotals:x=!1,totalRow:te=!1,totalColumn:S=!1,labels:C,className:w,...T},ne)=>{let{t:re}=t.useWimTranslation(`components`),E=c.default.useId(),D=C?.total??re(`pivottable.total`),O=(0,c.useMemo)(()=>o.layoutPivotColumns(f,{subtotals:x,total:S}),[f,x,S]),[k,A]=(0,c.useState)(()=>_??d(e)),j=g??k,M=(0,c.useMemo)(()=>new Set(j),[j]),N=(0,c.useCallback)(e=>{let t=M.has(e)?j.filter(t=>t!==e):[...j,e];g===void 0&&A(t),v?.(t)},[j,M,g,v]),P=(0,c.useMemo)(()=>o.layoutPivotRows(e,e=>M.has(e)),[e,M]),F=(0,c.useMemo)(()=>d(e).length>0,[e]),I=m!=null&&m!==!1,L=`${E}corner`,ie=e=>`${E}c${e}`,R=e=>`${E}r${e}`,z=`${E}total`,B=(0,c.useMemo)(()=>O.columns.map(e=>e.headerIds.map(e=>`${E}c${e}`).join(` `)),[O,E]),V=c.default.useRef(null),H=c.default.useRef(null),[U,W]=c.default.useState(!1),[G,K]=c.default.useState(!0);c.default.useLayoutEffect(()=>{let e=V.current,t=H.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=()=>{W(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight);let n=t.rows[0]?.cells[0];K(!n||n.offsetWidth<=e.clientWidth/2)};n();let r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[]);let q=i.useMergedRef(ne,H),J=ee&&G,Y=c.default.useRef([]),[ae,oe]=(0,c.useState)([]),X=O.depth;c.default.useLayoutEffect(()=>{if(!b)return;let e=Y.current.slice(0,X),t=()=>{let t=0,n=e.map(e=>{let n=t;return t+=e?.getBoundingClientRect().height??0,n});oe(e=>e.length===n.length&&e.every((e,t)=>e===n[t])?e:n)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return e.forEach(e=>e&&n.observe(e)),()=>n.disconnect()},[b,X]);let Z=(e,t=!1)=>b?{top:Math.floor(ae[e]??0),zIndex:10+X-e+ +!!t}:void 0,Q=`${E}caption`,$=h?{"aria-labelledby":Q}:T[`aria-label`]?{"aria-label":T[`aria-label`]}:T[`aria-labelledby`]?{"aria-labelledby":T[`aria-labelledby`]}:null;return(0,u.jsx)(`div`,{ref:V,className:s.default.scroller,style:y===void 0?void 0:{maxHeight:y},tabIndex:U?0:void 0,...U&&$?{role:`region`,...$}:null,children:(0,u.jsxs)(`table`,{ref:q,className:(0,l.default)(`wim-pivot-table`,s.default.root,w),...T,children:[h&&(0,u.jsx)(`caption`,{id:Q,className:s.default.caption,children:h}),(0,u.jsx)(`colgroup`,{}),O.groupSpans.map((e,t)=>(0,u.jsx)(`colgroup`,{span:e},t)),(0,u.jsx)(a.Table.Header,{children:O.headerRows.map((e,t)=>(0,u.jsxs)(`tr`,{ref:e=>{Y.current[t]=e},children:[t===0&&(I?(0,u.jsx)(`th`,{id:L,scope:`col`,rowSpan:O.depth,className:(0,l.default)(s.default.columnHeader,s.default.corner,s.default.bottom,b&&s.default.stickyTop,J&&s.default.stickyLeft),style:Z(0,!0),children:m}):(0,u.jsx)(`td`,{rowSpan:O.depth,className:(0,l.default)(s.default.columnHeader,s.default.bottom,b&&s.default.stickyTop,J&&s.default.stickyLeft),style:Z(0,!0)})),e.map((e,n)=>(0,u.jsx)(`th`,{id:ie(e.id),scope:e.kind===`group`&&e.topLevel?`colgroup`:`col`,colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,className:(0,l.default)(s.default.columnHeader,e.kind===`group`&&s.default.group,e.reachesBottom&&s.default.bottom,e.startsGroup&&!(J&&n===0)&&s.default.groupStart,b&&s.default.stickyTop),style:Z(t),children:e.kind===`group`||e.kind===`leaf`?e.node?.label:D},e.id))]},t))}),(0,u.jsx)(a.Table.Body,{children:P.map((e,t)=>{let i=[...e.ancestors.map(R),R(t)].join(` `),o=[...I?[L]:[],...e.ancestors.map(R)].join(` `);return(0,u.jsxs)(a.Table.Row,{className:(0,l.default)(e.hasChildren&&s.default.groupRow),children:[(0,u.jsx)(`th`,{id:R(t),scope:`row`,headers:o||void 0,className:(0,l.default)(s.default.rowHeader,J&&s.default.stickyLeft),style:{"--wim-pivot-table-depth":e.depth},children:e.hasChildren?(0,u.jsxs)(`button`,{type:`button`,className:s.default.toggle,"aria-expanded":e.expanded,onClick:()=>N(e.key),children:[(0,u.jsx)(`span`,{className:(0,l.default)(s.default.chevron,e.expanded&&s.default.open),"aria-hidden":`true`,children:(0,u.jsx)(r.Icon,{component:n.default,size:`sm`})}),e.node.label]}):(0,u.jsx)(`span`,{className:(0,l.default)(F&&s.default.leafLabel),children:e.node.label})}),O.columns.map((t,n)=>(0,u.jsx)(a.Table.Cell,{headers:`${i} ${B[n]}`,className:(0,l.default)(s.default.value,t.kind!==`leaf`&&s.default.aggregate,t.startsGroup&&!(J&&n===0)&&s.default.groupStart),children:p(e.key,t.key)},n))]},e.key)})}),te&&(0,u.jsx)(a.Table.Footer,{children:(0,u.jsxs)(a.Table.Row,{className:s.default.totalRow,children:[(0,u.jsx)(`th`,{id:z,scope:`row`,headers:I?L:void 0,className:(0,l.default)(s.default.rowHeader,J&&s.default.stickyLeft),children:(0,u.jsx)(`span`,{className:(0,l.default)(F&&s.default.leafLabel),children:D})}),O.columns.map((e,t)=>(0,u.jsx)(a.Table.Cell,{headers:`${z} ${B[t]}`,className:(0,l.default)(s.default.value,e.startsGroup&&!(J&&t===0)&&s.default.groupStart),children:p(null,e.key)},t))]})})]})})});f.displayName=`PivotTable`,exports.PivotTable=f;
@@ -0,0 +1,133 @@
1
+ import { default as React } from 'react';
2
+ export type PivotTableAxisNode = {
3
+ /** Unique within its axis. Passed back to `getValue`. */
4
+ key: string;
5
+ /**
6
+ * Heading shown for this row or column. On the row axis the label of a group is drawn
7
+ * inside its expand / collapse button, so it must not contain links or other controls.
8
+ */
9
+ label: React.ReactNode;
10
+ /** Nested headings. A node with children is a group; its own value is the subtotal. */
11
+ children?: PivotTableAxisNode[];
12
+ };
13
+ export type PivotTableLabels = {
14
+ /** Heading of the grand total row / column and of each subtotal column. */
15
+ total?: string;
16
+ };
17
+ export type PivotTableProps = Omit<React.ComponentPropsWithoutRef<"table">, "children"> & {
18
+ /** The row axis as a tree. Groups are drawn as an outline: one indented row per node. */
19
+ rows: PivotTableAxisNode[];
20
+ /** The column axis as a tree. Groups become headings that span their columns. */
21
+ columns: PivotTableAxisNode[];
22
+ /**
23
+ * Returns the content of one cell. The component does not aggregate: a group key asks
24
+ * for that group's subtotal and `null` asks for the grand total of that axis. Return
25
+ * `null` or `undefined` for an empty cell.
26
+ */
27
+ getValue: (rowKey: string | null, columnKey: string | null) => React.ReactNode;
28
+ /** Heading of the row axis, shown in the top-left corner. */
29
+ rowAxisLabel?: React.ReactNode;
30
+ /** Visible title of the table, also its accessible name. */
31
+ caption?: React.ReactNode;
32
+ /**
33
+ * Keys of the expanded row groups (controlled). A group that is not listed shows only
34
+ * its own row, which carries its subtotal.
35
+ */
36
+ expandedValues?: string[];
37
+ /** Row groups expanded on first render (uncontrolled). Defaults to every group. */
38
+ defaultExpandedValues?: string[];
39
+ /** Called with the new list of expanded row groups when a group is expanded or collapsed. */
40
+ onExpandedChange?: (values: string[]) => void;
41
+ /**
42
+ * Maximum height of the table (a number is px). Past it the table scrolls vertically
43
+ * inside its own box.
44
+ */
45
+ maxHeight?: string | number;
46
+ /**
47
+ * Keeps the column headings in view while the table scrolls vertically. Every heading
48
+ * level stays, stacked in order. Only has an effect together with `maxHeight`.
49
+ */
50
+ stickyHeader?: boolean;
51
+ /**
52
+ * Keeps the row headings in view while the table scrolls sideways. The column is only
53
+ * pinned while it takes at most half of the visible width; in a narrower container it
54
+ * scrolls with the rest, so that the values stay readable.
55
+ */
56
+ stickyRowHeaders?: boolean;
57
+ /** Adds a subtotal column after the columns of each column group. */
58
+ columnSubtotals?: boolean;
59
+ /** Adds a grand total row at the bottom. */
60
+ totalRow?: boolean;
61
+ /** Adds a grand total column at the right edge. */
62
+ totalColumn?: boolean;
63
+ /** Text of the total headings, for when the built-in translations do not fit. */
64
+ labels?: PivotTableLabels;
65
+ };
66
+ /**
67
+ * PivotTable — draws already aggregated data as a table with multi-level row and column
68
+ * headings, subtotals and grand totals. It only draws: grouping and summing stay with the
69
+ * caller, who answers `getValue(rowKey, columnKey)` for every cell.
70
+ *
71
+ * Row groups can be collapsed to their subtotal row with the button in their heading
72
+ * (Enter or Space). The button is named by the group label, so the heading still reads as
73
+ * the plain label when a cell announces it.
74
+ *
75
+ * Every cell lists the headings it belongs to in its `headers` attribute, so a screen
76
+ * reader announces the full row path and column path of a value.
77
+ *
78
+ * The shell is its own (a sideways scroller and a plain `table`); rows and value cells are
79
+ * `Table.Row` / `Table.Cell`, so spacing and density follow `Table`.
80
+ *
81
+ * Composition Contract:
82
+ * - Managed by: App consumption
83
+ * - Scroll lock: No (the table scrolls sideways inside its own box when it is wider than it)
84
+ */
85
+ export declare const PivotTable: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "children"> & {
86
+ /** The row axis as a tree. Groups are drawn as an outline: one indented row per node. */
87
+ rows: PivotTableAxisNode[];
88
+ /** The column axis as a tree. Groups become headings that span their columns. */
89
+ columns: PivotTableAxisNode[];
90
+ /**
91
+ * Returns the content of one cell. The component does not aggregate: a group key asks
92
+ * for that group's subtotal and `null` asks for the grand total of that axis. Return
93
+ * `null` or `undefined` for an empty cell.
94
+ */
95
+ getValue: (rowKey: string | null, columnKey: string | null) => React.ReactNode;
96
+ /** Heading of the row axis, shown in the top-left corner. */
97
+ rowAxisLabel?: React.ReactNode;
98
+ /** Visible title of the table, also its accessible name. */
99
+ caption?: React.ReactNode;
100
+ /**
101
+ * Keys of the expanded row groups (controlled). A group that is not listed shows only
102
+ * its own row, which carries its subtotal.
103
+ */
104
+ expandedValues?: string[];
105
+ /** Row groups expanded on first render (uncontrolled). Defaults to every group. */
106
+ defaultExpandedValues?: string[];
107
+ /** Called with the new list of expanded row groups when a group is expanded or collapsed. */
108
+ onExpandedChange?: (values: string[]) => void;
109
+ /**
110
+ * Maximum height of the table (a number is px). Past it the table scrolls vertically
111
+ * inside its own box.
112
+ */
113
+ maxHeight?: string | number;
114
+ /**
115
+ * Keeps the column headings in view while the table scrolls vertically. Every heading
116
+ * level stays, stacked in order. Only has an effect together with `maxHeight`.
117
+ */
118
+ stickyHeader?: boolean;
119
+ /**
120
+ * Keeps the row headings in view while the table scrolls sideways. The column is only
121
+ * pinned while it takes at most half of the visible width; in a narrower container it
122
+ * scrolls with the rest, so that the values stay readable.
123
+ */
124
+ stickyRowHeaders?: boolean;
125
+ /** Adds a subtotal column after the columns of each column group. */
126
+ columnSubtotals?: boolean;
127
+ /** Adds a grand total row at the bottom. */
128
+ totalRow?: boolean;
129
+ /** Adds a grand total column at the right edge. */
130
+ totalColumn?: boolean;
131
+ /** Text of the total headings, for when the built-in translations do not fit. */
132
+ labels?: PivotTableLabels;
133
+ } & React.RefAttributes<HTMLTableElement>>;
@@ -0,0 +1,166 @@
1
+ "use client";
2
+ import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
3
+ import t from "../../../icon/chevron-right.js";
4
+ import { Icon as n } from "../../media/Icon/Icon.js";
5
+ import { useMergedRef as r } from "../../../hooks/useMergedRef.js";
6
+ import { Table as i } from "../Table/Table.js";
7
+ import { layoutPivotColumns as a, layoutPivotRows as o } from "./layoutPivot.js";
8
+ import s from "./pivot-table.module.js";
9
+ import c, { useCallback as ee, useMemo as l, useState as u } from "react";
10
+ import d from "classnames";
11
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
12
+ //#region src/components/data-display/PivotTable/PivotTable.tsx
13
+ var m = (e, t = []) => {
14
+ for (let n of e) n.children?.length && (t.push(n.key), m(n.children, t));
15
+ return t;
16
+ }, h = c.forwardRef(({ rows: h, columns: g, getValue: _, rowAxisLabel: v, caption: y, expandedValues: b, defaultExpandedValues: x, onExpandedChange: S, maxHeight: C, stickyHeader: w = !1, stickyRowHeaders: te = !1, columnSubtotals: T = !1, totalRow: ne = !1, totalColumn: E = !1, labels: D, className: re, ...O }, ie) => {
17
+ let { t: k } = e("components"), A = c.useId(), j = D?.total ?? k("pivottable.total"), M = l(() => a(g, {
18
+ subtotals: T,
19
+ total: E
20
+ }), [
21
+ g,
22
+ T,
23
+ E
24
+ ]), [N, P] = u(() => x ?? m(h)), F = b ?? N, I = l(() => new Set(F), [F]), L = ee((e) => {
25
+ let t = I.has(e) ? F.filter((t) => t !== e) : [...F, e];
26
+ b === void 0 && P(t), S?.(t);
27
+ }, [
28
+ F,
29
+ I,
30
+ b,
31
+ S
32
+ ]), R = l(() => o(h, (e) => I.has(e)), [h, I]), z = l(() => m(h).length > 0, [h]), B = v != null && v !== !1, V = `${A}corner`, ae = (e) => `${A}c${e}`, H = (e) => `${A}r${e}`, U = `${A}total`, W = l(() => M.columns.map((e) => e.headerIds.map((e) => `${A}c${e}`).join(" ")), [M, A]), G = c.useRef(null), K = c.useRef(null), [q, oe] = c.useState(!1), [se, ce] = c.useState(!0);
33
+ c.useLayoutEffect(() => {
34
+ let e = G.current, t = K.current;
35
+ if (!e || !t || typeof ResizeObserver > "u") return;
36
+ let n = () => {
37
+ oe(e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight);
38
+ let n = t.rows[0]?.cells[0];
39
+ ce(!n || n.offsetWidth <= e.clientWidth / 2);
40
+ };
41
+ n();
42
+ let r = new ResizeObserver(n);
43
+ return r.observe(e), r.observe(t), () => r.disconnect();
44
+ }, []);
45
+ let le = r(ie, K), J = te && se, Y = c.useRef([]), [ue, de] = u([]), X = M.depth;
46
+ c.useLayoutEffect(() => {
47
+ if (!w) return;
48
+ let e = Y.current.slice(0, X), t = () => {
49
+ let t = 0, n = e.map((e) => {
50
+ let n = t;
51
+ return t += e?.getBoundingClientRect().height ?? 0, n;
52
+ });
53
+ de((e) => e.length === n.length && e.every((e, t) => e === n[t]) ? e : n);
54
+ };
55
+ if (t(), typeof ResizeObserver > "u") return;
56
+ let n = new ResizeObserver(t);
57
+ return e.forEach((e) => e && n.observe(e)), () => n.disconnect();
58
+ }, [w, X]);
59
+ let Z = (e, t = !1) => w ? {
60
+ top: Math.floor(ue[e] ?? 0),
61
+ zIndex: 10 + X - e + +!!t
62
+ } : void 0, Q = `${A}caption`, $ = y ? { "aria-labelledby": Q } : O["aria-label"] ? { "aria-label": O["aria-label"] } : O["aria-labelledby"] ? { "aria-labelledby": O["aria-labelledby"] } : null;
63
+ return /* @__PURE__ */ f("div", {
64
+ ref: G,
65
+ className: s.scroller,
66
+ style: C === void 0 ? void 0 : { maxHeight: C },
67
+ tabIndex: q ? 0 : void 0,
68
+ ...q && $ ? {
69
+ role: "region",
70
+ ...$
71
+ } : null,
72
+ children: /* @__PURE__ */ p("table", {
73
+ ref: le,
74
+ className: d("wim-pivot-table", s.root, re),
75
+ ...O,
76
+ children: [
77
+ y && /* @__PURE__ */ f("caption", {
78
+ id: Q,
79
+ className: s.caption,
80
+ children: y
81
+ }),
82
+ /* @__PURE__ */ f("colgroup", {}),
83
+ M.groupSpans.map((e, t) => /* @__PURE__ */ f("colgroup", { span: e }, t)),
84
+ /* @__PURE__ */ f(i.Header, { children: M.headerRows.map((e, t) => /* @__PURE__ */ p("tr", {
85
+ ref: (e) => {
86
+ Y.current[t] = e;
87
+ },
88
+ children: [t === 0 && (B ? /* @__PURE__ */ f("th", {
89
+ id: V,
90
+ scope: "col",
91
+ rowSpan: M.depth,
92
+ className: d(s.columnHeader, s.corner, s.bottom, w && s.stickyTop, J && s.stickyLeft),
93
+ style: Z(0, !0),
94
+ children: v
95
+ }) : /* @__PURE__ */ f("td", {
96
+ rowSpan: M.depth,
97
+ className: d(s.columnHeader, s.bottom, w && s.stickyTop, J && s.stickyLeft),
98
+ style: Z(0, !0)
99
+ })), e.map((e, n) => /* @__PURE__ */ f("th", {
100
+ id: ae(e.id),
101
+ scope: e.kind === "group" && e.topLevel ? "colgroup" : "col",
102
+ colSpan: e.colSpan > 1 ? e.colSpan : void 0,
103
+ rowSpan: e.rowSpan > 1 ? e.rowSpan : void 0,
104
+ className: d(s.columnHeader, e.kind === "group" && s.group, e.reachesBottom && s.bottom, e.startsGroup && !(J && n === 0) && s.groupStart, w && s.stickyTop),
105
+ style: Z(t),
106
+ children: e.kind === "group" || e.kind === "leaf" ? e.node?.label : j
107
+ }, e.id))]
108
+ }, t)) }),
109
+ /* @__PURE__ */ f(i.Body, { children: R.map((e, r) => {
110
+ let a = [...e.ancestors.map(H), H(r)].join(" "), o = [...B ? [V] : [], ...e.ancestors.map(H)].join(" ");
111
+ return /* @__PURE__ */ p(i.Row, {
112
+ className: d(e.hasChildren && s.groupRow),
113
+ children: [/* @__PURE__ */ f("th", {
114
+ id: H(r),
115
+ scope: "row",
116
+ headers: o || void 0,
117
+ className: d(s.rowHeader, J && s.stickyLeft),
118
+ style: { "--wim-pivot-table-depth": e.depth },
119
+ children: e.hasChildren ? /* @__PURE__ */ p("button", {
120
+ type: "button",
121
+ className: s.toggle,
122
+ "aria-expanded": e.expanded,
123
+ onClick: () => L(e.key),
124
+ children: [/* @__PURE__ */ f("span", {
125
+ className: d(s.chevron, e.expanded && s.open),
126
+ "aria-hidden": "true",
127
+ children: /* @__PURE__ */ f(n, {
128
+ component: t,
129
+ size: "sm"
130
+ })
131
+ }), e.node.label]
132
+ }) : /* @__PURE__ */ f("span", {
133
+ className: d(z && s.leafLabel),
134
+ children: e.node.label
135
+ })
136
+ }), M.columns.map((t, n) => /* @__PURE__ */ f(i.Cell, {
137
+ headers: `${a} ${W[n]}`,
138
+ className: d(s.value, t.kind !== "leaf" && s.aggregate, t.startsGroup && !(J && n === 0) && s.groupStart),
139
+ children: _(e.key, t.key)
140
+ }, n))]
141
+ }, e.key);
142
+ }) }),
143
+ ne && /* @__PURE__ */ f(i.Footer, { children: /* @__PURE__ */ p(i.Row, {
144
+ className: s.totalRow,
145
+ children: [/* @__PURE__ */ f("th", {
146
+ id: U,
147
+ scope: "row",
148
+ headers: B ? V : void 0,
149
+ className: d(s.rowHeader, J && s.stickyLeft),
150
+ children: /* @__PURE__ */ f("span", {
151
+ className: d(z && s.leafLabel),
152
+ children: j
153
+ })
154
+ }), M.columns.map((e, t) => /* @__PURE__ */ f(i.Cell, {
155
+ headers: `${U} ${W[t]}`,
156
+ className: d(s.value, e.startsGroup && !(J && t === 0) && s.groupStart),
157
+ children: _(null, e.key)
158
+ }, t))]
159
+ }) })
160
+ ]
161
+ })
162
+ });
163
+ });
164
+ h.displayName = "PivotTable";
165
+ //#endregion
166
+ export { h as PivotTable };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=e=>!!e.children?.length,t=n=>n.reduce((n,r)=>Math.max(n,1+(e(r)?t(r.children):0)),0);function n(n,r={}){let i=Math.max(1,t(n)),a=Array.from({length:i},()=>[]),o=[],s=[],c=0,l=(e,t,n,r,s,l)=>{let u=c++,d=e?.key??null;a[n].push({id:u,key:d,node:e,kind:t,colSpan:1,rowSpan:i-n,reachesBottom:!0,startsGroup:l,topLevel:s}),o.push({key:d,kind:t,headerIds:[...r,u],startsGroup:l})},u=(t,n,i,o)=>{let s=n===0;if(!e(t))return l(t,`leaf`,n,i,s,o),1;let d={id:c++,key:t.key,node:t,kind:`group`,colSpan:0,rowSpan:1,reachesBottom:!1,startsGroup:o,topLevel:s};a[n].push(d);let f=[...i,d.id],p=0;return t.children.forEach((e,t)=>{p+=u(e,n+1,f,o&&t===0)}),r.subtotals&&(l(t,`subtotal`,n+1,f,!1,!1),p+=1),d.colSpan=p,p};for(let e of n)s.push(u(e,0,[],!0));return r.total&&(l(null,`total`,0,[],!0,!0),s.push(1)),{headerRows:a,columns:o,depth:i,groupSpans:s}}function r(t,n=()=>!0){let r=[],i=(t,a,o)=>{for(let s of t){let t=r.length,c=e(s),l=c&&n(s.key);r.push({key:s.key,node:s,depth:a,hasChildren:c,expanded:l,ancestors:o}),l&&i(s.children,a+1,[...o,t])}};return i(t,0,[]),r}exports.layoutPivotColumns=n,exports.layoutPivotRows=r;
@@ -0,0 +1,67 @@
1
+ /** 軸の木の 1 節。ラベルなど、配置の計算に関係しない項目は型引数の側が持つ。 */
2
+ export type PivotAxisInput = {
3
+ key: string;
4
+ children?: PivotAxisInput[];
5
+ };
6
+ export type PivotHeaderKind = "group" | "leaf" | "subtotal" | "total";
7
+ /** 列見出しの 1 セル。`id` は軸の中で一意な連番で、`headers` 属性の組み立てに使う。 */
8
+ export type PivotHeaderCell<T extends PivotAxisInput = PivotAxisInput> = {
9
+ id: number;
10
+ /** 軸のキー。総計の列は `null`。小計の列は、まとめているグループのキー。 */
11
+ key: string | null;
12
+ /** 元の節。総計の列は `null`。小計の列は、まとめているグループの節。 */
13
+ node: T | null;
14
+ kind: PivotHeaderKind;
15
+ colSpan: number;
16
+ rowSpan: number;
17
+ /** 見出しの最下段に届いているか(本文との境界の帯を描くセル)。 */
18
+ reachesBottom: boolean;
19
+ /** 最上位の節の先頭の列から始まるか(グループの境目)。 */
20
+ startsGroup: boolean;
21
+ /** 最上位の節か。`colgroup` と 1 対 1 に対応するのはこの段だけ。 */
22
+ topLevel: boolean;
23
+ };
24
+ /** 値を持つ 1 列。 */
25
+ export type PivotColumn = {
26
+ /** `getValue` に渡す列のキー。総計の列は `null`。 */
27
+ key: string | null;
28
+ kind: Exclude<PivotHeaderKind, "group">;
29
+ /** この列に掛かる見出しのセルの `id`(上の段から順)。 */
30
+ headerIds: number[];
31
+ startsGroup: boolean;
32
+ };
33
+ export type PivotColumnLayout<T extends PivotAxisInput = PivotAxisInput> = {
34
+ /** 見出しの段ごとのセル(上の段から順・各段は左から順)。 */
35
+ headerRows: PivotHeaderCell<T>[][];
36
+ columns: PivotColumn[];
37
+ /** 見出しの段の数(列の軸が空でも 1)。 */
38
+ depth: number;
39
+ /** 最上位の節ごとの列の数。`colgroup` の `span` に使う。 */
40
+ groupSpans: number[];
41
+ };
42
+ export type PivotRow<T extends PivotAxisInput = PivotAxisInput> = {
43
+ key: string;
44
+ node: T;
45
+ depth: number;
46
+ hasChildren: boolean;
47
+ /** 子の行が出ているか(グループでない行は常に `false`)。 */
48
+ expanded: boolean;
49
+ /** 祖先の行の番号(返り値の配列の中の位置。根から順)。 */
50
+ ancestors: number[];
51
+ };
52
+ /**
53
+ * 列の軸の木を、見出しの段(`colSpan` / `rowSpan` 付き)と値の列の並びにする。
54
+ *
55
+ * - 葉は、自分の段から最下段まで縦に伸びる(木の深さが揃っていなくても段がずれない)
56
+ * - `subtotals` を付けると、グループごとに子の後ろへ小計の列を 1 本足す
57
+ * - `total` を付けると、右端に総計の列を 1 本足す
58
+ */
59
+ export declare function layoutPivotColumns<T extends PivotAxisInput>(nodes: T[], options?: {
60
+ subtotals?: boolean;
61
+ total?: boolean;
62
+ }): PivotColumnLayout<T>;
63
+ /**
64
+ * 行の軸の木を、深さ優先で 1 行ずつに並べる(アウトライン形式: グループも 1 行を持つ)。
65
+ * 折りたたまれたグループは自分の行だけを出し、配下の行は出さない。
66
+ */
67
+ export declare function layoutPivotRows<T extends PivotAxisInput>(nodes: T[], isExpanded?: (key: string) => boolean): PivotRow<T>[];
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ //#region src/components/data-display/PivotTable/layoutPivot.ts
3
+ var e = (e) => !!e.children?.length, t = (n) => n.reduce((n, r) => Math.max(n, 1 + (e(r) ? t(r.children) : 0)), 0);
4
+ function n(n, r = {}) {
5
+ let i = Math.max(1, t(n)), a = Array.from({ length: i }, () => []), o = [], s = [], c = 0, l = (e, t, n, r, s, l) => {
6
+ let u = c++, d = e?.key ?? null;
7
+ a[n].push({
8
+ id: u,
9
+ key: d,
10
+ node: e,
11
+ kind: t,
12
+ colSpan: 1,
13
+ rowSpan: i - n,
14
+ reachesBottom: !0,
15
+ startsGroup: l,
16
+ topLevel: s
17
+ }), o.push({
18
+ key: d,
19
+ kind: t,
20
+ headerIds: [...r, u],
21
+ startsGroup: l
22
+ });
23
+ }, u = (t, n, i, o) => {
24
+ let s = n === 0;
25
+ if (!e(t)) return l(t, "leaf", n, i, s, o), 1;
26
+ let d = {
27
+ id: c++,
28
+ key: t.key,
29
+ node: t,
30
+ kind: "group",
31
+ colSpan: 0,
32
+ rowSpan: 1,
33
+ reachesBottom: !1,
34
+ startsGroup: o,
35
+ topLevel: s
36
+ };
37
+ a[n].push(d);
38
+ let f = [...i, d.id], p = 0;
39
+ return t.children.forEach((e, t) => {
40
+ p += u(e, n + 1, f, o && t === 0);
41
+ }), r.subtotals && (l(t, "subtotal", n + 1, f, !1, !1), p += 1), d.colSpan = p, p;
42
+ };
43
+ for (let e of n) s.push(u(e, 0, [], !0));
44
+ return r.total && (l(null, "total", 0, [], !0, !0), s.push(1)), {
45
+ headerRows: a,
46
+ columns: o,
47
+ depth: i,
48
+ groupSpans: s
49
+ };
50
+ }
51
+ function r(t, n = () => !0) {
52
+ let r = [], i = (t, a, o) => {
53
+ for (let s of t) {
54
+ let t = r.length, c = e(s), l = c && n(s.key);
55
+ r.push({
56
+ key: s.key,
57
+ node: s,
58
+ depth: a,
59
+ hasChildren: c,
60
+ expanded: l,
61
+ ancestors: o
62
+ }), l && i(s.children, a + 1, [...o, t]);
63
+ }
64
+ };
65
+ return i(t, 0, []), r;
66
+ }
67
+ //#endregion
68
+ export { n as layoutPivotColumns, r as layoutPivotRows };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_scroller_1xfhj_7`,t=`_root_1xfhj_22`,n=`_caption_1xfhj_34`,r=`_columnHeader_1xfhj_41`,i=`_group_1xfhj_55`,a=`_bottom_1xfhj_62`,o=`_corner_1xfhj_65`,s=`_rowHeader_1xfhj_68`,c=`_toggle_1xfhj_81`,l=`_chevron_1xfhj_100`,u=`_open_1xfhj_116`,d=`_leafLabel_1xfhj_120`,f=`_value_1xfhj_127`,p=`_groupRow_1xfhj_133`,m=`_aggregate_1xfhj_138`,h=`_groupStart_1xfhj_142`,g=`_totalRow_1xfhj_145`,_=`_stickyTop_1xfhj_154`,v=`_stickyLeft_1xfhj_159`,y={scroller:e,root:t,caption:n,columnHeader:r,group:i,bottom:a,corner:o,rowHeader:s,toggle:c,chevron:l,open:u,leafLabel:d,value:f,groupRow:p,aggregate:m,groupStart:h,totalRow:g,stickyTop:_,stickyLeft:v};exports.aggregate=m,exports.bottom=a,exports.caption=n,exports.chevron=l,exports.columnHeader=r,exports.corner=o,exports.default=y,exports.group=i,exports.groupRow=p,exports.groupStart=h,exports.leafLabel=d,exports.open=u,exports.root=t,exports.rowHeader=s,exports.scroller=e,exports.stickyLeft=v,exports.stickyTop=_,exports.toggle=c,exports.totalRow=g,exports.value=f;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ //#region src/components/data-display/PivotTable/pivot-table.module.scss
3
+ var e = "_scroller_1xfhj_7", t = "_root_1xfhj_22", n = "_caption_1xfhj_34", r = "_columnHeader_1xfhj_41", i = "_group_1xfhj_55", a = "_bottom_1xfhj_62", o = "_corner_1xfhj_65", s = "_rowHeader_1xfhj_68", c = "_toggle_1xfhj_81", l = "_chevron_1xfhj_100", u = "_open_1xfhj_116", d = "_leafLabel_1xfhj_120", f = "_value_1xfhj_127", p = "_groupRow_1xfhj_133", m = "_aggregate_1xfhj_138", h = "_groupStart_1xfhj_142", g = "_totalRow_1xfhj_145", _ = "_stickyTop_1xfhj_154", v = "_stickyLeft_1xfhj_159", y = {
4
+ scroller: e,
5
+ root: t,
6
+ caption: n,
7
+ columnHeader: r,
8
+ group: i,
9
+ bottom: a,
10
+ corner: o,
11
+ rowHeader: s,
12
+ toggle: c,
13
+ chevron: l,
14
+ open: u,
15
+ leafLabel: d,
16
+ value: f,
17
+ groupRow: p,
18
+ aggregate: m,
19
+ groupStart: h,
20
+ totalRow: g,
21
+ stickyTop: _,
22
+ stickyLeft: v
23
+ };
24
+ //#endregion
25
+ export { m as aggregate, a as bottom, n as caption, l as chevron, r as columnHeader, o as corner, y as default, i as group, p as groupRow, h as groupStart, d as leafLabel, u as open, t as root, s as rowHeader, e as scroller, v as stickyLeft, _ as stickyTop, c as toggle, g as totalRow, f as value };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n({src:e,autoPlay:n,loop:r,muted:i,fit:a,videoId:o,resumePlayback:s,playlist:c,autoPlayNext:l,qualities:u,customControls:d,advancedControls:f,poster:p,containerRef:m}){let h=t.default.useRef(null),g=t.default.useRef(null),_=m??g,[v,y]=(0,t.useState)(!1),[b,x]=(0,t.useState)(0),[S,C]=(0,t.useState)(0),[w,T]=(0,t.useState)(1),[E,D]=(0,t.useState)(i),[O,k]=(0,t.useState)(!1),[A,j]=(0,t.useState)(1),[M,N]=(0,t.useState)(a),[P,F]=(0,t.useState)(0),[I,L]=(0,t.useState)(0),[R,z]=(0,t.useState)(null),[B,V]=(0,t.useState)(null),[H,U]=(0,t.useState)({show:!1,direction:`forward`}),W=u&&u.length>0?u[I].src:c&&c.length>0?c[P].src:e,G=c&&c.length>0&&c[P].poster||p,K=!(d||f);(0,t.useEffect)(()=>{if(o&&s&&h.current){let e=c&&c.length>0?`${o}-${P}`:o,t=localStorage.getItem(`wimui-video-resume-${e}`);t&&(h.current.currentTime=parseFloat(t))}},[o,s,P,c]),(0,t.useEffect)(()=>{n&&h.current&&h.current.play().catch(e=>{})},[n,W]),(0,t.useEffect)(()=>{h.current&&(h.current.volume=w,h.current.muted=E,h.current.playbackRate=A,h.current.loop=r&&(!c||c.length<=1))},[w,E,A,r,c]),(0,t.useEffect)(()=>{let e=()=>{k(!!document.fullscreenElement)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let q=(0,t.useCallback)(e=>{if(h.current){let t=Math.max(0,Math.min(h.current.currentTime+e,S));h.current.currentTime=t,x(t)}},[S]),J=(0,t.useCallback)(()=>{h.current&&(v?h.current.pause():h.current.play(),y(!v))},[v]),Y=(0,t.useCallback)(()=>{D(!E)},[E]),X=(0,t.useCallback)(()=>{_.current&&(document.fullscreenElement?(document.exitFullscreen(),k(!1)):(_.current.requestFullscreen().catch(e=>{}),k(!0)))},[_]),Z=(0,t.useCallback)(async()=>{if(h.current)try{document.pictureInPictureElement?await document.exitPictureInPicture():document.pictureInPictureEnabled&&await h.current.requestPictureInPicture()}catch{}},[]),Q=e=>{if(!h.current)return;let t=h.current.currentTime,n=!h.current.paused;L(e),setTimeout(()=>{h.current&&(h.current.currentTime=t,n&&h.current.play())},50),z(`main`)},$=(0,t.useCallback)(e=>{F(e),h.current&&(h.current.currentTime=0,setTimeout(()=>h.current?.play(),100))},[]);return(0,t.useEffect)(()=>{let e=e=>{if(![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&(d||f)&&(_.current?.contains(document.activeElement)||document.fullscreenElement===_.current||document.activeElement===document.body))switch(e.key.toLowerCase()){case` `:case`k`:e.preventDefault(),J();break;case`arrowright`:e.preventDefault(),q(10);break;case`arrowleft`:e.preventDefault(),q(-10);break;case`arrowup`:{e.preventDefault();let t=Math.min(1,w+.1);T(t),t>0&&D(!1);break}case`arrowdown`:{e.preventDefault();let t=Math.max(0,w-.1);T(t);break}case`m`:e.preventDefault(),Y();break;case`f`:e.preventDefault(),X();break;case`p`:e.preventDefault(),Z()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v,w,S,d,f,q,Y,J,X,Z,_]),{videoRef:h,containerRef:_,isPlaying:v,currentTime:b,duration:S,volume:w,isMuted:E,isFullscreen:O,playbackRate:A,activeFit:M,currentPlayIndex:P,currentQualityIndex:I,activeMenu:R,skipIndicator:H,activeSrc:W,activePoster:G,showNativeControls:K,setVolume:T,setIsMuted:D,setPlaybackRate:j,setActiveFit:N,setCurrentPlayIndex:F,setActiveMenu:z,togglePlay:J,toggleMute:Y,toggleFullscreen:X,togglePiP:Z,skip:q,handleQualityChange:Q,playPlaylistItem:$,handleTimeUpdate:()=>{if(h.current){let e=h.current.currentTime;if(x(e),o&&s&&Math.floor(e)%5==0&&S>0&&e<S-2){let t=c&&c.length>0?`${o}-${P}`:o;localStorage.setItem(`wimui-video-resume-${t}`,e.toString())}}},handleLoadedMetadata:()=>{h.current&&C(h.current.duration)},handleEnded:()=>{if(o&&s){let e=c&&c.length>0?`${o}-${P}`:o;localStorage.removeItem(`wimui-video-resume-${e}`)}c&&c.length>0&&l&&P<c.length-1?(F(e=>e+1),h.current&&setTimeout(()=>{h.current?.play()},100)):y(!1)},handleSeek:e=>{let t=parseFloat(e.target.value);h.current&&(h.current.currentTime=t,x(t))},handleVolumeChange:e=>{let t=parseFloat(e.target.value);T(t),t>0&&D(!1)},handleVideoClick:e=>{if(!d&&!f)return;let t=new Date().getTime(),n=e.currentTarget.getBoundingClientRect(),r=e.clientX-n.left,i=n.width;B&&t-B.time<300?(r>i/2?(q(10),U({show:!0,direction:`forward`})):(q(-10),U({show:!0,direction:`backward`})),setTimeout(()=>U({show:!1,direction:`forward`}),600),V(null)):(V({time:t,x:r}),setTimeout(()=>{Date.now()-t>=290&&J()},300))},formatTime:e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}}exports.useVideoPlayer=n;
2
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n({src:e,autoPlay:n,loop:r,muted:i,fit:a,videoId:o,resumePlayback:s,playlist:c,autoPlayNext:l,qualities:u,customControls:d,advancedControls:f,poster:p,containerRef:m}){let h=t.default.useRef(null),g=t.default.useRef(null),_=m??g,v=t.default.useRef(new Set),y=(0,t.useCallback)((e,t)=>{let n=setTimeout(()=>{v.current.delete(n),e()},t);v.current.add(n)},[]);(0,t.useEffect)(()=>{let e=v.current;return()=>{e.forEach(clearTimeout),e.clear()}},[]);let[b,x]=(0,t.useState)(!1),[S,C]=(0,t.useState)(0),[w,T]=(0,t.useState)(0),[E,D]=(0,t.useState)(1),[O,k]=(0,t.useState)(i),[A,j]=(0,t.useState)(!1),[M,N]=(0,t.useState)(1),[P,F]=(0,t.useState)(a),[I,L]=(0,t.useState)(0),[R,z]=(0,t.useState)(0),[B,V]=(0,t.useState)(null),[H,U]=(0,t.useState)(null),[W,G]=(0,t.useState)({show:!1,direction:`forward`}),K=u&&u.length>0?u[R].src:c&&c.length>0?c[I].src:e,q=c&&c.length>0&&c[I].poster||p,J=!(d||f);(0,t.useEffect)(()=>{if(o&&s&&h.current){let e=c&&c.length>0?`${o}-${I}`:o,t=localStorage.getItem(`wimui-video-resume-${e}`);t&&(h.current.currentTime=parseFloat(t))}},[o,s,I,c]),(0,t.useEffect)(()=>{n&&h.current&&h.current.play().catch(e=>{})},[n,K]),(0,t.useEffect)(()=>{h.current&&(h.current.volume=E,h.current.muted=O,h.current.playbackRate=M,h.current.loop=r&&(!c||c.length<=1))},[E,O,M,r,c]),(0,t.useEffect)(()=>{let e=()=>{j(!!document.fullscreenElement)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let Y=(0,t.useCallback)(e=>{if(h.current){let t=Math.max(0,Math.min(h.current.currentTime+e,w));h.current.currentTime=t,C(t)}},[w]),X=(0,t.useCallback)(()=>{h.current&&(b?h.current.pause():h.current.play(),x(!b))},[b]),Z=(0,t.useCallback)(()=>{k(!O)},[O]),Q=(0,t.useCallback)(()=>{_.current&&(document.fullscreenElement?(document.exitFullscreen(),j(!1)):(_.current.requestFullscreen().catch(e=>{}),j(!0)))},[_]),$=(0,t.useCallback)(async()=>{if(h.current)try{document.pictureInPictureElement?await document.exitPictureInPicture():document.pictureInPictureEnabled&&await h.current.requestPictureInPicture()}catch{}},[]),ee=e=>{if(!h.current)return;let t=h.current.currentTime,n=!h.current.paused;z(e),y(()=>{h.current&&(h.current.currentTime=t,n&&h.current.play())},50),V(`main`)},te=(0,t.useCallback)(e=>{L(e),h.current&&(h.current.currentTime=0,y(()=>h.current?.play(),100))},[y]);return(0,t.useEffect)(()=>{let e=e=>{if(![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&(d||f)&&(_.current?.contains(document.activeElement)||document.fullscreenElement===_.current||document.activeElement===document.body))switch(e.key.toLowerCase()){case` `:case`k`:e.preventDefault(),X();break;case`arrowright`:e.preventDefault(),Y(10);break;case`arrowleft`:e.preventDefault(),Y(-10);break;case`arrowup`:{e.preventDefault();let t=Math.min(1,E+.1);D(t),t>0&&k(!1);break}case`arrowdown`:{e.preventDefault();let t=Math.max(0,E-.1);D(t);break}case`m`:e.preventDefault(),Z();break;case`f`:e.preventDefault(),Q();break;case`p`:e.preventDefault(),$()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,E,w,d,f,Y,Z,X,Q,$,_]),{videoRef:h,containerRef:_,isPlaying:b,currentTime:S,duration:w,volume:E,isMuted:O,isFullscreen:A,playbackRate:M,activeFit:P,currentPlayIndex:I,currentQualityIndex:R,activeMenu:B,skipIndicator:W,activeSrc:K,activePoster:q,showNativeControls:J,setVolume:D,setIsMuted:k,setPlaybackRate:N,setActiveFit:F,setCurrentPlayIndex:L,setActiveMenu:V,togglePlay:X,toggleMute:Z,toggleFullscreen:Q,togglePiP:$,skip:Y,handleQualityChange:ee,playPlaylistItem:te,handleTimeUpdate:()=>{if(h.current){let e=h.current.currentTime;if(C(e),o&&s&&Math.floor(e)%5==0&&w>0&&e<w-2){let t=c&&c.length>0?`${o}-${I}`:o;localStorage.setItem(`wimui-video-resume-${t}`,e.toString())}}},handleLoadedMetadata:()=>{h.current&&T(h.current.duration)},handleEnded:()=>{if(o&&s){let e=c&&c.length>0?`${o}-${I}`:o;localStorage.removeItem(`wimui-video-resume-${e}`)}c&&c.length>0&&l&&I<c.length-1?(L(e=>e+1),h.current&&y(()=>{h.current?.play()},100)):x(!1)},handleSeek:e=>{let t=parseFloat(e.target.value);h.current&&(h.current.currentTime=t,C(t))},handleVolumeChange:e=>{let t=parseFloat(e.target.value);D(t),t>0&&k(!1)},handleVideoClick:e=>{if(!d&&!f)return;let t=new Date().getTime(),n=e.currentTarget.getBoundingClientRect(),r=e.clientX-n.left,i=n.width;H&&t-H.time<300?(r>i/2?(Y(10),G({show:!0,direction:`forward`})):(Y(-10),G({show:!0,direction:`backward`})),y(()=>G({show:!1,direction:`forward`}),600),U(null)):(U({time:t,x:r}),y(()=>{Date.now()-t>=290&&X()},300))},formatTime:e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}}exports.useVideoPlayer=n;