@nice2dev/events 1.1.10 → 1.2.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 +70 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.mjs +1544 -1461
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @nice2dev/events — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3a4939d: 1.2.0 — the API cleanup announced for this version, dictionaries per language by default, and
|
|
8
|
+
three new controls. **Breaking:** every removal has a replacement, listed name by name in
|
|
9
|
+
`documentation/omniverk/OMNIVERK_UPGRADE_1.2.0.md`.
|
|
10
|
+
|
|
11
|
+
**Removed (breaking).** All 118 `@deprecated` names: the aliases without the `Nice` prefix in
|
|
12
|
+
`ui-audio`, `ui-graphics` and `ui-3d`; `NiceBarcodeGenerator` (→ `NiceBarcode`), `NiceFloorPlanCanvas`
|
|
13
|
+
(→ `NiceSpatialEditor` in `@nice2dev/ui-buildings`), the v2 props and types of `NiceTopNav`,
|
|
14
|
+
`NiceProgress.showLabel`, `NiceCountryPicker.showDialCode` / `showFlag`, `type` on
|
|
15
|
+
`NiceDateTimePicker` / `NiceDateRangeBox` (→ `dateFormatPreset`); `ZoneOccupancy` in
|
|
16
|
+
`ui-buildings` and `events`, the `SmartHome*` types; the icon variant `flat` (→ `cutout`) and
|
|
17
|
+
`NiceIconEditor` (→ `NiceVectorEditor`); `NiceSizeLegacy`; the `snapGrid` module of `ui-diagrams` (→
|
|
18
|
+
`@nice2dev/spatial-core`); the opt-in stylesheet `@nice2dev/ui/css/legacy-bg-text-aliases.css`, which
|
|
19
|
+
formed an alias cycle with `style.css`. Props that were accepted and never read — 19 on
|
|
20
|
+
`NiceModuleGrid`, and more on `NiceAutocomplete`, `NiceTaskInbox`, `NiceConsentBanner`, the
|
|
21
|
+
building and communication controls, four `ui-audio` panels and `NiceStreamDashboard` — are gone
|
|
22
|
+
from the types. `NiceResourceAllocation` in `ui-erp` is `NiceCapacityPlanner` (the one in `ui`
|
|
23
|
+
keeps its name); `NiceGenericPlayerStageVisualizer` (→ `NiceStageVisualizer`) and
|
|
24
|
+
`NiceCubeBrowserProps` are removed. The `@nice2dev/ui/overlays` entry calls its modal, drawer,
|
|
25
|
+
bottom sheet and context menu `NiceOverlayModal`, `NiceOverlayDrawer`, `NiceOverlayBottomSheet` and
|
|
26
|
+
`NiceOverlayContextMenu`: the old names belonged to different components of `@nice2dev/ui`.
|
|
27
|
+
|
|
28
|
+
**Dictionaries per language.** `NiceI18nProvider` loads only the language in use, with `import()`
|
|
29
|
+
(it was `NiceI18nLazyProvider` in 1.1.10, which stays as the same component); the controls show their
|
|
30
|
+
built-in English until it arrives — `await loadNiceDictionary(lang)` before the first render to start
|
|
31
|
+
in the language. Nothing on the main entry of `@nice2dev/i18n` imports a dictionary any more:
|
|
32
|
+
`NICE_I18N_DICTIONARIES`, `createTranslator`, `NICE_I18N_VARIANTS` / `resolvePlVariant` and the
|
|
33
|
+
translation tooling moved to the new entry `@nice2dev/i18n/all`, and `@nice2dev/ui-core` no longer
|
|
34
|
+
re-exports the dictionary map. `@nice2dev/ui` with what it bundles: 1283 kB → 952 kB gzip loaded up
|
|
35
|
+
front. The `ui-audio` controls read the app's `NiceI18nProvider` now; their own provider overrides it.
|
|
36
|
+
|
|
37
|
+
**New controls.** `NiceRecurrenceEditor`, `NiceStopwatch`, `NiceCountdownTimer` (`@nice2dev/ui`) and
|
|
38
|
+
`NicePasswordGenerator` (`@nice2dev/auth`), plus `recurrenceDates()` and `generatePassword()`.
|
|
39
|
+
`NiceScheduler` honours a weekly rule's `byDay`, which it ignored.
|
|
40
|
+
|
|
41
|
+
**Visible changes.** The palette meets WCAG AA for text on every fill: darker fills in the light
|
|
42
|
+
theme, dark text on the fills of the dark theme (new `--nice-text-on-success` / `-error` / `-info` /
|
|
43
|
+
`-accent` / `-warning`; `NiceThemeText` takes `onSuccess`, `onError`, `onInfo`, `onWarning`). Mobile
|
|
44
|
+
and platform panels follow the app theme instead of `prefers-color-scheme`. Swipes in
|
|
45
|
+
`NiceSwipeActions`, `NiceTouchTable` and `NiceMobileCalendar` work with a mouse and a pen. The
|
|
46
|
+
`ui-forms` editors have the intended spacing (it was four times too large). `NiceMAM`,
|
|
47
|
+
`NiceTranscoder`, `NiceVideoAnnotator` and `NiceStreamDashboard` use `nice-`-prefixed BEM classes.
|
|
48
|
+
|
|
49
|
+
**Fixes.** Controls that invented results ask the host instead: `NiceIntegrationHub`,
|
|
50
|
+
`NiceMLStudio` (`onExperimentRun` may return metrics), `NiceRemoteManagement`
|
|
51
|
+
(`onCaptureScreenshot`), `NicePoseDetector` (`detector`), `NiceBatchScannerProvider`,
|
|
52
|
+
`NiceCacheStrategies`; `NiceLowCodeStudio` accepts dropped components. Controls that did nothing
|
|
53
|
+
work or say why they are off: `NiceStreamDashboard` adds sources, sends chat and runs the chosen
|
|
54
|
+
transition (new `onAddPlatform`, `onSendChatMessage`, `onTransition`, `onScreenshot`,
|
|
55
|
+
`onOpenAudioMixer`, `onOpenSettings`; `receiveChatMessage` feeds incoming chat), `NiceMLStudio`
|
|
56
|
+
downloads through `onModelDownload`, `NiceETLBuilder` saves through `onSave` (its Save button had
|
|
57
|
+
no handler), `NiceTranscoder` makes jobs of picked and dropped files, `NiceAutomationEditor` offers
|
|
58
|
+
the trigger types its model has. Texts of about fifty components go
|
|
59
|
+
through `t()` in six languages, among them the AI data grid, chart and form builders, the ML
|
|
60
|
+
studio, the report designer, the song picker, `NiceProtocolConfig`, `NiceETLBuilder` and
|
|
61
|
+
`NiceInlineHelp` — every key the controls pass to `t()` now has a dictionary entry, so none of
|
|
62
|
+
them stays English under another language; `NiceDataGridAI` sorts on a query in any language, not
|
|
63
|
+
only in English. `NiceWindow`, `NiceConsole`, `NiceFileManager` and `NiceGitManager` no longer
|
|
64
|
+
crash when `accessMode` switches to or from `'hidden'`. Ids come from `createId()` (`@nice2dev/ui-core`), so nothing throws
|
|
65
|
+
outside a secure context as `crypto.randomUUID()` did on plain http. `ui-3d` runs on three r183
|
|
66
|
+
without its deprecation warnings. `NiceRemoteManagement` calls the handlers of the latest render.
|
|
67
|
+
The AI hint popover and the `ui-platform` panels follow the app theme, not the system's or a
|
|
68
|
+
`.dark` class on the host. `NiceCommandPalette` has styles and its search filters;
|
|
69
|
+
`NiceTimeoutFeedback` starts its clock; `NiceOfflineBanner` takes `online`; Monaco's workers in
|
|
70
|
+
`NiceCodeEditor` load; the `ui-audio` panels that used Bootstrap classes use Nice controls; colours
|
|
71
|
+
that reached a canvas as `var(…)` (karaoke lanes and notes) are resolved first.
|
|
72
|
+
|
|
3
73
|
## 1.1.10
|
|
4
74
|
|
|
5
75
|
### 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"),T=require("@nice2dev/icons"),f=require("@nice2dev/ui"),d=require("react"),Z=require("@nice2dev/ui-core");function Pn(i){return i.map((s,a)=>({item:s,index:a,key:s.order??a})).sort((s,a)=>s.key-a.key||s.index-a.index).map(s=>s.item)}function Ve(i,s,a){if(s===a)return[...i];if(s<0||s>=i.length)return[...i];if(a<0||a>=i.length)return[...i];const n=[...i],[r]=n.splice(s,1);return n.splice(a,0,r),n}function Je(i){const{items:s,onReorder:a,disabled:n=!1}=i,[r,l]=d.useState(null),[o,m]=d.useState(null),[h,t]=d.useState(!1),u=d.useRef(null),p=d.useCallback(j=>s.findIndex(C=>C.id===j),[s]),k=d.useCallback((j,C)=>{const y=p(j),M=p(C);y<0||M<0||y===M||a==null||a(Ve([...s],y,M).map(c=>c.id))},[s,p,a]),g=d.useCallback(()=>{l(null),m(null),t(!1),u.current=null},[]),x=d.useCallback((j,C)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":r===j,onPointerDown:y=>{var w,v;if(n||y.button!==0&&y.pointerType==="mouse")return;(v=(w=y.currentTarget).setPointerCapture)==null||v.call(w,y.pointerId),l(j),t(!0),u.current=s.map(P=>P.id);const M=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",c),t(!1),l(null),m(null)},c=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",c),u.current&&(a==null||a(u.current)),g()};window.addEventListener("pointerup",M),window.addEventListener("pointercancel",c)},onPointerEnter:()=>{n||!r||r===j||(m(j),k(r,j))},onKeyDown:y=>{if(n)return;if(y.key===" "||y.key==="Enter"){y.preventDefault(),r===j?g():(l(j),u.current=s.map(P=>P.id));return}if(y.key==="Escape"&&r===j){y.preventDefault(),u.current&&(a==null||a(u.current)),g();return}if(r!==j)return;const c=y.key==="ArrowLeft"||y.key==="ArrowUp"?-1:y.key==="ArrowRight"||y.key==="ArrowDown"?1:0;if(c===0)return;y.preventDefault();const w=p(j),v=w+c;v<0||v>=s.length||a==null||a(Ve([...s],w,v).map(P=>P.id))},...C?{"aria-label":C}:{}}),[r,k,n,g,p,s,a]);return{activeId:r,overId:o,getHandleProps:x,dragging:h}}const An=({item:i})=>{const[s,a]=d.useState(!1),n=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(T.NtdPlay,{size:26})}):s||!n?e.jsx("div",{className:"nice-event-media__broken",title:"Image unavailable",children:e.jsx(T.NtdImage,{size:24})}):e.jsx("img",{src:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>a(!0)})},$n=[],Bn=d.forwardRef(function(s,a){const{items:n=$n,onUpload:r,onDelete:l,onLike:o,onItemClick:m,layout:h="grid",uploadEnabled:t=!0,typeFilter:u="all",onReorder:p,className:k,style:g}=s,[x,j]=d.useState(""),C=d.useMemo(()=>Pn(n),[n]),y=d.useMemo(()=>u==="all"?C:C.filter(P=>P.type===u),[C,u]),M=!!p&&u==="all",c=Je({items:C,onReorder:p,disabled:!M}),w=P=>{const b=P[0];!b||!r||(r(b,x.trim()||void 0),j(""))},v=h==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${h} ${k??""}`,style:g,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",y.length,")"]})}),t&&r&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:w}),e.jsx(f.NiceTextInput,{value:x,onChange:j,placeholder:"Add a caption…"})]}),y.length===0?e.jsx("p",{className:"nice-event-media__empty",children:"No media yet."}):e.jsx(f.NiceCardGroup,{columns:v?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:y.map((P,b)=>{const R=M?c.getHandleProps(P.id,`Move ${P.caption??`item ${b+1}`}`):null;return e.jsxs("div",{className:`nice-event-media__card${v?" nice-event-media__card--row":""}${c.activeId===P.id?" nice-event-media__card--dragging":""}`,onClick:()=>m==null?void 0:m(P),onPointerEnter:R==null?void 0:R.onPointerEnter,role:m?"button":void 0,tabIndex:m?0:void 0,children:[R&&e.jsx("span",{className:"nice-event-media__grip",role:R.role,tabIndex:R.tabIndex,"aria-grabbed":R["aria-grabbed"],"aria-label":R["aria-label"],draggable:R.draggable,onPointerDown:R.onPointerDown,onKeyDown:R.onKeyDown,onClick:_=>_.stopPropagation(),children:e.jsx(T.NtdMove,{size:14})}),e.jsx(An,{item:P}),e.jsxs("div",{className:"nice-event-media__body",children:[P.caption&&e.jsx("span",{className:"nice-event-media__caption",children:P.caption}),P.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:P.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[o&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:_=>{_.stopPropagation(),o(P.id)},"aria-label":"Like",children:[e.jsx(T.NtdHeart,{size:15})," ",P.likes??0]}),l&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:_=>{_.stopPropagation(),l(P.id)},"aria-label":"Delete",children:e.jsx(T.NtdTrash,{size:15})})]})]})]},P.id)})})]})}),me=({title:i,description:s,icon:a,action:n,className:r})=>e.jsx(f.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:r}),Rn=[],En=d.forwardRef(function(s,a){const{items:n=Rn,layout:r="grid",onReorder:l,onItemAdd:o,onItemRemove:m,onCaptionChange:h,onItemClick:t,previewMode:u=!1,transition:p="fade",defaultDurationMs:k=3e3,autoPlay:g=!0,disabled:x=!1,readOnly:j=!1,size:C="md",className:y,style:M}=s,[c,w]=d.useState(0),[v,P]=d.useState(null),[b,R]=d.useState(""),_=x||j,B=!!l&&!_,F=Je({items:n,onReorder:l,disabled:!B}),L=n.length>0?Math.min(c,n.length-1):0,E=n[L],U=(E==null?void 0:E.durationMs)??k;d.useEffect(()=>{if(!u||!g||n.length<2)return;const A=window.setTimeout(()=>w(q=>(q+1)%n.length),Math.max(250,U));return()=>window.clearTimeout(A)},[u,g,n.length,L,U]);const I=d.useMemo(()=>n.reduce((A,q)=>A+(q.durationMs??k),0),[n,k]),N=A=>{h==null||h(A,b),P(null),R("")};return n.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${y??""}`,style:M,children:e.jsx(me,{icon:e.jsx(T.NtdImage,{size:28}),title:"Nothing in the collage yet",description:"Add photos or video to start arranging them.",action:o&&!_?e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:o}):void 0})}):u?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${y??""}`,style:M,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(E==null?void 0:E.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:E.mediaUrl,controls:!0},E.id):e.jsx("img",{className:"nice-media-collage__slide",src:E==null?void 0:E.mediaUrl,alt:(E==null?void 0:E.caption)??""},E==null?void 0:E.id),(E==null?void 0:E.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:E.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(A=>(A-1+n.length)%n.length),children:"Previous"}),e.jsxs("span",{className:"nice-media-collage__counter",children:[L+1," / ",n.length]}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(A=>(A+1)%n.length),children:"Next"})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${r} nice-media-collage--${C} ${y??""}`,style:M,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(f.NiceSegmentedControl,{size:"sm",value:r,readOnly:!0,options:[{value:"sequence",label:"Sequence"},{value:"grid",label:"Grid"},{value:"mosaic",label:"Mosaic"}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[n.length," item",n.length===1?"":"s"," · ",Math.round(I/1e3),"s"]}),o&&!_&&e.jsx(f.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:o})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":"Collage order","aria-busy":F.dragging,children:n.map((A,q)=>{const X=B?F.getHandleProps(A.id,`Move ${A.caption??`item ${q+1}`}`):null;return e.jsxs("li",{className:`nice-media-collage__tile${F.activeId===A.id?" nice-media-collage__tile--active":""}${F.overId===A.id?" nice-media-collage__tile--over":""}`,onPointerEnter:X==null?void 0:X.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:q+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>t==null?void 0:t(A),disabled:!t,children:A.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(T.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:A.mediaUrl,alt:A.caption??"",loading:"lazy"})}),v===A.id?e.jsx(f.NiceTextInput,{value:b,onChange:R,placeholder:"Caption",autoFocus:!0,size:"sm",onBlur:()=>N(A.id),onKeyDown:z=>{z.key==="Enter"&&N(A.id),z.key==="Escape"&&P(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!h||_,onClick:()=>{P(A.id),R(A.caption??"")},children:A.caption||e.jsx("em",{children:"Add a caption"})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[X&&e.jsx("span",{className:"nice-media-collage__grip",role:X.role,tabIndex:X.tabIndex,"aria-grabbed":X["aria-grabbed"],"aria-label":X["aria-label"],draggable:X.draggable,onPointerDown:X.onPointerDown,onKeyDown:X.onKeyDown,children:e.jsx(T.NtdMove,{size:14})}),m&&!j&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${A.caption??`item ${q+1}`}`,disabled:x,onClick:()=>m(A.id),children:e.jsx(T.NtdTrash,{size:14})})]})]},A.id)})}),o&&!_&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(T.NtdPlus,{size:12})," Drag a tile, or focus one and press Space then the arrow keys."]})]})});function Ce(i){const s=i.toLowerCase();return["active","live","published","completed","confirmed"].includes(s)?"success":["cancelled","canceled","rejected","failed"].includes(s)?"error":["scheduled","pending","planning"].includes(s)?"info":["draft","archived"].includes(s)?"secondary":"warning"}const Ln={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},Dn=d.forwardRef(function(s,a){var De,Oe,Ue,Ye,Fe,Xe;const{event:n,participants:r=[],surveys:l=[],billing:o=[],scheduleItems:m=[],tasks:h=[],vendors:t=[],documents:u=[],displayMode:p="normal",tabs:k,activeTab:g,onTabChange:x,tabsIconOnly:j=!0,tabsCentered:C="auto",countLocation:y="bottom",showDetails:M=!0,showLocation:c=!0,showSchedule:w=!0,showParticipants:v=!0,showTasks:P=!0,showSurveys:b=!0,showVendors:R=!0,showBudget:_=!0,showDocuments:B=!0,showSettings:F=!0,editable:L=!1,onSave:E,onPublish:U,onShare:I,onExport:N,onUpdateEvent:A,onUpdateLocation:q,onAddSurvey:X,onSurveyRespond:z,onAddBilling:Y,className:V,style:K}=s,[D,Q]=d.useState(n.title),[G,he]=d.useState(n.description??""),[se,re]=d.useState(n.startDate??""),[pe,ke]=d.useState(n.endDate??""),[xe,le]=d.useState(((De=n.location)==null?void 0:De.name)??""),[ge,Te]=d.useState(((Oe=n.location)==null?void 0:Oe.address)??""),[oe,ie]=d.useState(((Ue=n.location)==null?void 0:Ue.virtualUrl)??""),[ne,Ne]=d.useState(((Ye=n.location)==null?void 0:Ye.isVirtual)??!1),[de,je]=d.useState(""),[ue,Pe]=d.useState("single"),[ye,_e]=d.useState(""),[ae,be]=d.useState(""),[fe,$]=d.useState(""),[O,W]=d.useState("PLN"),H={details:M,location:c,schedule:w,participants:v,tasks:P,surveys:b,vendors:R,budget:_,documents:B,settings:F},ce=(k??Ln[p]).filter(S=>H[S]!==!1),[Se,cn]=d.useState(ce[0]??"details"),rn=g??Se,ln=d.useCallback(S=>{const te=S;g===void 0&&cn(te),x==null||x(te)},[g,x]),on=d.useCallback(()=>{A==null||A({title:D,description:G||void 0,startDate:se||void 0,endDate:pe||void 0})},[D,G,se,pe,A]),dn=d.useCallback(()=>{q==null||q({name:xe,address:ge||void 0,virtualUrl:oe||void 0,isVirtual:ne})},[xe,ge,oe,ne,q]),un=d.useCallback(()=>{if(!de.trim()||!X)return;const S=ye.split(",").map(te=>te.trim()).filter(Boolean);X(de.trim(),ue,S.length>0?S:void 0),je(""),_e("")},[de,ue,ye,X]),mn=d.useCallback(()=>{!ae.trim()||!Y||(Y({label:ae.trim(),amount:parseFloat(fe)||0,currency:O}),be(""),$(""))},[ae,fe,O,Y]),hn=d.useMemo(()=>o.map(S=>({label:S.label,amount:S.amount})),[o]),pn=d.useMemo(()=>o.reduce((S,te)=>S+te.amount,0),[o]),xn=((Fe=o[0])==null?void 0:Fe.currency)??"PLN",gn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceTextInput,{label:"Title",value:D,onChange:Q,readOnly:!L}),e.jsx(f.NiceTextArea,{label:"Description",value:G,onChange:he,readOnly:!L,rows:3}),e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"Start"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:S=>re(S.target.value),readOnly:!L})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:pe,onChange:S=>ke(S.target.value),readOnly:!L})]})]}),L&&e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:on,children:"Save details"})]}),fn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceToggle,{label:"Virtual event",checked:ne,onChange:Ne,disabled:!L}),e.jsx(f.NiceTextInput,{label:"Venue name",value:xe,onChange:le,readOnly:!L}),ne?e.jsx(f.NiceTextInput,{label:"Virtual URL",value:oe,onChange:ie,readOnly:!L}):e.jsx(f.NiceTextInput,{label:"Address",value:ge,onChange:Te,readOnly:!L}),L&&e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:dn,children:"Save location"})]}),vn=e.jsx("div",{className:"nice-event-planning__participants",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No participants yet."}):e.jsxs(e.Fragment,{children:[e.jsx(f.NiceAvatarGroup,{max:8,children:r.map(S=>e.jsx(f.NiceAvatar,{name:S.name,src:S.avatarUrl},S.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:r.map(S=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(f.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:S.name}),e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:Ce(S.status),children:S.status})]},S.id))})]})}),Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[l.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No surveys yet."}):l.map(S=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:S.question})," ",e.jsx(f.NiceBadge,{size:"xs",outline:!0,variant:"info",children:S.type}),S.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:S.options.map((te,Tn)=>e.jsx(f.NiceButton,{size:"sm",variant:"outline",onClick:()=>z==null?void 0:z(S.id,te),children:te},Tn))}),S.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.responses.length," responses"]})]},S.id)),L&&X&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceTextInput,{label:"New survey question",value:de,onChange:je,placeholder:"Question"}),e.jsx(f.NiceSelect,{label:"Type",value:ue,onChange:S=>Pe(S),options:[{value:"single",label:"Single choice"},{value:"multiple",label:"Multiple choice"},{value:"text",label:"Free text"},{value:"rating",label:"Rating"}]}),e.jsx(f.NiceTextInput,{label:"Options (comma-separated)",value:ye,onChange:_e,placeholder:"Yes, No, Maybe"}),e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:un,disabled:!de.trim(),children:"Add survey"})]})]}),jn=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No billing items yet."}):e.jsx(f.NiceAmountBreakdown,{lines:[...hn,{label:"Total",amount:pn,isSummary:!0}],currency:xn}),L&&Y&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(f.NiceTextInput,{label:"Item",value:ae,onChange:be,placeholder:"Catering"}),e.jsx(f.NiceTextInput,{label:"Amount",value:fe,onChange:$,placeholder:"0.00"}),e.jsx(f.NiceSelect,{label:"Currency",value:O,onChange:S=>W(S),options:["PLN","EUR","USD","GBP"]}),e.jsx(f.NiceButton,{variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"plus",size:"sm"}),onClick:mn,disabled:!ae.trim(),children:"Add"})]})]}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(f.NiceToggle,{label:"Public event",checked:n.isPublic??!1,disabled:!L}),e.jsx(f.NiceTextInput,{label:"Max participants",value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!L}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",n.hostName," · Created ",new Date(n.createdAt).toLocaleDateString()]})]}),_n=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No agenda items yet."}):e.jsx("ul",{className:"nice-event-planning__schedule",children:m.map(S=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(Z.NiceIcon,{name:"clock",size:"sm"}),S.startTime??"",S.endTime?`–${S.endTime}`:""]}),e.jsx("span",{className:"nice-event-planning__schedule-title",children:S.title}),S.location&&e.jsx("span",{className:"nice-event-planning__muted",children:S.location})]},S.id))})}),bn=e.jsx("div",{className:"nice-event-planning__list",children:h.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No tasks yet."}):e.jsx("ul",{className:"nice-event-planning__tasks",children:h.map(S=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(f.NiceToggle,{label:S.title,checked:S.done??!1,disabled:!L}),S.assigneeName&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"info",children:S.assigneeName}),S.dueDate&&e.jsx("span",{className:"nice-event-planning__muted",children:S.dueDate})]},S.id))})}),wn=e.jsx("div",{className:"nice-event-planning__list",children:t.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No vendors yet."}):e.jsx("ul",{className:"nice-event-planning__vendors",children:t.map(S=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(Z.NiceIcon,{name:"briefcase",size:"sm"}),e.jsx("span",{className:"nice-event-planning__vendor-name",children:S.name}),S.category&&e.jsx("span",{className:"nice-event-planning__muted",children:S.category}),S.status&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:Ce(S.status),children:S.status}),S.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[S.cost," ",S.currency??""]})]},S.id))})}),kn=e.jsx("div",{className:"nice-event-planning__list",children:u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No documents yet."}):e.jsx("ul",{className:"nice-event-planning__documents",children:u.map(S=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(Z.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:S.name}),S.fileType&&e.jsx(f.NiceBadge,{size:"xs",outline:!0,variant:"secondary",children:S.fileType}),S.sizeKb!=null&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.sizeKb," KB"]})]},S.id))})}),Sn={details:gn,location:fn,schedule:_n,participants:vn,tasks:bn,surveys:Nn,vendors:wn,budget:jn,documents:kn,settings:yn},Cn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},In={schedule:m.length||void 0,participants:r.length||void 0,tasks:h.length||void 0,surveys:l.length||void 0,vendors:t.length||void 0,budget:o.length||void 0,documents:u.length||void 0},zn=ce.map(S=>({id:S,label:S.charAt(0).toUpperCase()+S.slice(1),icon:e.jsx(Z.NiceIcon,{name:Cn[S],size:"sm"}),badge:In[S],content:Sn[S]})),Mn=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(f.NiceBadge,{size:"sm",variant:Ce(n.status),children:n.status})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[E&&e.jsx(f.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(Z.NiceIcon,{name:"check",size:"sm"}),onClick:()=>E({title:D,description:G}),children:"Save"}),U&&e.jsx(f.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(Z.NiceIcon,{name:"upload",size:"sm"}),onClick:U,children:"Publish"}),I&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"link",size:"sm"}),onClick:I,children:"Share"}),N&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Z.NiceIcon,{name:"download",size:"sm"}),onClick:N,children:"Export"})]})]});return p==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${V??""}`,style:K,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(Z.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[n.startDate?new Date(n.startDate).toLocaleString():"No date",(Xe=n.location)!=null&&Xe.name?` · ${n.location.name}`:""]})]}),e.jsx(f.NiceBadge,{size:"sm",variant:Ce(n.status),children:n.status}),r.length>0&&e.jsx(f.NiceAvatarGroup,{max:4,size:"sm",children:r.map(S=>e.jsx(f.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"},S.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${p} ${V??""}`,style:K,children:[Mn,e.jsx(f.NiceTabs,{tabs:zn,activeTab:rn,onChange:ln,iconOnly:j,centered:C,countLocation:y})]})});function On(i){switch(i){case"confirmed":return"success";case"checked-in":return"info";case"declined":return"error";case"no-show":return"warning";default:return"secondary"}}const Ae=({participant:i,showRole:s=!0,showStatus:a=!0,meta:n,children:r,size:l="md",className:o})=>e.jsxs("li",{className:`nice-participant-row nice-participant-row--${l} ${o??""}`,children:[e.jsx(f.NiceAvatar,{name:i.name,src:i.avatarUrl,size:l}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(f.NiceBadge,{size:"xs",outline:!0,variant:"info",children:i.role}),a&&i.status&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:On(i.status),children:i.status}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),r&&e.jsx("span",{className:"nice-participant-row__trailing",children:r})]}),Un=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,qe=/^.*<\s*([^<>\s]+)\s*>$/;function en(i){var l,o;const s=[],a=[],n=new Set;let r=0;if(!i)return{valid:s,invalid:a,duplicates:r};for(const m of i.split(/[,;\r\n\t]+/)){const h=m.trim();if(!h)continue;const t=((o=(l=qe.exec(h))==null?void 0:l[1])==null?void 0:o.trim())??h,u=qe.test(h)?[t]:t.split(/\s+/);for(const p of u){if(!p)continue;if(!Un.test(p)){a.push(p);continue}const k=p.toLowerCase();if(n.has(k)){r+=1;continue}n.add(k),s.push(p)}}return{valid:s,invalid:a,duplicates:r}}function Yn(i,s){const a=new Set(i.map(r=>r.toLowerCase())),n=[...i];for(const r of s){const l=r.toLowerCase();a.has(l)||(a.add(l),n.push(r))}return n}function nn(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[r,l]=d.useState(""),o=!s,m=a??r,h=!n||m.trim().length>0;return{isAnonymous:o,name:m,setName:l,canAct:h,actor:{userId:s,userName:m.trim()}}}const Fn=[{answer:"yes",label:"Yes",variant:"success",Icon:T.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:T.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:T.NtdClose}],$e=d.forwardRef(function(s,a){const{value:n,onRespond:r,allowPlusOnes:l=!1,maxPlusOnes:o=5,plusOnes:m=0,allowNote:h=!1,currentUserId:t,currentUserName:u,compact:p=!1,disabled:k=!1,readOnly:g=!1,size:x="md",className:j,style:C}=s,y=nn({currentUserId:t,currentUserName:u}),[M,c]=d.useState(m),[w,v]=d.useState(""),P=!p&&y.isAnonymous&&!y.canAct,b=k||g,R=_=>{b||!r||r({answer:_,plusOnes:l&&_!=="no"?M:void 0,note:h&&w.trim()?w.trim():void 0,userId:y.actor.userId,userName:y.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${x}${p?" nice-rsvp-control--compact":""} ${j??""}`,style:C,children:[!p&&y.isAnonymous&&e.jsx(f.NiceTextInput,{label:"Your name",value:y.name,onChange:y.setName,placeholder:"Who is replying?",required:!0,disabled:b,size:x}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":"Your reply",children:Fn.map(({answer:_,label:B,variant:F,Icon:L})=>e.jsx(f.NiceButton,{size:x,variant:n===_?F:"outline",leftIcon:e.jsx(L,{size:16}),disabled:b||P,"aria-pressed":n===_,onClick:()=>R(_),children:B},_))}),!p&&l&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:"Additional guests"}),e.jsx(f.NiceNumericInput,{value:M,onChange:_=>c(Math.max(0,Math.min(o,_??0))),min:0,max:o,step:1,size:"xs",disabled:b})]}),!p&&h&&e.jsx(f.NiceTextInput,{label:"Note",value:w,onChange:v,placeholder:"Anything we should know?",disabled:b,size:x}),P&&e.jsx("p",{className:"nice-rsvp-control__hint",children:"Enter your name to reply."})]})}),Xn={yes:"confirmed",maybe:"invited",no:"declined"},We={confirmed:"yes","checked-in":"yes",declined:"no"},Ie=["confirmed","checked-in","invited","declined","no-show"],Vn=[],qn=d.forwardRef(function(s,a){const{participants:n=Vn,mode:r="organizer",currentUserId:l,currentUserName:o,onRsvpChange:m,onCheckIn:h,onScan:t,checkInSlot:u,onInvite:p,extraFields:k,groupBy:g="none",showSummary:x=!0,showSearch:j=!0,allowPlusOnes:C=!1,disabled:y=!1,readOnly:M=!1,size:c="md",className:w,style:v}=s,[P,b]=d.useState(""),[R,_]=d.useState("all"),[B,F]=d.useState(""),L=y||M,E=r==="guest",U=d.useMemo(()=>{const z={total:n.length};for(const Y of Ie)z[Y]=0;for(const Y of n)z[Y.status]=(z[Y.status]??0)+1;return z},[n]),I=d.useMemo(()=>{if(E)return n.filter(Y=>Y.userId===l||Y.id===l);const z=P.trim().toLowerCase();return n.filter(Y=>R!=="all"&&Y.status!==R?!1:!z||Y.name.toLowerCase().includes(z))},[n,E,l,P,R]),N=d.useMemo(()=>{if(g==="none"||E)return[{key:"all",label:"",items:I}];const z=new Map;for(const V of I){const K=g==="status"?V.status:V.role,D=z.get(K);D?D.push(V):z.set(K,[V])}return[...z.keys()].sort((V,K)=>g!=="status"?V.localeCompare(K):Ie.indexOf(V)-Ie.indexOf(K)).map(V=>({key:V,label:V,items:z.get(V)??[]}))},[I,g,E]),A=d.useMemo(()=>en(B),[B]),q=z=>Y=>{m==null||m(z,Xn[Y.answer],Y)},X=()=>{!p||A.valid.length===0||(p(A.valid),F(""))};if(E){const z=I[0];return z?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${w??""}`,style:v,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Ae,{participant:z,size:c})}),e.jsx($e,{value:We[z.status],onRespond:q(z.id),allowPlusOnes:C,currentUserId:l??z.userId,currentUserName:o??z.name,disabled:y,readOnly:M,size:c})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${w??""}`,style:v,children:e.jsx(me,{title:"You are not on this guest list",description:"Ask the host for an invitation link."})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${w??""}`,style:v,children:[x&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:U.total})," total"]})]}),(j||u||t)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[j&&e.jsxs(e.Fragment,{children:[e.jsx(f.NiceTextInput,{value:P,onChange:b,placeholder:"Search guests…",prefix:e.jsx(T.NtdSearch,{size:15}),size:c}),e.jsx(f.NiceSelect,{value:R,onChange:z=>_(z),size:c,options:[{value:"all",label:"All statuses"},...Ie.map(z=>({value:z,label:z}))]})]}),u,t&&!u&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(T.NtdQrCode,{size:15})," Scanner ready"]})]}),I.length===0?e.jsx(me,{title:"No guests yet",description:n.length>0?"No one matches the current filter.":"Invite people to see them here."}):N.map(z=>e.jsxs("section",{className:"nice-participant-list__group",children:[z.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[z.label," ",e.jsxs("span",{children:["(",z.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:z.items.map(Y=>e.jsxs(Ae,{participant:Y,size:c,meta:k==null?void 0:k.map(V=>e.jsx("span",{className:"nice-participant-list__extra",children:V.render?V.render(Y):String(Y[V.key]??"")},V.key)),children:[m&&e.jsx($e,{compact:!0,value:We[Y.status],onRespond:q(Y.id),currentUserId:Y.userId,currentUserName:Y.name,disabled:L,size:"sm"}),h&&Y.status!=="checked-in"&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(T.NtdCheck,{size:14}),disabled:L,onClick:()=>h(Y.id),children:"Check in"})]},Y.id))})]},z.key)),p&&!M&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(f.NiceTextArea,{label:"Invite by email",value:B,onChange:F,placeholder:"Paste addresses — commas, semicolons or new lines",rows:3,disabled:y,size:c}),e.jsxs(f.NiceButton,{variant:"primary",size:c,leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:y||A.valid.length===0,onClick:X,children:["Invite ",A.valid.length>0?`(${A.valid.length})`:""]}),(A.invalid.length>0||A.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[A.duplicates>0&&`${A.duplicates} duplicate(s) removed. `,A.invalid.length>0&&`${A.invalid.length} entry(ies) not recognised.`]})]})]})}),Wn={BIF:0,CLP:0,DJF:0,GNF:0,ISK:0,JPY:0,KMF:0,KRW:0,PYG:0,RWF:0,UGX:0,UYI:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,BHD:3,IQD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Re(i){return Wn[i==null?void 0:i.toUpperCase()]??2}function Ee(i,s){return Number.isFinite(i)?Math.round(i*10**Re(s)):0}function ze(i,s){const a=Re(s);return a===0?i:i/10**a}function Gn(i,s,a){const n=Re(s),r=ze(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(r)}catch{return`${r.toFixed(n)} ${s}`}}function ee(i,s,a){return Gn(Ee(i,s),s,a)}const Be={minX:0,minY:0,maxX:0,maxY:0};function Kn(i,s=0){if(i.length===0)return{...Be};let a=1/0,n=1/0,r=-1/0,l=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<n&&(n=o.y),o.x>r&&(r=o.x),o.y>l&&(l=o.y);return{minX:a-s,minY:n-s,maxX:r+s,maxY:l+s}}function Ge(i,s){return{minX:Math.min(i.minX,s.minX),minY:Math.min(i.minY,s.minY),maxX:Math.max(i.maxX,s.maxX),maxY:Math.max(i.maxY,s.maxY)}}function Ke(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Hn(i,s,a=0){const n=i.zoom||1,r=-i.pan.x/n-a,l=-i.pan.y/n-a;return{minX:r,minY:l,maxX:r+s.width/n+a*2,maxY:l+s.height/n+a*2}}function Qn(i,s=12){const a=[],n=[],r=new Map,l=new Map;let o=null,m=0;for(const h of i.sections??[]){let t=null,u=0;(h.rows??[]).forEach((k,g)=>{const x=Zn(k.seats??[]);if(x.length===0)return;const j=Kn(x,s);n.push({sectionId:h.id,rowIndex:g,label:k.label,seats:x,bounds:j}),x.forEach((C,y)=>{r.set(C.id,C),l.set(C.id,{sectionId:h.id,rowIndex:g,seatIndex:y})}),u+=x.length,t=t?Ge(t,j):j});const p=t??{...Be};a.push({section:h,bounds:p,seatCount:u}),m+=u,u>0&&(o=o?Ge(o,p):p)}return{sections:a,rows:n,bounds:o??{...Be},totalSeats:m,seatById:r,locationById:l}}function Zn(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function Jn(i,s){return i>s*4?"section":i>s?"row":"seat"}function es(i,s,a=2500,n){const r=i.sections.filter(u=>Ke(u.bounds,s)),l=new Set(r.map(u=>u.section.id)),o=i.rows.filter(u=>l.has(u.sectionId)&&Ke(u.bounds,s));let m=0;for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&(m+=1);const h=n??Jn(m,a);let t=[];if(h==="seat"){t=[];for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&t.push(p)}return{tier:h,sections:r,rows:h==="section"?[]:o,seats:t,visibleSeatCount:m}}function Le(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ve(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function He(i,s,a){var r;const n=(r=s.priceCategories)==null?void 0:r.find(l=>l.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function ns(i,s={},a){return!(ve(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function sn(i,s={},a){const n=[];let r=null;return i.forEach((l,o)=>{ns(l,s,a)?r?r.seats.push(l):r={start:o,seats:[l]}:r&&(n.push(r),r=null)}),r&&n.push(r),n}function ss(i,s,a={},n){const r=a.maxSeats??8;if(i.length>r)return{ok:!1,reason:"max-seats"};for(const o of i){const m=s.seatById.get(o);if(m){if(ve(m,n)!=="available")return{ok:!1,reason:"unavailable",seatId:o};if(a.allowedCategories&&!a.allowedCategories.includes(m.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:o}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const l=new Map;for(const o of i){const m=s.locationById.get(o);if(!m)continue;const h=`${m.sectionId}::${m.rowIndex}`,t=l.get(h);t?t.push(o):l.set(h,[o])}for(const[o,m]of l){const[h,t]=o.split("::"),u=Number(t),p=s.rows.find(c=>c.sectionId===h&&c.rowIndex===u);if(!p)continue;const k=sn(p.seats,a,n),g=new Set(m);let x=null;for(const c of k)if(c.seats.some(w=>g.has(w.id))){if(x)return{ok:!1,reason:"not-adjacent",seatId:m[0]};x=c}if(!x)continue;const j=x.seats.map((c,w)=>g.has(c.id)?w:-1).filter(c=>c>=0);if(j.length===0)continue;const C=j[0],y=j[j.length-1];if(y-C+1!==j.length)return{ok:!1,reason:"not-adjacent",seatId:m[0]};const M=x.seats.length;if(M>1&&(C===1||M-1-y===1))return{ok:!1,reason:"orphan-seat",seatId:m[0]}}return{ok:!0}}function ts(i,s,a,n={},r){if(i.includes(s))return{selected:i.filter(m=>m!==s)};const l=[...i,s],o=ss(l,a,n,r);return o.ok?{selected:l}:{rejected:o.reason??"not-adjacent"}}function is(i,s,a={},n={},r){if(s<=0)return[];const l=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let o=null;for(const m of i.rows)if(!(n.sectionId&&m.sectionId!==n.sectionId))for(const h of sn(m.seats,l,r)){const t=h.seats.length;if(!(t<s))for(let u=0;u+s<=t;u+=1){const p=u+s-1;if(t>s&&(u===1||t-1-p===1))continue;const k=h.seats.slice(u,p+1),g=k.reduce((x,j)=>x+(j.viewScore??50),0)/s;(!o||g>o.score)&&(o={ids:k.map(x=>x.id),score:g})}}return(o==null?void 0:o.ids)??[]}function as(i,s,a){var u,p,k,g;const n=i.locationById.get(s);if(!n)return null;const r=i.rows.findIndex(x=>x.sectionId===n.sectionId&&x.rowIndex===n.rowIndex);if(r<0)return null;const l=i.rows[r];if(a==="left")return((u=l.seats[n.seatIndex-1])==null?void 0:u.id)??null;if(a==="right")return((p=l.seats[n.seatIndex+1])==null?void 0:p.id)??null;if(a==="row-start")return((k=l.seats[0])==null?void 0:k.id)??null;if(a==="row-end")return((g=l.seats[l.seats.length-1])==null?void 0:g.id)??null;const o=i.rows[a==="up"?r-1:r+1];if(!o)return null;const m=l.seats[n.seatIndex].x;let h=null,t=1/0;for(const x of o.seats){const j=Math.abs(x.x-m);j<t&&(t=j,h=x)}return(h==null?void 0:h.id)??null}function cs(i,s,a){var h,t,u;const n=i.sections.filter(p=>p.seatCount>0);if(n.length===0)return null;const r=s?(h=i.locationById.get(s))==null?void 0:h.sectionId:void 0,l=n.findIndex(p=>p.section.id===r),o=l<0?0:a==="next"?l+1:l-1,m=n[o];return m?((u=(t=i.rows.find(p=>p.sectionId===m.section.id))==null?void 0:t.seats[0])==null?void 0:u.id)??null:null}const we=8;function rs(i,s){return i.seats.length===0?0:i.seats.filter(n=>ve(n,s)==="available").length/i.seats.length}const ls=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:r,interactive:l,onSeatClick:o,onSectionClick:m,describeSeat:h})=>i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:t,bounds:u,seatCount:p})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:u.minX,y:u.minY,width:u.maxX-u.minX,height:u.maxY-u.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:r.get(t.id)},role:m?"button":"img","aria-label":`${t.name}, ${p} seats`,tabIndex:m?0:void 0,onClick:m?()=>m(t.id):void 0}),e.jsx("text",{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:t.name})]},t.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(t=>{const u=rs(t,n);return e.jsxs("g",{children:[e.jsx("rect",{x:t.bounds.minX,y:t.bounds.minY,width:t.bounds.maxX-t.bounds.minX,height:t.bounds.maxY-t.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:r.get(t.sectionId),fillOpacity:.25+u*.65},role:"img","aria-label":`Row ${t.label}, ${t.seats.length} seats, ${Math.round(u*t.seats.length)} available`}),e.jsx("text",{x:t.bounds.minX-6,y:(t.bounds.minY+t.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:t.label})]},`${t.sectionId}-${t.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(t=>{const u=ve(t,n),p=Le(t),k=s.has(t.id),g=a===t.id,x={row:t.row,number:t.number},j=["nice-seating-chart__seat",`nice-seating-chart__seat--${u}`,k?"nice-seating-chart__seat--selected":"",p?`nice-seating-chart__seat--${p}`:"",g?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:j,"data-seat-id":t.id,role:"gridcell","aria-selected":k,"aria-disabled":u!=="available","aria-label":h(t),tabIndex:g?0:-1,onClick:l&&o?()=>o(t):void 0,children:[p?e.jsx("rect",{x:t.x-we,y:t.y-we,width:we*2,height:we*2,rx:3,className:"nice-seating-chart__seat-shape",fill:p==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:t.x,cy:t.y,r:we,className:"nice-seating-chart__seat-shape"}),p==="wheelchair"&&e.jsx(T.NtdWheelchair,{size:10,x:t.x-5,y:t.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:h(t)}),e.jsx("text",{x:t.x,y:t.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:x.number})]},t.id)})}),os=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:r,onBestAvailable:l,describeSeat:o,disabled:m=!1,defaultOpen:h=!1})=>{var M;const t=d.useMemo(()=>i.sections.filter(c=>c.seatCount>0),[i.sections]),[u,p]=d.useState(((M=t[0])==null?void 0:M.section.id)??""),[k,g]=d.useState(0),[x,j]=d.useState(2),C=d.useMemo(()=>i.rows.filter(c=>c.sectionId===u),[i.rows,u]),y=C.find(c=>c.rowIndex===k)??C[0];return e.jsxs(f.NiceCollapse,{trigger:"Choose seats without the map",defaultExpanded:h,className:"nice-seating-chart__list-panel",children:[l&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"How many seats?"}),e.jsx(f.NiceNumericInput,{value:x,onChange:c=>j(Math.max(1,Math.min(n,c??1))),min:1,max:n,size:"xs",disabled:m})]}),e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:m,onClick:()=>l(x,{sectionId:u||void 0}),children:"Best available"})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Section"}),e.jsx(f.NiceSelect,{size:"sm",value:u,disabled:m,onChange:c=>{p(c),g(0)},options:t.map(c=>({value:c.section.id,label:`${c.section.name} (${c.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(f.NiceSelect,{size:"sm",value:String((y==null?void 0:y.rowIndex)??0),disabled:m||C.length===0,onChange:c=>g(Number(c)),options:C.map(c=>({value:String(c.rowIndex),label:`${c.label} (${c.seats.length})`}))})]})]}),y&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:y.seats.map(c=>{const w=ve(c,a),v=Le(c),P=s.has(c.id);return e.jsx("li",{children:e.jsxs(f.NiceButton,{size:"sm",variant:P?"primary":"outline",disabled:m||w!=="available",ariaLabel:o(c),"aria-pressed":P,onClick:()=>r(c),children:[c.number,v&&e.jsx(T.NtdWheelchair,{size:11})]})},c.id)})})]})},ds={zoom:1,pan:{x:0,y:0}};function us(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=ds,viewport:r,onViewportChange:l,disabled:o=!1}=i,[m,h]=d.useState(n),t=r??m,[u,p]=d.useState(!1),k=d.useRef(new Map),g=d.useRef(null),x=d.useRef(null),j=d.useCallback(_=>{r===void 0&&h(_),l==null||l(_)},[r,l]),C=d.useCallback(_=>Math.min(a,Math.max(s,_)),[s,a]),y=d.useCallback((_,B)=>{const F=C(t.zoom*_);if(F===t.zoom)return;const L=F/t.zoom;j({zoom:F,pan:{x:B.x-(B.x-t.pan.x)*L,y:B.y-(B.y-t.pan.y)*L}})},[j,C,t]),M=d.useCallback((_,B,F)=>{const L=B??(F?{x:F.width/2,y:F.height/2}:{x:0,y:0});y(_,L)},[y]),c=d.useCallback((_,B,F=24)=>{const L=Math.max(1,_.maxX-_.minX),E=Math.max(1,_.maxY-_.minY),U=C(Math.min((B.width-F*2)/L,(B.height-F*2)/E));j({zoom:U,pan:{x:(B.width-L*U)/2-_.minX*U,y:(B.height-E*U)/2-_.minY*U}})},[j,C]),w=d.useCallback(()=>j(n),[j,n]),v=d.useCallback(_=>({x:(_.x-t.pan.x)/t.zoom,y:(_.y-t.pan.y)/t.zoom}),[t]),P=d.useCallback(_=>({x:_.x*t.zoom+t.pan.x,y:_.y*t.zoom+t.pan.y}),[t]),b=_=>{const B=_.currentTarget.getBoundingClientRect();return{x:_.clientX-B.left,y:_.clientY-B.top}};return{viewport:t,setViewport:j,containerProps:o?{}:{onWheel:_=>{_.preventDefault();const B=Math.exp(-_.deltaY*.002);y(Math.min(2,Math.max(.5,B)),b(_))},onPointerDown:_=>{var F,L;const B=b(_);if(k.current.set(_.pointerId,B),(L=(F=_.currentTarget).setPointerCapture)==null||L.call(F,_.pointerId),k.current.size===2){const[E,U]=[...k.current.values()];g.current={distance:Math.hypot(E.x-U.x,E.y-U.y)||1,zoom:t.zoom}}else x.current=B,p(!0)},onPointerMove:_=>{if(!k.current.has(_.pointerId))return;const B=b(_);if(k.current.set(_.pointerId,B),k.current.size===2&&g.current){const[E,U]=[...k.current.values()],I=Math.hypot(E.x-U.x,E.y-U.y)||1,N=C(g.current.zoom*(I/g.current.distance)),A={x:(E.x+U.x)/2,y:(E.y+U.y)/2};N!==t.zoom&&y(N/t.zoom,A);return}if(!x.current)return;const F=B.x-x.current.x,L=B.y-x.current.y;x.current=B,j({zoom:t.zoom,pan:{x:t.pan.x+F,y:t.pan.y+L}})},onPointerUp:_=>{k.current.delete(_.pointerId),k.current.size<2&&(g.current=null),k.current.size===0&&(x.current=null,p(!1))},onPointerCancel:_=>{k.current.delete(_.pointerId),g.current=null,x.current=null,p(!1)}},zoomBy:M,fitTo:c,reset:w,screenToWorld:v,worldToScreen:P,panning:u}}const ms={"orphan-seat":"That would leave a single empty seat. Pick a different seat.","not-adjacent":"Seats must be next to each other.","max-seats":"You have selected as many seats as this order allows.","category-not-allowed":"That seat is not part of the selected ticket type.",unavailable:"That seat is not available."},hs={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},tn=d.forwardRef(function(s,a){var ae,be,fe;const{chart:n=hs,mode:r="select",selection:l={},selectedSeatIds:o,defaultSelectedSeatIds:m=[],onSelectionChange:h,onSelectionRejected:t,seatStatusOverrides:u,onSeatClick:p,onBestAvailable:k,lod:g="auto",onLodChange:x,maxRenderedSeats:j=2500,containerSize:C,showLegend:y=!0,showList:M=!1,zoomable:c=!0,locale:w,disabled:v=!1,readOnly:P=!1,className:b,style:R}=s,_=d.useRef(null),[B,F]=d.useState({width:800,height:500}),[L,E]=d.useState(!1),[U,I]=d.useState(m),[N,A]=d.useState(null),[q,X]=d.useState(""),z=o??U,Y=d.useMemo(()=>new Set(z),[z]),V=r==="select"&&!v&&!P&&l.interactive!==!1,K=l.maxSeats??8,D=d.useMemo(()=>Qn(n),[n]),Q=C??B,G=!!C||L;d.useEffect(()=>{if(C||!_.current||typeof ResizeObserver>"u")return;const $=_.current,O=new ResizeObserver(([W])=>{const{width:H,height:J}=W.contentRect;H>0&&J>0&&(F({width:H,height:J}),E(!0))});return O.observe($),()=>O.disconnect()},[C]);const he=us({disabled:!c||v}),{fitTo:se,viewport:re}=he,pe=d.useRef(!1);d.useEffect(()=>{pe.current||!G||D.totalSeats===0||Q.width<=0||(pe.current=!0,se(D.bounds,Q))},[se,D,Q,G]);const ke=d.useMemo(()=>Hn(re,Q,40),[re,Q]),xe=g!=="auto"?g:N?"seat":void 0,le=d.useMemo(()=>es(D,ke,j,xe),[D,ke,j,xe]),ge=d.useRef(null);d.useEffect(()=>{ge.current!==le.tier&&(ge.current=le.tier,x==null||x(le.tier))},[le.tier,x]);const Te=d.useMemo(()=>{var $;return new Map((($=n.sections)==null?void 0:$.map(O=>[O.id,O.color]))??[])},[n.sections]),oe=d.useMemo(()=>{var $;return new Map((($=n.sections)==null?void 0:$.map(O=>[O.id,O]))??[])},[n.sections]),ie=d.useCallback($=>{const O=oe.get($.sectorId),W=ve($,u),H=Le($),J=[O?O.name:"",`row ${$.row}`,`seat ${$.number}`].filter(Boolean);if(O&&l.showPrices!==!1){const ce=He($,n,O);J.push(ee(ce.amount,ce.currency,w))}return J.push(W),H==="wheelchair"&&J.push("wheelchair accessible"),H==="companion"&&J.push("companion seat"),J.join(", ")},[n,oe,u,l.showPrices,w]),ne=d.useCallback($=>{o===void 0&&I($),h==null||h($)},[o,h]),Ne=d.useCallback($=>{if(p==null||p($),!V)return;const O=ts(z,$.id,D,l,u);if("rejected"in O){t==null||t({reason:O.rejected,seatId:$.id}),X(ms[O.rejected]);return}ne(O.selected),X(`${ie($)}. ${O.selected.length} of ${K} selected.`)},[ne,ie,D,V,K,p,t,u,z,l]),de=d.useCallback(($,O)=>{if(k){k($,O);return}const W=is(D,$,l,O,u);if(W.length===0){X(`No block of ${$} seats together is available.`);return}ne(W),A(W[0]),X(`Selected ${W.length} seats together.`)},[ne,D,k,u,l]),je=d.useCallback($=>{const O=D.locationById.get($);if(!O)return;const W=D.rows.find(H=>H.sectionId===O.sectionId&&H.rowIndex===O.rowIndex);W&&se(W.bounds,Q,80)},[se,D,Q]),ue=d.useCallback($=>{if(!$)return;A($),je($);const O=D.seatById.get($);O&&X(ie(O))},[ie,D.seatById,je]),Pe=$=>{var J,ce;const O=N??((ce=(J=D.rows[0])==null?void 0:J.seats[0])==null?void 0:ce.id)??null;if(!O)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[$.key];if(H){$.preventDefault(),ue(N?as(D,O,H):O);return}if($.key==="PageDown"||$.key==="PageUp"){$.preventDefault(),ue(cs(D,N,$.key==="PageDown"?"next":"prev"));return}if($.key==="Enter"||$.key===" "){$.preventDefault();const Se=D.seatById.get(O);Se&&Ne(Se);return}$.key==="Escape"&&z.length>0&&($.preventDefault(),ne([]),X("Selection cleared."))};if(D.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${b??""}`,style:R,children:e.jsx(me,{title:"This chart has no seats",description:"Add sections and rows to the seating chart to see it here."})});const ye=z.reduce(($,O)=>{const W=D.seatById.get(O),H=W?oe.get(W.sectorId):void 0;return!W||!H?$:$+He(W,n,H).amount},0),_e=((be=(ae=n.sections)==null?void 0:ae[0])==null?void 0:be.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${r} ${b??""}`,style:R,children:[e.jsxs("div",{ref:_,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":`${n.name} seating chart`,"aria-rowcount":D.rows.length,"aria-colcount":D.totalSeats,tabIndex:N?-1:0,onKeyDown:Pe,...he.containerProps,children:[e.jsxs("svg",{className:"nice-seating-chart__canvas",width:"100%",height:"100%",role:"presentation",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"nice-seat-companion-hatch",width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:e.jsx("line",{x1:0,y1:0,x2:0,y2:4,className:"nice-seating-chart__hatch"})})}),e.jsx("g",{transform:`translate(${re.pan.x} ${re.pan.y}) scale(${re.zoom})`,children:e.jsx(ls,{cull:le,selectedIds:Y,cursorId:N,statusOverrides:u,sectionColorById:Te,interactive:V,onSeatClick:Ne,onSectionClick:l.sectionSelect?$=>{var W;const O=(W=D.rows.find(H=>H.sectionId===$))==null?void 0:W.seats[0];O&&ue(O.id)}:void 0,describeSeat:ie})})]}),c&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom in",onClick:()=>he.zoomBy(1.25,void 0,Q),children:"+"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom out",onClick:()=>he.zoomBy(.8,void 0,Q),children:"−"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Fit to view",onClick:()=>se(D.bounds,Q),children:"Fit"})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:q}),y&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=n.priceCategories)==null?void 0:fe.map($=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:$.color},"aria-hidden":"true"}),$.name," · ",ee($.price,_e,w)]},$.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," Sold"]})]}),r==="select"&&z.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[z.length," seat",z.length===1?"":"s"," ·"," ",ee(ye,_e,w)]}),M&&e.jsx(os,{index:D,selectedIds:Y,statusOverrides:u,maxSeats:K,onSeatToggle:Ne,onBestAvailable:de,describeSeat:ie,disabled:!V,defaultOpen:r==="select"&&M})]})}),ps=d.forwardRef(function({showList:s=!0,className:a,...n},r){return e.jsx(tn,{ref:r,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),an=/\{\{\s*([\w.-]+)\s*\}\}/g,xs={"&":"&","<":"<",">":">",'"':""","'":"'"};function gs(i){return i.replace(/[&<>"']/g,s=>xs[s]??s)}function fs(i){const s=[],a=new Set;for(const n of i.matchAll(an)){const r=n[1];a.has(r)||(a.add(r),s.push(r))}return s}function vs(i,s={},a={}){const{escape:n=!0,missing:r="keep"}=a;return i.replace(an,(l,o)=>{const m=s[o];return m==null?r==="blank"?"":l:n?gs(String(m)):String(m)})}function Qe(i){return`{{${i}}}`}function Ns(i,s={}){return fs(i).filter(a=>s[a]===void 0||s[a]===null)}const js={name:"",body:""},ys=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],_s=d.forwardRef(function(s,a){const{template:n,defaultTemplate:r,onTemplateChange:l,tokens:o=[],previewData:m={},recipients:h=[],onRecipientsChange:t,onSend:u,sending:p=!1,toolbar:k=ys,disabled:g=!1,readOnly:x=!1,size:j="md",className:C,style:y}=s,[M,c]=Z.useControllableState({value:n,defaultValue:r,fallbackValue:js,onChange:l,componentName:"NiceInvitationDesigner"}),[w,v]=d.useState(""),P=g||x||p,b=d.useMemo(()=>en(w),[w]),R=d.useMemo(()=>{const N={};for(const A of o)A.sample!==void 0&&(N[A.key]=A.sample);return{...N,...m}},[o,m]),_=d.useMemo(()=>vs(M.body??"",R),[M.body,R]),B=d.useMemo(()=>Ns(M.body??"",R),[M.body,R]),F=h.map(N=>N.email),L=N=>c({...M,...N}),E=N=>{L({body:`${M.body??""}${Qe(N)}`})},U=()=>{!t||b.valid.length===0||(t(Yn(F,b.valid)),v(""))},I=N=>{t==null||t(F.filter(A=>A!==N))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${j} ${C??""}`,style:y,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(f.NiceTextInput,{label:"Template name",value:M.name,onChange:N=>L({name:N}),placeholder:"Birthday invitation",disabled:P,size:j}),o.length>0&&!x&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),o.map(N=>e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:P,onClick:()=>E(N.key),children:N.label},N.key))]}),e.jsx(f.NiceHtmlEditor,{value:M.body??"",onChange:N=>L({body:N}),toolbar:k,height:280,readOnly:x||p,disabled:g})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":"Invitation preview",children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:"Preview"}),B.length>0&&e.jsxs(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[B.length," unresolved"]})]}),M.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:M.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:_}}),B.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",B.map(N=>Qe(N)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:["Recipients ",e.jsxs("span",{children:["(",h.length,")"]})]})}),t&&!x&&e.jsxs(e.Fragment,{children:[e.jsx(f.NiceTextArea,{label:"Add addresses",value:w,onChange:v,placeholder:"Paste a list — commas, semicolons or new lines",rows:3,disabled:P,size:j}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsxs(f.NiceButton,{size:j,variant:"outline",leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:P||b.valid.length===0,onClick:U,children:["Add ",b.valid.length>0?`(${b.valid.length})`:""]}),(b.invalid.length>0||b.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[b.duplicates>0&&`${b.duplicates} duplicate(s). `,b.invalid.length>0&&`${b.invalid.length} not recognised: ${b.invalid.slice(0,3).join(", ")}`]})]})]}),h.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:h.map(N=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:N.name?`${N.name} <${N.email}>`:N.email}),N.status&&N.status!=="pending"&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:N.status==="sent"?"success":"error",children:N.status}),t&&!x&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${N.email}`,disabled:P,onClick:()=>I(N.email),children:e.jsx(T.NtdTrash,{size:13})})]},N.email))}),u&&!x&&e.jsx(f.NiceButton,{variant:"primary",size:j,leftIcon:e.jsx(T.NtdSend,{size:15}),loading:p,ariaLabel:"Send invitations",disabled:g||p||h.length===0,onClick:()=>u({templateId:M.id,emails:F}),children:p?"Sending…":`Send to ${h.length}`})]})]})}),bs=({value:i,max:s,currency:a,locale:n,label:r,className:l})=>{const o=s>0?s:1,m=i>=s&&s>0,h=(t,u)=>a?`${ee(t,a,n)} / ${ee(u,a,n)}`:`${t} / ${u}`;return e.jsx(f.NiceProgress,{className:l,value:Math.min(i,o),max:o,variant:m?"success":"primary",size:"sm",showValue:!0,formatValue:()=>h(i,s),"aria-label":r})},ws=[];function ks(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const a=i.quantityNeeded??1,n=i.quantityContributed??0;return{value:n,max:a,complete:a>0&&n>=a}}const Ss=d.forwardRef(function(s,a){const{items:n=ws,kind:r="registry",mode:l="owner",currency:o="PLN",locale:m,hideContributors:h=!1,currentUserId:t,currentUserName:u,onContribute:p,onClaim:k,onUnclaim:g,onItemAdd:x,onItemDelete:j,onItemClick:C,layout:y="grid",disabled:M=!1,readOnly:c=!1,size:w="md",className:v,style:P}=s,b=nn({currentUserId:t,currentUserName:u}),[R,_]=d.useState(null),[B,F]=d.useState(0),[L,E]=d.useState(""),U=l==="owner",I=M||c,N=r==="wishlist",A=d.useMemo(()=>N?[...n].sort((z,Y)=>Number(z.isPurchased??!1)-Number(Y.isPurchased??!1)||(Y.priority??0)-(z.priority??0)):n,[n,N]),q=()=>{_(null),F(0)},X=z=>{!p||!b.canAct||(p(z.id,{amount:B>0?B:void 0,quantity:B>0?void 0:1,userName:b.actor.userName,userId:b.actor.userId}),q())};return n.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${v??""}`,style:P,children:e.jsx(me,{icon:e.jsx(T.NtdGiftCard,{size:28}),title:N?"Nothing on the wishlist yet":"No gifts on the registry yet",description:U?"Add what you would like and share the link.":"The host has not added anything yet."})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${r} nice-gift-registry--${y} nice-gift-registry--${w} ${v??""}`,style:P,children:[!U&&b.isAnonymous&&(p||k)&&e.jsx(f.NiceTextInput,{label:"Your name",value:b.name,onChange:b.setName,placeholder:"So the host knows who to thank",required:!0,disabled:I,size:w}),e.jsx(f.NiceCardGroup,{columns:y==="list"?1:void 0,minColumnWidth:240,gap:12,children:A.map(z=>{const{value:Y,max:V,complete:K}=ks(z,r),D=z.price,Q=z.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${K?" nice-gift-registry__item--complete":""}`,children:[z.imageUrl&&e.jsx("img",{src:z.imageUrl,alt:"",className:"nice-gift-registry__image",loading:"lazy"}),e.jsxs("div",{className:"nice-gift-registry__body",children:[e.jsx("button",{type:"button",className:"nice-gift-registry__title",onClick:()=>C==null?void 0:C(z),disabled:!C,children:z.title}),z.description&&e.jsx("p",{className:"nice-gift-registry__description",children:z.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[D&&e.jsx("span",{className:"nice-gift-registry__price",children:ee(D.amount,D.currency||o,m)}),N&&(z.priority??0)>0&&e.jsxs(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(T.NtdStar,{size:11})," ",z.priority]}),K&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:N?"bought":"fully covered"}),z.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:z.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(T.NtdLink,{size:13})," Shop"]})]}),!N&&e.jsx(bs,{value:Y,max:V,label:`${z.title}: ${Y} of ${V} covered`}),!h&&Q.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:Q.map(G=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:G.contributorName}),G.amount!==void 0&&` — ${ee(G.amount,(D==null?void 0:D.currency)||o,m)}`,G.amount===void 0&&G.quantity?` — ${G.quantity}×`:"",G.message&&e.jsxs("em",{children:[" “",G.message,"”"]})]},G.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!U&&!K&&k&&e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:I||!b.canAct,leftIcon:e.jsx(T.NtdCheck,{size:14}),onClick:()=>k(z.id,{...b.actor,quantity:1}),children:"I'll take this"}),!U&&K&&g&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",disabled:I,onClick:()=>g(z.id),children:"Release"}),!U&&!K&&!N&&p&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:I||!b.canAct,onClick:()=>_(R===z.id?null:z.id),children:"Chip in"}),U&&j&&!c&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${z.title}`,disabled:M,onClick:()=>j(z.id),children:e.jsx(T.NtdTrash,{size:14})})]}),R===z.id&&e.jsxs("div",{className:"nice-gift-registry__pledge",children:[e.jsxs("label",{className:"nice-gift-registry__pledge-field",children:[e.jsxs("span",{children:["Amount (",(D==null?void 0:D.currency)||o,")"]}),e.jsx(f.NiceNumericInput,{value:B,onChange:G=>F(Math.max(0,G??0)),min:0,size:"xs",disabled:I})]}),e.jsx(f.NiceButton,{size:"sm",variant:"primary",disabled:I||!b.canAct,onClick:()=>X(z),children:"Confirm"}),e.jsx(f.NiceButton,{size:"sm",variant:"ghost",onClick:q,children:"Cancel"})]})]})]},z.id)})}),U&&x&&!c&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(f.NiceTextInput,{label:N?"Add a wish":"Add a gift",value:L,onChange:E,placeholder:"What would you like?",disabled:M,size:w}),e.jsx(f.NiceButton,{variant:"primary",size:w,leftIcon:e.jsx(T.NtdPlus,{size:15}),disabled:M||!L.trim(),onClick:()=>{x({title:L.trim(),quantityNeeded:1}),E("")},children:"Add"})]})]})});function Cs(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),r=s.get(n);r?r.push(a):s.set(n,[a])}return s}function Is(i,s,a){var h;const n=new Set(s.map(t=>t.id)),r=s.map(t=>t.id),l=new Map(r.map(t=>[t,0])),o=[];let m=0;if(r.length===0)return{balances:l,issues:i.map(t=>({itemId:t.id,reason:"no-participants"})),totalMinor:0};for(const t of i){const u=t.paidById;if(!u){o.push({itemId:t.id,reason:"no-payer"});continue}if(!n.has(u)){o.push({itemId:t.id,reason:"unknown-payer"});continue}let p=(h=t.splitAmong)!=null&&h.length?t.splitAmong.filter(y=>n.has(y)):r;p.length===0&&(p=r);const k=Ee(t.amount,a);m+=k;const g=p.length,x=Math.floor(k/g),j=k-x*g,C=new Map(p.map(y=>[y,x]));if(j!==0)if(C.has(u))C.set(u,(C.get(u)??0)+j);else{const y=[...p].sort(Me),M=j>0?1:-1;for(let c=0;c<Math.abs(j);c+=1){const w=y[c%y.length];C.set(w,(C.get(w)??0)+M)}}l.set(u,(l.get(u)??0)+k);for(const[y,M]of C)l.set(y,(l.get(y)??0)-M)}return{balances:l,issues:o,totalMinor:m}}function zs(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const r=Ee(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+r),i.set(n.toId,(i.get(n.toId)??0)-r)}}function Ms(i,s,a){const n=new Map(s.map(t=>[t.id,t.name])),r=[...i.entries()].filter(([,t])=>t>0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>u.v-t.v||Me(t.id,u.id)),l=[...i.entries()].filter(([,t])=>t<0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>t.v-u.v||Me(t.id,u.id)),o=[];let m=0,h=0;for(;m<l.length&&h<r.length;){const t=Math.min(-l[m].v,r[h].v);t>0&&o.push({fromId:l[m].id,fromName:n.get(l[m].id)??l[m].id,toId:r[h].id,toName:n.get(r[h].id)??r[h].id,amount:ze(t,a),currency:a}),l[m].v+=t,r[h].v-=t,l[m].v===0&&(m+=1),r[h].v===0&&(h+=1)}return o}function Ts(i,s,a=[]){const n=[],r=[],l=[...Cs(i).entries()].sort(([o],[m])=>Me(o,m));for(const[o,m]of l){const h=Is(m,s,o);r.push(...h.issues),zs(h.balances,a,o),n.push({currency:o,total:ze(h.totalMinor,o),balances:s.map(t=>({participantId:t.id,participantName:t.name,amount:ze(h.balances.get(t.id)??0,o),currency:o})),transfers:Ms(h.balances,s,o)})}return{groups:n,issues:r}}function Me(i,s){return i<s?-1:i>s?1:0}const Ps=[],As=[],$s=d.forwardRef(function(s,a){const{items:n=Ps,participants:r=As,settlements:l=[],view:o,defaultView:m="expenses",onViewChange:h,onSettle:t,onItemDelete:u,onItemClick:p,onValidationChange:k,sortBy:g="date",locale:x,disabled:j=!1,readOnly:C=!1,size:y="md",className:M,style:c}=s,[w,v]=d.useState(m),P=o??w,b=j||C,R=d.useMemo(()=>r.map(I=>({id:I.id,name:I.name})),[r]),_=d.useMemo(()=>Ts(n,R,l),[n,R,l]),B=d.useMemo(()=>g==="none"?n:n.map((I,N)=>({item:I,index:N})).sort((I,N)=>{if(g==="amount")return N.item.amount-I.item.amount||I.index-N.index;const A=I.item.incurredAt,q=N.item.incurredAt;return A&&q?A.localeCompare(q)||I.index-N.index:A?-1:q?1:I.index-N.index}).map(I=>I.item),[n,g]),F=_.issues.map(I=>`${I.itemId}:${I.reason}`).join("|");d.useEffect(()=>{k==null||k(_.issues)},[F]);const L=d.useMemo(()=>new Map(r.map(I=>[I.id,I.avatarUrl])),[r]),E=d.useMemo(()=>new Map(_.issues.map(I=>[I.itemId,I.reason])),[_.issues]),U=I=>{o===void 0&&v(I),h==null||h(I)};return n.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${M??""}`,style:c,children:e.jsx(me,{icon:e.jsx(T.NtdReceipt,{size:28}),title:"No expenses yet",description:"Add what people paid for and this will work out who owes whom."})}):e.jsxs("div",{ref:a,className:`nice-expense-split nice-expense-split--${y} ${M??""}`,style:c,children:[e.jsx(f.NiceSegmentedControl,{size:y,value:P,onChange:I=>U(I),options:[{value:"expenses",label:"Expenses"},{value:"balances",label:"Balances"},{value:"settlement",label:"Settle up"}]}),P==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:B.map(I=>{const N=E.get(I.id);return e.jsxs("li",{className:`nice-expense-split__item${N?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>p==null?void 0:p(I),disabled:!p,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:I.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[I.paidByName??I.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ee(I.amount,I.currency,x)}),I.isPaid&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),N&&e.jsx(f.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:N==="no-payer"?"no payer":"unknown payer"}),u&&!C&&e.jsx(f.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${I.label}`,disabled:j,onClick:()=>u(I.id),children:e.jsx(T.NtdTrash,{size:14})})]},I.id)})}),P==="balances"&&_.groups.map(I=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[I.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ee(I.total,I.currency,x)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:I.balances.map(N=>e.jsx(Ae,{participant:{id:N.participantId,name:N.participantName,avatarUrl:L.get(N.participantId)},showRole:!1,showStatus:!1,size:y,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${N.amount>0?"owed":N.amount<0?"owes":"settled"}`,children:[N.amount===0?"settled up":ee(Math.abs(N.amount),N.currency,x),N.amount>0&&e.jsx("em",{children:" is owed"}),N.amount<0&&e.jsx("em",{children:" owes"})]})},N.participantId))})]},I.currency)),P==="settlement"&&(_.groups.every(I=>I.transfers.length===0)?e.jsx(me,{icon:e.jsx(T.NtdCoins,{size:28}),title:"All settled up",description:"Nobody owes anybody anything."}):_.groups.filter(I=>I.transfers.length>0).map(I=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[I.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[I.transfers.length," transfer",I.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:I.transfers.map(N=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:N.fromName}),e.jsx(T.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:N.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ee(N.amount,N.currency,x)}),t&&!C&&e.jsx(f.NiceButton,{size:"sm",variant:"outline",disabled:b,onClick:()=>t(N),children:"Mark paid"})]},`${N.fromId}-${N.toId}-${N.amount}`))})]},I.currency)))]})}),Bs={upcoming:T.NtdClock,active:T.NtdPlay,voting:T.NtdThumbsUp,scored:T.NtdBarChart,completed:T.NtdCheck,skipped:T.NtdSkipForward},Rs={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Es=d.forwardRef(function(s,a){const{rounds:n,activeRoundId:r,onSelect:l,onStart:o,onEnd:m,onCreate:h,editable:t=!1,className:u,style:p}=s,k=[...n].sort((g,x)=>g.order-x.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${u??""}`,style:p,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",n.length,")"]}),t&&h&&e.jsx("button",{onClick:h,children:"+ Add Round"})]}),k.length===0?e.jsx("p",{className:"nice-round-list__empty",children:"No rounds yet."}):e.jsx("div",{className:"nice-round-list__items",children:k.map(g=>{const x=g.id===r;return e.jsxs("div",{className:`nice-round-list__item ${x?"nice-round-list__item--active":""}`,onClick:()=>l==null?void 0:l(g),role:l?"button":void 0,tabIndex:l?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",g.order]}),e.jsx("span",{className:"nice-round-list__icon",title:g.status,children:d.createElement(Bs[g.status],{size:16})}),e.jsxs("div",{className:"nice-round-list__info",children:[e.jsx("strong",{className:"nice-round-list__name",children:g.name}),g.description&&e.jsx("small",{children:g.description}),g.type&&e.jsx("span",{className:"nice-round-list__type",children:g.type})]}),e.jsx("span",{className:"nice-round-list__status",style:{color:Rs[g.status]},children:g.status}),g.durationMinutes&&e.jsxs("span",{className:"nice-round-list__duration",children:[g.durationMinutes,"m"]}),g.winnerIds&&g.winnerIds.length>0&&e.jsxs("span",{className:"nice-round-list__winners",children:[e.jsx(T.NtdTrophy,{size:14})," ",g.winnerIds.length]}),t&&e.jsxs("div",{className:"nice-round-list__actions",onClick:j=>j.stopPropagation(),children:[g.status==="upcoming"&&o&&e.jsx("button",{onClick:()=>o(g.id),children:"Start"}),(g.status==="active"||g.status==="voting")&&m&&e.jsx("button",{onClick:()=>m(g.id),children:"End"})]})]},g.id)})})]})}),Ls=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Ds=d.forwardRef(function(s,a){const{round:n,timerRunning:r=!1,remainingSeconds:l,onSubmitScore:o,onStart:m,onEnd:h,onSkip:t,editable:u=!1,footerActions:p,className:k,style:g}=s,[x,j]=d.useState({}),C=d.useCallback(c=>{const w=parseFloat(x[c]??"");isNaN(w)||!o||(o(c,w),j(v=>({...v,[c]:""})))},[x,o]),y=c=>{const w=Math.floor(c/60),v=c%60;return`${w}:${v.toString().padStart(2,"0")}`},M=n.scores?[...n.scores].sort((c,w)=>w.score-c.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${n.status} ${k??""}`,style:g,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsxs("span",{className:"nice-round-card__order",children:["Round #",n.order]}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:n.status})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.description}),(r||l!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${r?"nice-round-card__timer--running":""}`,children:[e.jsx(T.NtdClock,{size:14})," ",l!=null?y(l):"—"]}),M.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:"Scoreboard"}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Participant"}),e.jsx("th",{children:"Score"})]})}),e.jsx("tbody",{children:M.map((c,w)=>e.jsxs("tr",{className:w<3?`nice-round-card__top-${w+1}`:"",children:[e.jsxs("td",{children:[c.rank??w+1,w<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(T.NtdMedal,{size:14,primaryColor:Ls[w],"aria-label":`Place ${w+1}`})]})]}),e.jsx("td",{children:c.participantName}),e.jsx("td",{children:c.score})]},c.participantId))})]})]}),o&&(n.status==="active"||n.status==="voting")&&M.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:"Submit Scores"}),M.map(c=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:c.participantName}),e.jsx("input",{type:"number",value:x[c.participantId]??"",onChange:w=>j(v=>({...v,[c.participantId]:w.target.value})),min:0,step:1,placeholder:"Score"}),e.jsx("button",{onClick:()=>C(c.participantId),children:"Submit"})]},c.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[u&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&m&&e.jsxs("button",{onClick:m,children:[e.jsx(T.NtdPlay,{size:14})," Start Round"]}),(n.status==="active"||n.status==="voting")&&h&&e.jsxs("button",{onClick:h,children:[e.jsx(T.NtdStop,{size:14})," End Round"]}),n.status==="upcoming"&&t&&e.jsxs("button",{onClick:t,children:[e.jsx(T.NtdSkipForward,{size:14})," Skip"]})]}),p]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(T.NtdTrophy,{size:14})," Winners: ",n.winnerIds.length]})]})}),Os=d.forwardRef(function(s,a){const{songs:n,onAdd:r,onRemove:l,onVote:o,onSearch:m,showQueue:h=!0,readOnly:t=!1,className:u,style:p}=s,[k,g]=d.useState(""),x=d.useMemo(()=>{if(!k.trim())return n;const c=k.toLowerCase();return n.filter(w=>w.title.toLowerCase().includes(c)||w.artist.toLowerCase().includes(c))},[n,k]),j=d.useMemo(()=>n.filter(c=>c.isQueued),[n]),C=n.find(c=>c.isPlaying),y=c=>{g(c),m==null||m(c)},M=c=>{if(!c)return"";const w=Math.floor(c/60),v=c%60;return`${w}:${v.toString().padStart(2,"0")}`};return e.jsxs("div",{ref:a,className:`nice-song-picker ${u??""}`,style:p,children:[C&&e.jsxs("div",{className:"nice-song-picker__now-playing",children:[e.jsxs("span",{className:"nice-song-picker__np-label",children:[e.jsx(T.NtdMusic,{size:14})," Now Playing"]}),C.albumArt&&e.jsx("img",{src:C.albumArt,alt:"",className:"nice-song-picker__album-art"}),e.jsx("strong",{children:C.title}),e.jsx("span",{children:C.artist})]}),e.jsx("input",{type:"text",value:k,onChange:c=>y(c.target.value),placeholder:"Search songs…",className:"nice-song-picker__search"}),e.jsx("div",{className:"nice-song-picker__list",children:x.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:"No songs found."}):x.map(c=>e.jsxs("div",{className:`nice-song-picker__item ${c.isPlaying?"nice-song-picker__item--playing":""}`,children:[c.albumArt&&e.jsx("img",{src:c.albumArt,alt:"",className:"nice-song-picker__thumb"}),e.jsxs("div",{className:"nice-song-picker__info",children:[e.jsx("strong",{children:c.title}),e.jsx("span",{children:c.artist}),c.duration&&e.jsx("span",{className:"nice-song-picker__duration",children:M(c.duration)}),c.addedByName&&e.jsxs("small",{children:["Added by ",c.addedByName]})]}),!t&&e.jsxs("div",{className:"nice-song-picker__actions",children:[o&&e.jsxs("button",{onClick:()=>o(c.id),"aria-label":`Vote for ${c.title}`,children:[e.jsx(T.NtdThumbsUp,{size:14})," ",c.votes??0]}),r&&!c.isQueued&&e.jsx("button",{onClick:()=>r(c.id),children:"+ Queue"}),l&&c.isQueued&&e.jsx("button",{onClick:()=>l(c.id),children:"Remove"})]})]},c.id))}),h&&j.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",children:[e.jsxs("h4",{children:["Queue (",j.length,")"]}),j.map((c,w)=>e.jsxs("div",{className:"nice-song-picker__queue-item",children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",children:[w+1,"."]}),e.jsxs("span",{children:[c.title," — ",c.artist]})]},c.id))]})]})}),Us=d.forwardRef(function(s,a){const{songs:n,queue:r=[],onEnqueue:l,onDequeue:o,onNext:m,nowPlayingId:h,readOnly:t=!1,className:u,style:p}=s,[k,g]=d.useState(""),[x,j]=d.useState(""),C=n.find(v=>v.id===h),y=d.useMemo(()=>{let v=n;if(k.trim()){const P=k.toLowerCase();v=v.filter(b=>b.title.toLowerCase().includes(P)||b.artist.toLowerCase().includes(P))}return x&&(v=v.filter(P=>P.difficulty===x)),v},[n,k,x]),M=d.useMemo(()=>new Set(r.map(v=>v.id)),[r]),c=["easy","medium","hard","expert"],w=v=>{switch(v){case"easy":return"#4caf50";case"medium":return"#ff9800";case"hard":return"#f44336";case"expert":return"#9c27b0";default:return"#999"}};return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${u??""}`,style:p,children:[C&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",style:{borderLeft:"4px solid #e91e63",padding:"12px",marginBottom:12,background:"color-mix(in srgb, #e91e63 12%, var(--nice-bg-primary, #ffffff))"},children:[e.jsxs("span",{style:{fontWeight:600},children:[e.jsx(T.NtdMicrophone,{size:14})," Now Singing"]}),e.jsxs("div",{children:[e.jsx("strong",{children:C.title})," — ",C.artist,C.performerName&&e.jsxs("span",{children:[" (by ",C.performerName,")"]})]}),!t&&m&&e.jsxs("button",{onClick:m,style:{marginTop:8},children:["Skip / Next ",e.jsx(T.NtdSkipForward,{size:14})]})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",style:{display:"flex",gap:8,marginBottom:12},children:[e.jsx("input",{type:"text",value:k,onChange:v=>g(v.target.value),placeholder:"Search songs or artists…",style:{flex:1}}),e.jsxs("select",{value:x,onChange:v=>j(v.target.value),children:[e.jsx("option",{value:"",children:"All Difficulties"}),c.map(v=>e.jsx("option",{value:v,children:v},v))]})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:y.length===0?e.jsx("p",{children:"No songs match your search."}):y.map(v=>e.jsxs("div",{className:"nice-karaoke-picker__song",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #eee"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:v.title})," — ",v.artist,v.difficulty&&e.jsxs("span",{style:{marginLeft:8,fontSize:12,color:w(v.difficulty),fontWeight:600},children:["[",v.difficulty,"]"]}),v.hasLyrics&&e.jsx("span",{style:{marginLeft:6,fontSize:12},title:"Lyrics available","aria-label":"Lyrics available",children:e.jsx(T.NtdFileText,{size:12})}),v.language&&e.jsxs("span",{style:{marginLeft:6,fontSize:12,color:"#666"},children:["(",v.language,")"]})]}),!t&&e.jsx("div",{children:M.has(v.id)?e.jsx("button",{onClick:()=>o==null?void 0:o(v.id),style:{color:"#f44336",background:"transparent",border:"1px solid currentColor",borderRadius:4},children:"Remove"}):e.jsxs("button",{onClick:()=>l==null?void 0:l(v.id),children:[e.jsx(T.NtdMicrophone,{size:14})," Sing"]})})]},v.id))}),r.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",style:{marginTop:16},children:[e.jsxs("h4",{children:[e.jsx(T.NtdMusic,{size:14})," Queue (",r.length,")"]}),r.map((v,P)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0"},children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[P+1,"."]})," ",v.title," — ",v.artist,v.performerName&&e.jsxs("em",{children:[" (",v.performerName,")"]})]}),!t&&o&&e.jsx("button",{onClick:()=>o(v.id),style:{fontSize:12},"aria-label":`Remove ${v.title}`,children:e.jsx(T.NtdClose,{size:12})})]},v.id))]})]})}),Ze={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Ys={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Fs=d.forwardRef(function(s,a){const{attractions:n,onSelect:r,onDeselect:l,onVote:o,selectedIds:m=[],maxSelections:h,showVotes:t=!0,readOnly:u=!1,layout:p="grid",className:k,style:g}=s,[x,j]=d.useState(""),[C,y]=d.useState(""),M=d.useMemo(()=>new Set(m),[m]),c=d.useMemo(()=>{const b=new Set(n.map(R=>R.category));return Array.from(b)},[n]),w=d.useMemo(()=>{let b=n;if(x&&(b=b.filter(R=>R.category===x)),C.trim()){const R=C.toLowerCase();b=b.filter(_=>{var B;return _.name.toLowerCase().includes(R)||((B=_.description)==null?void 0:B.toLowerCase().includes(R))})}return b},[n,x,C]),v=!h||M.size<h,P=b=>{u||(M.has(b)?l==null||l(b):v&&(r==null||r(b)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${k??""}`,style:{color:"var(--nice-text-primary)",...g},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsx("h3",{style:{margin:0},children:"Attractions"}),h&&e.jsxs("span",{style:{color:"var(--nice-text-secondary, #64748b)",fontSize:14},children:[M.size,"/",h," selected"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:C,onChange:b=>y(b.target.value),placeholder:"Search attractions…",style:{flex:1,minWidth:150}}),e.jsx("button",{onClick:()=>j(""),style:{fontWeight:x?400:700},children:"All"}),c.map(b=>e.jsxs("button",{onClick:()=>j(b===x?"":b),style:{fontWeight:b===x?700:400,display:"inline-flex",alignItems:"center",gap:4},children:[d.createElement(Ze[b],{size:14})," ",Ys[b]]},b))]}),e.jsx("div",{style:{display:p==="grid"?"grid":"flex",gridTemplateColumns:p==="grid"?"repeat(auto-fill, minmax(200px, 1fr))":void 0,gap:12,flexDirection:p==="list"?"column":void 0},children:w.length===0?e.jsx("p",{children:"No attractions found."}):w.map(b=>{const R=M.has(b.id);return e.jsxs("div",{className:"nice-attraction-picker__card",style:{border:R?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:8,padding:12,cursor:u?"default":"pointer",background:R?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",transition:"all 0.2s"},onClick:()=>P(b.id),children:[b.imageUrl&&e.jsx("img",{src:b.imageUrl,alt:b.name,style:{width:"100%",borderRadius:6,marginBottom:8,objectFit:"cover",maxHeight:120}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex"},children:d.createElement(Ze[b.category],{size:16})}),e.jsx("strong",{children:b.name})]}),b.description&&e.jsx("p",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",margin:"6px 0"},children:b.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[t&&e.jsxs("span",{style:{fontSize:13,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(T.NtdThumbsUp,{size:14})," ",b.votes??0]}),!u&&o&&e.jsx("button",{onClick:_=>{_.stopPropagation(),o(b.id)},style:{fontSize:12},children:"Vote"})]})]},b.id)})})]})}),Xs={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Vs=d.forwardRef(function(s,a){const{attractions:n,onVote:r,onUnvote:l,votedIds:o=[],maxVotes:m,closed:h=!1,sortBy:t="votes",showResults:u=!0,className:p,style:k}=s,g=d.useMemo(()=>new Set(o),[o]),x=m?m-g.size:void 0,j=d.useMemo(()=>{const c=[...n];switch(t){case"votes":c.sort((w,v)=>(v.votes??0)-(w.votes??0));break;case"name":c.sort((w,v)=>w.name.localeCompare(v.name));break;case"category":c.sort((w,v)=>w.category.localeCompare(v.category));break}return c},[n,t]),C=d.useMemo(()=>Math.max(...n.map(c=>c.votes??0),1),[n]),y=c=>{h||(g.has(c)?l==null||l(c):(!x||x>0)&&(r==null||r(c)))},M=c=>{switch(c){case 0:return e.jsx(T.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:"1st place"});case 1:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#94a3b8",title:"2nd place"});case 2:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#b45309",title:"3rd place"});default:return`${c+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${p??""}`,style:{color:"var(--nice-text-primary)",...k},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("h3",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx(T.NtdClipboardCheck,{size:20}),h?"Voting Results":"Vote for Attractions"]}),!h&&x!==void 0&&e.jsxs("span",{style:{fontSize:14,color:x>0?"var(--nice-color-primary, #6366f1)":"var(--nice-color-error, #ef4444)"},children:[x," vote",x!==1?"s":""," remaining"]})]}),h&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:j.map((c,w)=>{const v=g.has(c.id),P=c.votes??0,b=u?`${Math.round(P/C*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:v?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:v?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:h?"default":"pointer",transition:"all 0.2s"},onClick:()=>y(c.id),children:[u&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:M(w)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:d.createElement(Xs[c.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:c.name}),c.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.description}),u&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:b,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),u&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:P}),!h&&e.jsx("button",{onClick:R=>{R.stopPropagation(),y(c.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:v?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:v?"Unvote":"Vote"})]},c.id)})}),u&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",n.reduce((c,w)=>c+(w.votes??0),0)]})]})});exports.NiceAttractionPicker=Fs;exports.NiceAttractionVoting=Vs;exports.NiceEventMedia=Bn;exports.NiceEventPlanning=Dn;exports.NiceExpenseSplit=$s;exports.NiceGiftRegistry=Ss;exports.NiceInvitationDesigner=_s;exports.NiceKaraokePicker=Us;exports.NiceMediaCollage=En;exports.NiceParticipantList=qn;exports.NiceRoundCard=Ds;exports.NiceRoundList=Es;exports.NiceRsvpControl=$e;exports.NiceSeatPicker=ps;exports.NiceSeatingChart=tn;exports.NiceSongPicker=Os;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@nice2dev/icons"),x=require("@nice2dev/ui"),d=require("react"),Q=require("@nice2dev/ui-core");function Bn(i){return i.map((s,a)=>({item:s,index:a,key:s.order??a})).sort((s,a)=>s.key-a.key||s.index-a.index).map(s=>s.item)}function We(i,s,a){if(s===a)return[...i];if(s<0||s>=i.length)return[...i];if(a<0||a>=i.length)return[...i];const n=[...i],[r]=n.splice(s,1);return n.splice(a,0,r),n}function nn(i){const{items:s,onReorder:a,disabled:n=!1}=i,[r,l]=d.useState(null),[o,m]=d.useState(null),[h,t]=d.useState(!1),u=d.useRef(null),p=d.useCallback(b=>s.findIndex(C=>C.id===b),[s]),N=d.useCallback((b,C)=>{const j=p(b),I=p(C);j<0||I<0||j===I||a==null||a(We([...s],j,I).map(c=>c.id))},[s,p,a]),v=d.useCallback(()=>{l(null),m(null),t(!1),u.current=null},[]),g=d.useCallback((b,C)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":r===b,onPointerDown:j=>{var w,B;if(n||j.button!==0&&j.pointerType==="mouse")return;(B=(w=j.currentTarget).setPointerCapture)==null||B.call(w,j.pointerId),l(b),t(!0),u.current=s.map(f=>f.id);const I=()=>{window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",c),t(!1),l(null),m(null)},c=()=>{window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",c),u.current&&(a==null||a(u.current)),v()};window.addEventListener("pointerup",I),window.addEventListener("pointercancel",c)},onPointerEnter:()=>{n||!r||r===b||(m(b),N(r,b))},onKeyDown:j=>{if(n)return;if(j.key===" "||j.key==="Enter"){j.preventDefault(),r===b?v():(l(b),u.current=s.map(f=>f.id));return}if(j.key==="Escape"&&r===b){j.preventDefault(),u.current&&(a==null||a(u.current)),v();return}if(r!==b)return;const c=j.key==="ArrowLeft"||j.key==="ArrowUp"?-1:j.key==="ArrowRight"||j.key==="ArrowDown"?1:0;if(c===0)return;j.preventDefault();const w=p(b),B=w+c;B<0||B>=s.length||a==null||a(We([...s],w,B).map(f=>f.id))},...C?{"aria-label":C}:{}}),[r,N,n,v,p,s,a]);return{activeId:r,overId:o,getHandleProps:g,dragging:h}}const $n=({item:i})=>{const[s,a]=d.useState(!1),n=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(T.NtdPlay,{size:26})}):s||!n?e.jsx("div",{className:"nice-event-media__broken",title:"Image unavailable",children:e.jsx(T.NtdImage,{size:24})}):e.jsx("img",{src:n,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>a(!0)})},Rn=[],En=d.forwardRef(function(s,a){const{items:n=Rn,onUpload:r,onDelete:l,onLike:o,onItemClick:m,layout:h="grid",uploadEnabled:t=!0,typeFilter:u="all",onReorder:p,className:N,style:v}=s,[g,b]=d.useState(""),C=d.useMemo(()=>Bn(n),[n]),j=d.useMemo(()=>u==="all"?C:C.filter(f=>f.type===u),[C,u]),I=!!p&&u==="all",c=nn({items:C,onReorder:p,disabled:!I}),w=f=>{const y=f[0];!y||!r||(r(y,g.trim()||void 0),b(""))},B=h==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${h} ${N??""}`,style:v,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",j.length,")"]})}),t&&r&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:w}),e.jsx(x.NiceTextInput,{value:g,onChange:b,placeholder:"Add a caption…"})]}),j.length===0?e.jsx("p",{className:"nice-event-media__empty",children:"No media yet."}):e.jsx(x.NiceCardGroup,{columns:B?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:j.map((f,y)=>{const $=I?c.getHandleProps(f.id,`Move ${f.caption??`item ${y+1}`}`):null;return e.jsxs("div",{className:`nice-event-media__card${B?" nice-event-media__card--row":""}${c.activeId===f.id?" nice-event-media__card--dragging":""}`,onClick:()=>m==null?void 0:m(f),onPointerEnter:$==null?void 0:$.onPointerEnter,role:m?"button":void 0,tabIndex:m?0:void 0,children:[$&&e.jsx("span",{className:"nice-event-media__grip",role:$.role,tabIndex:$.tabIndex,"aria-grabbed":$["aria-grabbed"],"aria-label":$["aria-label"],draggable:$.draggable,onPointerDown:$.onPointerDown,onKeyDown:$.onKeyDown,onClick:k=>k.stopPropagation(),children:e.jsx(T.NtdMove,{size:14})}),e.jsx($n,{item:f}),e.jsxs("div",{className:"nice-event-media__body",children:[f.caption&&e.jsx("span",{className:"nice-event-media__caption",children:f.caption}),f.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:f.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[o&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:k=>{k.stopPropagation(),o(f.id)},"aria-label":"Like",children:[e.jsx(T.NtdHeart,{size:15})," ",f.likes??0]}),l&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:k=>{k.stopPropagation(),l(f.id)},"aria-label":"Delete",children:e.jsx(T.NtdTrash,{size:15})})]})]})]},f.id)})})]})}),me=({title:i,description:s,icon:a,action:n,className:r})=>e.jsx(x.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:r}),Ln=[],Dn=d.forwardRef(function(s,a){const{items:n=Ln,layout:r="grid",onReorder:l,onItemAdd:o,onItemRemove:m,onCaptionChange:h,onItemClick:t,previewMode:u=!1,transition:p="fade",defaultDurationMs:N=3e3,autoPlay:v=!0,disabled:g=!1,readOnly:b=!1,size:C="md",className:j,style:I}=s,[c,w]=d.useState(0),[B,f]=d.useState(null),[y,$]=d.useState(""),k=g||b,R=!!l&&!k,F=nn({items:n,onReorder:l,disabled:!R}),L=n.length>0?Math.min(c,n.length-1):0,E=n[L],U=(E==null?void 0:E.durationMs)??N;d.useEffect(()=>{if(!u||!v||n.length<2)return;const P=window.setTimeout(()=>w(W=>(W+1)%n.length),Math.max(250,U));return()=>window.clearTimeout(P)},[u,v,n.length,L,U]);const z=d.useMemo(()=>n.reduce((P,W)=>P+(W.durationMs??N),0),[n,N]),_=P=>{h==null||h(P,y),f(null),$("")};return n.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${j??""}`,style:I,children:e.jsx(me,{icon:e.jsx(T.NtdImage,{size:28}),title:"Nothing in the collage yet",description:"Add photos or video to start arranging them.",action:o&&!k?e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:o}):void 0})}):u?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${j??""}`,style:I,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(E==null?void 0:E.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:E.mediaUrl,controls:!0},E.id):e.jsx("img",{className:"nice-media-collage__slide",src:E==null?void 0:E.mediaUrl,alt:(E==null?void 0:E.caption)??""},E==null?void 0:E.id),(E==null?void 0:E.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:E.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(P=>(P-1+n.length)%n.length),children:"Previous"}),e.jsxs("span",{className:"nice-media-collage__counter",children:[L+1," / ",n.length]}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:()=>w(P=>(P+1)%n.length),children:"Next"})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${r} nice-media-collage--${C} ${j??""}`,style:I,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(x.NiceSegmentedControl,{size:"sm",value:r,readOnly:!0,options:[{value:"sequence",label:"Sequence"},{value:"grid",label:"Grid"},{value:"mosaic",label:"Mosaic"}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[n.length," item",n.length===1?"":"s"," · ",Math.round(z/1e3),"s"]}),o&&!k&&e.jsx(x.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:o})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":"Collage order","aria-busy":F.dragging,children:n.map((P,W)=>{const X=R?F.getHandleProps(P.id,`Move ${P.caption??`item ${W+1}`}`):null;return e.jsxs("li",{className:`nice-media-collage__tile${F.activeId===P.id?" nice-media-collage__tile--active":""}${F.overId===P.id?" nice-media-collage__tile--over":""}`,onPointerEnter:X==null?void 0:X.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:W+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>t==null?void 0:t(P),disabled:!t,children:P.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(T.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:P.mediaUrl,alt:P.caption??"",loading:"lazy"})}),B===P.id?e.jsx(x.NiceTextInput,{value:y,onChange:$,placeholder:"Caption",autoFocus:!0,size:"sm",onBlur:()=>_(P.id),onKeyDown:M=>{M.key==="Enter"&&_(P.id),M.key==="Escape"&&f(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!h||k,onClick:()=>{f(P.id),$(P.caption??"")},children:P.caption||e.jsx("em",{children:"Add a caption"})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[X&&e.jsx("span",{className:"nice-media-collage__grip",role:X.role,tabIndex:X.tabIndex,"aria-grabbed":X["aria-grabbed"],"aria-label":X["aria-label"],draggable:X.draggable,onPointerDown:X.onPointerDown,onKeyDown:X.onKeyDown,children:e.jsx(T.NtdMove,{size:14})}),m&&!b&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${P.caption??`item ${W+1}`}`,disabled:g,onClick:()=>m(P.id),children:e.jsx(T.NtdTrash,{size:14})})]})]},P.id)})}),o&&!k&&n.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(T.NtdPlus,{size:12})," Drag a tile, or focus one and press Space then the arrow keys."]})]})});function Ie(i){const s=i.toLowerCase();return["active","live","published","completed","confirmed"].includes(s)?"success":["cancelled","canceled","rejected","failed"].includes(s)?"error":["scheduled","pending","planning"].includes(s)?"info":["draft","archived"].includes(s)?"secondary":"warning"}const On={micro:[],compact:["details","location","budget"],normal:["details","location","schedule","participants","tasks","surveys","budget"],full:["details","location","schedule","participants","tasks","surveys","vendors","budget","documents","settings"]},Un=d.forwardRef(function(s,a){var Oe,Ue,Ye,Fe,Xe,Ve;const{event:n,participants:r=[],surveys:l=[],billing:o=[],scheduleItems:m=[],tasks:h=[],vendors:t=[],documents:u=[],displayMode:p="normal",tabs:N,activeTab:v,onTabChange:g,tabsIconOnly:b=!0,tabsCentered:C="auto",countLocation:j="bottom",showDetails:I=!0,showLocation:c=!0,showSchedule:w=!0,showParticipants:B=!0,showTasks:f=!0,showSurveys:y=!0,showVendors:$=!0,showBudget:k=!0,showDocuments:R=!0,showSettings:F=!0,editable:L=!1,onSave:E,onPublish:U,onShare:z,onExport:_,onUpdateEvent:P,onUpdateLocation:W,onAddSurvey:X,onSurveyRespond:M,onAddBilling:Y,className:V,style:K}=s,[D,Z]=d.useState(n.title),[G,he]=d.useState(n.description??""),[se,ce]=d.useState(n.startDate??""),[pe,we]=d.useState(n.endDate??""),[xe,le]=d.useState(((Oe=n.location)==null?void 0:Oe.name)??""),[ge,Pe]=d.useState(((Ue=n.location)==null?void 0:Ue.address)??""),[oe,ie]=d.useState(((Ye=n.location)==null?void 0:Ye.virtualUrl)??""),[ne,Ne]=d.useState(((Fe=n.location)==null?void 0:Fe.isVirtual)??!1),[de,je]=d.useState(""),[ue,Ae]=d.useState("single"),[ye,_e]=d.useState(""),[ae,be]=d.useState(""),[fe,A]=d.useState(""),[O,q]=d.useState("PLN"),H={details:I,location:c,schedule:w,participants:B,tasks:f,surveys:y,vendors:$,budget:k,documents:R,settings:F},re=(N??On[p]).filter(S=>H[S]!==!1),[Se,ln]=d.useState(re[0]??"details"),on=v??Se,dn=d.useCallback(S=>{const te=S;v===void 0&&ln(te),g==null||g(te)},[v,g]),un=d.useCallback(()=>{P==null||P({title:D,description:G||void 0,startDate:se||void 0,endDate:pe||void 0})},[D,G,se,pe,P]),mn=d.useCallback(()=>{W==null||W({name:xe,address:ge||void 0,virtualUrl:oe||void 0,isVirtual:ne})},[xe,ge,oe,ne,W]),hn=d.useCallback(()=>{if(!de.trim()||!X)return;const S=ye.split(",").map(te=>te.trim()).filter(Boolean);X(de.trim(),ue,S.length>0?S:void 0),je(""),_e("")},[de,ue,ye,X]),pn=d.useCallback(()=>{!ae.trim()||!Y||(Y({label:ae.trim(),amount:parseFloat(fe)||0,currency:O}),be(""),A(""))},[ae,fe,O,Y]),xn=d.useMemo(()=>o.map(S=>({label:S.label,amount:S.amount})),[o]),gn=d.useMemo(()=>o.reduce((S,te)=>S+te.amount,0),[o]),fn=((Xe=o[0])==null?void 0:Xe.currency)??"PLN",vn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceTextInput,{label:"Title",value:D,onChange:Z,readOnly:!L}),e.jsx(x.NiceTextArea,{label:"Description",value:G,onChange:he,readOnly:!L,rows:3}),e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"Start"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:S=>ce(S.target.value),readOnly:!L})]}),e.jsxs("label",{className:"nice-field",children:[e.jsx("span",{className:"nice-field__label",children:"End"}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:pe,onChange:S=>we(S.target.value),readOnly:!L})]})]}),L&&e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:un,children:"Save details"})]}),Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceToggle,{label:"Virtual event",checked:ne,onChange:Ne,disabled:!L}),e.jsx(x.NiceTextInput,{label:"Venue name",value:xe,onChange:le,readOnly:!L}),ne?e.jsx(x.NiceTextInput,{label:"Virtual URL",value:oe,onChange:ie,readOnly:!L}):e.jsx(x.NiceTextInput,{label:"Address",value:ge,onChange:Pe,readOnly:!L}),L&&e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:mn,children:"Save location"})]}),jn=e.jsx("div",{className:"nice-event-planning__participants",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No participants yet."}):e.jsxs(e.Fragment,{children:[e.jsx(x.NiceAvatarGroup,{max:8,children:r.map(S=>e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl},S.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:r.map(S=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:S.name}),e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:S.status})]},S.id))})]})}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[l.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No surveys yet."}):l.map(S=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:S.question})," ",e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"info",children:S.type}),S.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:S.options.map((te,An)=>e.jsx(x.NiceButton,{size:"sm",variant:"outline",onClick:()=>M==null?void 0:M(S.id,te),children:te},An))}),S.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.responses.length," responses"]})]},S.id)),L&&X&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceTextInput,{label:"New survey question",value:de,onChange:je,placeholder:"Question"}),e.jsx(x.NiceSelect,{label:"Type",value:ue,onChange:S=>Ae(S),options:[{value:"single",label:"Single choice"},{value:"multiple",label:"Multiple choice"},{value:"text",label:"Free text"},{value:"rating",label:"Rating"}]}),e.jsx(x.NiceTextInput,{label:"Options (comma-separated)",value:ye,onChange:_e,placeholder:"Yes, No, Maybe"}),e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"plus",size:"sm"}),onClick:hn,disabled:!de.trim(),children:"Add survey"})]})]}),_n=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No billing items yet."}):e.jsx(x.NiceAmountBreakdown,{lines:[...xn,{label:"Total",amount:gn,isSummary:!0}],currency:fn}),L&&Y&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(x.NiceTextInput,{label:"Item",value:ae,onChange:be,placeholder:"Catering"}),e.jsx(x.NiceTextInput,{label:"Amount",value:fe,onChange:A,placeholder:"0.00"}),e.jsx(x.NiceSelect,{label:"Currency",value:O,onChange:S=>q(S),options:["PLN","EUR","USD","GBP"]}),e.jsx(x.NiceButton,{variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"plus",size:"sm"}),onClick:pn,disabled:!ae.trim(),children:"Add"})]})]}),bn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(x.NiceToggle,{label:"Public event",checked:n.isPublic??!1,disabled:!L}),e.jsx(x.NiceTextInput,{label:"Max participants",value:n.maxParticipants!=null?String(n.maxParticipants):"",onChange:()=>{},readOnly:!L}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",n.hostName," · Created ",new Date(n.createdAt).toLocaleDateString()]})]}),kn=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No agenda items yet."}):e.jsx("ul",{className:"nice-event-planning__schedule",children:m.map(S=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(Q.NiceIcon,{name:"clock",size:"sm"}),S.startTime??"",S.endTime?`–${S.endTime}`:""]}),e.jsx("span",{className:"nice-event-planning__schedule-title",children:S.title}),S.location&&e.jsx("span",{className:"nice-event-planning__muted",children:S.location})]},S.id))})}),wn=e.jsx("div",{className:"nice-event-planning__list",children:h.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No tasks yet."}):e.jsx("ul",{className:"nice-event-planning__tasks",children:h.map(S=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(x.NiceToggle,{label:S.title,checked:S.done??!1,disabled:!L}),S.assigneeName&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"info",children:S.assigneeName}),S.dueDate&&e.jsx("span",{className:"nice-event-planning__muted",children:S.dueDate})]},S.id))})}),Sn=e.jsx("div",{className:"nice-event-planning__list",children:t.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No vendors yet."}):e.jsx("ul",{className:"nice-event-planning__vendors",children:t.map(S=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(Q.NiceIcon,{name:"briefcase",size:"sm"}),e.jsx("span",{className:"nice-event-planning__vendor-name",children:S.name}),S.category&&e.jsx("span",{className:"nice-event-planning__muted",children:S.category}),S.status&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Ie(S.status),children:S.status}),S.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[S.cost," ",S.currency??""]})]},S.id))})}),In=e.jsx("div",{className:"nice-event-planning__list",children:u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:"No documents yet."}):e.jsx("ul",{className:"nice-event-planning__documents",children:u.map(S=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(Q.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:S.name}),S.fileType&&e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"secondary",children:S.fileType}),S.sizeKb!=null&&e.jsxs("span",{className:"nice-event-planning__muted",children:[S.sizeKb," KB"]})]},S.id))})}),Cn={details:vn,location:Nn,schedule:kn,participants:jn,tasks:wn,surveys:yn,vendors:Sn,budget:_n,documents:In,settings:bn},zn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},Mn={schedule:m.length||void 0,participants:r.length||void 0,tasks:h.length||void 0,surveys:l.length||void 0,vendors:t.length||void 0,budget:o.length||void 0,documents:u.length||void 0},Tn=re.map(S=>({id:S,label:S.charAt(0).toUpperCase()+S.slice(1),icon:e.jsx(Q.NiceIcon,{name:zn[S],size:"sm"}),badge:Mn[S],content:Cn[S]})),Pn=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(Q.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsx(x.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[E&&e.jsx(x.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(Q.NiceIcon,{name:"check",size:"sm"}),onClick:()=>E({title:D,description:G}),children:"Save"}),U&&e.jsx(x.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(Q.NiceIcon,{name:"upload",size:"sm"}),onClick:U,children:"Publish"}),z&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Q.NiceIcon,{name:"link",size:"sm"}),onClick:z,children:"Share"}),_&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(Q.NiceIcon,{name:"download",size:"sm"}),onClick:_,children:"Export"})]})]});return p==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${V??""}`,style:K,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(Q.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:n.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[n.startDate?new Date(n.startDate).toLocaleString():"No date",(Ve=n.location)!=null&&Ve.name?` · ${n.location.name}`:""]})]}),e.jsx(x.NiceBadge,{size:"sm",variant:Ie(n.status),children:n.status}),r.length>0&&e.jsx(x.NiceAvatarGroup,{max:4,size:"sm",children:r.map(S=>e.jsx(x.NiceAvatar,{name:S.name,src:S.avatarUrl,size:"sm"},S.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${p} ${V??""}`,style:K,children:[Pn,e.jsx(x.NiceTabs,{tabs:Tn,activeTab:on,onChange:dn,iconOnly:b,centered:C,countLocation:j})]})});function Yn(i){switch(i){case"confirmed":return"success";case"checked-in":return"info";case"declined":return"error";case"no-show":return"warning";default:return"secondary"}}const Be=({participant:i,showRole:s=!0,showStatus:a=!0,meta:n,children:r,size:l="md",className:o})=>e.jsxs("li",{className:`nice-participant-row nice-participant-row--${l} ${o??""}`,children:[e.jsx(x.NiceAvatar,{name:i.name,src:i.avatarUrl,size:l}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(x.NiceBadge,{size:"xs",outline:!0,variant:"info",children:i.role}),a&&i.status&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:Yn(i.status),children:i.status}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),r&&e.jsx("span",{className:"nice-participant-row__trailing",children:r})]}),Fn=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,qe=/^.*<\s*([^<>\s]+)\s*>$/;function sn(i){var l,o;const s=[],a=[],n=new Set;let r=0;if(!i)return{valid:s,invalid:a,duplicates:r};for(const m of i.split(/[,;\r\n\t]+/)){const h=m.trim();if(!h)continue;const t=((o=(l=qe.exec(h))==null?void 0:l[1])==null?void 0:o.trim())??h,u=qe.test(h)?[t]:t.split(/\s+/);for(const p of u){if(!p)continue;if(!Fn.test(p)){a.push(p);continue}const N=p.toLowerCase();if(n.has(N)){r+=1;continue}n.add(N),s.push(p)}}return{valid:s,invalid:a,duplicates:r}}function Xn(i,s){const a=new Set(i.map(r=>r.toLowerCase())),n=[...i];for(const r of s){const l=r.toLowerCase();a.has(l)||(a.add(l),n.push(r))}return n}function tn(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[r,l]=d.useState(""),o=!s,m=a??r,h=!n||m.trim().length>0;return{isAnonymous:o,name:m,setName:l,canAct:h,actor:{userId:s,userName:m.trim()}}}const Vn=[{answer:"yes",label:"Yes",variant:"success",Icon:T.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:T.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:T.NtdClose}],$e=d.forwardRef(function(s,a){const{value:n,onRespond:r,allowPlusOnes:l=!1,maxPlusOnes:o=5,plusOnes:m=0,allowNote:h=!1,currentUserId:t,currentUserName:u,compact:p=!1,disabled:N=!1,readOnly:v=!1,size:g="md",className:b,style:C}=s,j=tn({currentUserId:t,currentUserName:u}),[I,c]=d.useState(m),[w,B]=d.useState(""),f=!p&&j.isAnonymous&&!j.canAct,y=N||v,$=k=>{y||!r||r({answer:k,plusOnes:l&&k!=="no"?I:void 0,note:h&&w.trim()?w.trim():void 0,userId:j.actor.userId,userName:j.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${g}${p?" nice-rsvp-control--compact":""} ${b??""}`,style:C,children:[!p&&j.isAnonymous&&e.jsx(x.NiceTextInput,{label:"Your name",value:j.name,onChange:j.setName,placeholder:"Who is replying?",required:!0,disabled:y,size:g}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":"Your reply",children:Vn.map(({answer:k,label:R,variant:F,Icon:L})=>e.jsx(x.NiceButton,{size:g,variant:n===k?F:"outline",leftIcon:e.jsx(L,{size:16}),disabled:y||f,"aria-pressed":n===k,onClick:()=>$(k),children:R},k))}),!p&&l&&n!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:"Additional guests"}),e.jsx(x.NiceNumericInput,{value:I,onChange:k=>c(Math.max(0,Math.min(o,k??0))),min:0,max:o,step:1,size:"xs",disabled:y})]}),!p&&h&&e.jsx(x.NiceTextInput,{label:"Note",value:w,onChange:B,placeholder:"Anything we should know?",disabled:y,size:g}),f&&e.jsx("p",{className:"nice-rsvp-control__hint",children:"Enter your name to reply."})]})}),Wn={yes:"confirmed",maybe:"invited",no:"declined"},Ge={confirmed:"yes","checked-in":"yes",declined:"no"},Ce=["confirmed","checked-in","invited","declined","no-show"],qn=[],Gn=d.forwardRef(function(s,a){const{participants:n=qn,mode:r="organizer",currentUserId:l,currentUserName:o,onRsvpChange:m,onCheckIn:h,onScan:t,checkInSlot:u,onInvite:p,extraFields:N,groupBy:v="none",showSummary:g=!0,showSearch:b=!0,allowPlusOnes:C=!1,disabled:j=!1,readOnly:I=!1,size:c="md",className:w,style:B}=s,[f,y]=d.useState(""),[$,k]=d.useState("all"),[R,F]=d.useState(""),L=j||I,E=r==="guest",U=d.useMemo(()=>{const M={total:n.length};for(const Y of Ce)M[Y]=0;for(const Y of n)M[Y.status]=(M[Y.status]??0)+1;return M},[n]),z=d.useMemo(()=>{if(E)return n.filter(Y=>Y.userId===l||Y.id===l);const M=f.trim().toLowerCase();return n.filter(Y=>$!=="all"&&Y.status!==$?!1:!M||Y.name.toLowerCase().includes(M))},[n,E,l,f,$]),_=d.useMemo(()=>{if(v==="none"||E)return[{key:"all",label:"",items:z}];const M=new Map;for(const V of z){const K=v==="status"?V.status:V.role,D=M.get(K);D?D.push(V):M.set(K,[V])}return[...M.keys()].sort((V,K)=>v!=="status"?V.localeCompare(K):Ce.indexOf(V)-Ce.indexOf(K)).map(V=>({key:V,label:V,items:M.get(V)??[]}))},[z,v,E]),P=d.useMemo(()=>sn(R),[R]),W=M=>Y=>{m==null||m(M,Wn[Y.answer],Y)},X=()=>{!p||P.valid.length===0||(p(P.valid),F(""))};if(E){const M=z[0];return M?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${w??""}`,style:B,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Be,{participant:M,size:c})}),e.jsx($e,{value:Ge[M.status],onRespond:W(M.id),allowPlusOnes:C,currentUserId:l??M.userId,currentUserName:o??M.name,disabled:j,readOnly:I,size:c})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${w??""}`,style:B,children:e.jsx(me,{title:"You are not on this guest list",description:"Ask the host for an invitation link."})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${w??""}`,style:B,children:[g&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:U["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:U.total})," total"]})]}),(b||u||t)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(x.NiceTextInput,{value:f,onChange:y,placeholder:"Search guests…",prefix:e.jsx(T.NtdSearch,{size:15}),size:c}),e.jsx(x.NiceSelect,{value:$,onChange:M=>k(M),size:c,options:[{value:"all",label:"All statuses"},...Ce.map(M=>({value:M,label:M}))]})]}),u,t&&!u&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(T.NtdQrCode,{size:15})," Scanner ready"]})]}),z.length===0?e.jsx(me,{title:"No guests yet",description:n.length>0?"No one matches the current filter.":"Invite people to see them here."}):_.map(M=>e.jsxs("section",{className:"nice-participant-list__group",children:[M.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[M.label," ",e.jsxs("span",{children:["(",M.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:M.items.map(Y=>e.jsxs(Be,{participant:Y,size:c,meta:N==null?void 0:N.map(V=>e.jsx("span",{className:"nice-participant-list__extra",children:V.render?V.render(Y):String(Y[V.key]??"")},V.key)),children:[m&&e.jsx($e,{compact:!0,value:Ge[Y.status],onRespond:W(Y.id),currentUserId:Y.userId,currentUserName:Y.name,disabled:L,size:"sm"}),h&&Y.status!=="checked-in"&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(T.NtdCheck,{size:14}),disabled:L,onClick:()=>h(Y.id),children:"Check in"})]},Y.id))})]},M.key)),p&&!I&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(x.NiceTextArea,{label:"Invite by email",value:R,onChange:F,placeholder:"Paste addresses — commas, semicolons or new lines",rows:3,disabled:j,size:c}),e.jsxs(x.NiceButton,{variant:"primary",size:c,leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:j||P.valid.length===0,onClick:X,children:["Invite ",P.valid.length>0?`(${P.valid.length})`:""]}),(P.invalid.length>0||P.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[P.duplicates>0&&`${P.duplicates} duplicate(s) removed. `,P.invalid.length>0&&`${P.invalid.length} entry(ies) not recognised.`]})]})]})}),Kn={BIF:0,CLP:0,DJF:0,GNF:0,ISK:0,JPY:0,KMF:0,KRW:0,PYG:0,RWF:0,UGX:0,UYI:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,BHD:3,IQD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Ee(i){return Kn[i==null?void 0:i.toUpperCase()]??2}function Le(i,s){return Number.isFinite(i)?Math.round(i*10**Ee(s)):0}function Me(i,s){const a=Ee(s);return a===0?i:i/10**a}function Hn(i,s,a){const n=Ee(s),r=Me(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(r)}catch{return`${r.toFixed(n)} ${s}`}}function ee(i,s,a){return Hn(Le(i,s),s,a)}const Re={minX:0,minY:0,maxX:0,maxY:0};function Qn(i,s=0){if(i.length===0)return{...Re};let a=1/0,n=1/0,r=-1/0,l=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<n&&(n=o.y),o.x>r&&(r=o.x),o.y>l&&(l=o.y);return{minX:a-s,minY:n-s,maxX:r+s,maxY:l+s}}function Ke(i,s){return{minX:Math.min(i.minX,s.minX),minY:Math.min(i.minY,s.minY),maxX:Math.max(i.maxX,s.maxX),maxY:Math.max(i.maxY,s.maxY)}}function He(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Zn(i,s,a=0){const n=i.zoom||1,r=-i.pan.x/n-a,l=-i.pan.y/n-a;return{minX:r,minY:l,maxX:r+s.width/n+a*2,maxY:l+s.height/n+a*2}}function Jn(i,s=12){const a=[],n=[],r=new Map,l=new Map;let o=null,m=0;for(const h of i.sections??[]){let t=null,u=0;(h.rows??[]).forEach((N,v)=>{const g=es(N.seats??[]);if(g.length===0)return;const b=Qn(g,s);n.push({sectionId:h.id,rowIndex:v,label:N.label,seats:g,bounds:b}),g.forEach((C,j)=>{r.set(C.id,C),l.set(C.id,{sectionId:h.id,rowIndex:v,seatIndex:j})}),u+=g.length,t=t?Ke(t,b):b});const p=t??{...Re};a.push({section:h,bounds:p,seatCount:u}),m+=u,u>0&&(o=o?Ke(o,p):p)}return{sections:a,rows:n,bounds:o??{...Re},totalSeats:m,seatById:r,locationById:l}}function es(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function ns(i,s){return i>s*4?"section":i>s?"row":"seat"}function ss(i,s,a=2500,n){const r=i.sections.filter(u=>He(u.bounds,s)),l=new Set(r.map(u=>u.section.id)),o=i.rows.filter(u=>l.has(u.sectionId)&&He(u.bounds,s));let m=0;for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&(m+=1);const h=n??ns(m,a);let t=[];if(h==="seat"){t=[];for(const u of o)for(const p of u.seats)p.x>=s.minX&&p.x<=s.maxX&&p.y>=s.minY&&p.y<=s.maxY&&t.push(p)}return{tier:h,sections:r,rows:h==="section"?[]:o,seats:t,visibleSeatCount:m}}function De(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function ve(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function Qe(i,s,a){var r;const n=(r=s.priceCategories)==null?void 0:r.find(l=>l.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function ts(i,s={},a){return!(ve(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function an(i,s={},a){const n=[];let r=null;return i.forEach((l,o)=>{ts(l,s,a)?r?r.seats.push(l):r={start:o,seats:[l]}:r&&(n.push(r),r=null)}),r&&n.push(r),n}function is(i,s,a={},n){const r=a.maxSeats??8;if(i.length>r)return{ok:!1,reason:"max-seats"};for(const o of i){const m=s.seatById.get(o);if(m){if(ve(m,n)!=="available")return{ok:!1,reason:"unavailable",seatId:o};if(a.allowedCategories&&!a.allowedCategories.includes(m.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:o}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const l=new Map;for(const o of i){const m=s.locationById.get(o);if(!m)continue;const h=`${m.sectionId}::${m.rowIndex}`,t=l.get(h);t?t.push(o):l.set(h,[o])}for(const[o,m]of l){const[h,t]=o.split("::"),u=Number(t),p=s.rows.find(c=>c.sectionId===h&&c.rowIndex===u);if(!p)continue;const N=an(p.seats,a,n),v=new Set(m);let g=null;for(const c of N)if(c.seats.some(w=>v.has(w.id))){if(g)return{ok:!1,reason:"not-adjacent",seatId:m[0]};g=c}if(!g)continue;const b=g.seats.map((c,w)=>v.has(c.id)?w:-1).filter(c=>c>=0);if(b.length===0)continue;const C=b[0],j=b[b.length-1];if(j-C+1!==b.length)return{ok:!1,reason:"not-adjacent",seatId:m[0]};const I=g.seats.length;if(I>1&&(C===1||I-1-j===1))return{ok:!1,reason:"orphan-seat",seatId:m[0]}}return{ok:!0}}function as(i,s,a,n={},r){if(i.includes(s))return{selected:i.filter(m=>m!==s)};const l=[...i,s],o=is(l,a,n,r);return o.ok?{selected:l}:{rejected:o.reason??"not-adjacent"}}function rs(i,s,a={},n={},r){if(s<=0)return[];const l=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let o=null;for(const m of i.rows)if(!(n.sectionId&&m.sectionId!==n.sectionId))for(const h of an(m.seats,l,r)){const t=h.seats.length;if(!(t<s))for(let u=0;u+s<=t;u+=1){const p=u+s-1;if(t>s&&(u===1||t-1-p===1))continue;const N=h.seats.slice(u,p+1),v=N.reduce((g,b)=>g+(b.viewScore??50),0)/s;(!o||v>o.score)&&(o={ids:N.map(g=>g.id),score:v})}}return(o==null?void 0:o.ids)??[]}function cs(i,s,a){var u,p,N,v;const n=i.locationById.get(s);if(!n)return null;const r=i.rows.findIndex(g=>g.sectionId===n.sectionId&&g.rowIndex===n.rowIndex);if(r<0)return null;const l=i.rows[r];if(a==="left")return((u=l.seats[n.seatIndex-1])==null?void 0:u.id)??null;if(a==="right")return((p=l.seats[n.seatIndex+1])==null?void 0:p.id)??null;if(a==="row-start")return((N=l.seats[0])==null?void 0:N.id)??null;if(a==="row-end")return((v=l.seats[l.seats.length-1])==null?void 0:v.id)??null;const o=i.rows[a==="up"?r-1:r+1];if(!o)return null;const m=l.seats[n.seatIndex].x;let h=null,t=1/0;for(const g of o.seats){const b=Math.abs(g.x-m);b<t&&(t=b,h=g)}return(h==null?void 0:h.id)??null}function ls(i,s,a){var h,t,u;const n=i.sections.filter(p=>p.seatCount>0);if(n.length===0)return null;const r=s?(h=i.locationById.get(s))==null?void 0:h.sectionId:void 0,l=n.findIndex(p=>p.section.id===r),o=l<0?0:a==="next"?l+1:l-1,m=n[o];return m?((u=(t=i.rows.find(p=>p.sectionId===m.section.id))==null?void 0:t.seats[0])==null?void 0:u.id)??null:null}const ke=8;function os(i,s){return i.seats.length===0?0:i.seats.filter(n=>ve(n,s)==="available").length/i.seats.length}const ds=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:r,interactive:l,onSeatClick:o,onSectionClick:m,describeSeat:h})=>i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:t,bounds:u,seatCount:p})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:u.minX,y:u.minY,width:u.maxX-u.minX,height:u.maxY-u.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:r.get(t.id)},role:m?"button":"img","aria-label":`${t.name}, ${p} seats`,tabIndex:m?0:void 0,onClick:m?()=>m(t.id):void 0}),e.jsx("text",{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:t.name})]},t.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(t=>{const u=os(t,n);return e.jsxs("g",{children:[e.jsx("rect",{x:t.bounds.minX,y:t.bounds.minY,width:t.bounds.maxX-t.bounds.minX,height:t.bounds.maxY-t.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:r.get(t.sectionId),fillOpacity:.25+u*.65},role:"img","aria-label":`Row ${t.label}, ${t.seats.length} seats, ${Math.round(u*t.seats.length)} available`}),e.jsx("text",{x:t.bounds.minX-6,y:(t.bounds.minY+t.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:t.label})]},`${t.sectionId}-${t.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(t=>{const u=ve(t,n),p=De(t),N=s.has(t.id),v=a===t.id,g={row:t.row,number:t.number},b=["nice-seating-chart__seat",`nice-seating-chart__seat--${u}`,N?"nice-seating-chart__seat--selected":"",p?`nice-seating-chart__seat--${p}`:"",v?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:b,"data-seat-id":t.id,role:"gridcell","aria-selected":N,"aria-disabled":u!=="available","aria-label":h(t),tabIndex:v?0:-1,onClick:l&&o?()=>o(t):void 0,children:[p?e.jsx("rect",{x:t.x-ke,y:t.y-ke,width:ke*2,height:ke*2,rx:3,className:"nice-seating-chart__seat-shape",fill:p==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:t.x,cy:t.y,r:ke,className:"nice-seating-chart__seat-shape"}),p==="wheelchair"&&e.jsx(T.NtdWheelchair,{size:10,x:t.x-5,y:t.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:h(t)}),e.jsx("text",{x:t.x,y:t.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:g.number})]},t.id)})}),us=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:r,onBestAvailable:l,describeSeat:o,disabled:m=!1,defaultOpen:h=!1})=>{var I;const t=d.useMemo(()=>i.sections.filter(c=>c.seatCount>0),[i.sections]),[u,p]=d.useState(((I=t[0])==null?void 0:I.section.id)??""),[N,v]=d.useState(0),[g,b]=d.useState(2),C=d.useMemo(()=>i.rows.filter(c=>c.sectionId===u),[i.rows,u]),j=C.find(c=>c.rowIndex===N)??C[0];return e.jsxs(x.NiceCollapse,{trigger:"Choose seats without the map",defaultExpanded:h,className:"nice-seating-chart__list-panel",children:[l&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"How many seats?"}),e.jsx(x.NiceNumericInput,{value:g,onChange:c=>b(Math.max(1,Math.min(n,c??1))),min:1,max:n,size:"xs",disabled:m})]}),e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:m,onClick:()=>l(g,{sectionId:u||void 0}),children:"Best available"})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Section"}),e.jsx(x.NiceSelect,{size:"sm",value:u,disabled:m,onChange:c=>{p(c),v(0)},options:t.map(c=>({value:c.section.id,label:`${c.section.name} (${c.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(x.NiceSelect,{size:"sm",value:String((j==null?void 0:j.rowIndex)??0),disabled:m||C.length===0,onChange:c=>v(Number(c)),options:C.map(c=>({value:String(c.rowIndex),label:`${c.label} (${c.seats.length})`}))})]})]}),j&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:j.seats.map(c=>{const w=ve(c,a),B=De(c),f=s.has(c.id);return e.jsx("li",{children:e.jsxs(x.NiceButton,{size:"sm",variant:f?"primary":"outline",disabled:m||w!=="available",ariaLabel:o(c),"aria-pressed":f,onClick:()=>r(c),children:[c.number,B&&e.jsx(T.NtdWheelchair,{size:11})]})},c.id)})})]})},ms={zoom:1,pan:{x:0,y:0}};function hs(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=ms,viewport:r,onViewportChange:l,disabled:o=!1}=i,[m,h]=d.useState(n),t=r??m,[u,p]=d.useState(!1),N=d.useRef(new Map),v=d.useRef(null),g=d.useRef(null),b=d.useCallback(k=>{r===void 0&&h(k),l==null||l(k)},[r,l]),C=d.useCallback(k=>Math.min(a,Math.max(s,k)),[s,a]),j=d.useCallback((k,R)=>{const F=C(t.zoom*k);if(F===t.zoom)return;const L=F/t.zoom;b({zoom:F,pan:{x:R.x-(R.x-t.pan.x)*L,y:R.y-(R.y-t.pan.y)*L}})},[b,C,t]),I=d.useCallback((k,R,F)=>{const L=R??(F?{x:F.width/2,y:F.height/2}:{x:0,y:0});j(k,L)},[j]),c=d.useCallback((k,R,F=24)=>{const L=Math.max(1,k.maxX-k.minX),E=Math.max(1,k.maxY-k.minY),U=C(Math.min((R.width-F*2)/L,(R.height-F*2)/E));b({zoom:U,pan:{x:(R.width-L*U)/2-k.minX*U,y:(R.height-E*U)/2-k.minY*U}})},[b,C]),w=d.useCallback(()=>b(n),[b,n]),B=d.useCallback(k=>({x:(k.x-t.pan.x)/t.zoom,y:(k.y-t.pan.y)/t.zoom}),[t]),f=d.useCallback(k=>({x:k.x*t.zoom+t.pan.x,y:k.y*t.zoom+t.pan.y}),[t]),y=k=>{const R=k.currentTarget.getBoundingClientRect();return{x:k.clientX-R.left,y:k.clientY-R.top}};return{viewport:t,setViewport:b,containerProps:o?{}:{onWheel:k=>{k.preventDefault();const R=Math.exp(-k.deltaY*.002);j(Math.min(2,Math.max(.5,R)),y(k))},onPointerDown:k=>{var F,L;const R=y(k);if(N.current.set(k.pointerId,R),(L=(F=k.currentTarget).setPointerCapture)==null||L.call(F,k.pointerId),N.current.size===2){const[E,U]=[...N.current.values()];v.current={distance:Math.hypot(E.x-U.x,E.y-U.y)||1,zoom:t.zoom}}else g.current=R,p(!0)},onPointerMove:k=>{if(!N.current.has(k.pointerId))return;const R=y(k);if(N.current.set(k.pointerId,R),N.current.size===2&&v.current){const[E,U]=[...N.current.values()],z=Math.hypot(E.x-U.x,E.y-U.y)||1,_=C(v.current.zoom*(z/v.current.distance)),P={x:(E.x+U.x)/2,y:(E.y+U.y)/2};_!==t.zoom&&j(_/t.zoom,P);return}if(!g.current)return;const F=R.x-g.current.x,L=R.y-g.current.y;g.current=R,b({zoom:t.zoom,pan:{x:t.pan.x+F,y:t.pan.y+L}})},onPointerUp:k=>{N.current.delete(k.pointerId),N.current.size<2&&(v.current=null),N.current.size===0&&(g.current=null,p(!1))},onPointerCancel:k=>{N.current.delete(k.pointerId),v.current=null,g.current=null,p(!1)}},zoomBy:I,fitTo:c,reset:w,screenToWorld:B,worldToScreen:f,panning:u}}const ps={"orphan-seat":"That would leave a single empty seat. Pick a different seat.","not-adjacent":"Seats must be next to each other.","max-seats":"You have selected as many seats as this order allows.","category-not-allowed":"That seat is not part of the selected ticket type.",unavailable:"That seat is not available."},xs={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},rn=d.forwardRef(function(s,a){var ae,be,fe;const{chart:n=xs,mode:r="select",selection:l={},selectedSeatIds:o,defaultSelectedSeatIds:m=[],onSelectionChange:h,onSelectionRejected:t,seatStatusOverrides:u,onSeatClick:p,onBestAvailable:N,lod:v="auto",onLodChange:g,maxRenderedSeats:b=2500,containerSize:C,showLegend:j=!0,showList:I=!1,zoomable:c=!0,locale:w,disabled:B=!1,readOnly:f=!1,className:y,style:$}=s,k=d.useRef(null),[R,F]=d.useState({width:800,height:500}),[L,E]=d.useState(!1),[U,z]=d.useState(m),[_,P]=d.useState(null),[W,X]=d.useState(""),M=o??U,Y=d.useMemo(()=>new Set(M),[M]),V=r==="select"&&!B&&!f&&l.interactive!==!1,K=l.maxSeats??8,D=d.useMemo(()=>Jn(n),[n]),Z=C??R,G=!!C||L;d.useEffect(()=>{if(C||!k.current||typeof ResizeObserver>"u")return;const A=k.current,O=new ResizeObserver(([q])=>{const{width:H,height:J}=q.contentRect;H>0&&J>0&&(F({width:H,height:J}),E(!0))});return O.observe(A),()=>O.disconnect()},[C]);const he=hs({disabled:!c||B}),{fitTo:se,viewport:ce}=he,pe=d.useRef(!1);d.useEffect(()=>{pe.current||!G||D.totalSeats===0||Z.width<=0||(pe.current=!0,se(D.bounds,Z))},[se,D,Z,G]);const we=d.useMemo(()=>Zn(ce,Z,40),[ce,Z]),xe=v!=="auto"?v:_?"seat":void 0,le=d.useMemo(()=>ss(D,we,b,xe),[D,we,b,xe]),ge=d.useRef(null);d.useEffect(()=>{ge.current!==le.tier&&(ge.current=le.tier,g==null||g(le.tier))},[le.tier,g]);const Pe=d.useMemo(()=>{var A;return new Map(((A=n.sections)==null?void 0:A.map(O=>[O.id,O.color]))??[])},[n.sections]),oe=d.useMemo(()=>{var A;return new Map(((A=n.sections)==null?void 0:A.map(O=>[O.id,O]))??[])},[n.sections]),ie=d.useCallback(A=>{const O=oe.get(A.sectorId),q=ve(A,u),H=De(A),J=[O?O.name:"",`row ${A.row}`,`seat ${A.number}`].filter(Boolean);if(O&&l.showPrices!==!1){const re=Qe(A,n,O);J.push(ee(re.amount,re.currency,w))}return J.push(q),H==="wheelchair"&&J.push("wheelchair accessible"),H==="companion"&&J.push("companion seat"),J.join(", ")},[n,oe,u,l.showPrices,w]),ne=d.useCallback(A=>{o===void 0&&z(A),h==null||h(A)},[o,h]),Ne=d.useCallback(A=>{if(p==null||p(A),!V)return;const O=as(M,A.id,D,l,u);if("rejected"in O){t==null||t({reason:O.rejected,seatId:A.id}),X(ps[O.rejected]);return}ne(O.selected),X(`${ie(A)}. ${O.selected.length} of ${K} selected.`)},[ne,ie,D,V,K,p,t,u,M,l]),de=d.useCallback((A,O)=>{if(N){N(A,O);return}const q=rs(D,A,l,O,u);if(q.length===0){X(`No block of ${A} seats together is available.`);return}ne(q),P(q[0]),X(`Selected ${q.length} seats together.`)},[ne,D,N,u,l]),je=d.useCallback(A=>{const O=D.locationById.get(A);if(!O)return;const q=D.rows.find(H=>H.sectionId===O.sectionId&&H.rowIndex===O.rowIndex);q&&se(q.bounds,Z,80)},[se,D,Z]),ue=d.useCallback(A=>{if(!A)return;P(A),je(A);const O=D.seatById.get(A);O&&X(ie(O))},[ie,D.seatById,je]),Ae=A=>{var J,re;const O=_??((re=(J=D.rows[0])==null?void 0:J.seats[0])==null?void 0:re.id)??null;if(!O)return;const H={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[A.key];if(H){A.preventDefault(),ue(_?cs(D,O,H):O);return}if(A.key==="PageDown"||A.key==="PageUp"){A.preventDefault(),ue(ls(D,_,A.key==="PageDown"?"next":"prev"));return}if(A.key==="Enter"||A.key===" "){A.preventDefault();const Se=D.seatById.get(O);Se&&Ne(Se);return}A.key==="Escape"&&M.length>0&&(A.preventDefault(),ne([]),X("Selection cleared."))};if(D.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${y??""}`,style:$,children:e.jsx(me,{title:"This chart has no seats",description:"Add sections and rows to the seating chart to see it here."})});const ye=M.reduce((A,O)=>{const q=D.seatById.get(O),H=q?oe.get(q.sectorId):void 0;return!q||!H?A:A+Qe(q,n,H).amount},0),_e=((be=(ae=n.sections)==null?void 0:ae[0])==null?void 0:be.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${r} ${y??""}`,style:$,children:[e.jsxs("div",{ref:k,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":`${n.name} seating chart`,"aria-rowcount":D.rows.length,"aria-colcount":D.totalSeats,tabIndex:_?-1:0,onKeyDown:Ae,...he.containerProps,children:[e.jsxs("svg",{className:"nice-seating-chart__canvas",width:"100%",height:"100%",role:"presentation",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"nice-seat-companion-hatch",width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:e.jsx("line",{x1:0,y1:0,x2:0,y2:4,className:"nice-seating-chart__hatch"})})}),e.jsx("g",{transform:`translate(${ce.pan.x} ${ce.pan.y}) scale(${ce.zoom})`,children:e.jsx(ds,{cull:le,selectedIds:Y,cursorId:_,statusOverrides:u,sectionColorById:Pe,interactive:V,onSeatClick:Ne,onSectionClick:l.sectionSelect?A=>{var q;const O=(q=D.rows.find(H=>H.sectionId===A))==null?void 0:q.seats[0];O&&ue(O.id)}:void 0,describeSeat:ie})})]}),c&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom in",onClick:()=>he.zoomBy(1.25,void 0,Z),children:"+"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Zoom out",onClick:()=>he.zoomBy(.8,void 0,Z),children:"−"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:"Fit to view",onClick:()=>se(D.bounds,Z),children:"Fit"})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:W}),j&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=n.priceCategories)==null?void 0:fe.map(A=>e.jsxs("li",{className:"nice-seating-chart__legend-item",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch",style:{background:A.color},"aria-hidden":"true"}),A.name," · ",ee(A.price,_e,w)]},A.id)),e.jsxs("li",{className:"nice-seating-chart__legend-item nice-seating-chart__legend-item--sold",children:[e.jsx("span",{className:"nice-seating-chart__legend-swatch","aria-hidden":"true"})," Sold"]})]}),r==="select"&&M.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[M.length," seat",M.length===1?"":"s"," ·"," ",ee(ye,_e,w)]}),I&&e.jsx(us,{index:D,selectedIds:Y,statusOverrides:u,maxSeats:K,onSeatToggle:Ne,onBestAvailable:de,describeSeat:ie,disabled:!V,defaultOpen:r==="select"&&I})]})}),gs=d.forwardRef(function({showList:s=!0,className:a,...n},r){return e.jsx(rn,{ref:r,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),cn=/\{\{\s*([\w.-]+)\s*\}\}/g,fs={"&":"&","<":"<",">":">",'"':""","'":"'"};function vs(i){return i.replace(/[&<>"']/g,s=>fs[s]??s)}function Ns(i){const s=[],a=new Set;for(const n of i.matchAll(cn)){const r=n[1];a.has(r)||(a.add(r),s.push(r))}return s}function js(i,s={},a={}){const{escape:n=!0,missing:r="keep"}=a;return i.replace(cn,(l,o)=>{const m=s[o];return m==null?r==="blank"?"":l:n?vs(String(m)):String(m)})}function Ze(i){return`{{${i}}}`}function ys(i,s={}){return Ns(i).filter(a=>s[a]===void 0||s[a]===null)}const _s={name:"",body:""},bs=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],ks=d.forwardRef(function(s,a){const{template:n,defaultTemplate:r,onTemplateChange:l,tokens:o=[],previewData:m={},recipients:h=[],onRecipientsChange:t,onSend:u,sending:p=!1,toolbar:N=bs,disabled:v=!1,readOnly:g=!1,size:b="md",className:C,style:j}=s,[I,c]=Q.useControllableState({value:n,defaultValue:r,fallbackValue:_s,onChange:l,componentName:"NiceInvitationDesigner"}),[w,B]=d.useState(""),f=v||g||p,y=d.useMemo(()=>sn(w),[w]),$=d.useMemo(()=>{const _={};for(const P of o)P.sample!==void 0&&(_[P.key]=P.sample);return{..._,...m}},[o,m]),k=d.useMemo(()=>js(I.body??"",$),[I.body,$]),R=d.useMemo(()=>ys(I.body??"",$),[I.body,$]),F=h.map(_=>_.email),L=_=>c({...I,..._}),E=_=>{L({body:`${I.body??""}${Ze(_)}`})},U=()=>{!t||y.valid.length===0||(t(Xn(F,y.valid)),B(""))},z=_=>{t==null||t(F.filter(P=>P!==_))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${b} ${C??""}`,style:j,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(x.NiceTextInput,{label:"Template name",value:I.name,onChange:_=>L({name:_}),placeholder:"Birthday invitation",disabled:f,size:b}),o.length>0&&!g&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),o.map(_=>e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:f,onClick:()=>E(_.key),children:_.label},_.key))]}),e.jsx(x.NiceHtmlEditor,{value:I.body??"",onChange:_=>L({body:_}),toolbar:N,height:280,readOnly:g||p,disabled:v})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":"Invitation preview",children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:"Preview"}),R.length>0&&e.jsxs(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[R.length," unresolved"]})]}),I.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:I.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:k}}),R.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",R.map(_=>Ze(_)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:["Recipients ",e.jsxs("span",{children:["(",h.length,")"]})]})}),t&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(x.NiceTextArea,{label:"Add addresses",value:w,onChange:B,placeholder:"Paste a list — commas, semicolons or new lines",rows:3,disabled:f,size:b}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsxs(x.NiceButton,{size:b,variant:"outline",leftIcon:e.jsx(T.NtdMail,{size:15}),disabled:f||y.valid.length===0,onClick:U,children:["Add ",y.valid.length>0?`(${y.valid.length})`:""]}),(y.invalid.length>0||y.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[y.duplicates>0&&`${y.duplicates} duplicate(s). `,y.invalid.length>0&&`${y.invalid.length} not recognised: ${y.invalid.slice(0,3).join(", ")}`]})]})]}),h.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:h.map(_=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:_.name?`${_.name} <${_.email}>`:_.email}),_.status&&_.status!=="pending"&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:_.status==="sent"?"success":"error",children:_.status}),t&&!g&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Remove ${_.email}`,disabled:f,onClick:()=>z(_.email),children:e.jsx(T.NtdTrash,{size:13})})]},_.email))}),u&&!g&&e.jsx(x.NiceButton,{variant:"primary",size:b,leftIcon:e.jsx(T.NtdSend,{size:15}),loading:p,ariaLabel:"Send invitations",disabled:v||p||h.length===0,onClick:()=>u({templateId:I.id,emails:F}),children:p?"Sending…":`Send to ${h.length}`})]})]})}),ws=({value:i,max:s,currency:a,locale:n,label:r,className:l})=>{const o=s>0?s:1,m=i>=s&&s>0,h=(t,u)=>a?`${ee(t,a,n)} / ${ee(u,a,n)}`:`${t} / ${u}`;return e.jsx(x.NiceProgress,{className:l,value:Math.min(i,o),max:o,variant:m?"success":"primary",size:"sm",showValue:!0,formatValue:()=>h(i,s),"aria-label":r})},Ss=[];function Is(i,s){if(s==="wishlist")return{value:i.isPurchased?1:0,max:1,complete:!!i.isPurchased};const a=i.quantityNeeded??1,n=i.quantityContributed??0;return{value:n,max:a,complete:a>0&&n>=a}}const Cs=d.forwardRef(function(s,a){const{items:n=Ss,kind:r="registry",mode:l="owner",currency:o="PLN",locale:m,hideContributors:h=!1,currentUserId:t,currentUserName:u,onContribute:p,onClaim:N,onUnclaim:v,onItemAdd:g,onItemDelete:b,onItemClick:C,layout:j="grid",disabled:I=!1,readOnly:c=!1,size:w="md",className:B,style:f}=s,y=tn({currentUserId:t,currentUserName:u}),[$,k]=d.useState(null),[R,F]=d.useState(0),[L,E]=d.useState(""),U=l==="owner",z=I||c,_=r==="wishlist",P=d.useMemo(()=>_?[...n].sort((M,Y)=>Number(M.isPurchased??!1)-Number(Y.isPurchased??!1)||(Y.priority??0)-(M.priority??0)):n,[n,_]),W=()=>{k(null),F(0)},X=M=>{!p||!y.canAct||(p(M.id,{amount:R>0?R:void 0,quantity:R>0?void 0:1,userName:y.actor.userName,userId:y.actor.userId}),W())};return n.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${B??""}`,style:f,children:e.jsx(me,{icon:e.jsx(T.NtdGiftCard,{size:28}),title:_?"Nothing on the wishlist yet":"No gifts on the registry yet",description:U?"Add what you would like and share the link.":"The host has not added anything yet."})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${r} nice-gift-registry--${j} nice-gift-registry--${w} ${B??""}`,style:f,children:[!U&&y.isAnonymous&&(p||N)&&e.jsx(x.NiceTextInput,{label:"Your name",value:y.name,onChange:y.setName,placeholder:"So the host knows who to thank",required:!0,disabled:z,size:w}),e.jsx(x.NiceCardGroup,{columns:j==="list"?1:void 0,minColumnWidth:240,gap:12,children:P.map(M=>{const{value:Y,max:V,complete:K}=Is(M,r),D=M.price,Z=M.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${K?" nice-gift-registry__item--complete":""}`,children:[M.imageUrl&&e.jsx("img",{src:M.imageUrl,alt:"",className:"nice-gift-registry__image",loading:"lazy"}),e.jsxs("div",{className:"nice-gift-registry__body",children:[e.jsx("button",{type:"button",className:"nice-gift-registry__title",onClick:()=>C==null?void 0:C(M),disabled:!C,children:M.title}),M.description&&e.jsx("p",{className:"nice-gift-registry__description",children:M.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[D&&e.jsx("span",{className:"nice-gift-registry__price",children:ee(D.amount,D.currency||o,m)}),_&&(M.priority??0)>0&&e.jsxs(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(T.NtdStar,{size:11})," ",M.priority]}),K&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:_?"bought":"fully covered"}),M.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:M.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(T.NtdLink,{size:13})," Shop"]})]}),!_&&e.jsx(ws,{value:Y,max:V,label:`${M.title}: ${Y} of ${V} covered`}),!h&&Z.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:Z.map(G=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:G.contributorName}),G.amount!==void 0&&` — ${ee(G.amount,(D==null?void 0:D.currency)||o,m)}`,G.amount===void 0&&G.quantity?` — ${G.quantity}×`:"",G.message&&e.jsxs("em",{children:[" “",G.message,"”"]})]},G.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!U&&!K&&N&&e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:z||!y.canAct,leftIcon:e.jsx(T.NtdCheck,{size:14}),onClick:()=>N(M.id,{...y.actor,quantity:1}),children:"I'll take this"}),!U&&K&&v&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",disabled:z,onClick:()=>v(M.id),children:"Release"}),!U&&!K&&!_&&p&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:z||!y.canAct,onClick:()=>k($===M.id?null:M.id),children:"Chip in"}),U&&b&&!c&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${M.title}`,disabled:I,onClick:()=>b(M.id),children:e.jsx(T.NtdTrash,{size:14})})]}),$===M.id&&e.jsxs("div",{className:"nice-gift-registry__pledge",children:[e.jsxs("label",{className:"nice-gift-registry__pledge-field",children:[e.jsxs("span",{children:["Amount (",(D==null?void 0:D.currency)||o,")"]}),e.jsx(x.NiceNumericInput,{value:R,onChange:G=>F(Math.max(0,G??0)),min:0,size:"xs",disabled:z})]}),e.jsx(x.NiceButton,{size:"sm",variant:"primary",disabled:z||!y.canAct,onClick:()=>X(M),children:"Confirm"}),e.jsx(x.NiceButton,{size:"sm",variant:"ghost",onClick:W,children:"Cancel"})]})]})]},M.id)})}),U&&g&&!c&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(x.NiceTextInput,{label:_?"Add a wish":"Add a gift",value:L,onChange:E,placeholder:"What would you like?",disabled:I,size:w}),e.jsx(x.NiceButton,{variant:"primary",size:w,leftIcon:e.jsx(T.NtdPlus,{size:15}),disabled:I||!L.trim(),onClick:()=>{g({title:L.trim(),quantityNeeded:1}),E("")},children:"Add"})]})]})});function zs(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),r=s.get(n);r?r.push(a):s.set(n,[a])}return s}function Ms(i,s,a){var h;const n=new Set(s.map(t=>t.id)),r=s.map(t=>t.id),l=new Map(r.map(t=>[t,0])),o=[];let m=0;if(r.length===0)return{balances:l,issues:i.map(t=>({itemId:t.id,reason:"no-participants"})),totalMinor:0};for(const t of i){const u=t.paidById;if(!u){o.push({itemId:t.id,reason:"no-payer"});continue}if(!n.has(u)){o.push({itemId:t.id,reason:"unknown-payer"});continue}let p=(h=t.splitAmong)!=null&&h.length?t.splitAmong.filter(j=>n.has(j)):r;p.length===0&&(p=r);const N=Le(t.amount,a);m+=N;const v=p.length,g=Math.floor(N/v),b=N-g*v,C=new Map(p.map(j=>[j,g]));if(b!==0)if(C.has(u))C.set(u,(C.get(u)??0)+b);else{const j=[...p].sort(Te),I=b>0?1:-1;for(let c=0;c<Math.abs(b);c+=1){const w=j[c%j.length];C.set(w,(C.get(w)??0)+I)}}l.set(u,(l.get(u)??0)+N);for(const[j,I]of C)l.set(j,(l.get(j)??0)-I)}return{balances:l,issues:o,totalMinor:m}}function Ts(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const r=Le(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+r),i.set(n.toId,(i.get(n.toId)??0)-r)}}function Ps(i,s,a){const n=new Map(s.map(t=>[t.id,t.name])),r=[...i.entries()].filter(([,t])=>t>0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>u.v-t.v||Te(t.id,u.id)),l=[...i.entries()].filter(([,t])=>t<0).map(([t,u])=>({id:t,v:u})).sort((t,u)=>t.v-u.v||Te(t.id,u.id)),o=[];let m=0,h=0;for(;m<l.length&&h<r.length;){const t=Math.min(-l[m].v,r[h].v);t>0&&o.push({fromId:l[m].id,fromName:n.get(l[m].id)??l[m].id,toId:r[h].id,toName:n.get(r[h].id)??r[h].id,amount:Me(t,a),currency:a}),l[m].v+=t,r[h].v-=t,l[m].v===0&&(m+=1),r[h].v===0&&(h+=1)}return o}function As(i,s,a=[]){const n=[],r=[],l=[...zs(i).entries()].sort(([o],[m])=>Te(o,m));for(const[o,m]of l){const h=Ms(m,s,o);r.push(...h.issues),Ts(h.balances,a,o),n.push({currency:o,total:Me(h.totalMinor,o),balances:s.map(t=>({participantId:t.id,participantName:t.name,amount:Me(h.balances.get(t.id)??0,o),currency:o})),transfers:Ps(h.balances,s,o)})}return{groups:n,issues:r}}function Te(i,s){return i<s?-1:i>s?1:0}const Bs=[],$s=[],Rs=d.forwardRef(function(s,a){const{items:n=Bs,participants:r=$s,settlements:l=[],view:o,defaultView:m="expenses",onViewChange:h,onSettle:t,onItemDelete:u,onItemClick:p,onValidationChange:N,sortBy:v="date",locale:g,disabled:b=!1,readOnly:C=!1,size:j="md",className:I,style:c}=s,[w,B]=d.useState(m),f=o??w,y=b||C,$=d.useMemo(()=>r.map(z=>({id:z.id,name:z.name})),[r]),k=d.useMemo(()=>As(n,$,l),[n,$,l]),R=d.useMemo(()=>v==="none"?n:n.map((z,_)=>({item:z,index:_})).sort((z,_)=>{if(v==="amount")return _.item.amount-z.item.amount||z.index-_.index;const P=z.item.incurredAt,W=_.item.incurredAt;return P&&W?P.localeCompare(W)||z.index-_.index:P?-1:W?1:z.index-_.index}).map(z=>z.item),[n,v]),F=k.issues.map(z=>`${z.itemId}:${z.reason}`).join("|");d.useEffect(()=>{N==null||N(k.issues)},[F]);const L=d.useMemo(()=>new Map(r.map(z=>[z.id,z.avatarUrl])),[r]),E=d.useMemo(()=>new Map(k.issues.map(z=>[z.itemId,z.reason])),[k.issues]),U=z=>{o===void 0&&B(z),h==null||h(z)};return n.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${I??""}`,style:c,children:e.jsx(me,{icon:e.jsx(T.NtdReceipt,{size:28}),title:"No expenses yet",description:"Add what people paid for and this will work out who owes whom."})}):e.jsxs("div",{ref:a,className:`nice-expense-split nice-expense-split--${j} ${I??""}`,style:c,children:[e.jsx(x.NiceSegmentedControl,{size:j,value:f,onChange:z=>U(z),options:[{value:"expenses",label:"Expenses"},{value:"balances",label:"Balances"},{value:"settlement",label:"Settle up"}]}),f==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:R.map(z=>{const _=E.get(z.id);return e.jsxs("li",{className:`nice-expense-split__item${_?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>p==null?void 0:p(z),disabled:!p,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:z.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[z.paidByName??z.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ee(z.amount,z.currency,g)}),z.isPaid&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),_&&e.jsx(x.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:_==="no-payer"?"no payer":"unknown payer"}),u&&!C&&e.jsx(x.NiceButton,{size:"sm",variant:"ghost",ariaLabel:`Delete ${z.label}`,disabled:b,onClick:()=>u(z.id),children:e.jsx(T.NtdTrash,{size:14})})]},z.id)})}),f==="balances"&&k.groups.map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ee(z.total,z.currency,g)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:z.balances.map(_=>e.jsx(Be,{participant:{id:_.participantId,name:_.participantName,avatarUrl:L.get(_.participantId)},showRole:!1,showStatus:!1,size:j,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${_.amount>0?"owed":_.amount<0?"owes":"settled"}`,children:[_.amount===0?"settled up":ee(Math.abs(_.amount),_.currency,g),_.amount>0&&e.jsx("em",{children:" is owed"}),_.amount<0&&e.jsx("em",{children:" owes"})]})},_.participantId))})]},z.currency)),f==="settlement"&&(k.groups.every(z=>z.transfers.length===0)?e.jsx(me,{icon:e.jsx(T.NtdCoins,{size:28}),title:"All settled up",description:"Nobody owes anybody anything."}):k.groups.filter(z=>z.transfers.length>0).map(z=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[z.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[z.transfers.length," transfer",z.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:z.transfers.map(_=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:_.fromName}),e.jsx(T.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:_.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ee(_.amount,_.currency,g)}),t&&!C&&e.jsx(x.NiceButton,{size:"sm",variant:"outline",disabled:y,onClick:()=>t(_),children:"Mark paid"})]},`${_.fromId}-${_.toId}-${_.amount}`))})]},z.currency)))]})}),Es={upcoming:T.NtdClock,active:T.NtdPlay,voting:T.NtdThumbsUp,scored:T.NtdBarChart,completed:T.NtdCheck,skipped:T.NtdSkipForward},Ls={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Ds=d.forwardRef(function(s,a){const{rounds:n,activeRoundId:r,onSelect:l,onStart:o,onEnd:m,onCreate:h,editable:t=!1,className:u,style:p}=s,N=[...n].sort((v,g)=>v.order-g.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${u??""}`,style:p,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",n.length,")"]}),t&&h&&e.jsx("button",{onClick:h,children:"+ Add Round"})]}),N.length===0?e.jsx("p",{className:"nice-round-list__empty",children:"No rounds yet."}):e.jsx("div",{className:"nice-round-list__items",children:N.map(v=>{const g=v.id===r;return e.jsxs("div",{className:`nice-round-list__item ${g?"nice-round-list__item--active":""}`,onClick:()=>l==null?void 0:l(v),role:l?"button":void 0,tabIndex:l?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",v.order]}),e.jsx("span",{className:"nice-round-list__icon",title:v.status,children:d.createElement(Es[v.status],{size:16})}),e.jsxs("div",{className:"nice-round-list__info",children:[e.jsx("strong",{className:"nice-round-list__name",children:v.name}),v.description&&e.jsx("small",{children:v.description}),v.type&&e.jsx("span",{className:"nice-round-list__type",children:v.type})]}),e.jsx("span",{className:"nice-round-list__status",style:{color:Ls[v.status]},children:v.status}),v.durationMinutes&&e.jsxs("span",{className:"nice-round-list__duration",children:[v.durationMinutes,"m"]}),v.winnerIds&&v.winnerIds.length>0&&e.jsxs("span",{className:"nice-round-list__winners",children:[e.jsx(T.NtdTrophy,{size:14})," ",v.winnerIds.length]}),t&&e.jsxs("div",{className:"nice-round-list__actions",onClick:b=>b.stopPropagation(),children:[v.status==="upcoming"&&o&&e.jsx("button",{onClick:()=>o(v.id),children:"Start"}),(v.status==="active"||v.status==="voting")&&m&&e.jsx("button",{onClick:()=>m(v.id),children:"End"})]})]},v.id)})})]})}),Os=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Us=d.forwardRef(function(s,a){const{round:n,timerRunning:r=!1,remainingSeconds:l,onSubmitScore:o,onStart:m,onEnd:h,onSkip:t,editable:u=!1,footerActions:p,className:N,style:v}=s,[g,b]=d.useState({}),C=d.useCallback(c=>{const w=parseFloat(g[c]??"");isNaN(w)||!o||(o(c,w),b(B=>({...B,[c]:""})))},[g,o]),j=c=>{const w=Math.floor(c/60),B=c%60;return`${w}:${B.toString().padStart(2,"0")}`},I=n.scores?[...n.scores].sort((c,w)=>w.score-c.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${n.status} ${N??""}`,style:v,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsxs("span",{className:"nice-round-card__order",children:["Round #",n.order]}),e.jsx("h3",{className:"nice-round-card__name",children:n.name}),e.jsx("span",{className:"nice-round-card__status",children:n.status})]}),n.description&&e.jsx("p",{className:"nice-round-card__description",children:n.description}),(r||l!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${r?"nice-round-card__timer--running":""}`,children:[e.jsx(T.NtdClock,{size:14})," ",l!=null?j(l):"—"]}),I.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:"Scoreboard"}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Participant"}),e.jsx("th",{children:"Score"})]})}),e.jsx("tbody",{children:I.map((c,w)=>e.jsxs("tr",{className:w<3?`nice-round-card__top-${w+1}`:"",children:[e.jsxs("td",{children:[c.rank??w+1,w<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(T.NtdMedal,{size:14,primaryColor:Os[w],"aria-label":`Place ${w+1}`})]})]}),e.jsx("td",{children:c.participantName}),e.jsx("td",{children:c.score})]},c.participantId))})]})]}),o&&(n.status==="active"||n.status==="voting")&&I.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:"Submit Scores"}),I.map(c=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:c.participantName}),e.jsx("input",{type:"number",value:g[c.participantId]??"",onChange:w=>b(B=>({...B,[c.participantId]:w.target.value})),min:0,step:1,placeholder:"Score"}),e.jsx("button",{onClick:()=>C(c.participantId),children:"Submit"})]},c.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[u&&e.jsxs("div",{className:"nice-round-card__actions",children:[n.status==="upcoming"&&m&&e.jsxs("button",{onClick:m,children:[e.jsx(T.NtdPlay,{size:14})," Start Round"]}),(n.status==="active"||n.status==="voting")&&h&&e.jsxs("button",{onClick:h,children:[e.jsx(T.NtdStop,{size:14})," End Round"]}),n.status==="upcoming"&&t&&e.jsxs("button",{onClick:t,children:[e.jsx(T.NtdSkipForward,{size:14})," Skip"]})]}),p]}),n.winnerIds&&n.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(T.NtdTrophy,{size:14})," Winners: ",n.winnerIds.length]})]})}),Ys=i=>{if(!i)return"";const s=Math.floor(i/60),a=i%60;return`${s}:${a.toString().padStart(2,"0")}`},Fs=d.forwardRef(function(s,a){const{songs:n,onAdd:r,onRemove:l,onVote:o,onSearch:m,showQueue:h=!0,readOnly:t=!1,className:u,style:p}=s,{t:N}=Q.useNiceTranslation(),[v,g]=d.useState(""),b=d.useMemo(()=>{if(!v.trim())return n;const c=v.toLowerCase();return n.filter(w=>w.title.toLowerCase().includes(c)||w.artist.toLowerCase().includes(c))},[n,v]),C=d.useMemo(()=>n.filter(c=>c.isQueued),[n]),j=n.find(c=>c.isPlaying),I=c=>{g(c),m==null||m(c)};return e.jsxs("div",{ref:a,className:`nice-song-picker ${u??""}`,style:p,children:[j&&e.jsxs("div",{className:"nice-song-picker__now-playing",style:{display:"flex",alignItems:"center",gap:10,borderLeft:"4px solid var(--nice-color-primary, #3b82f6)",padding:12,marginBottom:12,background:"color-mix(in srgb, var(--nice-color-primary, #3b82f6) 10%, var(--nice-bg-primary, #ffffff))"},children:[j.albumArt&&e.jsx("img",{src:j.albumArt,alt:"",className:"nice-song-picker__album-art",style:{width:40,height:40,borderRadius:6,objectFit:"cover"}}),e.jsxs("div",{children:[e.jsxs("div",{className:"nice-song-picker__np-label",style:{fontWeight:600},children:[e.jsx(T.NtdMusic,{size:14})," ",N("songPicker.nowPlaying","Now playing")]}),e.jsx("strong",{children:j.title})," — ",e.jsx("span",{children:j.artist})]})]}),e.jsx("div",{className:"nice-song-picker__search",style:{marginBottom:12},children:e.jsx(x.NiceTextInput,{size:"sm",controlWidth:"100%",value:v,onChange:I,placeholder:N("songPicker.search","Search songs or artists…"),"aria-label":N("songPicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-song-picker__list",children:b.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:N("songPicker.noMatch","No songs found.")}):b.map(c=>e.jsxs("div",{className:`nice-song-picker__item ${c.isPlaying?"nice-song-picker__item--playing":""}`,style:{display:"flex",alignItems:"center",gap:10,padding:"8px 0",borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"},children:[c.albumArt&&e.jsx("img",{src:c.albumArt,alt:"",className:"nice-song-picker__thumb",style:{width:36,height:36,borderRadius:4,objectFit:"cover"}}),e.jsxs("div",{className:"nice-song-picker__info",style:{flex:1,minWidth:0},children:[e.jsx("strong",{children:c.title})," — ",e.jsx("span",{children:c.artist}),c.duration&&e.jsx("span",{className:"nice-song-picker__duration",style:{marginLeft:8,fontSize:12,color:"var(--nice-text-muted)"},children:Ys(c.duration)}),c.addedByName&&e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-secondary)"},children:N("songPicker.addedBy","Added by {name}").replace("{name}",c.addedByName)})]}),!t&&e.jsxs("div",{className:"nice-song-picker__actions",style:{display:"flex",gap:6},children:[o&&e.jsxs(x.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o(c.id),"aria-label":N("songPicker.vote","Vote for {title}").replace("{title}",c.title),children:[e.jsx(T.NtdThumbsUp,{size:14})," ",c.votes??0]}),r&&!c.isQueued&&e.jsxs(x.NiceButton,{variant:"primary",size:"sm",onClick:()=>r(c.id),children:[e.jsx(T.NtdPlus,{size:14})," ",N("songPicker.addToQueue","Queue")]}),l&&c.isQueued&&e.jsx(x.NiceButton,{variant:"outline",size:"sm",onClick:()=>l(c.id),children:N("remove","Remove")})]})]},c.id))}),h&&C.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",style:{marginTop:16},children:[e.jsx("h4",{children:N("songPicker.queue","Queue ({count})").replace("{count}",String(C.length))}),C.map((c,w)=>e.jsxs("div",{className:"nice-song-picker__queue-item",style:{display:"flex",gap:6,padding:"4px 0"},children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",style:{fontWeight:600},children:[w+1,"."]}),e.jsxs("span",{children:[c.title," — ",c.artist]})]},c.id))]})]})}),Je={easy:"Easy",medium:"Medium",hard:"Hard",expert:"Expert"},Xs={easy:"var(--nice-color-success, #16a34a)",medium:"var(--nice-color-warning, #d97706)",hard:"var(--nice-color-error, #dc2626)",expert:"var(--nice-color-accent, #7c3aed)"},ze="all",Vs=d.forwardRef(function(s,a){const{songs:n,queue:r=[],onEnqueue:l,onDequeue:o,onNext:m,nowPlayingId:h,readOnly:t=!1,className:u,style:p}=s,{t:N}=Q.useNiceTranslation(),v=f=>f in Je?N(`karaokePicker.difficulty.${f}`,Je[f]):f,[g,b]=d.useState(""),[C,j]=d.useState(ze),I=n.find(f=>f.id===h),c=d.useMemo(()=>{let f=n;if(g.trim()){const y=g.toLowerCase();f=f.filter($=>$.title.toLowerCase().includes(y)||$.artist.toLowerCase().includes(y))}return C!==ze&&(f=f.filter(y=>y.difficulty===C)),f},[n,g,C]),w=d.useMemo(()=>new Set(r.map(f=>f.id)),[r]),B=["easy","medium","hard","expert"];return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${u??""}`,style:p,children:[I&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",style:{borderLeft:"4px solid var(--nice-color-primary, #3b82f6)",padding:"12px",marginBottom:12,background:"color-mix(in srgb, var(--nice-color-primary, #3b82f6) 10%, var(--nice-bg-primary, #ffffff))"},children:[e.jsxs("span",{style:{fontWeight:600},children:[e.jsx(T.NtdMicrophone,{size:14})," ",N("karaokePicker.nowSinging","Now Singing")]}),e.jsxs("div",{children:[e.jsx("strong",{children:I.title})," — ",I.artist,I.performerName&&e.jsxs("span",{children:[" ","(",N("karaokePicker.by","by {name}").replace("{name}",I.performerName),")"]})]}),!t&&m&&e.jsx("div",{style:{marginTop:8},children:e.jsxs(x.NiceButton,{variant:"secondary",size:"sm",onClick:m,children:[N("karaokePicker.next","Skip / Next")," ",e.jsx(T.NtdSkipForward,{size:14})]})})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",style:{display:"flex",gap:8,marginBottom:12,alignItems:"flex-end"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(x.NiceTextInput,{size:"sm",controlWidth:"100%",value:g,onChange:b,placeholder:N("karaokePicker.search","Search songs or artists…"),"aria-label":N("karaokePicker.search","Search songs or artists…")})}),e.jsx("div",{style:{width:180},children:e.jsx(x.NiceSelect,{size:"sm","aria-label":N("karaokePicker.allDifficulties","All Difficulties"),value:C,onChange:f=>j((Array.isArray(f)?f[0]:f)||ze),options:[{value:ze,label:N("karaokePicker.allDifficulties","All Difficulties")},...B.map(f=>({value:f,label:v(f)}))]})})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:c.length===0?e.jsx("p",{children:N("karaokePicker.noMatch","No songs match your search.")}):c.map(f=>e.jsxs("div",{className:"nice-karaoke-picker__song",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid var(--nice-border-color, #e5e7eb)"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:f.title})," — ",f.artist,f.difficulty&&e.jsxs("span",{style:{marginLeft:8,fontSize:12,color:Xs[f.difficulty]??"var(--nice-text-muted, #94a3b8)",fontWeight:600},children:["[",v(f.difficulty),"]"]}),f.hasLyrics&&e.jsx("span",{style:{marginLeft:6,fontSize:12},title:N("karaokePicker.lyrics","Lyrics available"),"aria-label":N("karaokePicker.lyrics","Lyrics available"),children:e.jsx(T.NtdFileText,{size:12})}),f.language&&e.jsxs("span",{style:{marginLeft:6,fontSize:12,color:"var(--nice-text-secondary, #475569)"},children:["(",f.language,")"]})]}),!t&&e.jsx("div",{children:w.has(f.id)?e.jsx(x.NiceButton,{variant:"outline",size:"sm",onClick:()=>o==null?void 0:o(f.id),children:N("remove","Remove")}):e.jsxs(x.NiceButton,{variant:"primary",size:"sm",onClick:()=>l==null?void 0:l(f.id),children:[e.jsx(T.NtdMicrophone,{size:14})," ",N("karaokePicker.sing","Sing")]})})]},f.id))}),r.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",style:{marginTop:16},children:[e.jsxs("h4",{children:[e.jsx(T.NtdMusic,{size:14})," ",N("karaokePicker.queue","Queue ({count})").replace("{count}",String(r.length))]}),r.map((f,y)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0"},children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[y+1,"."]})," ",f.title," — ",f.artist,f.performerName&&e.jsxs("em",{children:[" (",f.performerName,")"]})]}),!t&&o&&e.jsx(x.NiceButton,{variant:"ghost",size:"xs",onClick:()=>o(f.id),"aria-label":`${N("remove","Remove")} ${f.title}`,children:e.jsx(T.NtdClose,{size:12})})]},f.id))]})]})}),en={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Ws={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},qs=d.forwardRef(function(s,a){const{attractions:n,onSelect:r,onDeselect:l,onVote:o,selectedIds:m=[],maxSelections:h,showVotes:t=!0,readOnly:u=!1,layout:p="grid",className:N,style:v}=s,[g,b]=d.useState(""),[C,j]=d.useState(""),I=d.useMemo(()=>new Set(m),[m]),c=d.useMemo(()=>{const y=new Set(n.map($=>$.category));return Array.from(y)},[n]),w=d.useMemo(()=>{let y=n;if(g&&(y=y.filter($=>$.category===g)),C.trim()){const $=C.toLowerCase();y=y.filter(k=>{var R;return k.name.toLowerCase().includes($)||((R=k.description)==null?void 0:R.toLowerCase().includes($))})}return y},[n,g,C]),B=!h||I.size<h,f=y=>{u||(I.has(y)?l==null||l(y):B&&(r==null||r(y)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${N??""}`,style:{color:"var(--nice-text-primary)",...v},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsx("h3",{style:{margin:0},children:"Attractions"}),h&&e.jsxs("span",{style:{color:"var(--nice-text-secondary, #64748b)",fontSize:14},children:[I.size,"/",h," selected"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:C,onChange:y=>j(y.target.value),placeholder:"Search attractions…",style:{flex:1,minWidth:150}}),e.jsx("button",{onClick:()=>b(""),style:{fontWeight:g?400:700},children:"All"}),c.map(y=>e.jsxs("button",{onClick:()=>b(y===g?"":y),style:{fontWeight:y===g?700:400,display:"inline-flex",alignItems:"center",gap:4},children:[d.createElement(en[y],{size:14})," ",Ws[y]]},y))]}),e.jsx("div",{style:{display:p==="grid"?"grid":"flex",gridTemplateColumns:p==="grid"?"repeat(auto-fill, minmax(200px, 1fr))":void 0,gap:12,flexDirection:p==="list"?"column":void 0},children:w.length===0?e.jsx("p",{children:"No attractions found."}):w.map(y=>{const $=I.has(y.id);return e.jsxs("div",{className:"nice-attraction-picker__card",style:{border:$?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:8,padding:12,cursor:u?"default":"pointer",background:$?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",transition:"all 0.2s"},onClick:()=>f(y.id),children:[y.imageUrl&&e.jsx("img",{src:y.imageUrl,alt:y.name,style:{width:"100%",borderRadius:6,marginBottom:8,objectFit:"cover",maxHeight:120}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex"},children:d.createElement(en[y.category],{size:16})}),e.jsx("strong",{children:y.name})]}),y.description&&e.jsx("p",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",margin:"6px 0"},children:y.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[t&&e.jsxs("span",{style:{fontSize:13,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(T.NtdThumbsUp,{size:14})," ",y.votes??0]}),!u&&o&&e.jsx("button",{onClick:k=>{k.stopPropagation(),o(y.id)},style:{fontSize:12},children:"Vote"})]})]},y.id)})})]})}),Gs={game:T.NtdGamepad,music:T.NtdMusic,dance:T.NtdMusic,quiz:T.NtdHelp,karaoke:T.NtdMicrophone,photo:T.NtdCamera,custom:T.NtdSparkle},Ks=d.forwardRef(function(s,a){const{attractions:n,onVote:r,onUnvote:l,votedIds:o=[],maxVotes:m,closed:h=!1,sortBy:t="votes",showResults:u=!0,className:p,style:N}=s,v=d.useMemo(()=>new Set(o),[o]),g=m?m-v.size:void 0,b=d.useMemo(()=>{const c=[...n];switch(t){case"votes":c.sort((w,B)=>(B.votes??0)-(w.votes??0));break;case"name":c.sort((w,B)=>w.name.localeCompare(B.name));break;case"category":c.sort((w,B)=>w.category.localeCompare(B.category));break}return c},[n,t]),C=d.useMemo(()=>Math.max(...n.map(c=>c.votes??0),1),[n]),j=c=>{h||(v.has(c)?l==null||l(c):(!g||g>0)&&(r==null||r(c)))},I=c=>{switch(c){case 0:return e.jsx(T.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:"1st place"});case 1:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#94a3b8",title:"2nd place"});case 2:return e.jsx(T.NtdMedal,{size:18,primaryColor:"#b45309",title:"3rd place"});default:return`${c+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${p??""}`,style:{color:"var(--nice-text-primary)",...N},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("h3",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx(T.NtdClipboardCheck,{size:20}),h?"Voting Results":"Vote for Attractions"]}),!h&&g!==void 0&&e.jsxs("span",{style:{fontSize:14,color:g>0?"var(--nice-color-primary, #6366f1)":"var(--nice-color-error, #ef4444)"},children:[g," vote",g!==1?"s":""," remaining"]})]}),h&&e.jsx("p",{style:{color:"var(--nice-text-secondary, #64748b)",marginBottom:12},children:"Voting is closed. Final results:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:b.map((c,w)=>{const B=v.has(c.id),f=c.votes??0,y=u?`${Math.round(f/C*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:B?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:B?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:h?"default":"pointer",transition:"all 0.2s"},onClick:()=>j(c.id),children:[u&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:I(w)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:d.createElement(Gs[c.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:c.name}),c.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.description}),u&&e.jsx("div",{style:{marginTop:4,height:6,borderRadius:3,background:"var(--nice-bg-tertiary, #e2e8f0)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:y,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),u&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:f}),!h&&e.jsx("button",{onClick:$=>{$.stopPropagation(),j(c.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:B?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:B?"Unvote":"Vote"})]},c.id)})}),u&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",n.reduce((c,w)=>c+(w.votes??0),0)]})]})});exports.NiceAttractionPicker=qs;exports.NiceAttractionVoting=Ks;exports.NiceEventMedia=En;exports.NiceEventPlanning=Un;exports.NiceExpenseSplit=Rs;exports.NiceGiftRegistry=Cs;exports.NiceInvitationDesigner=ks;exports.NiceKaraokePicker=Vs;exports.NiceMediaCollage=Dn;exports.NiceParticipantList=Gn;exports.NiceRoundCard=Us;exports.NiceRoundList=Ds;exports.NiceRsvpControl=$e;exports.NiceSeatPicker=gs;exports.NiceSeatingChart=rn;exports.NiceSongPicker=Fs;
|
package/dist/index.d.ts
CHANGED
|
@@ -1075,6 +1075,9 @@ export declare interface NiceSettlementTransfer {
|
|
|
1075
1075
|
|
|
1076
1076
|
/**
|
|
1077
1077
|
* {@link NiceSongPicker} — Song selection for music events.
|
|
1078
|
+
*
|
|
1079
|
+
* Nice controls and texts through `t()` (1.2.0); it used a bare input, native buttons and a
|
|
1080
|
+
* "+" glyph, all in English.
|
|
1078
1081
|
*/
|
|
1079
1082
|
export declare const NiceSongPicker: default_2.ForwardRefExoticComponent<NiceSongPickerProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
1080
1083
|
|
|
@@ -1408,11 +1411,4 @@ export declare interface VenueZoneOccupancy {
|
|
|
1408
1411
|
*/
|
|
1409
1412
|
export declare type VenueZoneType = 'stage' | 'vip' | 'general' | 'standing' | 'seated' | 'bar' | 'food-court' | 'backstage' | 'entrance' | 'exit' | 'emergency-exit' | 'restroom' | 'parking' | 'press' | 'tech-booth' | 'medical' | 'security' | 'custom';
|
|
1410
1413
|
|
|
1411
|
-
/**
|
|
1412
|
-
* @deprecated Use `VenueZoneOccupancy`. `@nice2dev/ui-buildings` exports a different
|
|
1413
|
-
* `ZoneOccupancy` (a building sensor reading), so importing both packages collided;
|
|
1414
|
-
* this alias is removed in 1.2.0.
|
|
1415
|
-
*/
|
|
1416
|
-
export declare type ZoneOccupancy = VenueZoneOccupancy;
|
|
1417
|
-
|
|
1418
1414
|
export { }
|