@nice2dev/social 1.2.1 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @nice2dev/social — Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ No changes in this release.
6
+
7
+ ## 1.2.2
8
+
9
+ ### Patch Changes
10
+
11
+ - 06eb0d2: 1.2.2 — library texts through the translator, a translator in the packages that had none, and the
12
+ end of the hook-dependency warnings. Nothing removed or renamed. Upgrade notes:
13
+ `documentation/omniverk/OMNIVERK_UPGRADE_1.2.2.md`.
14
+
15
+ **Translations.** 2,825 new keys in the global dictionary (en, pl, de, fr, es, uk), 80 in the local
16
+ dictionaries of ui-math, ui-diagrams and ui-presentations: column headers, option labels, texts in
17
+ conditions and templates, messages given to setters, labels returned by helpers, Polish texts that
18
+ were the English default. Relative dates through `Intl.RelativeTimeFormat`, plural forms through
19
+ `…One` / `…Many` keys. ui-science, ui-platform, ui-mobile, auth, licensing, templates, social and
20
+ the icon tools translate through `useNiceTranslation` (new peer `@nice2dev/ui-core ^1.2.0`);
21
+ ui-security reads the global translator when its own provider is absent.
22
+
23
+ **Additions.** `labelKey` on ui-mobile `TabItem` and `SwipeAction` (the presets set it);
24
+ `registerWebAuthn` / `authenticateWebAuthn` take the WebAuthn options `NiceWebAuthnButton` used to
25
+ drop (defaults unchanged); `NiceKeyboardHint` shows `descriptionKey`. Eight icons in
26
+ `@nice2dev/icons` — `NtdPoint`, `NtdSegment`, `NtdPerpendicular`, `NtdParallel`, `NtdMidpoint`,
27
+ `NtdAngleBisector`, `NtdGroup`, `NtdUngroup` — and the same names as `NiceIcon` built-ins.
28
+
29
+ **Behaviour changes, agreed.** ui-math, ui-diagrams and ui-presentations follow the app's global
30
+ `NiceI18nProvider` language when their own provider is absent (they stayed English);
31
+ `NicePresentationEditor` without `lang` takes the surrounding language. Icons drawn as glyphs are
32
+ Nice icons: the `NiceGeometry` tools, Align / Group / Ungroup / Layout of the diagram toolbar, the
33
+ presentation grid toggle, zoom and "Add Track" of `NiceDMXTimeline`. icons-gaming and
34
+ icons-filetypes name an icon by its `title` and are decorative without one, like `createIcon`
35
+ (screen readers read "GiHeart" or "DOCX file icon"); new optional `title` on the gaming icon props.
36
+
37
+ **Hook dependencies (161 → 0).** Fixed along the way: `NiceLowPowerMode` re-rendered forever from
38
+ mount and overflowed the stack on wake; `GenericPlayer` / `NiceGenericPlayerStage` restarted the
39
+ track on a volume change; `NiceDMXTimeline` called `onPlay` on every frame and missed cues added
40
+ during playback; `NiceConflictResolution` `autoResolve` never resolved; `NiceMAM` selected by the
41
+ previous filter; `NiceRulesEngine` "Run All" kept only the last result; `NiceCodeEditor` saved with
42
+ the first render's `onSave`; a consumer's cursor handler switched off `NiceCodeEditorAI`
43
+ completion; `useRadioStream` lost a volume set before the first play; `NiceGameEditor` shortcuts,
44
+ `useVoiceControl` continuous sessions, `NiceDeviceTrust` with a host storing the score.
45
+
3
46
  ## 1.2.1
4
47
 
