PageSourceSearch

https://snich.ai/assets/EventsPage-2427f9e3.js

js snich.ai collected 2026-10-05 15:07:30 UTC 30,731 bytes, 1 lines download raw bytes

1import{b as ae,r as g,j as e,a as de,R as Te,L as O,c as Le}from"./vendor-react-72e4a099.js";import{d as X,B as G,b as Re,M as Se,u as Ae,a as We}from"./Toast-43ee7788.js";import{C as I,a as A,T as te,E as V}from"./Display-48adcc24.js";import{T as Fe,P as Ie,C as Pe}from"./Controls-5a18fd37.js";import{a as ie}from"./api-d8a57490.js";import{u as me,s as ue,w as he,m as B,a as P,p as qe,t as Z,c as ze,r as Be}from"./format-5039f022.js";import{r as L}from"./buildLifecycle-a44b0e05.js";import{PageHead as Oe}from"./CabinetLayout-c1e3a7e9.js";import{u as re}from"./CabinetContext-31fc5321.js";import{E as J,f as ee,l as pe,o as le,i as q,m as fe,t as xe,n as He,q as Ue,j as Ye,u as _e,T as Ge,R as Ze,w as Ke,x as Qe}from"./shared-303b156a.js";import{i as ge}from"./eventDuration-e09aabf0.js";import{C as Ve}from"./chevron-left-39dc0897.js";import{C as je}from"./chevron-right-b4336544.js";import{P as ye}from"./plus-39793e81.js";import{L as be}from"./lock-73755c1f.js";import{C as Xe}from"./circle-alert-67975319.js";/* empty css                  */import{L as Je}from"./list-13d531b4.js";import{C as ne}from"./calendar-days-6829c81b.js";import{C as ve}from"./chevron-down-888c3b30.js";import{R as oe}from"./radio-dc3b7f8c.js";import{Z as es}from"./zap-a08e50de.js";import{C as Ne}from"./calendar-plus-0f511f3c.js";import{S as we}from"./search-01fb0df0.js";
1import{X as ss}from"./x-b9f3d093.js";import{T as Me}from"./trash-2-7a739e24.js";import{C as ts}from"./clock-e6794ea5.js";import{U as ns}from"./users-a990a1e8.js";import{V as as}from"./video-a08888e9.js";import{P as $e}from"./pencil-line-6bfa5da3.js";import{A as is}from"./arrow-right-eda8f931.js";import{F as rs}from"./film-0ba9e353.js";import"./createLucideIcon-581cd729.js";import"./eye-5711d0dd.js";import"./circle-check-63b159d4.js";import"./check-083433f7.js";import"./copy-34f4069e.js";import"./user-2d8f405f.js";import"./credit-card-a31de76a.js";import"./mic-098d6d5b.js";import"./layout-dashboard-52ca12db.js";import"./play-3580deb4.js";import"./log-out-e38723a8.js";import"./NotificationsPopover-e8b89aa4.js";import"./bell-521a1a83.js";import"./check-check-9685683e.js";import"./refresh-cw-98362cea.js";import"./sliders-horizontal-41aa44a5.js";import"./sparkles-e0558c3e.js";import"./file-text-e7c68864.js";import"./user-plus-d862ebc6.js";import"./list-checks-f8235a5c.js";import"./share-2-50cd044b.js";import"./user-check-ea278564.js";import"./corner-down-left-87f64a70.js";import"./arrow-up-955249b3.js";import"./arrow-down-5480e148.js";import"./JoinByLinkModal-119f67b7.js";import"./link-2-36909ef8.js";import"./Bits-7aa9b5d3.js";import"./index-d9998155.js";import"./roomAccess-6d61bdfc.js";import"./messenger2-list-5715e14b.js";import"./chevron-up-f536cc4c.js";import"./square-play-af60d053.js";import"./messages-square-bb2c8af1.js";import"./file-play-96922e92.js";import"./crown-fdf36aa5.js";import"./shield-b21f8aed.js";const R=56,De=24*60,ls=24,Q=["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"];function se(s){const t=ue(s);return t.setDate(t.getDate()-(t.getDay()+6)%7),t}function H(s,t){const a=new Date(s);return a.setDate(a.getDate()+t),a}function Ee(s){return`${s.getFullYear()}-${B(s.getMonth()+1)}-${B(s.getDate())}`}function os(s){if(s&&/^\d{4}-\d{2}-\d{2}$/.test(s)){const[t,a,n]=s.split("-").map(Number),i=new Date(t,a-1,n);if(!Number.isNaN(i.getTime()))return se(i)}return se(new Date)}function Ce(s){const t=H(s,6);return s.getFullYear()!==t.getFullYear()?`${s.getDate()} ${Q[s.getMonth()]} ${s.getFullYear()} – ${t.getDate()} ${Q[t.getMonth()]} ${t.getFullYear()}`:s.getMonth()!==t.getMonth()?`${s.getDate()} ${Q[s.getMonth()]} – ${t.getDate()} ${Q[t.getMonth()]} ${t.getFullYear()}`:`${s.getDate()} – ${t.getDate()} ${Q[t.getMonth()]} ${t.getFullYear()}`}function cs(){try{if(Intl.DateTimeFormat().resolvedOptions().timeZone==="Europe/Moscow")return"МСК"}catch{}const s=-new Date().getTimezoneOffset(),t=Math.trunc(s/60),a=Math.abs(s%60);return`GMT${s>=0?"+":"−"}${Math.abs(t)}${a?`:${B(a)}`:""}`}function ds(s,t){const a=Z(s.scheduledAt),n=Z(s.startedAt),i=(s.status==="ended"||s.status==="live")&&n?n:a||n;if(!i)return null;let r=s.status==="ended"?Z(s.endedAt)||Z(s.endsAt):Z(s.endsAt);return(!r||r<=i)&&(r=new Date(i.getTime()+Math.max(15,s.durationMinutes||60)*6e4)),s.status!=="ended"&&ge(s.durationMinutes)&&(r=s.status==="live"?new Date(Math.max(t,i.getTime()+15*6e4)):new Date(i.getTime()+2*36e5)),s.status==="live"&&r.getTime()<t&&(r=new Date(t)),{start:i,end:r}}function ms(s,t,a){const n=Array.from({length:7},()=>[]);for(const i of s){const r=ds(i,a);if(r)for(let u=0;u<7;u+=1){const p=H(t,u),f=H(t,u+1);if(r.end<=p||r.start>=f)continue;const h=Math.max(r.start.getTime(),p.getTime()),l=Math.min(r.end.getTime(),f.getTime());n[u].push({ev:i,start:r.start,end:r.end,startMin:(h-p.getTime())/6e4,endMin:Math.min(De,(l-p.getTime())/6e4),lane:0,lanes:1,cluster:0})}}for(const i of n){i.sort((l,j)=>l.startMin-j.startMin||j.endMin-l.endMin);let r=[],u=-1,p=[],f=0;const h=()=>{const l=Math.max(1,p.length);r.forEach(j=>{j.lanes=l,j.cluster=f}),r=[],p=[],f+=1};for(const l of i){const j=Math.max(l.endMin,l.startMin+ls);r.length&&l.startMin>=u&&h();let N=p.findIndex(d=>d<=l.startMin);N<0?(N=p.length,p.push(j)):p[N]=j,l.lane=N,r.push(l),u=Math.max(u,j)}r.length&&h()}return n}function us(s,t,a,n){const[i,r]=g.useState(null),[u,p]=g.useState(null),[f,h]=g.useState(!0),l=g.useRef(0),j=s.toISOString(),N=H(s,7).toISOString(),d=g.useCallback(async(D=!1)=>{const w=++l.current;D||h(!0);try{const E=await ie.get("/cabinet/events",{query:{workspaceId:a,tab:"all",from:j,to:N,type:t==="all"?void 0:t,limit:200}});if(w!==l.current)return;r(E),p(null)}
1catch(E){if(w!==l.current)return;D||p(ee(E,"Не удалось загрузить календарь"))}finally{w===l.current&&h(!1)}},[a,j,N,t]);return g.useEffect(()=>{if(!n)return;d();const D=window.setInterval(()=>void d(!0),6e4),w=()=>void d(!0);return window.addEventListener("focus",w),()=>{window.clearInterval(D),window.removeEventListener("focus",w)}},[n,d]),{data:i,error:u,loading:f,reload:d}}function hs({type:s}){const{workspace:t,workspaceLoading:a,workspaceError:n,reloadWorkspaces:i}=re(),[r,u]=ae(),p=r.get("week"),f=g.useMemo(()=>os(p),[p]),h=!a&&!!t,{data:l,error:j,loading:N,reload:d}=us(f,s,t==null?void 0:t.id,h),D=me(3e4),w=se(new Date(D)).getTime()===f.getTime(),E=g.useCallback(x=>{u(C=>{const W=new URLSearchParams(C);return Object.entries(x).forEach(([m,o])=>o?W.set(m,o):W.delete(m)),W},{replace:!0})},[u]),T=x=>{const C=H(f,x*7);E({week:se(new Date).getTime()===C.getTime()?null:Ee(C)})},b=l==null?void 0:l.typeCounts;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sn-b-cal-controls",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(X,{label:"Предыдущая неделя",variant:"quiet",className:"sn-b-cal-navbtn",onClick:()=>T(-1),children:e.jsx(Ve,{className:"sn-i sn-i-18"})}),e.jsx(X,{label:"Следующая неделя",variant:"quiet",className:"sn-b-cal-navbtn",onClick:()=>T(1),children:e.jsx(je,{className:"sn-i sn-i-18"})})]}),e.jsx(G,{variant:"quiet",size:"sm",className:"sn-b-cal-today",onClick:()=>E({week:null}),"aria-pressed":w,children:"Сегодня"}),e.jsx("h2",{className:"sn-b-cal-range","aria-live":"polite",children:Ce(f)}),e.jsx("div",{role:"group","aria-label":"Тип события",className:"sn-b-cal-types",children:[{value:"all",label:"Все",count:b==null?void 0:b.all,swatch:null},{value:"broadcast",label:"Трансляции",count:b==null?void 0:b.broadcast,swatch:"broadcast"},{value:"meeting",label:"Встречи",count:b==null?void 0:b.meeting,swatch:"meeting"}].map(x=>e.jsxs("button",{type:"button",className:"sn-pill","aria-pressed":s===x.value,onClick:()=>E({type:x.value==="all"?null:x.value}),children:[x.swatch&&e.jsx("span",{className:`sn-b-swatch is-${x.swatch}`,"aria-hidden":"true"}),x.label,x.count!==void 0&&e.jsx("span",{className:"sn-pill-count",children:x.count})]},x.value))})]}),n?e.jsx(J,{message:n,onRetry:()=>void i()}):j&&!l?e.jsx(J,{message:j,onRetry:()=>void d()}):e.jsx(fs,{weekStart:f,items:(l==null?void 0:l.items)||[],loading:N||!l,now:D})]})}function ps(){const s="(max-width: 760px)",[t,a]=g.useState(()=>{var n;return typeof window<"u"&&((n=window.matchMedia)==null?void 0:n.call(window,s).matches)});return g.useEffect(()=>{var r;const n=(r=window.matchMedia)==null?void 0:r.call(window,s);if(!n)return;const i=()=>a(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),!!t}function fs({weekStart:s,items:t,loading:a,now:n}){const i=de(),r=g.useRef(null),[u,p]=g.useState(null),f=g.useMemo(()=>ms(t,s,n),[t,s,n]),h=new Date(n),l=Math.floor((ue(h).getTime()-s.getTime())/864e5+.5),j=l>=0&&l<7,N=h.getHours()*60+h.getMinutes(),d=g.useMemo(cs,[]),D=ps(),w=D?2:3,[E,T]=g.useState(null);g.useEffect(()=>{if(!E)return;const m=o=>{var M,v;(o instanceof KeyboardEvent?o.key==="Escape":!((v=(M=o.target).closest)!=null&&v.call(M,".sn-b-cal-more, .sn-b-cal-more-pop")))&&T(null)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",m)}},[E]),g.useEffect(()=>T(null),[s]);const b=g.useRef(null);g.useLayoutEffect(()=>{const m=r.current,o=`${s.getTime()}:${a?"l":"r"}`;if(!m||b.current===o||a)return;b.current=o;const M=f.flat().reduce((z,K)=>Math.min(z,K.startMin/60),9);let v=Math.floor(M);const c=Math.max(4,(m.clientHeight-60)/R),$=N/60;if(j&&$>=7&&($<v||$>v+c-1)&&(v=Math.max(0,Math.floor($)-2)),m.scrollTop=Math.max(0,v*R-12),m.scrollWidth>m.clientWidth+1){const z=(m.scrollWidth-60)/7;m.scrollLeft=j?Math.max(0,l*z):0}},[s,a,f,j,N,l]);const x=(m,o)=>{const M=m.currentTarget.getBoundingClientRect(),v=Math.floor((m.clientY-M.top)/R*2)*30,c=Math.max(0,Math.min(De-30,v)),$=H(s,o);return $.setMinutes(c),{minutes:c,at:$}},C=(m,o)=>{if(m.target.closest(".sn-b-cal-ev, .sn-b-cal-more, .sn-b-cal-more-pop")){p(null);return}const{minutes:M,at:v}=x(m,o);if(v.getTime()+30*6e4<=n){p(null);return}p(c=>c&&c.day===o&&c.minutes===M?c:{day:o,minutes:M})},W=(m,o)=>{if(m.target.closest(".sn-b-cal-ev, .sn-b-cal-more, .sn-b-cal-more-pop"))return;const{at:M}=x(m,o);if(M.getTime()+30*6e4<=n)return;let v=M;M.getTime()<n&&(v=new Date(Math.ceil(n/3e5)*3e5));const c=`${B(v.getHours())}:${B(v.getMinutes())}`;i(`${L.createMeeting()}?date=${Ee(v)}&time=${c}`)};return e.jsx(I,{className:"sn-b-cal-card","aria-busy":a||void 0,children:e.jsxs("section",{ref:r,className:"sn-b-cal-body","aria-label":`Неделя ${Ce(s)}`,children:[e.jsxs("div",{className:"sn-b-cal-inner",children:[e.jsxs("div",{className:"sn-b-cal-head",children:[e.jsx("div",{className:"sn-b-cal-zone",children:d}),Array.from({length:7}).map((m,o)=>{const M=H(s,o),v=o===l,c=o>=5;return e.jsxs("div",{className:`sn-b-cal-dayhead${v?" is-today":""}${c?" is-weekend":""}`,children:[e.jsx("span",{className:"sn-b-cal-wd",children:pe(he(M,!0))}),e.jsx("span",{className:"sn-display sn-b-cal-num",children:M.getDate()}),v&&e.jsx("span",{className:"sn-b-cal-todaylabel",children:"Сегодня"})]},o)})]}),e.jsxs("div",{className:"sn-b-cal-grid",style:{height:24*R},children:[e.jsxs("div",{className:"sn-b-cal-gutter","aria-hidden":"true",children:[Array.from({length:23}).map((m,o)=>j&&Math.abs(N-(o+1)*60)<16?null:e.jsx("span",{className:"sn-b-cal-hour",style:{to
1p:(o+1)*R-8},children:`${B(o+1)}:00`},o)),j&&e.jsx("span",{className:"sn-b-cal-now-badge",style:{top:N/60*R-10},children:P(h)})]}),f.map((m,o)=>{const v=H(s,o+1).getTime()>n;return e.jsxs("div",{className:`sn-b-cal-col${o===l?" is-today":""}${o>=5?" is-weekend":""}${v?" is-clickable":""}`,onMouseMove:v?c=>C(c,o):void 0,onMouseLeave:()=>p(null),onClick:v?c=>W(c,o):void 0,children:[u&&u.day===o&&e.jsxs("div",{className:"sn-b-cal-ghost",style:{top:u.minutes/60*R+2,height:R-4},"aria-hidden":"true",children:[e.jsx(ye,{className:"sn-i sn-i-14"}),`${B(Math.floor(u.minutes/60))}:${B(u.minutes%60)}`]}),m.filter(c=>c.lane<w).map(c=>e.jsx(gs,{segment:c,now:n,cascadeFrom:D?2:3,maxLanes:w},`${c.ev.id}-${o}`)),xs(m,w).map(c=>{const $=`${o}:${c[0].cluster}`,z=c[0].startMin/60*R+2,K=o<4?{left:4}:{right:5};return e.jsxs(Te.Fragment,{children:[e.jsxs("button",{type:"button",className:"sn-b-cal-more",style:{top:z,right:5},"aria-expanded":E===$,"aria-label":`Ещё ${c.length} ${qe(c.length,"событие","события","событий")} в это время`,onClick:()=>T(F=>F===$?null:$),children:["+",c.length]}),E===$&&e.jsx("div",{className:"sn-b-cal-more-pop",style:{top:z+26,...K},role:"dialog","aria-label":"Ещё события",children:c.map(F=>e.jsxs(O,{to:le(F.ev),className:"sn-b-cal-more-row",children:[e.jsx("span",{className:"sn-mono",children:P(F.start)}),e.jsx("span",{className:"sn-ellipsis",children:F.ev.title}),F.ev.status==="live"&&e.jsx("span",{className:"sn-live-dot","aria-label":"в эфире"})]},F.ev.id))})]},$)}),j&&o===l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sn-b-cal-now",style:{to
1p:N/60*R-1}}),e.jsx("div",{className:"sn-b-cal-now-dot",style:{top:N/60*R-5}})]})]},o)}),e.jsx("div",{className:"sn-b-cal-lines","aria-hidden":"true"})]})]}),a&&!t.length&&e.jsx("div",{className:"sn-b-cal-loading","aria-label":"Загрузка календаря",children:e.jsx(A,{width:140,height:52,radius:10})})]})})}function xs(s,t){const a=new Map;for(const n of s){if(n.lane<t)continue;const i=a.get(n.cluster)||[];i.push(n),a.set(n.cluster,i)}return[...a.values()].map(n=>n.sort((i,r)=>i.startMin-r.startMin))}function gs({segment:s,now:t,cascadeFrom:a,maxLanes:n}){const{ev:i}=s,r=Math.min(s.lanes,n),u=s.startMin/60*R+2,p=Math.max((s.endMin-s.startMin)/60*R-4,20),f=i.status==="ended"||i.status!=="live"&&s.end.getTime()<=t,h=i.status==="live",l=!f&&!h&&q(i)&&!i.hasSpeaker&&fe(i),j=!q(i)&&i.access==="invite",N=p<34,d=p>=46&&!l&&!h,D=Math.max(1,Math.round((p-26)/15)),w=!f&&ge(i.durationMinutes)?`с ${P(s.start)}`:`${P(s.start)}–${P(s.end)}`,E=h?"is-live":f?"is-past":q(i)?"is-broadcast":"is-meeting",T=r>=a,b=`(100% - 9px) / ${r}`,x=T?{left:4+s.lane*16,right:5}:{left:`calc(4px + ${b} * ${s.lane})`,width:`calc(${b} - ${r>1?2:0}px)`};return e.jsxs(O,{to:le(i),className:`sn-b-cal-ev ${E}${N?" is-compact":""}${T?" is-cascade":""}`,style:{top:u,height:p,...x,"--sn-b-z":3+s.lane},title:`${i.title} · ${w}`,"aria-label":`${i.title}, ${pe(he(s.start))} ${w}, ${xe(i)}${h?", в эфире":""}${l?", нет спикера":""}`,children:[e.jsxs("span",{className:"sn-b-cal-ev-time",children:[h&&e.jsx("span",{className:"sn-live-dot",style:{background:"#fff"}}),j&&!h&&e.jsx(be,{className:"sn-i",style:{width:12,height:12}}),e.jsx("span",{className:"sn-mono",children:d?w:P(s.start)}),h&&e.jsx("span",{children:"в эфире"}),l&&e.jsxs("span",{className:"sn-b-cal-ev-warn",children:[e.jsx(Xe,{className:"sn-i",style:{width:12,height:12}}),r===1&&"нет спикера"]}),N&&e.jsx("span",{className:"sn-b-cal-ev-inline",children:i.title})]}),!N&&e.jsx("span",{className:"sn-b-cal-ev-title",style:{WebkitLineClamp:D},children:i.title})]})}const _={upcoming:60,past:10,drafts:50};function js(s){const t=s.replace(/\/+$/,"");return t.endsWith("/past")?"past":t.endsWith("/drafts")?"drafts":t.endsWith("/calendar")?"calendar":"upcoming"}function ke(s){return s==="broadcast"||s==="meeting"?s:"all"}function Ht(){const s=Le(),[t]=ae(),a=js(s.pathname),n=ke(t.get("type")),i=n==="all"?"":`?type=${n}`;return e.jsxs("div",{className:"sn-b-page sn-b-events",children:[e.jsx(Oe,{title:"Эфиры и встречи",subtitle:"Всё, что вы ведёте или продюсируете: трансляции, встречи, записи.",actions:e.jsxs("div",{className:"sn-b-pagehead-actions",children:[e.jsxs("nav",{className:"sn-b-viewseg","aria-label":"Вид",children:[e.jsxs(O,{to:`${L.events()}${i}`,"aria-current":a!=="calendar"?"page":void 0,children:[e.jsx(Je,{className:"sn-i sn-i-16"}),"Список"]}),e.jsxs(O,{to:`${L.eventsCalendar()}${i}`,"aria-current":a==="calendar"?"page":void 0,children:[e.jsx(ne,{className:"sn-i sn-i-16"}),"Неделя"]})]}),e.jsx(ys,{})]})}),a==="calendar"?e.jsx(hs,{type:n}):e.jsx(vs,{tab:a},a),(a==="upcoming"||a==="past")&&e.jsxs("p",{className:"sn-b-foot",children:[e.jsx(ne,{className:"sn-i sn-i-16"}),e.jsx("span",{children:"Эфиры и встречи SNICH могут сами появляться в Google и Яндекс Календаре."}),e.jsx(O,{to:L.settingsIntegrations(),style:{fontWeight:600},children:"Настроить интеграцию"})]})]})}function ys(){const s=de(),{openQuickMeeting:t}=re(),a=Re();return e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"primary",icon:e.jsx(ye,{className:"sn-i sn-i-18"}),iconRight:e.jsx(ve,{className:"sn-i sn-i-16",style:{marginLeft:-2,opacity:.8}}),onClick:a.toggle,"aria-haspopup":"menu","aria-expanded":a.open,children:"Создать"}),e.jsx(Se,{open:a.open,onClose:a.close,anchor:a.anchor,placement:"bottom-end",width:300,items:[{label:"Трансляция",description:"Эфир со страницей, регистрацией и спикерами",icon:e.jsx(oe,{className:"sn-i sn-i-18"}),onSelect:()=>s(L.createBroadcast())},{label:"Встреча сейчас",description:"Комната откроется сразу, ссылку можно отправить",icon:e.jsx(es,{className:"sn-i sn-i-18"}),onSelect:()=>t()},{label:"Запланировать встречу",description:"Дата, участники и приглашения",icon:e.jsx(Ne,{className:"sn-i sn-i-18"}),onSelect:()=>s(L.createMeeting())}]})]})}function bs(s,t,a,n,i){const[r,u]=g.useState(null),[p,f]=g.useState(null),[h,l]=g.useState(!0),[j,N]=g.useState(!1),d=g.useRef(0),D=g.useRef(_[s]),w=g.useCallback((b,x)=>ie.get("/cabinet/events",{query:{workspaceId:n,tab:s,type:t==="all"?void 0:t,q:a||void 0,limit:x,offset:b}}),[n,s,t,a]),E=g.useCallback(async(b=!1)=>{const x=++d.current;b||l(!0);try{const C=await w(0,Math.max(_[s],b?D.current:_[s]));if(x!==d.current)return;D.current=Math.max(_[s],C.items.length),u(C),f(null)}catch(C){if(x!==d.current)return;b||(f(ee(C,"Не удалось загрузить события")),u(null))}finally{x===d.current&&l(!1)}},[w,s]),T=g.useCallback(async()=>
1{if(!r||j)return;const b=d.current;N(!0);try{const x=await w(r.items.length,_[s]);if(b!==d.current)return;u(C=>{if(!C)return x;const W=new Set(C.items.map(o=>o.id)),m=[...C.items,...x.items.filter(o=>!W.has(o.id))];return D.current=m.length,{...x,items:m}})}catch(x){f(ee(x,"Не удалось загрузить ещё события"))}finally{N(!1)}},[r,w,j,s]);return g.useEffect(()=>{if(!i)return;D.current=_[s],E();const b=window.setInterval(()=>void E(!0),6e4),x=()=>void E(!0);return window.addEventListener("focus",x),()=>{window.clearInterval(b),window.removeEventListener("focus",x)}},[i,E,s]),{data:r,error:p,loading:h,loadingMore:j,reload:E,loadMore:T,setData:u}}function vs({tab:s}){const{workspace:t,workspaceLoading:a,workspaceError:n,reloadWorkspaces:i,refreshNav:r}=re(),[u,p]=ae(),f=ke(u.get("type")),h=(u.get("q")||"").trim(),[l,j]=g.useState(u.get("q")||""),N=!a&&!!t,{data:d,error:D,loading:w,loadingMore:E,reload:T,loadMore:b,setData:x}=bs(s,f,s==="drafts"?"":h,t==null?void 0:t.id,N),C=me(3e4),W=Ae(),[m,o]=g.useState(null),M=g.useCallback((y,k)=>{p(Y=>{const S=new URLSearchParams(Y);return k?S.set(y,k):S.delete(y),S},{replace:!0})},[p]);g.useEffect(()=>{const y=l.trim();if(y===h)return;const k=window.setTimeout(()=>M("q",y||null),250);return()=>window.clearTimeout(k)},[l,h,M]);const v=g.useMemo(()=>{const y=new URLSearchParams;f!=="all"&&y.set("type",f),h&&y.set("q",h);const k=y.toString();return k?`?${k}`:""},[f,h]),c=d==null?void 0:d.counts,$=d==null?void 0:d.typeCounts,z=f!=="all"||!!h,K=async()=>{const y=m;if(y)try{await ie.del(`/rooms/${y.id}`),x(k=>k&&{...k,items:k.items.filter(Y=>Y.id!==y.id),total:Math.max(0,k.total-1),counts:{...k.counts,drafts:Math.max(0,k.counts.drafts-1)}}),o(null),W.success(`Черновик «${y.title}» удалён`),r(),T(!0)}catch(k){W.error(ee(k,"Не удалось удалить черновик"))}},F=[{value:"upcoming",label:"Предстоящие",count:c==null?void 0:c.upcoming,to:`${L.events()}${v}`},{value:"past",label:"Прошедшие",count:c==null?void 0:c.past,to:`${L.eventsPast()}${v}`},{value:"drafts",label:"Черновики",count:c==null?void 0:c.drafts,to:L.eventsDrafts()}];let U;if(n)U=e.jsx(J,{message:n,onRetry:()=>void i()});else if(D&&!d)U=e.jsx(J,{message:D,onRetry:()=>void T()});else if(!d||w&&!d.items.length)U=e.jsx(Ds,{drafts:s==="drafts"});else if(!d.items.length)U=e.jsx(Es,{tab:s,filtered:z,q:h,onReset:()=>{j(""),p(new URLSearchParams,{replace:!0})}});else if(s==="drafts")U=e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:d.items.map(y=>e.jsx($s,{ev:y,now:C,onDelete:()=>o(y)},y.id))});else{const y=s==="past",k=He(d.items.map(S=>({ev:S,scheduledAt:y&&S.startedAt||S.scheduledAt}))),Y=Math.max(0,d.total-d.items.length);U=e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,opacity:w?.6:1,transition:"opacity .15s"},"aria-busy":w||void 0,children:[k.map(S=>e.jsx(Ns,{date:S.date,now:C,children:S.items.map(({ev:ce})=>e.jsx(ws,{ev:ce,past:y,now:C},ce.id))},S.key)),(Y>0||y)&&e.jsxs("div",{className:"sn-b-daygroup",children:[e.jsx("span",{className:"sn-b-daygroup-spacer"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,flexWrap:"wrap"},children:[Y>0&&e.jsxs(G,{variant:"quiet",size:"sm",icon:e.jsx(ve,{className:"sn-i sn-i-16"}),loading:E,onClick:()=>void b(),children:["Показать ещё ",Math.min(Y,_[s])]}),y&&e.jsxs("span",{style:{fontSize:13,color:"var(--sn-ink-3)"},children:["Записи и AI-итоги всех событий — в разделе"," ",e.jsx(O,{to:L.recordings(),style:{fontWeight:600},children:"Записи и итоги"})]})]})]}),D&&e.jsx("p",{className:"sn-hint",role:"alert",style:{fontSize:13,color:"var(--sn-red)"},children:D})]})}return e.jsxs(e.Fragment,{children:[e.jsx(Fe,{items:F,ariaLabel:"Какие события показать",value:s}),s!=="drafts"&&e.jsxs("div",{className:"sn-b-filters",children:[e.jsx("div",{role:"group","aria-label":"Тип события",children:e.jsx(Ie,{value:f,onChange:y=>M("type",y==="all"?null:y),items:[{value:"all",label:"Все",count:$==null?void 0:$.all},{value:"broadcast",label:"Трансляции",count:$==null?void 0:$.broadcast},{value:"meeting",label:"Встречи",count:$==null?void 0:$.meeting}]})}),e.jsxs("label",{className:"sn-b-search",children:[e.jsx("span",{className:"sn-b-vh",children:"Найти по наÐ
1·Ð²Ð°Ð½Ð¸ÑŽ или участнику"}),e.jsx(we,{className:"sn-i sn-i-18","aria-hidden":"true"}),e.jsx("input",{className:"sn-input sn-input-sm",type:"search",value:l,placeholder:"Найти по названию или участнику",onChange:y=>j(y.target.value),onKeyDown:y=>{y.key==="Escape"&&l&&(y.stopPropagation(),j(""),M("q",null)),y.key==="Enter"&&M("q",l.trim()||null)}}),l&&e.jsx(X,{label:"Очистить поиск",size:"xs",variant:"plain",onClick:()=>{j(""),M("q",null)},children:e.jsx(ss,{className:"sn-i sn-i-14"})})]})]}),U,s==="drafts"&&d&&d.items.length>0&&e.jsxs("p",{className:"sn-b-note",children:[e.jsx(We,{className:"sn-i sn-i-16"}),"Черновики видны только вам. Пока событие не создано, приглашения никому не уходят."]}),e.jsx(Pe,{open:!!m,onClose:()=>o(null),onConfirm:K,title:"Удалить черновик?",description:m?`«${m.title}» удалится вместе со всеми настройками. Восстановить его не получится.`:void 0,confirmLabel:"Удалить",icon:e.jsx(Me,{className:"sn-i sn-i-20"})})]})}function Ns({date:s,now:t,children:a}){const n=s?Ue(s,new Date(t)):null;return e.jsxs("section",{className:"sn-b-daygroup","aria-label":n?`${n.label}, ${n.number} ${n.sub}`:"Без даты",children:[e.jsx("div",{className:`sn-b-dayhead${n!=null&&n.today?" is-today":""}`,children:n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sn-b-dayhead-top",children:[e.jsx("span",{className:"sn-display sn-b-dayhead-num",children:n.number}),e.jsx("span",{className:"sn-b-dayhead-label",children:n.label})]}),e.jsx("span",{className:"sn-b-dayhead-sub",children:n.sub})]}):e.jsx("span",{className:"sn-b-dayhead-label",children:"Без даты"})}),e.jsx(I,{style:{overflow:"hidden"},children:a})]})}function ws({ev:s,past:t,now:a}){const n=t&&s.startedAt||s.scheduledAt,i=t&&s.endedAt||s.endsAt,r=t?null:Ye(s,a),u=_e(s,t),p=fe(s),f=t&&s.recording.state==="ready"&&s.recording.durationSeconds>0?ze(s.recording.durationSeconds):"",h=s.status==="cancelled";
1return e.jsxs(O,{className:"sn-b-evrow",to:le(s),children:[e.jsxs("div",{className:"sn-b-evrow-time",children:[e.jsx("span",{children:P(n)||"—"}),i&&e.jsx("span",{children:P(i)})]}),e.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{className:"sn-b-evrow-head",children:[e.jsx("span",{className:"sn-b-evrow-title",style:h?{textDecoration:"line-through",color:"var(--sn-ink-3)"}:void 0,children:s.title}),r&&e.jsx(te,{tone:"amber",icon:e.jsx(ts,{className:"sn-i sn-i-14"}),style:{flex:"none"},children:r})]}),e.jsxs("div",{className:"sn-b-evrow-meta",children:[e.jsxs("span",{children:[!q(s)&&s.access==="invite"?e.jsx(be,{className:"sn-i sn-i-14"}):e.jsx(Ge,{ev:s}),xe(s,{past:t}),f&&` · запись ${f}`]}),u&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:[e.jsx(ns,{className:"sn-i sn-i-14"}),u]})]})]})]}),e.jsxs("div",{className:"sn-b-evrow-tags",children:[t?h?e.jsx(te,{tone:"gray",children:"Отменено"}):e.jsx(Ze,{state:s.recording.state,summaryReady:s.summary.ready,tasksCount:s.summary.tasksCount}):(s.status==="live"||p)&&e.jsx(Ke,{ev:s}),e.jsx(Qe,{role:s.myRole})]}),e.jsx(je,{className:"sn-i sn-i-18 sn-b-evrow-chevron",style:{color:"var(--sn-ink-3)"}})]})}function Ms(s){const t=[];return s.scheduledAt||t.push({word:"дата",feminine:!0}),q(s)&&!s.hasSpeaker&&t.push({word:"спикеры"}),!q(s)&&s.participantsCount<=1&&t.push({word:"участники"}),t.length?t.length===1?`не ${t[0].feminine?"указана":"указаны"} ${t[0].word}`:`не указаны ${t.slice(0,-1).map(a=>a.word).join(", ")} и ${t[t.length-1].word}`:""}function $s({ev:s,now:t,onDelete:a}){const n=q(s)?L.createBroadcast(s.id):L.createMeeting(s.id),i=Z(s.updatedAt),r=Ms(s),u=i?`изменён ${Be(i,new Date(t)).toLowerCase()} в ${P(i)}`:"";return e.jsxs(I,{className:"sn-b-draft",children:[e.jsx("span",{className:"sn-b-draft-icon",children:q(s)?e.jsx(oe,{className:"sn-i"}):e.jsx(as,{className:"sn-i"})}),e.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0,flexWrap:"wrap"},children:[e.jsx(O,{to:n,className:"sn-b-evrow-title",style:{color:"var(--sn-ink)"},children:s.title||"Без названия"}),e.jsx(te,{tone:"gray",icon:e.jsx($e,{className:"sn-i sn-i-14"}),children:"Черновик"})]}),e.jsx("div",{className:"sn-b-evrow-meta",style:{whiteSpace:"normal"},children:[q(s)?"Трансляция":"Встреча",u,r].filter(Boolean).join(" · ")})]}),e.jsxs("div",{className:"sn-b-draft-actions",children:[e.jsx(X,{label:`Удалить черновик «${s.title}»`,size:"sm",onClick:a,children:e.jsx(Me,{className:"sn-i sn-i-18"})}),e.jsx(G,{variant:"quiet",size:"sm",to:n,iconRight:e.jsx(is,{className:"sn-i sn-i-16"}),children:"Продолжить"})]})]})}function Ds({drafts:s}){return s?e.jsxs(I,{className:"sn-b-draft","aria-busy":"true",children:[e.jsx(A,{width:52,height:52,radius:14}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(A,{width:220,height:18}),e.jsx(A,{width:320,height:14,style:{maxWidth:"100%"}})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},"aria-busy":"true","aria-label":"Загрузка событий",children:[2,1].map((t,a)=>e.jsxs("div",{className:"sn-b-daygroup",children:[e.jsxs("div",{className:"sn-b-dayhead",children:[e.jsx(A,{width:80,height:28}),e.jsx(A,{width:100,height:14})]}),e.jsx(I,{style:{overflow:"hidden"},children:Array.from({length:t}).map((n,i)=>e.jsxs("div",{className:"sn-b-evrow",style:{pointerEvents:"none"},children:[e.jsxs("div",{className:"sn-b-evrow-time",children:[e.jsx(A,{width:44,height:16}),e.jsx(A,{width:36,height:12})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(A,{width:"45%",height:18}),e.jsx(A,{width:"30%",height:14})]}),e.jsx(A,{width:120,height:26,radius:999}),e.jsx("span",{})]},i))})]},a))})}function Es({tab:s,filtered:t,q:a,onReset:n}){return t?e.jsx(I,{children:e.jsx(V,{icon:e.jsx(we,{className:"sn-i"}),title:"Ничего не нашлось",action:e.jsx(G,{variant:"quiet",size:"sm",onClick:n,children:"Сбросить фильтры"}),children:a?`По запросу «${a}» событий нет. Попробуйте другое название или имя участника.`:"Среди событий этого типа ничего нет."})}):s==="past"?e.jsx(I,{children:e.jsx(V,{icon:e.jsx(rs,{className:"sn-i"}),title:"Прошедших событий пока нет",children:"Здесь появятся завершённые эфиры и встречи — с записями, расшифровками и AI-итогами."})}):s==="drafts"?e.jsx(I,{children:e.jsx(V,{icon:e.jsx($e,{className:"sn-i"}),title:"Черновиков нет",children:"Если закрыть создание события на полпути, черновик сохранится здесь — его можно будет продолжить."})}):e.jsx(I,{children:e.jsx(V,{icon:e.jsx(ne,{className:"sn-i"}),title:"Ничего не запланировано",action:e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",justifyContent:"center"},children:[e.jsx(G,{variant:"primary",size:"sm",to:L.createBroadcast(),icon:e.jsx(oe,{className:"sn-i sn-i-16"}),children:"Трансляция"}),e.jsx(G,{variant:"quiet",size:"sm",to:L.createMeeting(),icon:e.jsx(Ne,{className:"sn-i sn-i-16"}),children:"Запланировать встречу"})]}),children:"Создайте трансляцию или встречу — она появится здесь вместе с готовностью и командой."})})}export{Ht as default,ke as parseType};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.