1import{j as C,l as c,r as O,t as R}from"./contentQueue.schema-D3RcXRQx.js";import{_ as o,d as h,v as t}from"./convex-BkXOozYW.js";var x={scheduling_duration_limit_hours:48,scheduling_horizon_days:3,scheduling_in_past_allowed:!1,max_cams:3,max_epg_days:7,max_feeds:2,max_feeds_queues:1,max_queue_items:250,max_schedule_feeds:1,interstitial_required:void 0,interstitial_watermark:!0,access_public_beta:!1,access_team_seats:0,channel_stale_weeks:6},N={scheduling_duration_limit_hours:100,scheduling_horizon_days:14,scheduling_in_past_allowed:!1,max_cams:5,max_epg_days:14,max_feeds:4,max_feeds_queues:5,max_queue_items:500,max_schedule_feeds:2,interstitial_required:void 0,interstitial_watermark:!1,access_public_beta:!1,access_team_seats:1,channel_stale_weeks:-1},w={scheduling_duration_limit_hours:200,scheduling_horizon_days:28,scheduling_in_past_allowed:!1,max_cams:8,max_epg_days:31,max_feeds:8,max_feeds_queues:10,max_queue_items:1e3,max_schedule_feeds:3,interstitial_required:void 0,interstitial_watermark:!1,access_public_beta:!1,access_team_seats:3,channel_stale_weeks:-1},g={scheduling_duration_limit_hours:300,scheduling_horizon_days:42,scheduling_in_past_allowed:!1,max_cams:12,max_epg_days:365,max_feeds:12,max_feeds_queues:20,max_queue_items:1e3,max_schedule_feeds:3,interstitial_required:void 0,interstitial_watermark:!1,access_public_beta:!0,access_team_seats:5,channel_stale_weeks:-1},D={...g,scheduling_duration_limit_hours:300,scheduling_horizon_days:365,scheduling_in_past_allowed:!0,max_cams:7,max_schedule_feeds:3,access_team_seats:10,channel_stale_weeks:6},U={...g,scheduling_duration_limit_hours:300,scheduling_horizon_days:365,scheduling_in_past_allowed:!0,max_cams:7,max_schedule_feeds:3,access_team_seats:10,channel_stale_weeks:-1},k={free:x,basic:N,creator:w,creator_plus:g,vip:D,admin:U},Ne=e=>k[e],d=[{name:"Sunday",nameShort:"Sun.",dayOfWeek:0},{name:"Monday",nameShort:"Mon.",dayOfWeek:1},{name:"Tuesday",nameShort:"Tue.",dayOfWeek:2},{name:"Wednesday",nameShort:"Wed.",dayOfWeek:3},{name:"Thursday",nameShort:"Thu.",dayOfWeek:4},{name:"Friday",nameShort:"Fri.",dayOfWeek:5},{name:"Saturday",nameShort:"Sat.",dayOfWeek:6}],we=[d[1],d[2],d[3],d[4],d[5],d[6],d[0]];var De=["image/png","image/jpeg","image/webp"],Ue="320x180",L=e=>e*60;var ke=L(1);var Q=c(1);var Le=c(48);var Qe=c(1),E=e=>e.reduce((a,n)=>a+n.duration,0),F=t.object({title:t.string(),subtitle:t.string()}
1),P=t.object({channelId:t.id("channels"),mediaId:t.id("media")}),W=t.object({name:t.string(),channelId:t.optional(t.id("channels")),type:t.union(t.literal("upnext")),duration:t.number(),showCountdown:t.boolean(),showWatermark:t.boolean(),options:t.union(F)}),q=t.union(P),Fe=h(W).index("by_channel_and_type",["channelId","type"]),B=e=>e*1e3,V=e=>B(c(e)),f=e=>{const a=Number.isFinite(e)?Math.max(0,Math.floor(e)):0,n=C.fromObject({seconds:a}),r=n.as("hours")>=1?"hh:mm:ss":"mm:ss";return n.toFormat(r)},S=e=>e/1e3,m=V(1),$=[0,4,8,12,16,20],Pe=t.union(t.literal(0),t.literal(4),t.literal(8),t.literal(12),t.literal(16),t.literal(20)),j=t.union(t.literal("interstitial"),t.literal("media"),t.literal("livestream"),t.literal("advertisement"),t.literal("break")),H=t.object({type:j,duration:t.number(),startDuration:t.optional(t.number()),mediaId:t.optional(t.id("media")),contentId:t.optional(t.id("content")),mediaEditId:t.optional(t.id("mediaEdits")),interstitialId:t.optional(t.id("interstitials")),interstitialRenderOptions:t.optional(q)}),z=t.union(t.literal("media"),t.literal("livestream")),G=t.object({type:z,contentQueueId:t.id("contentQueue"),durationSeconds:t.optional(t.number()),ordinal:t.number(),name:t.optional(t.string()),channelId:t.id("channels"),contentId:t.optional(t.id("content")),mediaId:t.optional(t.id("media")),mediaEditId:t.optional(t.id("mediaEdits")),contextType:t.optional(t.union(t.literal("media"),t.literal("playlist"))),contextId:t.optional(t.union(t.id("media"),t.id("playlists"))),segments:t.array(H)}),We=h(G).index("by_contentQueueAndOrdinal",["contentQueueId","ordinal"]),Y=e=>e.mediaId!==void 0||e.contentId!==void 0,X=(e,a)=>{if(e.duration<=0)throw new o({message:`Segment ${a} duration must be greater than zero.`})},K=e=>{if(e.interstitialId!==void 0&&e.mediaId!==void 0)throw new o({message:"Segment cannot set both interstitialId and mediaId."})},J=(e,a)=>{switch(X(e,a),K(e),e.type){case"interstitial":if(e.interstitialId===void 0)throw new o({message:`Segment ${a} of type interstitial requires interstitialId.`});if(e.mediaId!==void 0)throw new o({message:`Segment ${a} of type interstitial cannot set mediaId.`});return;case"media":case"livestream":case"advertisement":if(!Y(e))throw new o({message:`Segment ${a} of type ${e.type} requires mediaId or contentId.`});if(e.interstitialId!==void 0)throw new o({message:`Segment ${a} of type ${e.type} cannot set interstitialId.`});return;case"break":return e.interstitialId===void 0&&e.mediaId===void 0&&e.contentId===void 0||e.interstitialId!==void 0||e.mediaId!==void 0||e.contentId!==void 0,void 0;default:throw new o({message:`Segment ${a} has an unsupported type.`})}},Z=({segments:e,start:a,end:n,durationSeconds:r})=>{if(e.length<1)throw new o({message:"Composite content queue items require at least one segment."});if(e.length>100)throw new o({message:"Content queue items cannot have more than 100 segments."});e.forEach((s,_)=>{if(J(s,_),(s.startDuration??0)<0)throw new o({message:`Segment ${_} startDuration must be >= 0.`})});const i=E(e);if(n!==void 0&&n-a!==i)throw new o({message:"Parent span must equal the sum of segment durations."});if(r!==void 0&&r!==i)throw new o({message:"durationSeconds must equal the sum of segment durations."})},qe=e=>{const{start:a,segments:n,...r}=e,i=E(n),s=a+i;return Z({segments:n,start:a,end:s,durationSeconds:i}),{...r,start:a,end:s,durationSeconds:i,segments:n}},y=e=>e.start??0,p=e=>{let a;e.durationSeconds!==void 0?a=e.durationSeconds:e.type==="livestream"?a=Q:a=0;const n=e.segments?.length?E(e.segments):0;return Math.max(a,n)},ee=e=>{const a=y(e)+p(e);return e.end===void 0?a:Math.max(e.end,a)},te=e=>e.mediaId!==void 0||e.contentId!==void 0||e.interstitialId!==void 0,M=(e,a)=>a.type!=="break"||te(a)||e.mediaId===void 0&&e.contentId===void 0?a:{...a,...e.contentId!==void 0&&{contentId:e.contentId},...e.mediaId!==void 0&&{mediaId:e.mediaId},...e.mediaEditId!==void 0&&{mediaEditId:e.mediaEditId}},ae=e=>e.segments.map(a=>M(e,a)),A=.001,ne=e=>p(e),Be=(e,a)=>{const n=ae(e),r=ne(e),i=Math.min(Math.max(a,0),Math.max(0,r-A));let s=0;for(let l=0;l<n.length;l+=1){const I=n[l],T=I.duration;if(i<s+T)return{segments:n,segmentIndex:l,segment:I,segmentTimestampFloat:i-s,segmentStartDuration:I.startDuration??0,nextSegmentIndex:l+1<n.length?l+1:void 0,isInterstitial:!!I.interstitialId};s+=T}const _=n.length-1,v=n[_];return{segments:n,segmentIndex:_,segment:v,segmentTimestampFloat:Math.max(0,v.duration-A),segmentStartDuration:v.startDuration??0,nextSegmentIndex:void 0,isInterstitial:!!v.interstitialId}},re=(e,a)=>{const[n,r]=e,[i,s]=a;return n<s&&r>i},b=(e,a)=>{const n=a??e;return Math.max(0,n.endsAt-n.startsAt)},Ve=e=>e?.itemCount??0,$e=24*m/1e3,ie=e=>Math.floor(e/m),je=(e,a)=>{const n=ie(e),r=Math.ceil(a/m)-1;return{bucketIndexStart:n,bucketIndexEnd:Math.max(n,r)}},se=(e,a,n)=>{const r=a*m,i=(n+1)*m;return{rangeStart:Math.floor(S(r-e)),rangeEnd:Math.ceil(S(i-e))}},oe=e=>({rangeStart:c(e),rangeEndInclusiveSecond:c(e+4)-1}),de=(e,a)=>$.filter(n=>{const{rangeStart:r,rangeEndInclusiveSecond:i}=oe(n);return a>r&&e<=i}),le=(e,a)=>{const n=S(b(a)),r=Math.max(e.rangeStart,0),i=Math.min(e.rangeEnd,n);return i<r?null:{rangeStart:r,rangeEnd:i}},ue=(e,a,n)=>{const r=se(e.startsAt,a,n),i=le(r,e);return i?de(i.rangeStart,i.rangeEnd):[]},ce=e=>e.reduce((a,n)=>(a[n._id]={startsAt:n.startsAt,endsAt:n.endsAt},a),{}),_e=(e,a)=>{const n=a?.[e._id];return n?[n.startsAt,n.endsAt]:[e.startsAt,e.endsAt]},He=(e,a,n,r)=>
1e.filter(i=>re(_e(i,r),[a,n])),ze=(e,a)=>{const n=ce(e);return a?Object.entries(a).reduce((r,[i,s])=>(s&&(r[i]={startsAt:s.startsAt,endsAt:s.endsAt}),r),{...n}):n},me=(e,a)=>e?[...new Set(a.flatMap(n=>ue(e,n.bucketIndexStart,n.bucketIndexEnd)))]:[],Ge=(e,a)=>{if(!e||e.length===0)return{kind:"fullCollect"};if(!a)return{kind:"none"};const n=me(a,e);return n.length===0?{kind:"none"}:{kind:"segments",segments:n}},ve=(e,a)=>{const n=S(b(e,a));return Math.max(0,O-n)},Ie=t.union(t.literal("available"),t.literal("initializing")),Se=t.union(t.literal("public"),t.literal("unlisted"),t.literal("private")),he=t.union(t.literal("codec"),t.literal("conversion"),t.literal("emptyFile"),t.literal("invalidFile"),t.literal("tooSmall"),t.literal("uploadAborted")),ge=t.union(t.literal("deleted"),t.literal("failed"),t.literal("processed"),t.literal("rejected"),t.literal("uploaded")),Ee=t.union(t.literal("claim"),t.literal("copyright"),t.literal("duplicate"),t.literal("inappropriate"),t.literal("legal"),t.literal("length"),t.literal("termsOfUse"),t.literal("trademark"),t.literal("uploaderAccountClosed"),t.literal("uploaderAccountSuspended")),pe
1=t.union(t.literal("embedDisabled"),t.literal("ytAgeRestricted")),Te=t.union(t.literal("youtube_150_error"),t.literal("youtube_101_error"),t.literal("youtube_100_error")),fe=t.union(Ie,ge,he,Ee,Se,pe,Te),Ae=t.union(t.literal("youtube"),t.literal("twitch"),t.literal("tiktok"),t.literal("internetarchive"),t.literal("dailymotion")),u={unknown:-999,private:-900,userFetch:-101,livestreamScheduled:-3,livestreamToVideo:-2,livestream:-1},Ye=[u.unknown,u.userFetch],ye=t.object({title:t.string(),duration:t.number(),sourceId:t.string(),source:Ae,url:t.string(),syncedAt:t.number(),resolvedStatus:fe,isRegionRestricted:t.boolean(),contentId:t.id("content"),sourceChannelId:t.optional(t.id("sourceChannels")),thumbnailUrl:t.string(),thumbnailUrl_low:t.optional(t.string()),thumbnailUrl_med:t.optional(t.string()),thumbnailUrl_high:t.optional(t.string()),thumbnailUrl_max:t.optional(t.string()),isLive:t.optional(t.boolean()),lastLiveCheckAt:t.optional(t.number())}),Xe=h(ye).index("by_source",["sourceId","source"]).index("by_source_channel",["sourceChannelId"]),Me=e=>e===u.livestream||e===u.livestreamToVideo||e===u.livestreamScheduled,be=e=>e?Me(e.duration):!1,Ce=Array.from({length:36},(e,a)=>Number((.25+a*.05).toFixed(2))),Ke=t.optional(t.union(...Ce.map(t.literal))),Je=e=>("resolvedStatus"in e?e.resolvedStatus:e.status)==="private"||e.duration===u.private,Ze=(e,a)=>{if(!e||be(e))return;const n=a?.duration??e.duration??0;return n>0?n:void 0},et=e=>{const{contentDurationSeconds:a,queue:n,resolvedWindow:r}=e,i=ve(n,r);if(!(a<=i))return`This queue only has ${f(i)} of space remaining, but this content is ${f(a)}.`},Oe=(e,a)=>{const n=e.segments[a];if(n!==void 0)return M(e,n)},tt=({contentQueue:e,contentQueueItem:a})=>{const n=y(a),r=ee(a);return{startsAt:e.startsAt+n*1e3,endsAt:e.startsAt+r*1e3}},at=(e,a={})=>{const n={...e,start:0,end:p(e)};if(a.segmentIndex===void 0)return n;const r=Oe(e,a.segmentIndex);return r?{...n,...r.contentId!==void 0&&{contentId:r.contentId},...r.mediaId!==void 0&&{mediaId:r.mediaId},...r.mediaEditId!==void 0&&{mediaEditId:r.mediaEditId}}:n},nt=e=>e.type===R.scheduled?"windowed":"full";export{E as A,Ne as B,y as C,f as D,S as E,L as F,De as I,Ue as L,Le as M,ke as N,V as O,Qe as P,k as R,ee as S,Z as T,b as _,Ze as a,Be as b,be as c,He as d,_e as f,ie as g,je as h,Oe as i,Q as j,B as k,u as l,Ge as m,at as n,et as o,ze as p,tt as r,Je as s,nt as t,Ye as u,Ve as v,qe as w,p as x,re as y,x as z};
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.