5
48
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),U=l.forwardRef(function(u,M){const{comments:m,currentUserId:n,onSubmit:o,onEdit:_,onDelete:g,onReact:r,readOnly:b=!1,maxDepth:$=4,reactions:S=["👍","❤️","😂","😮","😢"],placeholder:y="Write a comment…",className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(null),[t,i]=l.useState(""),[c,a]=l.useState(null),[N,L]=l.useState(""),T=new Map;for(const d of m){const A=d.parentId??"__root__";T.has(A)||T.set(A,[]),T.get(A).push(d)}const P=l.useCallback(()=>{!x.trim()||!o||(o(x.trim()),s(""))},[x,o]),R=l.useCallback(()=>{!t.trim()||!o||!h||(o(t.trim(),h),i(""),v(null))},[t,h,o]),C=l.useCallback(()=>{!c||!N.trim()||!_||(_(c,N.trim()),a(null),L(""))},[c,N,_]),I=(d,A)=>{const F=n&&d.authorId===n,p=T.get(d.id)??[];return e.jsxs("div",{className:"nice-comments__item",style:{marginLeft:A*24},children:[e.jsxs("div",{className:"nice-comments__header",children:[d.authorAvatarUrl&&e.jsx("img",{src:d.authorAvatarUrl,alt:"",className:"nice-comments__avatar"}),e.jsx("strong",{className:"nice-comments__author",children:d.authorName}),e.jsx("time",{className:"nice-comments__time",children:d.createdAt}),d.isEdited&&e.jsx("span",{className:"nice-comments__edited",children:"(edited)"})]}),c===d.id?e.jsxs("div",{className:"nice-comments__edit-form",children:[e.jsx("textarea",{value:N,onChange:j=>L(j.target.value)}),e.jsx("button",{onClick:C,children:"Save"}),e.jsx("button",{onClick:()=>a(null),children:"Cancel"})]}):e.jsx("p",{className:"nice-comments__content",children:d.isDeleted?e.jsx("em",{children:"Comment deleted"}):d.content}),!d.isDeleted&&d.reactions&&e.jsx("div",{className:"nice-comments__reactions",children:Object.entries(d.reactions).map(([j,f])=>e.jsxs("button",{className:"nice-comments__reaction",onClick:()=>r==null?void 0:r(d.id,j),children:[j," ",f]},j))}),!d.isDeleted&&!b&&e.jsxs("div",{className:"nice-comments__actions",children:[r&&S.map(j=>e.jsx("button",{onClick:()=>r(d.id,j),title:j,children:j},j)),A<$&&e.jsx("button",{onClick:()=>{v(d.id),i("")},children:"Reply"}),F&&_&&e.jsx("button",{onClick:()=>{a(d.id),L(d.content)},children:"Edit"}),F&&g&&e.jsx("button",{onClick:()=>g(d.id),children:"Delete"})]}),h===d.id&&e.jsxs("div",{className:"nice-comments__reply-form",children:[e.jsx("textarea",{value:t,onChange:j=>i(j.target.value),placeholder:"Write a reply…"}),e.jsx("button",{onClick:R,disabled:!t.trim(),children:"Send"}),e.jsx("button",{onClick:()=>v(null),children:"Cancel"})]}),p.map(j=>I(j,A+1))]},d.id)},D=T.get("__root__")??[];return e.jsxs("div",{ref:M,className:`nice-comments ${k??""}`,style:w,children:[!b&&e.jsxs("div",{className:"nice-comments__new",children:[e.jsx("textarea",{value:x,onChange:d=>s(d.target.value),placeholder:y}),e.jsx("button",{onClick:P,disabled:!x.trim(),children:"Post"})]}),D.length===0?e.jsx("p",{className:"nice-comments__empty",children:"No comments yet."}):D.map(d=>I(d,0))]})}),z={star:"polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",heart:"polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",share:"polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",thumb:"polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)","thumb-down":"polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"},W=({shape:E,filled:u=!0})=>e.jsx("span",{"aria-hidden":"true",className:`nice-social-shape nice-social-shape--${E}`,style:{display:"inline-block",width:"1em",height:"1em",verticalAlign:"-0.125em",background:"currentColor",clipPath:z[E],opacity:u?1:.35}}),B=l.forwardRef(function(u,M){const{value:m,max:n=5,mode:o="stars",aggregation:_,onChange:g,readOnly:r=!1,size:b="md",showValue:$=!1,label:S,emojiSet:y=["😢","😕","😐","🙂","😍"],className:k,style:w}=u,[x,s]=l.useState(null),h=x!==null?x+1:m??0,v=l.useCallback(c=>{r||!g||g(c+1)},[r,g]),t=()=>{const c=[];for(let a=0;a<n;a++){const N=a<h;let L;o==="emoji"?L=y[a]??y[y.length-1]:o==="hearts"?L=e.jsx(W,{shape:"heart",filled:N}):o==="thumbs"?L=e.jsx(W,{shape:N?"thumb":"thumb-down",filled:N}):L=e.jsx(W,{shape:"star",filled:N}),c.push(e.jsx("span",{className:`nice-ratings__symbol ${N?"nice-ratings__symbol--active":""}`,onClick:()=>v(a),onMouseEnter:()=>!r&&s(a),onMouseLeave:()=>!r&&s(null),role:r?void 0:"button",tabIndex:r?void 0:0,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&v(a)},children:L},a))}return c},i=()=>e.jsxs("div",{className:"nice-ratings__numeric",children:[e.jsx("input",{type:"number",min:0,max:n,step:.5,value:m??0,onChange:c=>g==null?void 0:g(parseFloat(c.target.value)||0),readOnly:r,className:"nice-ratings__numeric-input"}),e.jsxs("span",{className:"nice-ratings__numeric-max",children:["/ ",n]})]});return e.jsxs("div",{ref:M,className:`nice-ratings nice-ratings--${b} nice-ratings--${o} ${r?"nice-ratings--readonly":""} ${k??""}`,style:w,children:[S&&e.jsx("span",{className:"nice-ratings__label",children:S}),e.jsxs("div",{className:"nice-ratings__body",children:[o==="numeric"?i():t(),$&&o!=="numeric"&&e.jsxs("span",{className:"nice-ratings__value",children:[h," / ",n]})]}),_&&e.jsxs("div",{className:"nice-ratings__aggregation",children:[e.jsx("span",{className:"nice-ratings__avg",children:_.average.toFixed(1)}),e.jsxs("span",{className:"nice-ratings__count",children:["(",_.count," ratings)"]}),_.distribution&&e.jsx("div",{className:"nice-ratings__distribution",children:Object.entries(_.distribution).sort(([c],[a])=>+a-+c).map(([c,a])=>e.jsxs("div",{className:"nice-ratings__distribution-row",children:[e.jsx("span",{children:c}),e.jsx("div",{className:"nice-ratings__bar",children:e.jsx("div",{className:"nice-ratings__bar-fill",style:{width:`${_.count?a/_.count*100:0}%`}})}),e.jsx("span",{children:a})]},c))})]})]})}),K=l.forwardRef(function(u,M){const{stats:m,userState:n,onLike:o,onShare:_,onBookmark:g,direction:r="horizontal",size:b="md",showCounts:$=!0,showLabels:S=!1,className:y,style:k}=u,w=l.useCallback(s=>s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toString(),[]),x=[{key:"like",shape:"heart",label:"Like",count:m.likes,isActive:(n==null?void 0:n.liked)??!1,onClick:o},{key:"share",shape:"share",label:"Share",count:m.shares,isActive:(n==null?void 0:n.shared)??!1,onClick:_},{key:"bookmark",shape:"star",label:"Bookmark",count:m.bookmarks,isActive:(n==null?void 0:n.bookmarked)??!1,onClick:g}];return e.jsx("div",{ref:M,className:`nice-social-panel nice-social-panel--${r} nice-social-panel--${b} ${y??""}`,style:k,children:x.map(s=>e.jsxs("button",{className:`nice-social-panel__btn nice-social-panel__btn--${s.key} ${s.isActive?"nice-social-panel__btn--active":""}`,onClick:s.onClick,title:s.label,"aria-label":s.label,"aria-pressed":s.isActive,children:[e.jsx("span",{className:"nice-social-panel__icon",children:e.jsx(W,{shape:s.shape,filled:s.isActive||s.shape==="share"})}),S&&e.jsx("span",{className:"nice-social-panel__label",children:s.label}),$&&e.jsx("span",{className:"nice-social-panel__count",children:w(s.count)})]},s.key))})}),H=l.forwardRef(function(u,M){const{tags:m,onTagClick:n,minFontSize:o=12,maxFontSize:_=36,sortBy:g="weight",maxTags:r,selectedIds:b,className:$,style:S}=u,y=l.useMemo(()=>{let s=[...m];if(g==="weight")s.sort((h,v)=>v.weight-h.weight);else if(g==="alphabetical")s.sort((h,v)=>h.label.localeCompare(v.label));else for(let h=s.length-1;h>0;h--){const v=Math.floor(Math.random()*(h+1));[s[h],s[v]]=[s[v],s[h]]}return r&&s.length>r&&(s=s.slice(0,r)),s},[m,g,r]),{minW:k,maxW:w}=l.useMemo(()=>{if(y.length===0)return{minW:0,maxW:1};const s=y.map(h=>h.weight);return{minW:Math.min(...s),maxW:Math.max(...s)}},[y]),x=s=>{if(w===k)return(o+_)/2;const h=(s-k)/(w-k);return o+h*(_-o)};return e.jsx("div",{ref:M,className:`nice-tag-cloud ${$??""}`,style:S,children:y.length===0?e.jsx("p",{className:"nice-tag-cloud__empty",children:"No tags."}):y.map(s=>{const h=b==null?void 0:b.includes(s.id),v=x(s.weight);return e.jsx("span",{className:`nice-tag-cloud__tag ${h?"nice-tag-cloud__tag--selected":""}`,style:{fontSize:v,color:s.color},onClick:()=>n==null?void 0:n(s),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&n&&n(s)},title:`${s.label} (${s.weight})`,children:s.label},s.id)})})}),q={online:"#22c55e",away:"#eab308",busy:"#ef4444",offline:"#9ca3af"},V=l.forwardRef(function(u,M){const{users:m,onUserClick:n,onAction:o,actions:_=[],searchable:g=!1,statusFilter:r,showStatus:b=!0,layout:$="list",groupByRole:S=!1,className:y,style:k}=u,[w,x]=l.useState(""),s=l.useMemo(()=>{let t=m;if(r&&r.length>0&&(t=t.filter(i=>i.status&&r.includes(i.status))),w.trim()){const i=w.toLowerCase();t=t.filter(c=>{var a,N;return c.name.toLowerCase().includes(i)||((a=c.email)==null?void 0:a.toLowerCase().includes(i))||((N=c.role)==null?void 0:N.toLowerCase().includes(i))})}return t},[m,r,w]),h=l.useMemo(()=>{if(!S)return{"":s};const t={};for(const i of s){const c=i.role??"Other";t[c]||(t[c]=[]),t[c].push(i)}return t},[s,S]),v=t=>e.jsxs("div",{className:`nice-user-list__item nice-user-list__item--${$}`,onClick:()=>n==null?void 0:n(t),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:i=>{i.key==="Enter"&&n&&n(t)},children:[e.jsxs("div",{className:"nice-user-list__avatar-wrap",children:[t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:t.name,className:"nice-user-list__avatar"}):e.jsx("span",{className:"nice-user-list__avatar-placeholder",children:t.name.charAt(0).toUpperCase()}),b&&t.status&&e.jsx("span",{className:"nice-user-list__status-dot",style:{backgroundColor:q[t.status]},title:t.status})]}),e.jsxs("div",{className:"nice-user-list__info",children:[e.jsx("span",{className:"nice-user-list__name",children:t.name}),t.email&&e.jsx("span",{className:"nice-user-list__email",children:t.email}),t.role&&e.jsx("span",{className:"nice-user-list__role",children:t.role})]}),_.length>0&&e.jsx("div",{className:"nice-user-list__actions",children:_.map(i=>e.jsx("button",{className:"nice-user-list__action-btn",onClick:c=>{c.stopPropagation(),o==null||o(t,i)},children:i},i))})]},t.id);return e.jsxs("div",{ref:M,className:`nice-user-list nice-user-list--${$} ${y??""}`,style:k,children:[g&&e.jsx("input",{type:"text",value:w,onChange:t=>x(t.target.value),placeholder:"Search users…",className:"nice-user-list__search"}),s.length===0?e.jsx("p",{className:"nice-user-list__empty",children:"No users found."}):Object.entries(h).map(([t,i])=>e.jsxs("div",{className:"nice-user-list__group",children:[S&&t&&e.jsxs("h4",{className:"nice-user-list__group-title",children:[t," (",i.length,")"]}),i.map(v)]},t))]})});function Y(E){if(!E)return"";let u=E;return u=u.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""),u=u.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),u=u.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi,'$1=""'),u=u.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi,'$1=""'),u=u.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi,""),u}const G=l.forwardRef(function(u,M){const{pages:m,selectedPageId:n,onSelectPage:o,onSavePage:_,onDeletePage:g,onCreatePage:r,editable:b=!1,searchable:$=!0,renderHtml:S=!1,sidebarWidth:y=260,className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(!1),[t,i]=l.useState(""),[c,a]=l.useState(""),[N,L]=l.useState(""),[T,P]=l.useState(!1),R=l.useMemo(()=>{if(m.some(f=>f.children&&f.children.length>0))return m.filter(f=>!f.parentId);const p=new Map;for(const f of m)p.set(f.id,{...f,children:[]});const j=[];for(const f of p.values())f.parentId&&p.has(f.parentId)?p.get(f.parentId).children.push(f):j.push(f);return j},[m]),C=l.useMemo(()=>m.find(p=>p.id===n),[m,n]),I=l.useMemo(()=>{if(!x.trim())return R;const p=x.toLowerCase(),j=new Set(m.filter(f=>f.title.toLowerCase().includes(p)).map(f=>f.id));return m.filter(f=>j.has(f.id))},[R,m,x]),D=l.useCallback(()=>{C&&(i(C.title),a(C.content??""),v(!0))},[C]),d=l.useCallback(()=>{!C||!_||(_(C.id,c,t),v(!1))},[C,c,t,_]),A=l.useCallback(()=>{!N.trim()||!r||(r(n??null,N.trim()),L(""),P(!1))},[N,n,r]),F=(p,j=0)=>{var f;return e.jsxs("div",{children:[e.jsx("div",{className:`nice-wiki__page-item ${p.id===n?"nice-wiki__page-item--active":""}`,style:{paddingLeft:12+j*16},onClick:()=>o==null?void 0:o(p),role:"button",tabIndex:0,onKeyDown:O=>{O.key==="Enter"&&(o==null||o(p))},children:p.title}),(f=p.children)==null?void 0:f.map(O=>F(O,j+1))]},p.id)};return e.jsxs("div",{ref:M,className:`nice-wiki ${k??""}`,style:{display:"flex",...w},children:[e.jsxs("div",{className:"nice-wiki__sidebar",style:{width:y,minWidth:y},children:[e.jsxs("div",{className:"nice-wiki__sidebar-header",children:[e.jsx("strong",{children:"Wiki"}),b&&r&&e.jsx("button",{onClick:()=>P(!T),title:"New page",children:"+"})]}),T&&e.jsxs("div",{className:"nice-wiki__new-page",children:[e.jsx("input",{type:"text",value:N,onChange:p=>L(p.target.value),placeholder:"New page title"}),e.jsx("button",{onClick:A,disabled:!N.trim(),children:"Create"})]}),$&&e.jsx("input",{type:"text",className:"nice-wiki__search",value:x,onChange:p=>s(p.target.value),placeholder:"Search pages…"}),e.jsx("div",{className:"nice-wiki__tree",children:I.length===0?e.jsx("p",{className:"nice-wiki__empty",children:"No pages."}):I.map(p=>F(p))})]}),e.jsx("div",{className:"nice-wiki__content",children:C?h?e.jsxs("div",{className:"nice-wiki__editor",children:[e.jsx("input",{type:"text",className:"nice-wiki__edit-title",value:t,onChange:p=>i(p.target.value)}),e.jsx("textarea",{className:"nice-wiki__edit-body",value:c,onChange:p=>a(p.target.value),rows:20}),e.jsxs("div",{className:"nice-wiki__edit-actions",children:[e.jsx("button",{onClick:d,children:"Save"}),e.jsx("button",{onClick:()=>v(!1),children:"Cancel"})]})]}):e.jsxs("div",{className:"nice-wiki__viewer",children:[e.jsxs("div",{className:"nice-wiki__viewer-header",children:[e.jsx("h2",{children:C.title}),e.jsxs("div",{className:"nice-wiki__viewer-meta",children:[C.lastEditedBy&&e.jsxs("span",{children:["Edited by ",C.lastEditedBy]}),C.lastEditedAt&&e.jsxs("span",{children:[" on ",C.lastEditedAt]})]}),b&&e.jsxs("div",{className:"nice-wiki__viewer-actions",children:[e.jsx("button",{onClick:D,children:"Edit"}),g&&e.jsx("button",{onClick:()=>g(C.id),children:"Delete"})]})]}),S?e.jsx("div",{className:"nice-wiki__viewer-body",dangerouslySetInnerHTML:{__html:Y(C.content??"")}}):e.jsx("div",{className:"nice-wiki__viewer-body",children:C.content??e.jsx("em",{children:"No content."})})]}):e.jsx("div",{className:"nice-wiki__placeholder",children:"Select a page from the sidebar."})})]})}),J={comment:"var(--nice-color-primary, #3b82f6)",like:"var(--nice-color-error, #ef4444)",share:"var(--nice-color-info, #0ea5e9)",create:"var(--nice-color-success, #22c55e)",update:"var(--nice-color-warning, #f59e0b)",delete:"var(--nice-color-error, #ef4444)",join:"var(--nice-color-success, #22c55e)",leave:"var(--nice-text-muted, #6b7280)",upload:"var(--nice-color-accent, #8b5cf6)",mention:"var(--nice-color-primary, #3b82f6)",custom:"var(--nice-text-muted, #6b7280)"},Q=l.forwardRef(function(u,M){const{events:m,onEventClick:n,groupByDate:o=!0,typeFilter:_,showFilters:g=!1,maxEvents:r,onLoadMore:b,hasMore:$=!1,className:S,style:y}=u,[k,w]=l.useState(new Set),x=_??(k.size>0?Array.from(k):void 0),s=l.useMemo(()=>{let i=m;if(x&&x.length>0){const c=new Set(x);i=i.filter(a=>c.has(a.type))}return r&&(i=i.slice(0,r)),i},[m,x,r]),h=l.useMemo(()=>{if(!o)return[{label:"",events:s}];const i=new Map;for(const c of s){const a=c.timestamp.slice(0,10);i.has(a)||i.set(a,[]),i.get(a).push(c)}return Array.from(i.entries()).map(([c,a])=>({label:c,events:a}))},[s,o]),v=l.useMemo(()=>{const i=new Set(m.map(c=>c.type));return Array.from(i).sort()},[m]),t=i=>{w(c=>{const a=new Set(c);return a.has(i)?a.delete(i):a.add(i),a})};return e.jsxs("div",{ref:M,className:`nice-activity-feed ${S??""}`,style:y,children:[g&&!_&&e.jsxs("div",{className:"nice-activity-feed__filters",children:[v.map(i=>e.jsx("button",{className:`nice-activity-feed__filter-chip ${k.has(i)?"nice-activity-feed__filter-chip--active":""}`,onClick:()=>t(i),children:i},i)),k.size>0&&e.jsx("button",{className:"nice-activity-feed__filter-clear",onClick:()=>w(new Set),children:"Clear"})]}),s.length===0?e.jsx("p",{className:"nice-activity-feed__empty",children:"No activity."}):h.map(({label:i,events:c})=>e.jsxs("div",{className:"nice-activity-feed__group",children:[o&&i&&e.jsx("div",{className:"nice-activity-feed__date-label",children:i}),c.map(a=>e.jsxs("div",{className:"nice-activity-feed__event",onClick:()=>n==null?void 0:n(a),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:N=>{N.key==="Enter"&&n&&n(a)},children:[e.jsx("span",{className:`nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,title:a.type,"aria-hidden":"true",style:{background:J[a.type]}}),e.jsxs("div",{className:"nice-activity-feed__body",children:[a.actorAvatarUrl&&e.jsx("img",{src:a.actorAvatarUrl,alt:"",className:"nice-activity-feed__avatar"}),e.jsxs("span",{className:"nice-activity-feed__message",children:[e.jsx("strong",{children:a.actorName})," ",a.message,a.targetLabel&&e.jsxs(e.Fragment,{children:[" ",e.jsx("em",{children:a.targetLabel})]})]}),e.jsx("time",{className:"nice-activity-feed__time",children:a.timestamp})]})]},a.id))]},i||"__all")),$&&b&&e.jsx("button",{className:"nice-activity-feed__load-more",onClick:b,children:"Load more"})]})});exports.NiceActivityFeed=Q;exports.NiceComments=U;exports.NiceRatings=B;exports.NiceSocialPanel=K;exports.NiceTagCloud=H;exports.NiceUserList=V;exports.NiceWiki=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("@nice2dev/ui-core"),r=require("react"),B=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{comments:u,currentUserId:n,onSubmit:d,onEdit:p,onDelete:N,onReact:o,readOnly:k=!1,maxDepth:A=4,reactions:T=["👍","❤️","😂","😮","😢"],placeholder:b=c("comments.writeAComment","Write a comment…"),className:w,style:C}=_,[v,s]=r.useState(""),[h,g]=r.useState(null),[t,i]=r.useState(""),[l,a]=r.useState(null),[y,M]=r.useState(""),P=new Map;for(const m of u){const L=m.parentId??"__root__";P.has(L)||P.set(L,[]),P.get(L).push(m)}const D=r.useCallback(()=>{!v.trim()||!d||(d(v.trim()),s(""))},[v,d]),W=r.useCallback(()=>{!t.trim()||!d||!h||(d(t.trim(),h),i(""),g(null))},[t,h,d]),S=r.useCallback(()=>{!l||!y.trim()||!p||(p(l,y.trim()),a(null),M(""))},[l,y,p]),I=(m,L)=>{const R=n&&m.authorId===n,x=P.get(m.id)??[];return e.jsxs("div",{className:"nice-comments__item",style:{marginLeft:L*24},children:[e.jsxs("div",{className:"nice-comments__header",children:[m.authorAvatarUrl&&e.jsx("img",{src:m.authorAvatarUrl,alt:"",className:"nice-comments__avatar"}),e.jsx("strong",{className:"nice-comments__author",children:m.authorName}),e.jsx("time",{className:"nice-comments__time",children:m.createdAt}),m.isEdited&&e.jsx("span",{className:"nice-comments__edited",children:c("comments.edited","(edited)")})]}),l===m.id?e.jsxs("div",{className:"nice-comments__edit-form",children:[e.jsx("textarea",{value:y,onChange:j=>M(j.target.value)}),e.jsx("button",{onClick:S,children:c("comments.save","Save")}),e.jsx("button",{onClick:()=>a(null),children:c("comments.cancel","Cancel")})]}):e.jsx("p",{className:"nice-comments__content",children:m.isDeleted?e.jsx("em",{children:c("comments.commentDeleted","Comment deleted")}):m.content}),!m.isDeleted&&m.reactions&&e.jsx("div",{className:"nice-comments__reactions",children:Object.entries(m.reactions).map(([j,f])=>e.jsxs("button",{className:"nice-comments__reaction",onClick:()=>o==null?void 0:o(m.id,j),children:[j," ",f]},j))}),!m.isDeleted&&!k&&e.jsxs("div",{className:"nice-comments__actions",children:[o&&T.map(j=>e.jsx("button",{onClick:()=>o(m.id,j),title:j,children:j},j)),L<A&&e.jsx("button",{onClick:()=>{g(m.id),i("")},children:c("comments.reply","Reply")}),R&&p&&e.jsx("button",{onClick:()=>{a(m.id),M(m.content)},children:c("comments.edit","Edit")}),R&&N&&e.jsx("button",{onClick:()=>N(m.id),children:c("comments.delete","Delete")})]}),h===m.id&&e.jsxs("div",{className:"nice-comments__reply-form",children:[e.jsx("textarea",{value:t,onChange:j=>i(j.target.value),placeholder:c("comments.writeAReply","Write a reply…")}),e.jsx("button",{onClick:W,disabled:!t.trim(),children:c("comments.send","Send")}),e.jsx("button",{onClick:()=>g(null),children:c("comments.cancel","Cancel")})]}),x.map(j=>I(j,L+1))]},m.id)},U=P.get("__root__")??[];return e.jsxs("div",{ref:E,className:`nice-comments ${w??""}`,style:C,children:[!k&&e.jsxs("div",{className:"nice-comments__new",children:[e.jsx("textarea",{value:v,onChange:m=>s(m.target.value),placeholder:b}),e.jsx("button",{onClick:D,disabled:!v.trim(),children:c("comments.post","Post")})]}),U.length===0?e.jsx("p",{className:"nice-comments__empty",children:c("comments.noCommentsYet","No comments yet.")}):U.map(m=>I(m,0))]})}),K={star:"polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",heart:"polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",share:"polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",thumb:"polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)","thumb-down":"polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"},O=({shape:$,filled:_=!0})=>e.jsx("span",{"aria-hidden":"true",className:`nice-social-shape nice-social-shape--${$}`,style:{display:"inline-block",width:"1em",height:"1em",verticalAlign:"-0.125em",background:"currentColor",clipPath:K[$],opacity:_?1:.35}}),q=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{value:u,max:n=5,mode:d="stars",aggregation:p,onChange:N,readOnly:o=!1,size:k="md",showValue:A=!1,label:T,emojiSet:b=["😢","😕","😐","🙂","😍"],className:w,style:C}=_,[v,s]=r.useState(null),h=v!==null?v+1:u??0,g=r.useCallback(l=>{o||!N||N(l+1)},[o,N]),t=()=>{const l=[];for(let a=0;a<n;a++){const y=a<h;let M;d==="emoji"?M=b[a]??b[b.length-1]:d==="hearts"?M=e.jsx(O,{shape:"heart",filled:y}):d==="thumbs"?M=e.jsx(O,{shape:y?"thumb":"thumb-down",filled:y}):M=e.jsx(O,{shape:"star",filled:y}),l.push(e.jsx("span",{className:`nice-ratings__symbol ${y?"nice-ratings__symbol--active":""}`,onClick:()=>g(a),onMouseEnter:()=>!o&&s(a),onMouseLeave:()=>!o&&s(null),role:o?void 0:"button",tabIndex:o?void 0:0,onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&g(a)},children:M},a))}return l},i=()=>e.jsxs("div",{className:"nice-ratings__numeric",children:[e.jsx("input",{type:"number",min:0,max:n,step:.5,value:u??0,onChange:l=>N==null?void 0:N(parseFloat(l.target.value)||0),readOnly:o,className:"nice-ratings__numeric-input"}),e.jsxs("span",{className:"nice-ratings__numeric-max",children:["/ ",n]})]});return e.jsxs("div",{ref:E,className:`nice-ratings nice-ratings--${k} nice-ratings--${d} ${o?"nice-ratings--readonly":""} ${w??""}`,style:C,children:[T&&e.jsx("span",{className:"nice-ratings__label",children:T}),e.jsxs("div",{className:"nice-ratings__body",children:[d==="numeric"?i():t(),A&&d!=="numeric"&&e.jsxs("span",{className:"nice-ratings__value",children:[h," / ",n]})]}),p&&e.jsxs("div",{className:"nice-ratings__aggregation",children:[e.jsx("span",{className:"nice-ratings__avg",children:p.average.toFixed(1)}),e.jsx("span",{className:"nice-ratings__count",children:c("ratings.ratings","({count} ratings)").replace("{count}",String(p.count))}),p.distribution&&e.jsx("div",{className:"nice-ratings__distribution",children:Object.entries(p.distribution).sort(([l],[a])=>+a-+l).map(([l,a])=>e.jsxs("div",{className:"nice-ratings__distribution-row",children:[e.jsx("span",{children:l}),e.jsx("div",{className:"nice-ratings__bar",children:e.jsx("div",{className:"nice-ratings__bar-fill",style:{width:`${p.count?a/p.count*100:0}%`}})}),e.jsx("span",{children:a})]},l))})]})]})}),H=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{stats:u,userState:n,onLike:d,onShare:p,onBookmark:N,direction:o="horizontal",size:k="md",showCounts:A=!0,showLabels:T=!1,className:b,style:w}=_,C=r.useCallback(s=>s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toString(),[]),v=[{key:"like",shape:"heart",label:c("socialPanel.like","Like"),count:u.likes,isActive:(n==null?void 0:n.liked)??!1,onClick:d},{key:"share",shape:"share",label:c("socialPanel.share","Share"),count:u.shares,isActive:(n==null?void 0:n.shared)??!1,onClick:p},{key:"bookmark",shape:"star",label:c("socialPanel.bookmark","Bookmark"),count:u.bookmarks,isActive:(n==null?void 0:n.bookmarked)??!1,onClick:N}];return e.jsx("div",{ref:E,className:`nice-social-panel nice-social-panel--${o} nice-social-panel--${k} ${b??""}`,style:w,children:v.map(s=>e.jsxs("button",{className:`nice-social-panel__btn nice-social-panel__btn--${s.key} ${s.isActive?"nice-social-panel__btn--active":""}`,onClick:s.onClick,title:s.label,"aria-label":s.label,"aria-pressed":s.isActive,children:[e.jsx("span",{className:"nice-social-panel__icon",children:e.jsx(O,{shape:s.shape,filled:s.isActive||s.shape==="share"})}),T&&e.jsx("span",{className:"nice-social-panel__label",children:s.label}),A&&e.jsx("span",{className:"nice-social-panel__count",children:C(s.count)})]},s.key))})}),V=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{tags:u,onTagClick:n,minFontSize:d=12,maxFontSize:p=36,sortBy:N="weight",maxTags:o,selectedIds:k,className:A,style:T}=_,b=r.useMemo(()=>{let s=[...u];if(N==="weight")s.sort((h,g)=>g.weight-h.weight);else if(N==="alphabetical")s.sort((h,g)=>h.label.localeCompare(g.label));else for(let h=s.length-1;h>0;h--){const g=Math.floor(Math.random()*(h+1));[s[h],s[g]]=[s[g],s[h]]}return o&&s.length>o&&(s=s.slice(0,o)),s},[u,N,o]),{minW:w,maxW:C}=r.useMemo(()=>{if(b.length===0)return{minW:0,maxW:1};const s=b.map(h=>h.weight);return{minW:Math.min(...s),maxW:Math.max(...s)}},[b]),v=s=>{if(C===w)return(d+p)/2;const h=(s-w)/(C-w);return d+h*(p-d)};return e.jsx("div",{ref:E,className:`nice-tag-cloud ${A??""}`,style:T,children:b.length===0?e.jsx("p",{className:"nice-tag-cloud__empty",children:c("tagCloud.noTags","No tags.")}):b.map(s=>{const h=k==null?void 0:k.includes(s.id),g=v(s.weight);return e.jsx("span",{className:`nice-tag-cloud__tag ${h?"nice-tag-cloud__tag--selected":""}`,style:{fontSize:g,color:s.color},onClick:()=>n==null?void 0:n(s),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&n&&n(s)},title:`${s.label} (${s.weight})`,children:s.label},s.id)})})}),Y={online:"#22c55e",away:"#eab308",busy:"#ef4444",offline:"#9ca3af"},G=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{users:u,onUserClick:n,onAction:d,actions:p=[],searchable:N=!1,statusFilter:o,showStatus:k=!0,layout:A="list",groupByRole:T=!1,className:b,style:w}=_,[C,v]=r.useState(""),s=r.useMemo(()=>{let t=u;if(o&&o.length>0&&(t=t.filter(i=>i.status&&o.includes(i.status))),C.trim()){const i=C.toLowerCase();t=t.filter(l=>{var a,y;return l.name.toLowerCase().includes(i)||((a=l.email)==null?void 0:a.toLowerCase().includes(i))||((y=l.role)==null?void 0:y.toLowerCase().includes(i))})}return t},[u,o,C]),h=r.useMemo(()=>{if(!T)return{"":s};const t={};for(const i of s){const l=i.role??"Other";t[l]||(t[l]=[]),t[l].push(i)}return t},[s,T]),g=t=>e.jsxs("div",{className:`nice-user-list__item nice-user-list__item--${A}`,onClick:()=>n==null?void 0:n(t),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:i=>{i.key==="Enter"&&n&&n(t)},children:[e.jsxs("div",{className:"nice-user-list__avatar-wrap",children:[t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:t.name,className:"nice-user-list__avatar"}):e.jsx("span",{className:"nice-user-list__avatar-placeholder",children:t.name.charAt(0).toUpperCase()}),k&&t.status&&e.jsx("span",{className:"nice-user-list__status-dot",style:{backgroundColor:Y[t.status]},title:t.status})]}),e.jsxs("div",{className:"nice-user-list__info",children:[e.jsx("span",{className:"nice-user-list__name",children:t.name}),t.email&&e.jsx("span",{className:"nice-user-list__email",children:t.email}),t.role&&e.jsx("span",{className:"nice-user-list__role",children:t.role})]}),p.length>0&&e.jsx("div",{className:"nice-user-list__actions",children:p.map(i=>e.jsx("button",{className:"nice-user-list__action-btn",onClick:l=>{l.stopPropagation(),d==null||d(t,i)},children:i},i))})]},t.id);return e.jsxs("div",{ref:E,className:`nice-user-list nice-user-list--${A} ${b??""}`,style:w,children:[N&&e.jsx("input",{type:"text",value:C,onChange:t=>v(t.target.value),placeholder:c("userList.searchUsers","Search users…"),className:"nice-user-list__search"}),s.length===0?e.jsx("p",{className:"nice-user-list__empty",children:c("userList.noUsersFound","No users found.")}):Object.entries(h).map(([t,i])=>e.jsxs("div",{className:"nice-user-list__group",children:[T&&t&&e.jsxs("h4",{className:"nice-user-list__group-title",children:[t," (",i.length,")"]}),i.map(g)]},t))]})});function J($){if(!$)return"";let _=$;return _=_.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""),_=_.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),_=_.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi,'$1=""'),_=_.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi,'$1=""'),_=_.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi,""),_}const Q=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{pages:u,selectedPageId:n,onSelectPage:d,onSavePage:p,onDeletePage:N,onCreatePage:o,editable:k=!1,searchable:A=!0,renderHtml:T=!1,sidebarWidth:b=260,className:w,style:C}=_,[v,s]=r.useState(""),[h,g]=r.useState(!1),[t,i]=r.useState(""),[l,a]=r.useState(""),[y,M]=r.useState(""),[P,D]=r.useState(!1),W=r.useMemo(()=>{if(u.some(f=>f.children&&f.children.length>0))return u.filter(f=>!f.parentId);const x=new Map;for(const f of u)x.set(f.id,{...f,children:[]});const j=[];for(const f of x.values())f.parentId&&x.has(f.parentId)?x.get(f.parentId).children.push(f):j.push(f);return j},[u]),S=r.useMemo(()=>u.find(x=>x.id===n),[u,n]),I=r.useMemo(()=>{if(!v.trim())return W;const x=v.toLowerCase(),j=new Set(u.filter(f=>f.title.toLowerCase().includes(x)).map(f=>f.id));return u.filter(f=>j.has(f.id))},[W,u,v]),U=r.useCallback(()=>{S&&(i(S.title),a(S.content??""),g(!0))},[S]),m=r.useCallback(()=>{!S||!p||(p(S.id,l,t),g(!1))},[S,l,t,p]),L=r.useCallback(()=>{!y.trim()||!o||(o(n??null,y.trim()),M(""),D(!1))},[y,n,o]),R=(x,j=0)=>{var f;return e.jsxs("div",{children:[e.jsx("div",{className:`nice-wiki__page-item ${x.id===n?"nice-wiki__page-item--active":""}`,style:{paddingLeft:12+j*16},onClick:()=>d==null?void 0:d(x),role:"button",tabIndex:0,onKeyDown:z=>{z.key==="Enter"&&(d==null||d(x))},children:x.title}),(f=x.children)==null?void 0:f.map(z=>R(z,j+1))]},x.id)};return e.jsxs("div",{ref:E,className:`nice-wiki ${w??""}`,style:{display:"flex",...C},children:[e.jsxs("div",{className:"nice-wiki__sidebar",style:{width:b,minWidth:b},children:[e.jsxs("div",{className:"nice-wiki__sidebar-header",children:[e.jsx("strong",{children:c("wiki.wiki","Wiki")}),k&&o&&e.jsx("button",{onClick:()=>D(!P),title:c("wiki.newPage","New page"),children:"+"})]}),P&&e.jsxs("div",{className:"nice-wiki__new-page",children:[e.jsx("input",{type:"text",value:y,onChange:x=>M(x.target.value),placeholder:c("wiki.newPageTitle","New page title")}),e.jsx("button",{onClick:L,disabled:!y.trim(),children:c("wiki.create","Create")})]}),A&&e.jsx("input",{type:"text",className:"nice-wiki__search",value:v,onChange:x=>s(x.target.value),placeholder:c("wiki.searchPages","Search pages…")}),e.jsx("div",{className:"nice-wiki__tree",children:I.length===0?e.jsx("p",{className:"nice-wiki__empty",children:c("wiki.noPages","No pages.")}):I.map(x=>R(x))})]}),e.jsx("div",{className:"nice-wiki__content",children:S?h?e.jsxs("div",{className:"nice-wiki__editor",children:[e.jsx("input",{type:"text",className:"nice-wiki__edit-title",value:t,onChange:x=>i(x.target.value)}),e.jsx("textarea",{className:"nice-wiki__edit-body",value:l,onChange:x=>a(x.target.value),rows:20}),e.jsxs("div",{className:"nice-wiki__edit-actions",children:[e.jsx("button",{onClick:m,children:c("wiki.save","Save")}),e.jsx("button",{onClick:()=>g(!1),children:c("wiki.cancel","Cancel")})]})]}):e.jsxs("div",{className:"nice-wiki__viewer",children:[e.jsxs("div",{className:"nice-wiki__viewer-header",children:[e.jsx("h2",{children:S.title}),e.jsxs("div",{className:"nice-wiki__viewer-meta",children:[S.lastEditedBy&&e.jsx("span",{children:c("wiki.editedBy","Edited by {lastEditedBy}").replace("{lastEditedBy}",String(S.lastEditedBy))}),S.lastEditedAt&&e.jsxs("span",{children:[" ",c("wiki.on","on {lastEditedAt}").replace("{lastEditedAt}",String(S.lastEditedAt))]})]}),k&&e.jsxs("div",{className:"nice-wiki__viewer-actions",children:[e.jsx("button",{onClick:U,children:c("wiki.edit","Edit")}),N&&e.jsx("button",{onClick:()=>N(S.id),children:c("wiki.delete","Delete")})]})]}),T?e.jsx("div",{className:"nice-wiki__viewer-body",dangerouslySetInnerHTML:{__html:J(S.content??"")}}):e.jsx("div",{className:"nice-wiki__viewer-body",children:S.content??e.jsx("em",{children:c("wiki.noContent","No content.")})})]}):e.jsx("div",{className:"nice-wiki__placeholder",children:c("wiki.selectAPageFromThe","Select a page from the sidebar.")})})]})}),X={comment:"var(--nice-color-primary, #3b82f6)",like:"var(--nice-color-error, #ef4444)",share:"var(--nice-color-info, #0ea5e9)",create:"var(--nice-color-success, #22c55e)",update:"var(--nice-color-warning, #f59e0b)",delete:"var(--nice-color-error, #ef4444)",join:"var(--nice-color-success, #22c55e)",leave:"var(--nice-text-muted, #6b7280)",upload:"var(--nice-color-accent, #8b5cf6)",mention:"var(--nice-color-primary, #3b82f6)",custom:"var(--nice-text-muted, #6b7280)"},Z=r.forwardRef(function(_,E){const{t:c}=F.useNiceTranslation(),{events:u,onEventClick:n,groupByDate:d=!0,typeFilter:p,showFilters:N=!1,maxEvents:o,onLoadMore:k,hasMore:A=!1,className:T,style:b}=_,[w,C]=r.useState(new Set),v=p??(w.size>0?Array.from(w):void 0),s=r.useMemo(()=>{let i=u;if(v&&v.length>0){const l=new Set(v);i=i.filter(a=>l.has(a.type))}return o&&(i=i.slice(0,o)),i},[u,v,o]),h=r.useMemo(()=>{if(!d)return[{label:"",events:s}];const i=new Map;for(const l of s){const a=l.timestamp.slice(0,10);i.has(a)||i.set(a,[]),i.get(a).push(l)}return Array.from(i.entries()).map(([l,a])=>({label:l,events:a}))},[s,d]),g=r.useMemo(()=>{const i=new Set(u.map(l=>l.type));return Array.from(i).sort()},[u]),t=i=>{C(l=>{const a=new Set(l);return a.has(i)?a.delete(i):a.add(i),a})};return e.jsxs("div",{ref:E,className:`nice-activity-feed ${T??""}`,style:b,children:[N&&!p&&e.jsxs("div",{className:"nice-activity-feed__filters",children:[g.map(i=>e.jsx("button",{className:`nice-activity-feed__filter-chip ${w.has(i)?"nice-activity-feed__filter-chip--active":""}`,onClick:()=>t(i),children:i},i)),w.size>0&&e.jsx("button",{className:"nice-activity-feed__filter-clear",onClick:()=>C(new Set),children:c("activityFeed.clear","Clear")})]}),s.length===0?e.jsx("p",{className:"nice-activity-feed__empty",children:c("activityFeed.noActivity","No activity.")}):h.map(({label:i,events:l})=>e.jsxs("div",{className:"nice-activity-feed__group",children:[d&&i&&e.jsx("div",{className:"nice-activity-feed__date-label",children:i}),l.map(a=>e.jsxs("div",{className:"nice-activity-feed__event",onClick:()=>n==null?void 0:n(a),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:y=>{y.key==="Enter"&&n&&n(a)},children:[e.jsx("span",{className:`nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,title:a.type,"aria-hidden":"true",style:{background:X[a.type]}}),e.jsxs("div",{className:"nice-activity-feed__body",children:[a.actorAvatarUrl&&e.jsx("img",{src:a.actorAvatarUrl,alt:"",className:"nice-activity-feed__avatar"}),e.jsxs("span",{className:"nice-activity-feed__message",children:[e.jsx("strong",{children:a.actorName})," ",a.message,a.targetLabel&&e.jsxs(e.Fragment,{children:[" ",e.jsx("em",{children:a.targetLabel})]})]}),e.jsx("time",{className:"nice-activity-feed__time",children:a.timestamp})]})]},a.id))]},i||"__all")),A&&k&&e.jsx("button",{className:"nice-activity-feed__load-more",onClick:k,children:c("activityFeed.loadMore","Load more")})]})});exports.NiceActivityFeed=Z;exports.NiceComments=B;exports.NiceRatings=q;exports.NiceSocialPanel=H;exports.NiceTagCloud=V;exports.NiceUserList=G;exports.NiceWiki=Q;