@nice2dev/events 1.1.10 → 1.2.1
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 +173 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.mjs +2808 -2761
- package/package.json +7 -7
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"),z=require("@nice2dev/icons"),N=require("@nice2dev/ui"),F=require("@nice2dev/ui-core"),l=require("react");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],[t]=n.splice(s,1);return n.splice(a,0,t),n}function tn(i){const{items:s,onReorder:a,disabled:n=!1}=i,[t,d]=l.useState(null),[o,u]=l.useState(null),[f,c]=l.useState(!1),r=l.useRef(null),m=l.useCallback(x=>s.findIndex(P=>P.id===x),[s]),h=l.useCallback((x,P)=>{const b=m(x),A=m(P);b<0||A<0||b===A||a==null||a(We([...s],b,A).map(v=>v.id))},[s,m,a]),T=l.useCallback(()=>{d(null),u(null),c(!1),r.current=null},[]),g=l.useCallback((x,P)=>({role:"button",draggable:!1,tabIndex:n?-1:0,"aria-grabbed":t===x,onPointerDown:b=>{var p,M;if(n||b.button!==0&&b.pointerType==="mouse")return;(M=(p=b.currentTarget).setPointerCapture)==null||M.call(p,b.pointerId),d(x),c(!0),r.current=s.map(_=>_.id);const A=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),c(!1),d(null),u(null)},v=()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",v),r.current&&(a==null||a(r.current)),T()};window.addEventListener("pointerup",A),window.addEventListener("pointercancel",v)},onPointerEnter:()=>{n||!t||t===x||(u(x),h(t,x))},onKeyDown:b=>{if(n)return;if(b.key===" "||b.key==="Enter"){b.preventDefault(),t===x?T():(d(x),r.current=s.map(_=>_.id));return}if(b.key==="Escape"&&t===x){b.preventDefault(),r.current&&(a==null||a(r.current)),T();return}if(t!==x)return;const v=b.key==="ArrowLeft"||b.key==="ArrowUp"?-1:b.key==="ArrowRight"||b.key==="ArrowDown"?1:0;if(v===0)return;b.preventDefault();const p=m(x),M=p+v;M<0||M>=s.length||a==null||a(We([...s],p,M).map(_=>_.id))},...P?{"aria-label":P}:{}}),[t,h,n,T,m,s,a]);return{activeId:t,overId:o,getHandleProps:g,dragging:f}}const $n=({item:i})=>{const{t:s}=F.useNiceTranslation(),[a,n]=l.useState(!1),t=i.thumbnailUrl??i.url;return i.type==="video"?e.jsx("div",{className:"nice-event-media__video-thumb",children:e.jsx(z.NtdPlay,{size:26})}):a||!t?e.jsx("div",{className:"nice-event-media__broken",title:s("eventMedia.imageUnavailable","Image unavailable"),children:e.jsx(z.NtdImage,{size:24})}):e.jsx("img",{src:t,alt:i.caption??"",className:"nice-event-media__thumb",loading:"lazy",onError:()=>n(!0)})},Ln=[],En=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Ln,onUpload:d,onDelete:o,onLike:u,onItemClick:f,layout:c="grid",uploadEnabled:r=!0,typeFilter:m="all",onReorder:h,className:T,style:g}=s,[x,P]=l.useState(""),b=l.useMemo(()=>Bn(t),[t]),A=l.useMemo(()=>m==="all"?b:b.filter(R=>R.type===m),[b,m]),v=!!h&&m==="all",p=tn({items:b,onReorder:h,disabled:!v}),M=R=>{const k=R[0];!k||!d||(d(k,x.trim()||void 0),P(""))},_=c==="list";return e.jsxs("div",{ref:a,className:`nice-event-media nice-event-media--${c} ${T??""}`,style:g,children:[e.jsx("div",{className:"nice-event-media__header",children:e.jsxs("h3",{children:["Media (",A.length,")"]})}),r&&d&&e.jsxs("div",{className:"nice-event-media__upload",children:[e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!1,imagePreview:!1,onFilesSelected:M}),e.jsx(N.NiceTextInput,{value:x,onChange:P,placeholder:n("eventMedia.addACaption","Add a caption…")})]}),A.length===0?e.jsx("p",{className:"nice-event-media__empty",children:n("eventMedia.noMediaYet","No media yet.")}):e.jsx(N.NiceCardGroup,{columns:_?1:void 0,minColumnWidth:200,gap:12,align:"stretch",children:A.map((R,k)=>{const j=v?p.getHandleProps(R.id,n("eventMedia.moveItem","Move {name}").replace("{name}",R.caption??n("eventMedia.itemN","item {n}").replace("{n}",String(k+1)))):null;return e.jsxs("div",{className:`nice-event-media__card${_?" nice-event-media__card--row":""}${p.activeId===R.id?" nice-event-media__card--dragging":""}`,onClick:()=>f==null?void 0:f(R),onKeyDown:C=>{f&&C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),f(R))},onPointerEnter:j==null?void 0:j.onPointerEnter,role:f?"button":void 0,tabIndex:f?0:void 0,children:[j&&e.jsx("span",{className:"nice-event-media__grip",role:j.role,tabIndex:j.tabIndex,"aria-grabbed":j["aria-grabbed"],"aria-label":j["aria-label"],draggable:j.draggable,onPointerDown:j.onPointerDown,onKeyDown:j.onKeyDown,onClick:C=>C.stopPropagation(),children:e.jsx(z.NtdMove,{size:14})}),e.jsx($n,{item:R}),e.jsxs("div",{className:"nice-event-media__body",children:[R.caption&&e.jsx("span",{className:"nice-event-media__caption",children:R.caption}),R.uploadedByName&&e.jsx("span",{className:"nice-event-media__uploader",children:R.uploadedByName}),e.jsxs("div",{className:"nice-event-media__actions",children:[u&&e.jsxs("button",{type:"button",className:"nice-event-media__action",onClick:C=>{C.stopPropagation(),u(R.id)},"aria-label":n("eventMedia.like","Like"),children:[e.jsx(z.NtdHeart,{size:15})," ",R.likes??0]}),o&&e.jsx("button",{type:"button",className:"nice-event-media__action nice-event-media__action--danger",onClick:C=>{C.stopPropagation(),o(R.id)},"aria-label":n("eventMedia.delete","Delete"),children:e.jsx(z.NtdTrash,{size:15})})]})]})]},R.id)})})]})}),pe=({title:i,description:s,icon:a,action:n,className:t})=>e.jsx(N.NiceEmpty,{size:"sm",title:i,description:s,icon:a,action:n,className:t}),Dn=[],On=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Dn,layout:d="grid",onReorder:o,onItemAdd:u,onItemRemove:f,onCaptionChange:c,onItemClick:r,previewMode:m=!1,transition:h="fade",defaultDurationMs:T=3e3,autoPlay:g=!0,disabled:x=!1,readOnly:P=!1,size:b="md",className:A,style:v}=s,[p,M]=l.useState(0),[_,R]=l.useState(null),[k,j]=l.useState(""),C=x||P,O=!!o&&!C,V=tn({items:t,onReorder:o,disabled:!O}),E=t.length>0?Math.min(p,t.length-1):0,L=t[E],X=(L==null?void 0:L.durationMs)??T;l.useEffect(()=>{if(!m||!g||t.length<2)return;const B=window.setTimeout(()=>M(G=>(G+1)%t.length),Math.max(250,X));return()=>window.clearTimeout(B)},[m,g,t.length,E,X]);const S=l.useMemo(()=>t.reduce((B,G)=>B+(G.durationMs??T),0),[t,T]),y=B=>{c==null||c(B,k),R(null),j("")};return t.length===0?e.jsx("div",{ref:a,className:`nice-media-collage ${A??""}`,style:v,children:e.jsx(pe,{icon:e.jsx(z.NtdImage,{size:28}),title:n("mediaCollage.nothingInTheCollageYet","Nothing in the collage yet"),description:n("mediaCollage.addPhotosOrVideoTo","Add photos or video to start arranging them."),action:u&&!C?e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!0,onFilesSelected:u}):void 0})}):m?e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--preview nice-media-collage--${h} ${A??""}`,style:v,children:[e.jsxs("div",{className:"nice-media-collage__stage","aria-live":"polite",children:[(L==null?void 0:L.type)==="video"?e.jsx("video",{className:"nice-media-collage__slide",src:L.mediaUrl,controls:!0},L.id):e.jsx("img",{className:"nice-media-collage__slide",src:L==null?void 0:L.mediaUrl,alt:(L==null?void 0:L.caption)??""},L==null?void 0:L.id),(L==null?void 0:L.caption)&&e.jsx("p",{className:"nice-media-collage__slide-caption",children:L.caption})]}),e.jsxs("div",{className:"nice-media-collage__playbar",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B-1+t.length)%t.length),children:n("mediaCollage.previous","Previous")}),e.jsxs("span",{className:"nice-media-collage__counter",children:[E+1," / ",t.length]}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:()=>M(B=>(B+1)%t.length),children:n("mediaCollage.next","Next")})]})]}):e.jsxs("div",{ref:a,className:`nice-media-collage nice-media-collage--${d} nice-media-collage--${b} ${A??""}`,style:v,children:[e.jsxs("div",{className:"nice-media-collage__toolbar",children:[e.jsx(N.NiceSegmentedControl,{size:"sm",value:d,readOnly:!0,options:[{value:"sequence",label:n("mediaCollage.sequence","Sequence")},{value:"grid",label:n("mediaCollage.grid","Grid")},{value:"mosaic",label:n("mediaCollage.mosaic","Mosaic")}]}),e.jsxs("span",{className:"nice-media-collage__duration",children:[t.length," item",t.length===1?"":"s"," · ",Math.round(S/1e3),"s"]}),u&&!C&&e.jsx(N.NiceUpload,{accept:"image/*,video/*",multiple:!0,imagePreview:!1,onFilesSelected:u})]}),e.jsx("ol",{className:"nice-media-collage__tiles","aria-label":n("mediaCollage.collageOrder","Collage order"),"aria-busy":V.dragging,children:t.map((B,G)=>{const q=O?V.getHandleProps(B.id,n("mediaCollage.moveItem","Move {name}").replace("{name}",B.caption??n("mediaCollage.itemN","item {n}").replace("{n}",String(G+1)))):null;return e.jsxs("li",{className:`nice-media-collage__tile${V.activeId===B.id?" nice-media-collage__tile--active":""}${V.overId===B.id?" nice-media-collage__tile--over":""}`,onPointerEnter:q==null?void 0:q.onPointerEnter,children:[e.jsx("span",{className:"nice-media-collage__index","aria-hidden":"true",children:G+1}),e.jsx("button",{type:"button",className:"nice-media-collage__thumb-button",onClick:()=>r==null?void 0:r(B),disabled:!r,children:B.type==="video"?e.jsx("span",{className:"nice-media-collage__video-thumb",children:e.jsx(z.NtdPlay,{size:22})}):e.jsx("img",{className:"nice-media-collage__thumb",src:B.mediaUrl,alt:B.caption??"",loading:"lazy"})}),_===B.id?e.jsx(N.NiceTextInput,{value:k,onChange:j,placeholder:n("mediaCollage.caption","Caption"),autoFocus:!0,size:"sm",onBlur:()=>y(B.id),onKeyDown:I=>{I.key==="Enter"&&y(B.id),I.key==="Escape"&&R(null)}}):e.jsx("button",{type:"button",className:"nice-media-collage__caption",disabled:!c||C,onClick:()=>{R(B.id),j(B.caption??"")},children:B.caption||e.jsx("em",{children:n("mediaCollage.addACaption","Add a caption")})}),e.jsxs("div",{className:"nice-media-collage__tile-actions",children:[q&&e.jsx("span",{className:"nice-media-collage__grip",role:q.role,tabIndex:q.tabIndex,"aria-grabbed":q["aria-grabbed"],"aria-label":q["aria-label"],draggable:q.draggable,onPointerDown:q.onPointerDown,onKeyDown:q.onKeyDown,children:e.jsx(z.NtdMove,{size:14})}),f&&!P&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("mediaCollage.removeItem","Remove {name}").replace("{name}",B.caption??n("mediaCollage.itemN","item {n}").replace("{n}",String(G+1))),disabled:x,onClick:()=>f(B.id),children:e.jsx(z.NtdTrash,{size:14})})]})]},B.id)})}),u&&!C&&t.length>0&&e.jsxs("p",{className:"nice-media-collage__hint",children:[e.jsx(z.NtdPlus,{size:12})," ",n("mediaCollage.dragATileOrFocus","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 Yn={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=l.forwardRef(function(s,a){var Ye,Ue,Ve,Fe,Xe,qe;const{t:n}=F.useNiceTranslation(),{event:t,participants:d=[],surveys:o=[],billing:u=[],scheduleItems:f=[],tasks:c=[],vendors:r=[],documents:m=[],displayMode:h="normal",tabs:T,activeTab:g,onTabChange:x,tabsIconOnly:P=!0,tabsCentered:b="auto",countLocation:A="bottom",showDetails:v=!0,showLocation:p=!0,showSchedule:M=!0,showParticipants:_=!0,showTasks:R=!0,showSurveys:k=!0,showVendors:j=!0,showBudget:C=!0,showDocuments:O=!0,showSettings:V=!0,editable:E=!1,onSave:L,onPublish:X,onShare:S,onExport:y,onUpdateEvent:B,onUpdateLocation:G,onAddSurvey:q,onSurveyRespond:I,onAddBilling:U,className:W,style:Q}=s,[Y,J]=l.useState(t.title),[H,he]=l.useState(t.description??""),[se,oe]=l.useState(t.startDate??""),[ge,Ce]=l.useState(t.endDate??""),[xe,le]=l.useState(((Ye=t.location)==null?void 0:Ye.name)??""),[ve,Ae]=l.useState(((Ue=t.location)==null?void 0:Ue.address)??""),[de,ae]=l.useState(((Ve=t.location)==null?void 0:Ve.virtualUrl)??""),[te,_e]=l.useState(((Fe=t.location)==null?void 0:Fe.isVirtual)??!1),[ue,je]=l.useState(""),[me,Re]=l.useState("single"),[ye,be]=l.useState(""),[ce,ke]=l.useState(""),[fe,$]=l.useState(""),[D,K]=l.useState("PLN"),Z={details:v,location:p,schedule:M,participants:_,tasks:R,surveys:k,vendors:j,budget:C,documents:O,settings:V},re=(T??Yn[h]).filter(w=>Z[w]!==!1),[Se,ln]=l.useState(re[0]??"details"),dn=g??Se,un=l.useCallback(w=>{const ie=w;g===void 0&&ln(ie),x==null||x(ie)},[g,x]),mn=l.useCallback(()=>{B==null||B({title:Y,description:H||void 0,startDate:se||void 0,endDate:ge||void 0})},[Y,H,se,ge,B]),pn=l.useCallback(()=>{G==null||G({name:xe,address:ve||void 0,virtualUrl:de||void 0,isVirtual:te})},[xe,ve,de,te,G]),hn=l.useCallback(()=>{if(!ue.trim()||!q)return;const w=ye.split(",").map(ie=>ie.trim()).filter(Boolean);q(ue.trim(),me,w.length>0?w:void 0),je(""),be("")},[ue,me,ye,q]),gn=l.useCallback(()=>{!ce.trim()||!U||(U({label:ce.trim(),amount:parseFloat(fe)||0,currency:D}),ke(""),$(""))},[ce,fe,D,U]),xn=l.useMemo(()=>u.map(w=>({label:w.label,amount:w.amount})),[u]),vn=l.useMemo(()=>u.reduce((w,ie)=>w+ie.amount,0),[u]),fn=((Xe=u[0])==null?void 0:Xe.currency)??"PLN",Nn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.title","Title"),value:Y,onChange:J,readOnly:!E}),e.jsx(N.NiceTextArea,{label:n("eventPlanning.description","Description"),value:H,onChange:he,readOnly:!E,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:n("eventPlanning.start","Start")}),e.jsx("input",{className:"nice-input",type:"datetime-local",value:se,onChange:w=>oe(w.target.value),readOnly:!E})]}),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:ge,onChange:w=>Ce(w.target.value),readOnly:!E})]})]}),E&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:mn,children:n("eventPlanning.saveDetails","Save details")})]}),_n=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:n("eventPlanning.virtualEvent","Virtual event"),checked:te,onChange:_e,disabled:!E}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.venueName","Venue name"),value:xe,onChange:le,readOnly:!E}),te?e.jsx(N.NiceTextInput,{label:n("eventPlanning.virtualUrl","Virtual URL"),value:de,onChange:ae,readOnly:!E}):e.jsx(N.NiceTextInput,{label:n("eventPlanning.address","Address"),value:ve,onChange:Ae,readOnly:!E}),E&&e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:pn,children:n("eventPlanning.saveLocation","Save location")})]}),jn=e.jsx("div",{className:"nice-event-planning__participants",children:d.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noParticipantsYet","No participants yet.")}):e.jsxs(e.Fragment,{children:[e.jsx(N.NiceAvatarGroup,{max:8,children:d.map(w=>e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl},w.id))}),e.jsx("ul",{className:"nice-event-planning__participant-list",children:d.map(w=>e.jsxs("li",{className:"nice-event-planning__participant",children:[e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"}),e.jsx("span",{className:"nice-event-planning__participant-name",children:w.name}),e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:n(`participantList.status.${w.status}`,w.status)})]},w.id))})]})}),yn=e.jsxs("div",{className:"nice-event-planning__form",children:[o.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noSurveysYet","No surveys yet.")}):o.map(w=>e.jsxs("div",{className:"nice-event-planning__survey",children:[e.jsx("strong",{children:w.question})," ",e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"info",children:n(`eventPlanning.surveyType.${w.type}`,w.type)}),w.options&&e.jsx("div",{className:"nice-event-planning__survey-options",children:w.options.map((ie,Rn)=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",onClick:()=>I==null?void 0:I(w.id,ie),children:ie},Rn))}),w.responses&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.responses.length," responses"]})]},w.id)),E&&q&&e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.newSurveyQuestion","New survey question"),value:ue,onChange:je,placeholder:n("eventPlanning.question","Question")}),e.jsx(N.NiceSelect,{label:n("eventPlanning.type","Type"),value:me,onChange:w=>Re(w),options:[{value:"single",label:n("eventPlanning.singleChoice","Single choice")},{value:"multiple",label:n("eventPlanning.multipleChoice","Multiple choice")},{value:"text",label:n("eventPlanning.freeText","Free text")},{value:"rating",label:n("eventPlanning.rating","Rating")}]}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.optionsCommaSeparated","Options (comma-separated)"),value:ye,onChange:be,placeholder:n("eventPlanning.yesNoMaybe","Yes, No, Maybe")}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"plus",size:"sm"}),onClick:hn,disabled:!ue.trim(),children:n("eventPlanning.addSurvey","Add survey")})]})]}),bn=e.jsxs("div",{className:"nice-event-planning__form",children:[u.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noBillingItemsYet","No billing items yet.")}):e.jsx(N.NiceAmountBreakdown,{lines:[...xn,{label:n("eventPlanning.total","Total"),amount:vn,isSummary:!0}],currency:fn}),E&&U&&e.jsxs("div",{className:"nice-event-planning__row",children:[e.jsx(N.NiceTextInput,{label:n("eventPlanning.item","Item"),value:ce,onChange:ke,placeholder:n("eventPlanning.catering","Catering")}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.amount","Amount"),value:fe,onChange:$,placeholder:"0.00"}),e.jsx(N.NiceSelect,{label:n("eventPlanning.currency","Currency"),value:D,onChange:w=>K(w),options:["PLN","EUR","USD","GBP"]}),e.jsx(N.NiceButton,{variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"plus",size:"sm"}),onClick:gn,disabled:!ce.trim(),children:"Add"})]})]}),kn=e.jsxs("div",{className:"nice-event-planning__form",children:[e.jsx(N.NiceToggle,{label:n("eventPlanning.publicEvent","Public event"),checked:t.isPublic??!1,disabled:!E}),e.jsx(N.NiceTextInput,{label:n("eventPlanning.maxParticipants","Max participants"),value:t.maxParticipants!=null?String(t.maxParticipants):"",onChange:()=>{},readOnly:!E}),e.jsxs("div",{className:"nice-event-planning__muted",children:["Host: ",t.hostName," · Created ",new Date(t.createdAt).toLocaleDateString()]})]}),wn=e.jsx("div",{className:"nice-event-planning__list",children:f.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noAgendaItemsYet","No agenda items yet.")}):e.jsx("ul",{className:"nice-event-planning__schedule",children:f.map(w=>e.jsxs("li",{className:"nice-event-planning__schedule-item",children:[e.jsxs("span",{className:"nice-event-planning__schedule-time",children:[e.jsx(F.NiceIcon,{name:"clock",size:"sm"}),w.startTime??"",w.endTime?`–${w.endTime}`:""]}),e.jsx("span",{className:"nice-event-planning__schedule-title",children:w.title}),w.location&&e.jsx("span",{className:"nice-event-planning__muted",children:w.location})]},w.id))})}),Cn=e.jsx("div",{className:"nice-event-planning__list",children:c.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noTasksYet","No tasks yet.")}):e.jsx("ul",{className:"nice-event-planning__tasks",children:c.map(w=>e.jsxs("li",{className:"nice-event-planning__task",children:[e.jsx(N.NiceToggle,{label:w.title,checked:w.done??!1,disabled:!E}),w.assigneeName&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"info",children:w.assigneeName}),w.dueDate&&e.jsx("span",{className:"nice-event-planning__muted",children:w.dueDate})]},w.id))})}),Sn=e.jsx("div",{className:"nice-event-planning__list",children:r.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noVendorsYet","No vendors yet.")}):e.jsx("ul",{className:"nice-event-planning__vendors",children:r.map(w=>e.jsxs("li",{className:"nice-event-planning__vendor",children:[e.jsx(F.NiceIcon,{name:"briefcase",size:"sm"}),e.jsx("span",{className:"nice-event-planning__vendor-name",children:w.name}),w.category&&e.jsx("span",{className:"nice-event-planning__muted",children:w.category}),w.status&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Ie(w.status),children:n(`eventPlanning.vendorStatus.${w.status}`,w.status)}),w.cost!=null&&e.jsxs("span",{className:"nice-event-planning__vendor-cost",children:[w.cost," ",w.currency??""]})]},w.id))})}),In=e.jsx("div",{className:"nice-event-planning__list",children:m.length===0?e.jsx("p",{className:"nice-event-planning__empty",children:n("eventPlanning.noDocumentsYet","No documents yet.")}):e.jsx("ul",{className:"nice-event-planning__documents",children:m.map(w=>e.jsxs("li",{className:"nice-event-planning__document",children:[e.jsx(F.NiceIcon,{name:"file",size:"sm"}),e.jsx("span",{className:"nice-event-planning__document-name",children:w.name}),w.fileType&&e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"secondary",children:w.fileType}),w.sizeKb!=null&&e.jsxs("span",{className:"nice-event-planning__muted",children:[w.sizeKb," KB"]})]},w.id))})}),Pn={details:Nn,location:_n,schedule:wn,participants:jn,tasks:Cn,surveys:yn,vendors:Sn,budget:bn,documents:In,settings:kn},Tn={details:"file",location:"home",schedule:"clock",participants:"users",tasks:"list",surveys:"clipboard",vendors:"briefcase",budget:"dollar",documents:"folder",settings:"settings"},zn={schedule:f.length||void 0,participants:d.length||void 0,tasks:c.length||void 0,surveys:o.length||void 0,vendors:r.length||void 0,budget:u.length||void 0,documents:m.length||void 0},Mn=re.map(w=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),icon:e.jsx(F.NiceIcon,{name:Tn[w],size:"sm"}),badge:zn[w],content:Pn[w]})),An=e.jsxs("div",{className:"nice-event-planning__toolbar",children:[e.jsxs("div",{className:"nice-event-planning__toolbar-title",children:[e.jsx(F.NiceIcon,{name:"calendar",size:"md"}),e.jsx("span",{className:"nice-event-planning__title",children:t.title}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(t.status),children:n(`eventPlanning.eventStatus.${t.status}`,t.status)})]}),e.jsx("span",{className:"nice-event-planning__toolbar-spacer"}),e.jsxs("div",{className:"nice-event-planning__toolbar-actions",children:[L&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",leftIcon:e.jsx(F.NiceIcon,{name:"check",size:"sm"}),onClick:()=>L({title:Y,description:H}),children:n("eventPlanning.save","Save")}),X&&e.jsx(N.NiceButton,{size:"sm",variant:"success",leftIcon:e.jsx(F.NiceIcon,{name:"upload",size:"sm"}),onClick:X,children:n("eventPlanning.publish","Publish")}),S&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(F.NiceIcon,{name:"link",size:"sm"}),onClick:S,children:n("eventPlanning.share","Share")}),y&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",leftIcon:e.jsx(F.NiceIcon,{name:"download",size:"sm"}),onClick:y,children:n("eventPlanning.export","Export")})]})]});return h==="micro"?e.jsx("div",{ref:a,className:`nice-event-planning nice-event-planning--micro ${W??""}`,style:Q,children:e.jsxs("div",{className:"nice-event-planning__micro",children:[e.jsx(F.NiceIcon,{name:"calendar",size:"md"}),e.jsxs("div",{className:"nice-event-planning__micro-body",children:[e.jsx("span",{className:"nice-event-planning__title",children:t.title}),e.jsxs("span",{className:"nice-event-planning__muted",children:[t.startDate?new Date(t.startDate).toLocaleString():n("eventPlanning.noDate","No date"),(qe=t.location)!=null&&qe.name?` · ${t.location.name}`:""]})]}),e.jsx(N.NiceBadge,{size:"sm",variant:Ie(t.status),children:n(`eventPlanning.eventStatus.${t.status}`,t.status)}),d.length>0&&e.jsx(N.NiceAvatarGroup,{max:4,size:"sm",children:d.map(w=>e.jsx(N.NiceAvatar,{name:w.name,src:w.avatarUrl,size:"sm"},w.id))})]})}):e.jsxs("div",{ref:a,className:`nice-event-planning nice-event-planning--${h} ${W??""}`,style:Q,children:[An,e.jsx(N.NiceTabs,{tabs:Mn,activeTab:dn,onChange:un,iconOnly:P,centered:b,countLocation:A})]})});function Vn(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:t,size:d="md",className:o})=>{const{t:u}=F.useNiceTranslation();return e.jsxs("li",{className:`nice-participant-row nice-participant-row--${d} ${o??""}`,children:[e.jsx(N.NiceAvatar,{name:i.name,src:i.avatarUrl,size:d}),e.jsx("span",{className:"nice-participant-row__name",children:i.name}),s&&i.role&&e.jsx(N.NiceBadge,{size:"xs",outline:!0,variant:"info",children:u(`participantList.role.${i.role}`,i.role)}),a&&i.status&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:Vn(i.status),children:u(`participantList.status.${i.status}`,i.status)}),n&&e.jsx("span",{className:"nice-participant-row__meta",children:n}),t&&e.jsx("span",{className:"nice-participant-row__trailing",children:t})]})},Fn=/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/,Ge=/^.*<\s*([^<>\s]+)\s*>$/;function sn(i){var d,o;const s=[],a=[],n=new Set;let t=0;if(!i)return{valid:s,invalid:a,duplicates:t};for(const u of i.split(/[,;\r\n\t]+/)){const f=u.trim();if(!f)continue;const c=((o=(d=Ge.exec(f))==null?void 0:d[1])==null?void 0:o.trim())??f,r=Ge.test(f)?[c]:c.split(/\s+/);for(const m of r){if(!m)continue;if(!Fn.test(m)){a.push(m);continue}const h=m.toLowerCase();if(n.has(h)){t+=1;continue}n.add(h),s.push(m)}}return{valid:s,invalid:a,duplicates:t}}function Xn(i,s){const a=new Set(i.map(t=>t.toLowerCase())),n=[...i];for(const t of s){const d=t.toLowerCase();a.has(d)||(a.add(d),n.push(t))}return n}function an(i={}){const{currentUserId:s,currentUserName:a,requireIdentity:n=!0}=i,[t,d]=l.useState(""),o=!s,u=a??t,f=!n||u.trim().length>0;return{isAnonymous:o,name:u,setName:d,canAct:f,actor:{userId:s,userName:u.trim()}}}const qn=[{answer:"yes",label:"Yes",variant:"success",Icon:z.NtdCheck},{answer:"maybe",label:"Maybe",variant:"warning",Icon:z.NtdHelp},{answer:"no",label:"No",variant:"error",Icon:z.NtdClose}],$e=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{value:t,onRespond:d,allowPlusOnes:o=!1,maxPlusOnes:u=5,plusOnes:f=0,allowNote:c=!1,currentUserId:r,currentUserName:m,compact:h=!1,disabled:T=!1,readOnly:g=!1,size:x="md",className:P,style:b}=s,A=an({currentUserId:r,currentUserName:m}),[v,p]=l.useState(f),[M,_]=l.useState(""),R=!h&&A.isAnonymous&&!A.canAct,k=T||g,j=C=>{k||!d||d({answer:C,plusOnes:o&&C!=="no"?v:void 0,note:c&&M.trim()?M.trim():void 0,userId:A.actor.userId,userName:A.actor.userName||void 0})};return e.jsxs("div",{ref:a,className:`nice-rsvp-control nice-rsvp-control--${x}${h?" nice-rsvp-control--compact":""} ${P??""}`,style:b,children:[!h&&A.isAnonymous&&e.jsx(N.NiceTextInput,{label:n("rsvpControl.yourName","Your name"),value:A.name,onChange:A.setName,placeholder:n("rsvpControl.whoIsReplying","Who is replying?"),required:!0,disabled:k,size:x}),e.jsx("div",{className:"nice-rsvp-control__answers",role:"group","aria-label":n("rsvpControl.yourReply","Your reply"),children:qn.map(({answer:C,label:O,variant:V,Icon:E})=>e.jsx(N.NiceButton,{size:x,variant:t===C?V:"outline",leftIcon:e.jsx(E,{size:16}),disabled:k||R,"aria-pressed":t===C,onClick:()=>j(C),children:n(`rsvpControl.answer.${C}`,O)},C))}),!h&&o&&t!=="no"&&e.jsxs("label",{className:"nice-rsvp-control__field",children:[e.jsx("span",{className:"nice-rsvp-control__field-label",children:n("rsvpControl.additionalGuests","Additional guests")}),e.jsx(N.NiceNumericInput,{value:v,onChange:C=>p(Math.max(0,Math.min(u,C??0))),min:0,max:u,step:1,size:"xs",disabled:k})]}),!h&&c&&e.jsx(N.NiceTextInput,{label:n("rsvpControl.note","Note"),value:M,onChange:_,placeholder:n("rsvpControl.anythingWeShouldKnow","Anything we should know?"),disabled:k,size:x}),R&&e.jsx("p",{className:"nice-rsvp-control__hint",children:n("rsvpControl.enterYourNameToReply","Enter your name to reply.")})]})}),Wn={yes:"confirmed",maybe:"invited",no:"declined"},Ke={confirmed:"yes","checked-in":"yes",declined:"no"},Pe=["confirmed","checked-in","invited","declined","no-show"],Gn=[],Kn=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{participants:t=Gn,mode:d="organizer",currentUserId:o,currentUserName:u,onRsvpChange:f,onCheckIn:c,onScan:r,checkInSlot:m,onInvite:h,extraFields:T,groupBy:g="none",showSummary:x=!0,showSearch:P=!0,allowPlusOnes:b=!1,disabled:A=!1,readOnly:v=!1,size:p="md",className:M,style:_}=s,[R,k]=l.useState(""),[j,C]=l.useState("all"),[O,V]=l.useState(""),E=A||v,L=d==="guest",X=l.useMemo(()=>{const I={total:t.length};for(const U of Pe)I[U]=0;for(const U of t)I[U.status]=(I[U.status]??0)+1;return I},[t]),S=l.useMemo(()=>{if(L)return t.filter(U=>U.userId===o||U.id===o);const I=R.trim().toLowerCase();return t.filter(U=>j!=="all"&&U.status!==j?!1:!I||U.name.toLowerCase().includes(I))},[t,L,o,R,j]),y=l.useMemo(()=>{if(g==="none"||L)return[{key:"all",label:"",items:S}];const I=new Map;for(const W of S){const Q=g==="status"?W.status:W.role,Y=I.get(Q);Y?Y.push(W):I.set(Q,[W])}return[...I.keys()].sort((W,Q)=>g!=="status"?W.localeCompare(Q):Pe.indexOf(W)-Pe.indexOf(Q)).map(W=>({key:W,label:W,items:I.get(W)??[]}))},[S,g,L]),B=l.useMemo(()=>sn(O),[O]),G=I=>U=>{f==null||f(I,Wn[U.answer],U)},q=()=>{!h||B.valid.length===0||(h(B.valid),V(""))};if(L){const I=S[0];return I?e.jsxs("div",{ref:a,className:`nice-participant-list nice-participant-list--guest ${M??""}`,style:_,children:[e.jsx("ul",{className:"nice-participant-list__rows",children:e.jsx(Be,{participant:I,size:p})}),e.jsx($e,{value:Ke[I.status],onRespond:G(I.id),allowPlusOnes:b,currentUserId:o??I.userId,currentUserName:u??I.name,disabled:A,readOnly:v,size:p})]}):e.jsx("div",{ref:a,className:`nice-participant-list ${M??""}`,style:_,children:e.jsx(pe,{title:n("participantList.youAreNotOnThis","You are not on this guest list"),description:n("participantList.askTheHostForAn","Ask the host for an invitation link.")})})}return e.jsxs("div",{ref:a,className:`nice-participant-list ${M??""}`,style:_,children:[x&&e.jsxs("div",{className:"nice-participant-list__summary",children:[e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.confirmed})," confirmed"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.invited})," awaiting reply"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X.declined})," declined"]}),e.jsxs("span",{className:"nice-participant-list__stat",children:[e.jsx("strong",{children:X["checked-in"]})," checked in"]}),e.jsxs("span",{className:"nice-participant-list__stat nice-participant-list__stat--total",children:[e.jsx("strong",{children:X.total})," total"]})]}),(P||m||r)&&e.jsxs("div",{className:"nice-participant-list__toolbar",children:[P&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextInput,{value:R,onChange:k,placeholder:n("participantList.searchGuests","Search guests…"),prefix:e.jsx(z.NtdSearch,{size:15}),size:p}),e.jsx(N.NiceSelect,{value:j,onChange:I=>C(I),size:p,options:[{value:"all",label:n("participantList.allStatuses","All statuses")},...Pe.map(I=>({value:I,label:n(`participantList.status.${I}`,I)}))]})]}),m,r&&!m&&e.jsxs("span",{className:"nice-participant-list__scan-hint",children:[e.jsx(z.NtdQrCode,{size:15})," ",n("participantList.scannerReady","Scanner ready")]})]}),S.length===0?e.jsx(pe,{title:n("participantList.noGuestsYet","No guests yet"),description:t.length>0?n("participantList.noMatch","No one matches the current filter."):n("participantList.invitePeopleHint","Invite people to see them here.")}):y.map(I=>e.jsxs("section",{className:"nice-participant-list__group",children:[I.label&&e.jsxs("h4",{className:"nice-participant-list__group-title",children:[I.label," ",e.jsxs("span",{children:["(",I.items.length,")"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:I.items.map(U=>e.jsxs(Be,{participant:U,size:p,meta:T==null?void 0:T.map(W=>e.jsx("span",{className:"nice-participant-list__extra",children:W.render?W.render(U):String(U[W.key]??"")},W.key)),children:[f&&e.jsx($e,{compact:!0,value:Ke[U.status],onRespond:G(U.id),currentUserId:U.userId,currentUserName:U.name,disabled:E,size:"sm"}),c&&U.status!=="checked-in"&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",leftIcon:e.jsx(z.NtdCheck,{size:14}),disabled:E,onClick:()=>c(U.id),children:n("participantList.checkIn","Check in")})]},U.id))})]},I.key)),h&&!v&&e.jsxs("div",{className:"nice-participant-list__invite",children:[e.jsx(N.NiceTextArea,{label:n("participantList.inviteByEmail","Invite by email"),value:O,onChange:V,placeholder:n("participantList.pasteAddressesCommasSemicolonsOr","Paste addresses — commas, semicolons or new lines"),rows:3,disabled:A,size:p}),e.jsx(N.NiceButton,{variant:"primary",size:p,leftIcon:e.jsx(z.NtdMail,{size:15}),disabled:A||B.valid.length===0,onClick:q,children:n("participantList.invite","Invite {valid}").replace("{valid}",B.valid.length>0?`(${B.valid.length})`:"")}),(B.invalid.length>0||B.duplicates>0)&&e.jsxs("p",{className:"nice-participant-list__invite-hint",children:[B.duplicates>0&&`${n("participantList.duplicatesRemoved","{count} duplicate(s) removed.").replace("{count}",String(B.duplicates))} `,B.invalid.length>0&&n("participantList.notRecognised","{count} entry(ies) not recognised.").replace("{count}",String(B.invalid.length))]})]})]})}),Hn={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 Hn[i==null?void 0:i.toUpperCase()]??2}function De(i,s){return Number.isFinite(i)?Math.round(i*10**Ee(s)):0}function ze(i,s){const a=Ee(s);return a===0?i:i/10**a}function Qn(i,s,a){const n=Ee(s),t=ze(i,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(t)}catch{return`${t.toFixed(n)} ${s}`}}function ne(i,s,a){return Qn(De(i,s),s,a)}const Le={minX:0,minY:0,maxX:0,maxY:0};function Zn(i,s=0){if(i.length===0)return{...Le};let a=1/0,n=1/0,t=-1/0,d=-1/0;for(const o of i)o.x<a&&(a=o.x),o.y<n&&(n=o.y),o.x>t&&(t=o.x),o.y>d&&(d=o.y);return{minX:a-s,minY:n-s,maxX:t+s,maxY:d+s}}function He(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 Qe(i,s){return i.minX<=s.maxX&&i.maxX>=s.minX&&i.minY<=s.maxY&&i.maxY>=s.minY}function Jn(i,s,a=0){const n=i.zoom||1,t=-i.pan.x/n-a,d=-i.pan.y/n-a;return{minX:t,minY:d,maxX:t+s.width/n+a*2,maxY:d+s.height/n+a*2}}function et(i,s=12){const a=[],n=[],t=new Map,d=new Map;let o=null,u=0;for(const f of i.sections??[]){let c=null,r=0;(f.rows??[]).forEach((h,T)=>{const g=nt(h.seats??[]);if(g.length===0)return;const x=Zn(g,s);n.push({sectionId:f.id,rowIndex:T,label:h.label,seats:g,bounds:x}),g.forEach((P,b)=>{t.set(P.id,P),d.set(P.id,{sectionId:f.id,rowIndex:T,seatIndex:b})}),r+=g.length,c=c?He(c,x):x});const m=c??{...Le};a.push({section:f,bounds:m,seatCount:r}),u+=r,r>0&&(o=o?He(o,m):m)}return{sections:a,rows:n,bounds:o??{...Le},totalSeats:u,seatById:t,locationById:d}}function nt(i){return[...i].sort((s,a)=>s.number-a.number||s.x-a.x)}function tt(i,s){return i>s*4?"section":i>s?"row":"seat"}function st(i,s,a=2500,n){const t=i.sections.filter(r=>Qe(r.bounds,s)),d=new Set(t.map(r=>r.section.id)),o=i.rows.filter(r=>d.has(r.sectionId)&&Qe(r.bounds,s));let u=0;for(const r of o)for(const m of r.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&(u+=1);const f=n??tt(u,a);let c=[];if(f==="seat"){c=[];for(const r of o)for(const m of r.seats)m.x>=s.minX&&m.x<=s.maxX&&m.y>=s.minY&&m.y<=s.maxY&&c.push(m)}return{tier:f,sections:t,rows:f==="section"?[]:o,seats:c,visibleSeatCount:u}}function Oe(i){if(i.accessType)return i.accessType;if(i.status==="wheelchair"||i.status==="companion")return i.status}function Ne(i,s){const a=(s==null?void 0:s[i.id])??i.status;return a==="wheelchair"||a==="companion"?"available":a}function Ze(i,s,a){var t;const n=(t=s.priceCategories)==null?void 0:t.find(d=>d.id===i.priceCategoryId);return{amount:(n==null?void 0:n.price)??a.basePrice,currency:a.currency}}function it(i,s={},a){return!(Ne(i,a)!=="available"||s.allowedCategories&&!s.allowedCategories.includes(i.priceCategoryId))}function cn(i,s={},a){const n=[];let t=null;return i.forEach((d,o)=>{it(d,s,a)?t?t.seats.push(d):t={start:o,seats:[d]}:t&&(n.push(t),t=null)}),t&&n.push(t),n}function at(i,s,a={},n){const t=a.maxSeats??8;if(i.length>t)return{ok:!1,reason:"max-seats"};for(const o of i){const u=s.seatById.get(o);if(u){if(Ne(u,n)!=="available")return{ok:!1,reason:"unavailable",seatId:o};if(a.allowedCategories&&!a.allowedCategories.includes(u.priceCategoryId))return{ok:!1,reason:"category-not-allowed",seatId:o}}}if(!a.adjacentOnly||i.length===0)return{ok:!0};const d=new Map;for(const o of i){const u=s.locationById.get(o);if(!u)continue;const f=`${u.sectionId}::${u.rowIndex}`,c=d.get(f);c?c.push(o):d.set(f,[o])}for(const[o,u]of d){const[f,c]=o.split("::"),r=Number(c),m=s.rows.find(v=>v.sectionId===f&&v.rowIndex===r);if(!m)continue;const h=cn(m.seats,a,n),T=new Set(u);let g=null;for(const v of h)if(v.seats.some(p=>T.has(p.id))){if(g)return{ok:!1,reason:"not-adjacent",seatId:u[0]};g=v}if(!g)continue;const x=g.seats.map((v,p)=>T.has(v.id)?p:-1).filter(v=>v>=0);if(x.length===0)continue;const P=x[0],b=x[x.length-1];if(b-P+1!==x.length)return{ok:!1,reason:"not-adjacent",seatId:u[0]};const A=g.seats.length;if(A>1&&(P===1||A-1-b===1))return{ok:!1,reason:"orphan-seat",seatId:u[0]}}return{ok:!0}}function ct(i,s,a,n={},t){if(i.includes(s))return{selected:i.filter(u=>u!==s)};const d=[...i,s],o=at(d,a,n,t);return o.ok?{selected:d}:{rejected:o.reason??"not-adjacent"}}function rt(i,s,a={},n={},t){if(s<=0)return[];const d=n.categoryId?{...a,allowedCategories:[n.categoryId]}:a;let o=null;for(const u of i.rows)if(!(n.sectionId&&u.sectionId!==n.sectionId))for(const f of cn(u.seats,d,t)){const c=f.seats.length;if(!(c<s))for(let r=0;r+s<=c;r+=1){const m=r+s-1;if(c>s&&(r===1||c-1-m===1))continue;const h=f.seats.slice(r,m+1),T=h.reduce((g,x)=>g+(x.viewScore??50),0)/s;(!o||T>o.score)&&(o={ids:h.map(g=>g.id),score:T})}}return(o==null?void 0:o.ids)??[]}function ot(i,s,a){var r,m,h,T;const n=i.locationById.get(s);if(!n)return null;const t=i.rows.findIndex(g=>g.sectionId===n.sectionId&&g.rowIndex===n.rowIndex);if(t<0)return null;const d=i.rows[t];if(a==="left")return((r=d.seats[n.seatIndex-1])==null?void 0:r.id)??null;if(a==="right")return((m=d.seats[n.seatIndex+1])==null?void 0:m.id)??null;if(a==="row-start")return((h=d.seats[0])==null?void 0:h.id)??null;if(a==="row-end")return((T=d.seats[d.seats.length-1])==null?void 0:T.id)??null;const o=i.rows[a==="up"?t-1:t+1];if(!o)return null;const u=d.seats[n.seatIndex].x;let f=null,c=1/0;for(const g of o.seats){const x=Math.abs(g.x-u);x<c&&(c=x,f=g)}return(f==null?void 0:f.id)??null}function lt(i,s,a){var f,c,r;const n=i.sections.filter(m=>m.seatCount>0);if(n.length===0)return null;const t=s?(f=i.locationById.get(s))==null?void 0:f.sectionId:void 0,d=n.findIndex(m=>m.section.id===t),o=d<0?0:a==="next"?d+1:d-1,u=n[o];return u?((r=(c=i.rows.find(m=>m.sectionId===u.section.id))==null?void 0:c.seats[0])==null?void 0:r.id)??null:null}const we=8;function dt(i,s){return i.seats.length===0?0:i.seats.filter(n=>Ne(n,s)==="available").length/i.seats.length}const ut=({cull:i,selectedIds:s,cursorId:a,statusOverrides:n,sectionColorById:t,interactive:d,onSeatClick:o,onSectionClick:u,describeSeat:f})=>{const{t:c}=F.useNiceTranslation();return i.tier==="section"?e.jsx("g",{className:"nice-seating-chart__sections",children:i.sections.map(({section:r,bounds:m,seatCount:h})=>e.jsxs("g",{className:"nice-seating-chart__section",children:[e.jsx("rect",{x:m.minX,y:m.minY,width:m.maxX-m.minX,height:m.maxY-m.minY,rx:12,className:"nice-seating-chart__section-shape",style:{fill:t.get(r.id)},role:u?"button":"img","aria-label":c("seatingChart.sectionLabel","{name}, {count} seats").replace("{name}",r.name).replace("{count}",String(h)),tabIndex:u?0:void 0,onClick:u?()=>u(r.id):void 0}),e.jsx("text",{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2,className:"nice-seating-chart__section-label",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:r.name})]},r.id))}):i.tier==="row"?e.jsx("g",{className:"nice-seating-chart__rows",children:i.rows.map(r=>{const m=dt(r,n);return e.jsxs("g",{children:[e.jsx("rect",{x:r.bounds.minX,y:r.bounds.minY,width:r.bounds.maxX-r.bounds.minX,height:r.bounds.maxY-r.bounds.minY,rx:8,className:"nice-seating-chart__row-shape",style:{fill:t.get(r.sectionId),fillOpacity:.25+m*.65},role:"img","aria-label":c("seatingChart.rowLabel","Row {row}, {count} seats, {free} available").replace("{row}",String(r.label)).replace("{count}",String(r.seats.length)).replace("{free}",String(Math.round(m*r.seats.length)))}),e.jsx("text",{x:r.bounds.minX-6,y:(r.bounds.minY+r.bounds.maxY)/2,className:"nice-seating-chart__row-label",textAnchor:"end",dominantBaseline:"middle","aria-hidden":"true",children:r.label})]},`${r.sectionId}-${r.rowIndex}`)})}):e.jsx("g",{className:"nice-seating-chart__seats",children:i.seats.map(r=>{const m=Ne(r,n),h=Oe(r),T=s.has(r.id),g=a===r.id,x={row:r.row,number:r.number},P=["nice-seating-chart__seat",`nice-seating-chart__seat--${m}`,T?"nice-seating-chart__seat--selected":"",h?`nice-seating-chart__seat--${h}`:"",g?"nice-seating-chart__seat--cursor":""].filter(Boolean).join(" ");return e.jsxs("g",{className:P,"data-seat-id":r.id,role:"gridcell","aria-selected":T,"aria-disabled":m!=="available","aria-label":f(r),tabIndex:g?0:-1,onClick:d&&o?()=>o(r):void 0,children:[h?e.jsx("rect",{x:r.x-we,y:r.y-we,width:we*2,height:we*2,rx:3,className:"nice-seating-chart__seat-shape",fill:h==="companion"?"url(#nice-seat-companion-hatch)":void 0}):e.jsx("circle",{cx:r.x,cy:r.y,r:we,className:"nice-seating-chart__seat-shape"}),h==="wheelchair"&&e.jsx(z.NtdWheelchair,{size:10,x:r.x-5,y:r.y-5,className:"nice-seating-chart__seat-glyph"}),e.jsx("title",{children:f(r)}),e.jsx("text",{x:r.x,y:r.y,className:"nice-seating-chart__seat-number",textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:x.number})]},r.id)})})},mt=({index:i,selectedIds:s,statusOverrides:a,maxSeats:n,onSeatToggle:t,onBestAvailable:d,describeSeat:o,disabled:u=!1,defaultOpen:f=!1})=>{var v;const{t:c}=F.useNiceTranslation(),r=l.useMemo(()=>i.sections.filter(p=>p.seatCount>0),[i.sections]),[m,h]=l.useState(((v=r[0])==null?void 0:v.section.id)??""),[T,g]=l.useState(0),[x,P]=l.useState(2),b=l.useMemo(()=>i.rows.filter(p=>p.sectionId===m),[i.rows,m]),A=b.find(p=>p.rowIndex===T)??b[0];return e.jsxs(N.NiceCollapse,{trigger:c("seatListPanel.chooseWithoutMap","Choose seats without the map"),defaultExpanded:f,className:"nice-seating-chart__list-panel",children:[d&&e.jsxs("div",{className:"nice-seating-chart__best",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:c("seatListPanel.howManySeats","How many seats?")}),e.jsx(N.NiceNumericInput,{value:x,onChange:p=>P(Math.max(1,Math.min(n,p??1))),min:1,max:n,size:"xs",disabled:u})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:u,onClick:()=>d(x,{sectionId:m||void 0}),children:c("seatListPanel.bestAvailable","Best available")})]}),e.jsxs("div",{className:"nice-seating-chart__pickers",children:[e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:c("seatListPanel.section","Section")}),e.jsx(N.NiceSelect,{size:"sm",value:m,disabled:u,onChange:p=>{h(p),g(0)},options:r.map(p=>({value:p.section.id,label:`${p.section.name} (${p.seatCount})`}))})]}),e.jsxs("label",{className:"nice-seating-chart__field",children:[e.jsx("span",{children:"Row"}),e.jsx(N.NiceSelect,{size:"sm",value:String((A==null?void 0:A.rowIndex)??0),disabled:u||b.length===0,onChange:p=>g(Number(p)),options:b.map(p=>({value:String(p.rowIndex),label:`${p.label} (${p.seats.length})`}))})]})]}),A&&e.jsx("ul",{className:"nice-seating-chart__seat-list",children:A.seats.map(p=>{const M=Ne(p,a),_=Oe(p),R=s.has(p.id);return e.jsx("li",{children:e.jsxs(N.NiceButton,{size:"sm",variant:R?"primary":"outline",disabled:u||M!=="available",ariaLabel:o(p),"aria-pressed":R,onClick:()=>t(p),children:[p.number,_&&e.jsx(z.NtdWheelchair,{size:11})]})},p.id)})})]})},pt={zoom:1,pan:{x:0,y:0}};function ht(i={}){const{minZoom:s=.1,maxZoom:a=10,initial:n=pt,viewport:t,onViewportChange:d,disabled:o=!1}=i,[u,f]=l.useState(n),c=t??u,[r,m]=l.useState(!1),h=l.useRef(new Map),T=l.useRef(null),g=l.useRef(null),x=l.useCallback(j=>{t===void 0&&f(j),d==null||d(j)},[t,d]),P=l.useCallback(j=>Math.min(a,Math.max(s,j)),[s,a]),b=l.useCallback((j,C)=>{const O=P(c.zoom*j);if(O===c.zoom)return;const V=O/c.zoom;x({zoom:O,pan:{x:C.x-(C.x-c.pan.x)*V,y:C.y-(C.y-c.pan.y)*V}})},[x,P,c]),A=l.useCallback((j,C,O)=>{const V=C??(O?{x:O.width/2,y:O.height/2}:{x:0,y:0});b(j,V)},[b]),v=l.useCallback((j,C,O=24)=>{const V=Math.max(1,j.maxX-j.minX),E=Math.max(1,j.maxY-j.minY),L=P(Math.min((C.width-O*2)/V,(C.height-O*2)/E));x({zoom:L,pan:{x:(C.width-V*L)/2-j.minX*L,y:(C.height-E*L)/2-j.minY*L}})},[x,P]),p=l.useCallback(()=>x(n),[x,n]),M=l.useCallback(j=>({x:(j.x-c.pan.x)/c.zoom,y:(j.y-c.pan.y)/c.zoom}),[c]),_=l.useCallback(j=>({x:j.x*c.zoom+c.pan.x,y:j.y*c.zoom+c.pan.y}),[c]),R=j=>{const C=j.currentTarget.getBoundingClientRect();return{x:j.clientX-C.left,y:j.clientY-C.top}};return{viewport:c,setViewport:x,containerProps:o?{}:{onWheel:j=>{j.preventDefault();const C=Math.exp(-j.deltaY*.002);b(Math.min(2,Math.max(.5,C)),R(j))},onPointerDown:j=>{var O,V;const C=R(j);if(h.current.set(j.pointerId,C),(V=(O=j.currentTarget).setPointerCapture)==null||V.call(O,j.pointerId),h.current.size===2){const[E,L]=[...h.current.values()];T.current={distance:Math.hypot(E.x-L.x,E.y-L.y)||1,zoom:c.zoom}}else g.current=C,m(!0)},onPointerMove:j=>{if(!h.current.has(j.pointerId))return;const C=R(j);if(h.current.set(j.pointerId,C),h.current.size===2&&T.current){const[E,L]=[...h.current.values()],X=Math.hypot(E.x-L.x,E.y-L.y)||1,S=P(T.current.zoom*(X/T.current.distance)),y={x:(E.x+L.x)/2,y:(E.y+L.y)/2};S!==c.zoom&&b(S/c.zoom,y);return}if(!g.current)return;const O=C.x-g.current.x,V=C.y-g.current.y;g.current=C,x({zoom:c.zoom,pan:{x:c.pan.x+O,y:c.pan.y+V}})},onPointerUp:j=>{h.current.delete(j.pointerId),h.current.size<2&&(T.current=null),h.current.size===0&&(g.current=null,m(!1))},onPointerCancel:j=>{h.current.delete(j.pointerId),T.current=null,g.current=null,m(!1)}},zoomBy:A,fitTo:v,reset:p,screenToWorld:M,worldToScreen:_,panning:r}}const gt={"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."},xt={id:"empty",name:"",venueId:"",sections:[],priceCategories:[],totalSeats:0},rn=l.forwardRef(function(s,a){var ce,ke,fe;const{t:n}=F.useNiceTranslation(),{chart:t=xt,mode:d="select",selection:o={},selectedSeatIds:u,defaultSelectedSeatIds:f=[],onSelectionChange:c,onSelectionRejected:r,seatStatusOverrides:m,onSeatClick:h,onBestAvailable:T,lod:g="auto",onLodChange:x,maxRenderedSeats:P=2500,containerSize:b,showLegend:A=!0,showList:v=!1,zoomable:p=!0,locale:M,disabled:_=!1,readOnly:R=!1,className:k,style:j}=s,C=l.useRef(null),[O,V]=l.useState({width:800,height:500}),[E,L]=l.useState(!1),[X,S]=l.useState(f),[y,B]=l.useState(null),[G,q]=l.useState(""),I=u??X,U=l.useMemo(()=>new Set(I),[I]),W=d==="select"&&!_&&!R&&o.interactive!==!1,Q=o.maxSeats??8,Y=l.useMemo(()=>et(t),[t]),J=b??O,H=!!b||E;l.useEffect(()=>{if(b||!C.current||typeof ResizeObserver>"u")return;const $=C.current,D=new ResizeObserver(([K])=>{const{width:Z,height:ee}=K.contentRect;Z>0&&ee>0&&(V({width:Z,height:ee}),L(!0))});return D.observe($),()=>D.disconnect()},[b]);const he=ht({disabled:!p||_}),{fitTo:se,viewport:oe}=he,ge=l.useRef(!1);l.useEffect(()=>{ge.current||!H||Y.totalSeats===0||J.width<=0||(ge.current=!0,se(Y.bounds,J))},[se,Y,J,H]);const Ce=l.useMemo(()=>Jn(oe,J,40),[oe,J]),xe=g!=="auto"?g:y?"seat":void 0,le=l.useMemo(()=>st(Y,Ce,P,xe),[Y,Ce,P,xe]),ve=l.useRef(null);l.useEffect(()=>{ve.current!==le.tier&&(ve.current=le.tier,x==null||x(le.tier))},[le.tier,x]);const Ae=l.useMemo(()=>{var $;return new Map((($=t.sections)==null?void 0:$.map(D=>[D.id,D.color]))??[])},[t.sections]),de=l.useMemo(()=>{var $;return new Map((($=t.sections)==null?void 0:$.map(D=>[D.id,D]))??[])},[t.sections]),ae=l.useCallback($=>{const D=de.get($.sectorId),K=Ne($,m),Z=Oe($),ee=[D?D.name:"",n("seatingChart.rowN","row {row}").replace("{row}",String($.row)),n("seatingChart.seatN","seat {number}").replace("{number}",String($.number))].filter(Boolean);if(D&&o.showPrices!==!1){const re=Ze($,t,D);ee.push(ne(re.amount,re.currency,M))}return ee.push(n(`seatingChart.status.${K}`,K)),Z==="wheelchair"&&ee.push(n("seatingChart.wheelchairAccessible","wheelchair accessible")),Z==="companion"&&ee.push(n("seatingChart.companionSeat","companion seat")),ee.join(", ")},[t,de,m,o.showPrices,M,n]),te=l.useCallback($=>{u===void 0&&S($),c==null||c($)},[u,c]),_e=l.useCallback($=>{if(h==null||h($),!W)return;const D=ct(I,$.id,Y,o,m);if("rejected"in D){r==null||r({reason:D.rejected,seatId:$.id}),q(n(`seatingChart.rejection.${D.rejected}`,gt[D.rejected]));return}te(D.selected),q(n("seatingChart.seatSelected","{seat}. {count} of {max} selected.").replace("{seat}",ae($)).replace("{count}",String(D.selected.length)).replace("{max}",String(Q)))},[n,te,ae,Y,W,Q,h,r,m,I,o]),ue=l.useCallback(($,D)=>{if(T){T($,D);return}const K=rt(Y,$,o,D,m);if(K.length===0){q(n("seatingChart.noBlockAvailable","No block of {count} seats together is available.").replace("{count}",String($)));return}te(K),B(K[0]),q(n("seatingChart.selectedTogether","Selected {count} seats together.").replace("{count}",String(K.length)))},[te,Y,T,m,o,n]),je=l.useCallback($=>{const D=Y.locationById.get($);if(!D)return;const K=Y.rows.find(Z=>Z.sectionId===D.sectionId&&Z.rowIndex===D.rowIndex);K&&se(K.bounds,J,80)},[se,Y,J]),me=l.useCallback($=>{if(!$)return;B($),je($);const D=Y.seatById.get($);D&&q(ae(D))},[ae,Y.seatById,je]),Re=$=>{var ee,re;const D=y??((re=(ee=Y.rows[0])==null?void 0:ee.seats[0])==null?void 0:re.id)??null;if(!D)return;const Z={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"row-start",End:"row-end"}[$.key];if(Z){$.preventDefault(),me(y?ot(Y,D,Z):D);return}if($.key==="PageDown"||$.key==="PageUp"){$.preventDefault(),me(lt(Y,y,$.key==="PageDown"?"next":"prev"));return}if($.key==="Enter"||$.key===" "){$.preventDefault();const Se=Y.seatById.get(D);Se&&_e(Se);return}$.key==="Escape"&&I.length>0&&($.preventDefault(),te([]),q(n("seatingChart.selectionCleared","Selection cleared.")))};if(Y.totalSeats===0)return e.jsx("div",{ref:a,className:`nice-seating-chart ${k??""}`,style:j,children:e.jsx(pe,{title:n("seatingChart.thisChartHasNoSeats","This chart has no seats"),description:n("seatingChart.addSectionsAndRowsTo","Add sections and rows to the seating chart to see it here.")})});const ye=I.reduce(($,D)=>{const K=Y.seatById.get(D),Z=K?de.get(K.sectorId):void 0;return!K||!Z?$:$+Ze(K,t,Z).amount},0),be=((ke=(ce=t.sections)==null?void 0:ce[0])==null?void 0:ke.currency)??"PLN";return e.jsxs("div",{ref:a,className:`nice-seating-chart nice-seating-chart--${d} ${k??""}`,style:j,children:[e.jsxs("div",{ref:C,className:"nice-seating-chart__canvas-host",role:"grid","aria-label":n("seatingChart.chartLabel","{name} seating chart").replace("{name}",t.name),"aria-rowcount":Y.rows.length,"aria-colcount":Y.totalSeats,tabIndex:y?-1:0,onKeyDown:Re,...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(${oe.pan.x} ${oe.pan.y}) scale(${oe.zoom})`,children:e.jsx(ut,{cull:le,selectedIds:U,cursorId:y,statusOverrides:m,sectionColorById:Ae,interactive:W,onSeatClick:_e,onSectionClick:o.sectionSelect?$=>{var K;const D=(K=Y.rows.find(Z=>Z.sectionId===$))==null?void 0:K.seats[0];D&&me(D.id)}:void 0,describeSeat:ae})})]}),p&&e.jsxs("div",{className:"nice-seating-chart__zoom",children:[e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.zoomIn","Zoom in"),onClick:()=>he.zoomBy(1.25,void 0,J),children:e.jsx(z.NtdZoomIn,{size:16})}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.zoomOut","Zoom out"),onClick:()=>he.zoomBy(.8,void 0,J),children:e.jsx(z.NtdZoomOut,{size:16})}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("seatingChart.fitToView","Fit to view"),onClick:()=>se(Y.bounds,J),children:e.jsx(z.NtdMaximize,{size:16})})]})]}),e.jsx("p",{className:"nice-seating-chart__status",role:"status","aria-live":"polite",children:G}),A&&e.jsxs("ul",{className:"nice-seating-chart__legend",children:[(fe=t.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," · ",ne($.price,be,M)]},$.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"})," ",n("seatingChart.sold","Sold")]})]}),d==="select"&&I.length>0&&e.jsxs("p",{className:"nice-seating-chart__total",children:[I.length," seat",I.length===1?"":"s"," ·"," ",ne(ye,be,M)]}),v&&e.jsx(mt,{index:Y,selectedIds:U,statusOverrides:m,maxSeats:Q,onSeatToggle:_e,onBestAvailable:ue,describeSeat:ae,disabled:!W,defaultOpen:d==="select"&&v})]})}),vt=l.forwardRef(function({showList:s=!0,className:a,...n},t){return e.jsx(rn,{ref:t,mode:"select",showList:s,className:`nice-seat-picker ${a??""}`,...n})}),on=/\{\{\s*([\w.-]+)\s*\}\}/g,ft={"&":"&","<":"<",">":">",'"':""","'":"'"};function Nt(i){return i.replace(/[&<>"']/g,s=>ft[s]??s)}function _t(i){const s=[],a=new Set;for(const n of i.matchAll(on)){const t=n[1];a.has(t)||(a.add(t),s.push(t))}return s}function jt(i,s={},a={}){const{escape:n=!0,missing:t="keep"}=a;return i.replace(on,(d,o)=>{const u=s[o];return u==null?t==="blank"?"":d:n?Nt(String(u)):String(u)})}function Je(i){return`{{${i}}}`}function yt(i,s={}){return _t(i).filter(a=>s[a]===void 0||s[a]===null)}const bt={name:"",body:""},kt=["bold","italic","underline","h1","h2","ul","ol","link","image","alignLeft","alignCenter","undo","redo"],wt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{template:t,defaultTemplate:d,onTemplateChange:o,tokens:u=[],previewData:f={},recipients:c=[],onRecipientsChange:r,onSend:m,sending:h=!1,toolbar:T=kt,disabled:g=!1,readOnly:x=!1,size:P="md",className:b,style:A}=s,[v,p]=F.useControllableState({value:t,defaultValue:d,fallbackValue:bt,onChange:o,componentName:"NiceInvitationDesigner"}),[M,_]=l.useState(""),R=g||x||h,k=l.useMemo(()=>sn(M),[M]),j=l.useMemo(()=>{const y={};for(const B of u)B.sample!==void 0&&(y[B.key]=B.sample);return{...y,...f}},[u,f]),C=l.useMemo(()=>jt(v.body??"",j),[v.body,j]),O=l.useMemo(()=>yt(v.body??"",j),[v.body,j]),V=c.map(y=>y.email),E=y=>p({...v,...y}),L=y=>{E({body:`${v.body??""}${Je(y)}`})},X=()=>{!r||k.valid.length===0||(r(Xn(V,k.valid)),_(""))},S=y=>{r==null||r(V.filter(B=>B!==y))};return e.jsxs("div",{ref:a,className:`nice-invitation-designer nice-invitation-designer--${P} ${b??""}`,style:A,children:[e.jsxs("section",{className:"nice-invitation-designer__editor",children:[e.jsx(N.NiceTextInput,{label:n("invitationDesigner.templateName","Template name"),value:v.name,onChange:y=>E({name:y}),placeholder:n("invitationDesigner.birthdayInvitation","Birthday invitation"),disabled:R,size:P}),u.length>0&&!x&&e.jsxs("div",{className:"nice-invitation-designer__tokens",children:[e.jsx("span",{className:"nice-invitation-designer__tokens-label",children:"Insert:"}),u.map(y=>e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:R,onClick:()=>L(y.key),children:y.label},y.key))]}),e.jsx(N.NiceHtmlEditor,{value:v.body??"",onChange:y=>E({body:y}),toolbar:T,height:280,readOnly:x||h,disabled:g})]}),e.jsxs("section",{className:"nice-invitation-designer__preview","aria-label":n("invitationDesigner.invitationPreview","Invitation preview"),children:[e.jsxs("header",{className:"nice-invitation-designer__preview-header",children:[e.jsx("h4",{children:n("invitationDesigner.preview","Preview")}),O.length>0&&e.jsxs(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[O.length," unresolved"]})]}),v.coverImageUrl&&e.jsx("img",{className:"nice-invitation-designer__cover",src:v.coverImageUrl,alt:""}),e.jsx("div",{className:"nice-invitation-designer__preview-body",dangerouslySetInnerHTML:{__html:C}}),O.length>0&&e.jsxs("p",{className:"nice-invitation-designer__unresolved",children:["No preview value for: ",O.map(y=>Je(y)).join(", ")]})]}),e.jsxs("section",{className:"nice-invitation-designer__recipients",children:[e.jsx("header",{className:"nice-invitation-designer__recipients-header",children:e.jsxs("h4",{children:[n("invitationDesigner.recipients","Recipients")," ",e.jsxs("span",{children:["(",c.length,")"]})]})}),r&&!x&&e.jsxs(e.Fragment,{children:[e.jsx(N.NiceTextArea,{label:n("invitationDesigner.addAddresses","Add addresses"),value:M,onChange:_,placeholder:n("invitationDesigner.pasteAListCommasSemicolons","Paste a list — commas, semicolons or new lines"),rows:3,disabled:R,size:P}),e.jsxs("div",{className:"nice-invitation-designer__paste-actions",children:[e.jsx(N.NiceButton,{size:P,variant:"outline",leftIcon:e.jsx(z.NtdMail,{size:15}),disabled:R||k.valid.length===0,onClick:X,children:k.valid.length>0?n("invitationDesigner.addN","Add ({count})").replace("{count}",String(k.valid.length)):n("invitationDesigner.add","Add")}),(k.invalid.length>0||k.duplicates>0)&&e.jsxs("span",{className:"nice-invitation-designer__paste-hint",children:[k.duplicates>0&&`${n("invitationDesigner.duplicates","{count} duplicate(s).").replace("{count}",String(k.duplicates))} `,k.invalid.length>0&&n("invitationDesigner.notRecognised","{count} not recognised: {list}").replace("{count}",String(k.invalid.length)).replace("{list}",k.invalid.slice(0,3).join(", "))]})]})]}),c.length>0&&e.jsx("ul",{className:"nice-invitation-designer__recipient-list",children:c.map(y=>e.jsxs("li",{className:"nice-invitation-designer__recipient",children:[e.jsx("span",{children:y.name?`${y.name} <${y.email}>`:y.email}),y.status&&y.status!=="pending"&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:y.status==="sent"?"success":"error",children:n(`invitationDesigner.recipientStatus.${y.status}`,y.status)}),r&&!x&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("invitationDesigner.removeRecipient","Remove {email}").replace("{email}",y.email),disabled:R,onClick:()=>S(y.email),children:e.jsx(z.NtdTrash,{size:13})})]},y.email))}),m&&!x&&e.jsx(N.NiceButton,{variant:"primary",size:P,leftIcon:e.jsx(z.NtdSend,{size:15}),loading:h,ariaLabel:n("invitationDesigner.sendInvitations","Send invitations"),disabled:g||h||c.length===0,onClick:()=>m({templateId:v.id,emails:V}),children:h?n("invitationDesigner.sending","Sending…"):n("invitationDesigner.sendTo","Send to {count}").replace("{count}",String(c.length))})]})]})}),Ct=({value:i,max:s,currency:a,locale:n,label:t,className:d})=>{const o=s>0?s:1,u=i>=s&&s>0,f=(c,r)=>a?`${ne(c,a,n)} / ${ne(r,a,n)}`:`${c} / ${r}`;return e.jsx(N.NiceProgress,{className:d,value:Math.min(i,o),max:o,variant:u?"success":"primary",size:"sm",showValue:!0,formatValue:()=>f(i,s),"aria-label":t})},St=[];function It(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 Pt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=St,kind:d="registry",mode:o="owner",currency:u="PLN",locale:f,hideContributors:c=!1,currentUserId:r,currentUserName:m,onContribute:h,onClaim:T,onUnclaim:g,onItemAdd:x,onItemDelete:P,onItemClick:b,layout:A="grid",disabled:v=!1,readOnly:p=!1,size:M="md",className:_,style:R}=s,k=an({currentUserId:r,currentUserName:m}),[j,C]=l.useState(null),[O,V]=l.useState(0),[E,L]=l.useState(""),X=o==="owner",S=v||p,y=d==="wishlist",B=l.useMemo(()=>y?[...t].sort((I,U)=>Number(I.isPurchased??!1)-Number(U.isPurchased??!1)||(U.priority??0)-(I.priority??0)):t,[t,y]),G=()=>{C(null),V(0)},q=I=>{!h||!k.canAct||(h(I.id,{amount:O>0?O:void 0,quantity:O>0?void 0:1,userName:k.actor.userName,userId:k.actor.userId}),G())};return t.length===0?e.jsx("div",{ref:a,className:`nice-gift-registry ${_??""}`,style:R,children:e.jsx(pe,{icon:e.jsx(z.NtdGiftCard,{size:28}),title:y?n("giftRegistry.emptyWishlist","Nothing on the wishlist yet"):n("giftRegistry.emptyRegistry","No gifts on the registry yet"),description:X?n("giftRegistry.emptyOwnerHint","Add what you would like and share the link."):n("giftRegistry.emptyGuestHint","The host has not added anything yet.")})}):e.jsxs("div",{ref:a,className:`nice-gift-registry nice-gift-registry--${d} nice-gift-registry--${A} nice-gift-registry--${M} ${_??""}`,style:R,children:[!X&&k.isAnonymous&&(h||T)&&e.jsx(N.NiceTextInput,{label:n("giftRegistry.yourName","Your name"),value:k.name,onChange:k.setName,placeholder:n("giftRegistry.soTheHostKnowsWho","So the host knows who to thank"),required:!0,disabled:S,size:M}),e.jsx(N.NiceCardGroup,{columns:A==="list"?1:void 0,minColumnWidth:240,gap:12,children:B.map(I=>{const{value:U,max:W,complete:Q}=It(I,d),Y=I.price,J=I.contributions??[];return e.jsxs("div",{className:`nice-gift-registry__item${Q?" nice-gift-registry__item--complete":""}`,children:[I.imageUrl&&e.jsx("img",{src:I.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:()=>b==null?void 0:b(I),disabled:!b,children:I.title}),I.description&&e.jsx("p",{className:"nice-gift-registry__description",children:I.description}),e.jsxs("div",{className:"nice-gift-registry__facts",children:[Y&&e.jsx("span",{className:"nice-gift-registry__price",children:ne(Y.amount,Y.currency||u,f)}),y&&(I.priority??0)>0&&e.jsxs(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:[e.jsx(z.NtdStar,{size:11})," ",I.priority]}),Q&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:y?"bought":"fully covered"}),I.url&&e.jsxs("a",{className:"nice-gift-registry__link",href:I.url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(z.NtdLink,{size:13})," ",n("giftRegistry.shop","Shop")]})]}),!y&&e.jsx(Ct,{value:U,max:W,label:n("giftRegistry.covered","{name}: {value} of {max} covered").replace("{name}",I.title).replace("{value}",String(U)).replace("{max}",String(W))}),!c&&J.length>0&&e.jsx("ul",{className:"nice-gift-registry__contributors",children:J.map(H=>e.jsxs("li",{className:"nice-gift-registry__contributor",children:[e.jsx("strong",{children:H.contributorName}),H.amount!==void 0&&` — ${ne(H.amount,(Y==null?void 0:Y.currency)||u,f)}`,H.amount===void 0&&H.quantity?` — ${H.quantity}×`:"",H.message&&e.jsxs("em",{children:[" “",H.message,"”"]})]},H.id))}),e.jsxs("div",{className:"nice-gift-registry__actions",children:[!X&&!Q&&T&&e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:S||!k.canAct,leftIcon:e.jsx(z.NtdCheck,{size:14}),onClick:()=>T(I.id,{...k.actor,quantity:1}),children:"I'll take this"}),!X&&Q&&g&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",disabled:S,onClick:()=>g(I.id),children:n("giftRegistry.release","Release")}),!X&&!Q&&!y&&h&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:S||!k.canAct,onClick:()=>C(j===I.id?null:I.id),children:n("giftRegistry.chipIn","Chip in")}),X&&P&&!p&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("giftRegistry.deleteItem","Delete {name}").replace("{name}",I.title),disabled:v,onClick:()=>P(I.id),children:e.jsx(z.NtdTrash,{size:14})})]}),j===I.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 (",(Y==null?void 0:Y.currency)||u,")"]}),e.jsx(N.NiceNumericInput,{value:O,onChange:H=>V(Math.max(0,H??0)),min:0,size:"xs",disabled:S})]}),e.jsx(N.NiceButton,{size:"sm",variant:"primary",disabled:S||!k.canAct,onClick:()=>q(I),children:n("giftRegistry.confirm","Confirm")}),e.jsx(N.NiceButton,{size:"sm",variant:"ghost",onClick:G,children:n("giftRegistry.cancel","Cancel")})]})]})]},I.id)})}),X&&x&&!p&&e.jsxs("div",{className:"nice-gift-registry__add",children:[e.jsx(N.NiceTextInput,{label:y?n("giftRegistry.addAWish","Add a wish"):n("giftRegistry.addAGift","Add a gift"),value:E,onChange:L,placeholder:n("giftRegistry.whatWouldYouLike","What would you like?"),disabled:v,size:M}),e.jsx(N.NiceButton,{variant:"primary",size:M,leftIcon:e.jsx(z.NtdPlus,{size:15}),disabled:v||!E.trim(),onClick:()=>{x({title:E.trim(),quantityNeeded:1}),L("")},children:"Add"})]})]})});function Tt(i){const s=new Map;for(const a of i){const n=(a.currency||"").toUpperCase(),t=s.get(n);t?t.push(a):s.set(n,[a])}return s}function zt(i,s,a){var f;const n=new Set(s.map(c=>c.id)),t=s.map(c=>c.id),d=new Map(t.map(c=>[c,0])),o=[];let u=0;if(t.length===0)return{balances:d,issues:i.map(c=>({itemId:c.id,reason:"no-participants"})),totalMinor:0};for(const c of i){const r=c.paidById;if(!r){o.push({itemId:c.id,reason:"no-payer"});continue}if(!n.has(r)){o.push({itemId:c.id,reason:"unknown-payer"});continue}let m=(f=c.splitAmong)!=null&&f.length?c.splitAmong.filter(b=>n.has(b)):t;m.length===0&&(m=t);const h=De(c.amount,a);u+=h;const T=m.length,g=Math.floor(h/T),x=h-g*T,P=new Map(m.map(b=>[b,g]));if(x!==0)if(P.has(r))P.set(r,(P.get(r)??0)+x);else{const b=[...m].sort(Me),A=x>0?1:-1;for(let v=0;v<Math.abs(x);v+=1){const p=b[v%b.length];P.set(p,(P.get(p)??0)+A)}}d.set(r,(d.get(r)??0)+h);for(const[b,A]of P)d.set(b,(d.get(b)??0)-A)}return{balances:d,issues:o,totalMinor:u}}function Mt(i,s,a){for(const n of s){if((n.currency||"").toUpperCase()!==a||!i.has(n.fromId)||!i.has(n.toId))continue;const t=De(n.amount,a);i.set(n.fromId,(i.get(n.fromId)??0)+t),i.set(n.toId,(i.get(n.toId)??0)-t)}}function At(i,s,a){const n=new Map(s.map(c=>[c.id,c.name])),t=[...i.entries()].filter(([,c])=>c>0).map(([c,r])=>({id:c,v:r})).sort((c,r)=>r.v-c.v||Me(c.id,r.id)),d=[...i.entries()].filter(([,c])=>c<0).map(([c,r])=>({id:c,v:r})).sort((c,r)=>c.v-r.v||Me(c.id,r.id)),o=[];let u=0,f=0;for(;u<d.length&&f<t.length;){const c=Math.min(-d[u].v,t[f].v);c>0&&o.push({fromId:d[u].id,fromName:n.get(d[u].id)??d[u].id,toId:t[f].id,toName:n.get(t[f].id)??t[f].id,amount:ze(c,a),currency:a}),d[u].v+=c,t[f].v-=c,d[u].v===0&&(u+=1),t[f].v===0&&(f+=1)}return o}function Rt(i,s,a=[]){const n=[],t=[],d=[...Tt(i).entries()].sort(([o],[u])=>Me(o,u));for(const[o,u]of d){const f=zt(u,s,o);t.push(...f.issues),Mt(f.balances,a,o),n.push({currency:o,total:ze(f.totalMinor,o),balances:s.map(c=>({participantId:c.id,participantName:c.name,amount:ze(f.balances.get(c.id)??0,o),currency:o})),transfers:At(f.balances,s,o)})}return{groups:n,issues:t}}function Me(i,s){return i<s?-1:i>s?1:0}const Bt=[],$t=[],Lt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{items:t=Bt,participants:d=$t,settlements:o=[],view:u,defaultView:f="expenses",onViewChange:c,onSettle:r,onItemDelete:m,onItemClick:h,onValidationChange:T,sortBy:g="date",locale:x,disabled:P=!1,readOnly:b=!1,size:A="md",className:v,style:p}=s,[M,_]=l.useState(f),R=u??M,k=P||b,j=l.useMemo(()=>d.map(S=>({id:S.id,name:S.name})),[d]),C=l.useMemo(()=>Rt(t,j,o),[t,j,o]),O=l.useMemo(()=>g==="none"?t:t.map((S,y)=>({item:S,index:y})).sort((S,y)=>{if(g==="amount")return y.item.amount-S.item.amount||S.index-y.index;const B=S.item.incurredAt,G=y.item.incurredAt;return B&&G?B.localeCompare(G)||S.index-y.index:B?-1:G?1:S.index-y.index}).map(S=>S.item),[t,g]),V=C.issues.map(S=>`${S.itemId}:${S.reason}`).join("|");l.useEffect(()=>{T==null||T(C.issues)},[V]);const E=l.useMemo(()=>new Map(d.map(S=>[S.id,S.avatarUrl])),[d]),L=l.useMemo(()=>new Map(C.issues.map(S=>[S.itemId,S.reason])),[C.issues]),X=S=>{u===void 0&&_(S),c==null||c(S)};return t.length===0?e.jsx("div",{ref:a,className:`nice-expense-split ${v??""}`,style:p,children:e.jsx(pe,{icon:e.jsx(z.NtdReceipt,{size:28}),title:n("expenseSplit.noExpensesYet","No expenses yet"),description:n("expenseSplit.addWhatPeoplePaidFor","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--${A} ${v??""}`,style:p,children:[e.jsx(N.NiceSegmentedControl,{size:A,value:R,onChange:S=>X(S),options:[{value:"expenses",label:n("expenseSplit.expenses","Expenses")},{value:"balances",label:n("expenseSplit.balances","Balances")},{value:"settlement",label:n("expenseSplit.settleUp","Settle up")}]}),R==="expenses"&&e.jsx("ul",{className:"nice-expense-split__items",children:O.map(S=>{const y=L.get(S.id);return e.jsxs("li",{className:`nice-expense-split__item${y?" nice-expense-split__item--excluded":""}`,children:[e.jsxs("button",{type:"button",className:"nice-expense-split__item-main",onClick:()=>h==null?void 0:h(S),disabled:!h,children:[e.jsx("span",{className:"nice-expense-split__item-label",children:S.label}),e.jsxs("span",{className:"nice-expense-split__item-payer",children:[S.paidByName??S.paidById??"nobody"," paid"]})]}),e.jsx("span",{className:"nice-expense-split__item-amount",children:ne(S.amount,S.currency,x)}),S.isPaid&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"success",children:"paid"}),y&&e.jsx(N.NiceBadge,{size:"xs",subtle:!0,variant:"warning",children:y==="no-payer"?"no payer":"unknown payer"}),m&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"ghost",ariaLabel:n("expenseSplit.deleteItem","Delete {name}").replace("{name}",S.label),disabled:P,onClick:()=>m(S.id),children:e.jsx(z.NtdTrash,{size:14})})]},S.id)})}),R==="balances"&&C.groups.map(S=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[S.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[ne(S.total,S.currency,x)," total"]})]}),e.jsx("ul",{className:"nice-participant-list__rows",children:S.balances.map(y=>e.jsx(Be,{participant:{id:y.participantId,name:y.participantName,avatarUrl:E.get(y.participantId)},showRole:!1,showStatus:!1,size:A,children:e.jsxs("span",{className:`nice-expense-split__balance nice-expense-split__balance--${y.amount>0?"owed":y.amount<0?"owes":"settled"}`,children:[y.amount===0?"settled up":ne(Math.abs(y.amount),y.currency,x),y.amount>0&&e.jsx("em",{children:" is owed"}),y.amount<0&&e.jsx("em",{children:" owes"})]})},y.participantId))})]},S.currency)),R==="settlement"&&(C.groups.every(S=>S.transfers.length===0)?e.jsx(pe,{icon:e.jsx(z.NtdCoins,{size:28}),title:n("expenseSplit.allSettledUp","All settled up"),description:n("expenseSplit.nobodyOwesAnybodyAnything","Nobody owes anybody anything.")}):C.groups.filter(S=>S.transfers.length>0).map(S=>e.jsxs("section",{className:"nice-expense-split__group",children:[e.jsxs("h4",{className:"nice-expense-split__group-title",children:[S.currency,e.jsxs("span",{className:"nice-expense-split__group-total",children:[S.transfers.length," transfer",S.transfers.length===1?"":"s"]})]}),e.jsx("ul",{className:"nice-expense-split__transfers",children:S.transfers.map(y=>e.jsxs("li",{className:"nice-expense-split__transfer",children:[e.jsx("span",{className:"nice-expense-split__transfer-from",children:y.fromName}),e.jsx(z.NtdArrowRight,{size:15}),e.jsx("span",{className:"nice-expense-split__transfer-to",children:y.toName}),e.jsx("span",{className:"nice-expense-split__transfer-amount",children:ne(y.amount,y.currency,x)}),r&&!b&&e.jsx(N.NiceButton,{size:"sm",variant:"outline",disabled:k,onClick:()=>r(y),children:n("expenseSplit.markPaid","Mark paid")})]},`${y.fromId}-${y.toId}-${y.amount}`))})]},S.currency)))]})}),Et=[],Dt={upcoming:z.NtdClock,active:z.NtdPlay,voting:z.NtdThumbsUp,scored:z.NtdBarChart,completed:z.NtdCheck,skipped:z.NtdSkipForward},Ot={upcoming:"#9ca3af",active:"#22c55e",voting:"#eab308",scored:"#3b82f6",completed:"#6b7280",skipped:"#d1d5db"},Yt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{rounds:t=Et,activeRoundId:d,onSelect:o,onStart:u,onEnd:f,onCreate:c,editable:r=!1,className:m,style:h}=s,T=[...t].sort((g,x)=>g.order-x.order);return e.jsxs("div",{ref:a,className:`nice-round-list ${m??""}`,style:h,children:[e.jsxs("div",{className:"nice-round-list__header",children:[e.jsxs("h3",{children:["Rounds (",t.length,")"]}),r&&c&&e.jsx("button",{onClick:c,children:n("roundList.addRound","+ Add Round")})]}),T.length===0?e.jsx("p",{className:"nice-round-list__empty",children:n("roundList.noRoundsYet","No rounds yet.")}):e.jsx("div",{className:"nice-round-list__items",children:T.map(g=>{const x=g.id===d;return e.jsxs("div",{className:`nice-round-list__item ${x?"nice-round-list__item--active":""}`,onClick:()=>o==null?void 0:o(g),role:o?"button":void 0,tabIndex:o?0:void 0,children:[e.jsxs("span",{className:"nice-round-list__order",children:["#",g.order]}),e.jsx("span",{className:"nice-round-list__icon",title:n(`roundCard.status.${g.status}`,g.status),children:l.createElement(Dt[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:Ot[g.status]},children:n(`roundCard.status.${g.status}`,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(z.NtdTrophy,{size:14})," ",g.winnerIds.length]}),r&&e.jsxs("div",{className:"nice-round-list__actions",onClick:P=>P.stopPropagation(),children:[g.status==="upcoming"&&u&&e.jsx("button",{onClick:()=>u(g.id),children:n("roundList.start","Start")}),(g.status==="active"||g.status==="voting")&&f&&e.jsx("button",{onClick:()=>f(g.id),children:"End"})]})]},g.id)})})]})}),Ut=["var(--nice-lb-gold, #facc15)","var(--nice-lb-silver, #cbd5e1)","var(--nice-lb-bronze, #d97706)"],Vt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{round:t,timerRunning:d=!1,remainingSeconds:o,onSubmitScore:u,onStart:f,onEnd:c,onSkip:r,editable:m=!1,footerActions:h,className:T,style:g}=s,[x,P]=l.useState({}),b=l.useCallback(p=>{const M=parseFloat(x[p]??"");isNaN(M)||!u||(u(p,M),P(_=>({..._,[p]:""})))},[x,u]),A=p=>{const M=Math.floor(p/60),_=p%60;return`${M}:${_.toString().padStart(2,"0")}`},v=t.scores?[...t.scores].sort((p,M)=>M.score-p.score):[];return e.jsxs("div",{ref:a,className:`nice-round-card nice-round-card--${t.status} ${T??""}`,style:g,children:[e.jsxs("div",{className:"nice-round-card__header",children:[e.jsx("span",{className:"nice-round-card__order",children:n("roundCard.roundN","Round #{n}").replace("{n}",String(t.order))}),e.jsx("h3",{className:"nice-round-card__name",children:t.name}),e.jsx("span",{className:"nice-round-card__status",children:n(`roundCard.status.${t.status}`,t.status)})]}),t.description&&e.jsx("p",{className:"nice-round-card__description",children:t.description}),(d||o!=null)&&e.jsxs("div",{className:`nice-round-card__timer ${d?"nice-round-card__timer--running":""}`,children:[e.jsx(z.NtdClock,{size:14})," ",o!=null?A(o):"—"]}),v.length>0&&e.jsxs("div",{className:"nice-round-card__scoreboard",children:[e.jsx("h4",{children:n("roundCard.scoreboard","Scoreboard")}),e.jsxs("table",{className:"nice-round-card__scores-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("roundCard.rank","Rank")}),e.jsx("th",{children:n("roundCard.participant","Participant")}),e.jsx("th",{children:n("roundCard.score","Score")})]})}),e.jsx("tbody",{children:v.map((p,M)=>e.jsxs("tr",{className:M<3?`nice-round-card__top-${M+1}`:"",children:[e.jsxs("td",{children:[p.rank??M+1,M<3&&e.jsxs(e.Fragment,{children:[" ",e.jsx(z.NtdMedal,{size:14,primaryColor:Ut[M],"aria-label":n("roundCard.placeN","Place {n}").replace("{n}",String(M+1))})]})]}),e.jsx("td",{children:p.participantName}),e.jsx("td",{children:p.score})]},p.participantId))})]})]}),u&&(t.status==="active"||t.status==="voting")&&v.length>0&&e.jsxs("div",{className:"nice-round-card__score-input",children:[e.jsx("h4",{children:n("roundCard.submitScores","Submit Scores")}),v.map(p=>e.jsxs("div",{className:"nice-round-card__score-row",children:[e.jsx("span",{children:p.participantName}),e.jsx("input",{type:"number",value:x[p.participantId]??"",onChange:M=>P(_=>({..._,[p.participantId]:M.target.value})),min:0,step:1,placeholder:n("roundCard.score","Score")}),e.jsx("button",{onClick:()=>b(p.participantId),children:n("roundCard.submit","Submit")})]},p.participantId))]}),e.jsxs("div",{className:"nice-round-card__footer",children:[m&&e.jsxs("div",{className:"nice-round-card__actions",children:[t.status==="upcoming"&&f&&e.jsxs("button",{onClick:f,children:[e.jsx(z.NtdPlay,{size:14})," ",n("roundCard.startRound","Start Round")]}),(t.status==="active"||t.status==="voting")&&c&&e.jsxs("button",{onClick:c,children:[e.jsx(z.NtdStop,{size:14})," ",n("roundCard.endRound","End Round")]}),t.status==="upcoming"&&r&&e.jsxs("button",{onClick:r,children:[e.jsx(z.NtdSkipForward,{size:14})," ",n("roundCard.skip","Skip")]})]}),h]}),t.winnerIds&&t.winnerIds.length>0&&e.jsxs("div",{className:"nice-round-card__winners",children:[e.jsx(z.NtdTrophy,{size:14})," Winners: ",t.winnerIds.length]})]})}),Ft=[],Xt=i=>{if(!i)return"";const s=Math.floor(i/60),a=i%60;return`${s}:${a.toString().padStart(2,"0")}`},qt=l.forwardRef(function(s,a){const{songs:n=Ft,onAdd:t,onRemove:d,onVote:o,onSearch:u,showQueue:f=!0,readOnly:c=!1,className:r,style:m}=s,{t:h}=F.useNiceTranslation(),[T,g]=l.useState(""),x=l.useMemo(()=>{if(!T.trim())return n;const v=T.toLowerCase();return n.filter(p=>p.title.toLowerCase().includes(v)||p.artist.toLowerCase().includes(v))},[n,T]),P=l.useMemo(()=>n.filter(v=>v.isQueued),[n]),b=n.find(v=>v.isPlaying),A=v=>{g(v),u==null||u(v)};return e.jsxs("div",{ref:a,className:`nice-song-picker ${r??""}`,style:m,children:[b&&e.jsxs("div",{className:"nice-song-picker__now-playing",children:[b.albumArt&&e.jsx("img",{src:b.albumArt,alt:"",className:"nice-song-picker__album-art"}),e.jsxs("div",{children:[e.jsxs("div",{className:"nice-song-picker__np-label",children:[e.jsx(z.NtdMusic,{size:14})," ",h("songPicker.nowPlaying","Now playing")]}),e.jsx("strong",{children:b.title})," — ",e.jsx("span",{children:b.artist})]})]}),e.jsx("div",{className:"nice-song-picker__search",children:e.jsx(N.NiceTextInput,{size:"sm",controlWidth:"100%",value:T,onChange:A,placeholder:h("songPicker.search","Search songs or artists…"),"aria-label":h("songPicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-song-picker__list",children:x.length===0?e.jsx("p",{className:"nice-song-picker__empty",children:h("songPicker.noMatch","No songs found.")}):x.map(v=>e.jsxs("div",{className:`nice-song-picker__item ${v.isPlaying?"nice-song-picker__item--playing":""}`,children:[v.albumArt&&e.jsx("img",{src:v.albumArt,alt:"",className:"nice-song-picker__thumb"}),e.jsxs("div",{className:"nice-song-picker__info",children:[e.jsx("strong",{children:v.title})," — ",e.jsx("span",{children:v.artist}),v.duration&&e.jsx("span",{className:"nice-song-picker__duration",children:Xt(v.duration)}),v.addedByName&&e.jsx("div",{className:"nice-song-picker__added-by",children:h("songPicker.addedBy","Added by {name}").replace("{name}",v.addedByName)})]}),!c&&e.jsxs("div",{className:"nice-song-picker__actions",children:[o&&e.jsxs(N.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o(v.id),"aria-label":h("songPicker.vote","Vote for {title}").replace("{title}",v.title),children:[e.jsx(z.NtdThumbsUp,{size:14})," ",v.votes??0]}),t&&!v.isQueued&&e.jsxs(N.NiceButton,{variant:"primary",size:"sm",onClick:()=>t(v.id),children:[e.jsx(z.NtdPlus,{size:14})," ",h("songPicker.addToQueue","Queue")]}),d&&v.isQueued&&e.jsx(N.NiceButton,{variant:"outline",size:"sm",onClick:()=>d(v.id),children:h("remove","Remove")})]})]},v.id))}),f&&P.length>0&&e.jsxs("div",{className:"nice-song-picker__queue",children:[e.jsx("h4",{children:h("songPicker.queue","Queue ({count})").replace("{count}",String(P.length))}),P.map((v,p)=>e.jsxs("div",{className:"nice-song-picker__queue-item",children:[e.jsxs("span",{className:"nice-song-picker__queue-pos",children:[p+1,"."]}),e.jsxs("span",{children:[v.title," — ",v.artist]})]},v.id))]})]})}),Wt=[],en={easy:"Easy",medium:"Medium",hard:"Hard",expert:"Expert"},Gt={easy:"var(--nice-color-success, #16a34a)",medium:"var(--nice-color-warning, #d97706)",hard:"var(--nice-color-error, #dc2626)",expert:"var(--nice-color-accent, #7c3aed)"},Te="all",Kt=l.forwardRef(function(s,a){const{songs:n=Wt,queue:t=[],onEnqueue:d,onDequeue:o,onNext:u,nowPlayingId:f,readOnly:c=!1,className:r,style:m}=s,{t:h}=F.useNiceTranslation(),T=_=>_ in en?h(`karaokePicker.difficulty.${_}`,en[_]):_,[g,x]=l.useState(""),[P,b]=l.useState(Te),A=n.find(_=>_.id===f),v=l.useMemo(()=>{let _=n;if(g.trim()){const R=g.toLowerCase();_=_.filter(k=>k.title.toLowerCase().includes(R)||k.artist.toLowerCase().includes(R))}return P!==Te&&(_=_.filter(R=>R.difficulty===P)),_},[n,g,P]),p=l.useMemo(()=>new Set(t.map(_=>_.id)),[t]),M=["easy","medium","hard","expert"];return e.jsxs("div",{ref:a,className:`nice-karaoke-picker ${r??""}`,style:m,children:[A&&e.jsxs("div",{className:"nice-karaoke-picker__now-singing",children:[e.jsxs("span",{className:"nice-karaoke-picker__label",children:[e.jsx(z.NtdMicrophone,{size:14})," ",h("karaokePicker.nowSinging","Now Singing")]}),e.jsxs("div",{children:[e.jsx("strong",{children:A.title})," — ",A.artist,A.performerName&&e.jsxs("span",{children:[" ","(",h("karaokePicker.by","by {name}").replace("{name}",A.performerName),")"]})]}),!c&&u&&e.jsx("div",{className:"nice-karaoke-picker__next",children:e.jsxs(N.NiceButton,{variant:"secondary",size:"sm",onClick:u,children:[h("karaokePicker.next","Skip / Next")," ",e.jsx(z.NtdSkipForward,{size:14})]})})]}),e.jsxs("div",{className:"nice-karaoke-picker__filters",children:[e.jsx("div",{className:"nice-karaoke-picker__search",children:e.jsx(N.NiceTextInput,{size:"sm",controlWidth:"100%",value:g,onChange:x,placeholder:h("karaokePicker.search","Search songs or artists…"),"aria-label":h("karaokePicker.search","Search songs or artists…")})}),e.jsx("div",{className:"nice-karaoke-picker__difficulty-filter",children:e.jsx(N.NiceSelect,{size:"sm","aria-label":h("karaokePicker.allDifficulties","All Difficulties"),value:P,onChange:_=>b((Array.isArray(_)?_[0]:_)||Te),options:[{value:Te,label:h("karaokePicker.allDifficulties","All Difficulties")},...M.map(_=>({value:_,label:T(_)}))]})})]}),e.jsx("div",{className:"nice-karaoke-picker__catalog",children:v.length===0?e.jsx("p",{children:h("karaokePicker.noMatch","No songs match your search.")}):v.map(_=>e.jsxs("div",{className:"nice-karaoke-picker__song",children:[e.jsxs("div",{children:[e.jsx("strong",{children:_.title})," — ",_.artist,_.difficulty&&e.jsxs("span",{className:"nice-karaoke-picker__difficulty",style:{color:Gt[_.difficulty]??"var(--nice-text-muted, #94a3b8)"},children:["[",T(_.difficulty),"]"]}),_.hasLyrics&&e.jsx("span",{className:"nice-karaoke-picker__lyrics",title:h("karaokePicker.lyrics","Lyrics available"),"aria-label":h("karaokePicker.lyrics","Lyrics available"),children:e.jsx(z.NtdFileText,{size:12})}),_.language&&e.jsxs("span",{className:"nice-karaoke-picker__language",children:["(",_.language,")"]})]}),!c&&e.jsx("div",{children:p.has(_.id)?e.jsx(N.NiceButton,{variant:"outline",size:"sm",onClick:()=>o==null?void 0:o(_.id),children:h("remove","Remove")}):e.jsxs(N.NiceButton,{variant:"primary",size:"sm",onClick:()=>d==null?void 0:d(_.id),children:[e.jsx(z.NtdMicrophone,{size:14})," ",h("karaokePicker.sing","Sing")]})})]},_.id))}),t.length>0&&e.jsxs("div",{className:"nice-karaoke-picker__queue",children:[e.jsxs("h4",{children:[e.jsx(z.NtdMusic,{size:14})," ",h("karaokePicker.queue","Queue ({count})").replace("{count}",String(t.length))]}),t.map((_,R)=>e.jsxs("div",{className:"nice-karaoke-picker__queue-item",children:[e.jsxs("span",{children:[e.jsxs("strong",{children:[R+1,"."]})," ",_.title," — ",_.artist,_.performerName&&e.jsxs("em",{children:[" (",_.performerName,")"]})]}),!c&&o&&e.jsx(N.NiceButton,{variant:"ghost",size:"xs",onClick:()=>o(_.id),"aria-label":`${h("remove","Remove")} ${_.title}`,children:e.jsx(z.NtdClose,{size:12})})]},_.id))]})]})}),Ht=[],nn={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},Qt={game:"Games",music:"Music",dance:"Dance",quiz:"Quiz",karaoke:"Karaoke",photo:"Photo",custom:"Custom"},Zt=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{attractions:t=Ht,onSelect:d,onDeselect:o,onVote:u,selectedIds:f=[],maxSelections:c,showVotes:r=!0,readOnly:m=!1,layout:h="grid",className:T,style:g}=s,[x,P]=l.useState(""),[b,A]=l.useState(""),v=l.useMemo(()=>new Set(f),[f]),p=l.useMemo(()=>{const k=new Set(t.map(j=>j.category));return Array.from(k)},[t]),M=l.useMemo(()=>{let k=t;if(x&&(k=k.filter(j=>j.category===x)),b.trim()){const j=b.toLowerCase();k=k.filter(C=>{var O;return C.name.toLowerCase().includes(j)||((O=C.description)==null?void 0:O.toLowerCase().includes(j))})}return k},[t,x,b]),_=!c||v.size<c,R=k=>{m||(v.has(k)?o==null||o(k):_&&(d==null||d(k)))};return e.jsxs("div",{ref:a,className:`nice-attraction-picker ${T??""}`,style:g,children:[e.jsxs("div",{className:"nice-attraction-picker__header",children:[e.jsx("h3",{className:"nice-attraction-picker__title",children:n("attractionPicker.attractions","Attractions")}),c&&e.jsxs("span",{className:"nice-attraction-picker__count",children:[v.size,"/",c," selected"]})]}),e.jsxs("div",{className:"nice-attraction-picker__filters",children:[e.jsx("input",{type:"text",value:b,onChange:k=>A(k.target.value),placeholder:n("attractionPicker.searchAttractions","Search attractions…"),className:"nice-attraction-picker__search"}),e.jsx("button",{type:"button",onClick:()=>P(""),className:`nice-attraction-picker__category${x?"":" nice-attraction-picker__category--active"}`,children:"All"}),p.map(k=>e.jsxs("button",{type:"button",onClick:()=>P(k===x?"":k),className:`nice-attraction-picker__category${k===x?" nice-attraction-picker__category--active":""}`,children:[l.createElement(nn[k],{size:14})," ",n(`attractionPicker.category.${k}`,Qt[k])]},k))]}),e.jsx("div",{className:`nice-attraction-picker__items nice-attraction-picker__items--${h}`,children:M.length===0?e.jsx("p",{children:n("attractionPicker.noAttractionsFound","No attractions found.")}):M.map(k=>{const j=v.has(k.id);return e.jsxs("div",{className:`nice-attraction-picker__card${j?" nice-attraction-picker__card--selected":""}${m?" nice-attraction-picker__card--readonly":""}`,onClick:()=>R(k.id),children:[k.imageUrl&&e.jsx("img",{src:k.imageUrl,alt:k.name,className:"nice-attraction-picker__image"}),e.jsxs("div",{className:"nice-attraction-picker__name",children:[e.jsx("span",{className:"nice-attraction-picker__icon",children:l.createElement(nn[k.category],{size:16})}),e.jsx("strong",{children:k.name})]}),k.description&&e.jsx("p",{className:"nice-attraction-picker__description",children:k.description}),e.jsxs("div",{className:"nice-attraction-picker__card-footer",children:[r&&e.jsxs("span",{className:"nice-attraction-picker__votes",children:[e.jsx(z.NtdThumbsUp,{size:14})," ",k.votes??0]}),!m&&u&&e.jsx("button",{type:"button",className:"nice-attraction-picker__vote",onClick:C=>{C.stopPropagation(),u(k.id)},children:n("attractionPicker.vote","Vote")})]})]},k.id)})})]})}),Jt=[],es={game:z.NtdGamepad,music:z.NtdMusic,dance:z.NtdMusic,quiz:z.NtdHelp,karaoke:z.NtdMicrophone,photo:z.NtdCamera,custom:z.NtdSparkle},ns=l.forwardRef(function(s,a){const{t:n}=F.useNiceTranslation(),{attractions:t=Jt,onVote:d,onUnvote:o,votedIds:u=[],maxVotes:f,closed:c=!1,sortBy:r="votes",showResults:m=!0,className:h,style:T}=s,g=l.useMemo(()=>new Set(u),[u]),x=f?f-g.size:void 0,P=l.useMemo(()=>{const p=[...t];switch(r){case"votes":p.sort((M,_)=>(_.votes??0)-(M.votes??0));break;case"name":p.sort((M,_)=>M.name.localeCompare(_.name));break;case"category":p.sort((M,_)=>M.category.localeCompare(_.category));break}return p},[t,r]),b=l.useMemo(()=>Math.max(...t.map(p=>p.votes??0),1),[t]),A=p=>{c||(g.has(p)?o==null||o(p):(!x||x>0)&&(d==null||d(p)))},v=p=>{switch(p){case 0:return e.jsx(z.NtdTrophy,{size:18,primaryColor:"#f59e0b",title:n("attractionVoting.n1stPlace","1st place")});case 1:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#94a3b8",title:n("attractionVoting.n2ndPlace","2nd place")});case 2:return e.jsx(z.NtdMedal,{size:18,primaryColor:"#b45309",title:n("attractionVoting.n3rdPlace","3rd place")});default:return`${p+1}.`}};return e.jsxs("div",{ref:a,className:`nice-attraction-voting ${h??""}`,style:{color:"var(--nice-text-primary)",...T},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(z.NtdClipboardCheck,{size:20}),c?n("attractionVoting.votingResults","Voting Results"):n("attractionVoting.voteForAttractions","Vote for Attractions")]}),!c&&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"]})]}),c&&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:P.map((p,M)=>{const _=g.has(p.id),R=p.votes??0,k=m?`${Math.round(R/b*100)}%`:"0%";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderRadius:8,border:_?"2px solid var(--nice-color-primary, #6366f1)":"1px solid var(--nice-border-color, #cbd5e1)",background:_?"color-mix(in srgb, var(--nice-color-primary) 12%, transparent)":"var(--nice-bg-elevated, var(--nice-bg-primary))",cursor:c?"default":"pointer",transition:"all 0.2s"},onClick:()=>A(p.id),children:[m&&e.jsx("span",{style:{fontSize:18,minWidth:32,textAlign:"center"},children:v(M)}),e.jsx("span",{style:{display:"inline-flex",fontSize:20},children:l.createElement(es[p.category],{size:20})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600},children:p.name}),p.description&&e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.description}),m&&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:k,background:"var(--nice-color-primary, #6366f1)",borderRadius:3,transition:"width 0.3s"}})})]}),m&&e.jsx("span",{style:{fontWeight:600,fontSize:16,minWidth:40,textAlign:"right"},children:R}),!c&&e.jsx("button",{onClick:j=>{j.stopPropagation(),A(p.id)},style:{padding:"4px 12px",borderRadius:4,border:"none",background:_?"var(--nice-color-error, #ef4444)":"var(--nice-color-primary, #6366f1)",color:"#fff",cursor:"pointer",fontSize:13},children:_?n("attractionVoting.unvote","Unvote"):n("attractionVoting.vote","Vote")})]},p.id)})}),m&&e.jsxs("div",{style:{marginTop:12,textAlign:"right",fontSize:13,color:"var(--nice-text-secondary, #64748b)"},children:["Total votes: ",t.reduce((p,M)=>p+(M.votes??0),0)]})]})});exports.NiceAttractionPicker=Zt;exports.NiceAttractionVoting=ns;exports.NiceEventMedia=En;exports.NiceEventPlanning=Un;exports.NiceExpenseSplit=Lt;exports.NiceGiftRegistry=Pt;exports.NiceInvitationDesigner=wt;exports.NiceKaraokePicker=Kt;exports.NiceMediaCollage=On;exports.NiceParticipantList=Kn;exports.NiceRoundCard=Vt;exports.NiceRoundList=Yt;exports.NiceRsvpControl=$e;exports.NiceSeatPicker=vt;exports.NiceSeatingChart=rn;exports.NiceSongPicker=qt;
|
package/dist/index.d.ts
CHANGED
|
@@ -351,7 +351,7 @@ export declare const NiceAttractionPicker: default_2.ForwardRefExoticComponent<N
|
|
|
351
351
|
/** Props for {@link NiceAttractionPicker}. */
|
|
352
352
|
export declare interface NiceAttractionPickerProps {
|
|
353
353
|
/** Available attractions. */
|
|
354
|
-
attractions
|
|
354
|
+
attractions?: EventAttraction[];
|
|
355
355
|
/** Called when selecting an attraction. */
|
|
356
356
|
onSelect?: (attractionId: string) => void;
|
|
357
357
|
/** Called when deselecting. */
|
|
@@ -380,7 +380,7 @@ export declare const NiceAttractionVoting: default_2.ForwardRefExoticComponent<N
|
|
|
380
380
|
/** Props for {@link NiceAttractionVoting}. */
|
|
381
381
|
export declare interface NiceAttractionVotingProps {
|
|
382
382
|
/** Attractions available for voting. */
|
|
383
|
-
attractions
|
|
383
|
+
attractions?: EventAttraction[];
|
|
384
384
|
/** Called when voting for an attraction. */
|
|
385
385
|
onVote?: (attractionId: string) => void;
|
|
386
386
|
/** Called when retracting a vote. */
|
|
@@ -768,7 +768,7 @@ export declare const NiceKaraokePicker: default_2.ForwardRefExoticComponent<Nice
|
|
|
768
768
|
/** Props for {@link NiceKaraokePicker}. */
|
|
769
769
|
export declare interface NiceKaraokePickerProps {
|
|
770
770
|
/** Available karaoke songs. */
|
|
771
|
-
songs
|
|
771
|
+
songs?: KaraokeSong[];
|
|
772
772
|
/** Current karaoke queue (ordered). */
|
|
773
773
|
queue?: KaraokeSong[];
|
|
774
774
|
/** Called when a song is added to the queue. */
|
|
@@ -923,7 +923,7 @@ export declare const NiceRoundList: default_2.ForwardRefExoticComponent<NiceRoun
|
|
|
923
923
|
/** Props for {@link NiceRoundList}. */
|
|
924
924
|
export declare interface NiceRoundListProps {
|
|
925
925
|
/** Rounds to display. */
|
|
926
|
-
rounds
|
|
926
|
+
rounds?: EventRound[];
|
|
927
927
|
/** Currently active round ID. */
|
|
928
928
|
activeRoundId?: string;
|
|
929
929
|
/** Called when selecting a round. */
|
|
@@ -1075,13 +1075,16 @@ 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
|
|
|
1081
1084
|
/** Props for {@link NiceSongPicker}. */
|
|
1082
1085
|
export declare interface NiceSongPickerProps {
|
|
1083
1086
|
/** Available songs. */
|
|
1084
|
-
songs
|
|
1087
|
+
songs?: SongEntry[];
|
|
1085
1088
|
/** Called when adding a song to the queue/playlist. */
|
|
1086
1089
|
onAdd?: (songId: string) => void;
|
|
1087
1090
|
/** Called when removing a song. */
|
|
@@ -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 { }
|