import{Bd as i,Bf as b,De as d,Df as l,Od as r,Qd as s,Rd as c,le as o,mf as u,ue as a,zf as h}from"./chunk-4JM6MIZ5.js";var g=class{byVideoChannel;byAccount;createdAt;updatedAt;publishedAt;originallyPublishedAt;category;licence;language;privacy;truncatedDescription;description;duration;durationLabel;id;uuid;shortUUID;isLocal;name;serverHost;thumbnailPath;thumbnailUrl;aspectRatio;isLive;previewPath;previewUrl;embedPath;embedUrl;url;views;viewers;likes;dislikes;nsfw;originInstanceUrl;originInstanceHost;waitTranscoding;state;scheduledUpdate;blacklisted;blacklistedReason;blockedOwner;blockedServer;account;channel;userHistory;pluginData;streamingPlaylists;files;videoSource;automaticTags;static buildWatchUrl(t){return o({shortUUID:t.shortUUID||t.uuid})}static buildUpdateUrl(t){return"/videos/update/"+(t.shortUUID||t.uuid)}constructor(t,e={}){let n=h();this.createdAt=new Date(t.createdAt.toString()),this.publishedAt=new Date(t.publishedAt.toString()),this.category=t.category,this.licence=t.licence,this.language=t.language,this.privacy=t.privacy,this.waitTranscoding=t.waitTranscoding,this.state=t.state,this.truncatedDescription=t.truncatedDescription,this.description=t.description,this.isLive=t.isLive,this.duration=t.duration,this.durationLabel=u(t.duration),this.id=t.id,this.uuid=t.uuid,this.shortUUID=t.shortUUID,this.isLocal=t.isLocal,this.name=t.name,this.thumbnailPath=t.thumbnailPath,this.thumbnailUrl=this.thumbnailPath?t.thumbnailUrl||n+t.thumbnailPath:null,this.previewPath=t.previewPath,this.previewUrl=this.previewPath?t.previewUrl||n+t.previewPath:null,this.embedPath=t.embedPath,this.embedUrl=t.embedUrl||b()+t.embedPath,this.url=t.url,this.views=t.views,this.viewers=t.viewers,this.likes=t.likes,this.dislikes=t.dislikes,this.nsfw=t.nsfw,this.account=t.account,this.channel=t.channel,this.byAccount=l.CREATE_BY_STRING(t.account.name,t.account.host),this.byVideoChannel=l.CREATE_BY_STRING(t.channel.name,t.channel.host),this.category.label=a(this.category.label,e),this.licence.label=a(this.licence.label,e),this.language.label=a(this.language.label,e),this.privacy.label=a(this.privacy.label,e),this.scheduledUpdate=t.scheduledUpdate,this.originallyPublishedAt=t.originallyPublishedAt?new Date(t.originallyPublishedAt.toString()):null,this.state&&(this.state.label=a(this.state.label,e)),this.blacklisted=t.blacklisted,this.blacklistedReason=t.blacklistedReason,this.blockedOwner=t.blockedOwner,this.blockedServer=t.blockedServer,this.streamingPlaylists=t.streamingPlaylists,this.files=t.files,this.videoSource=t.videoSource,this.userHistory=t.userHistory,this.originInstanceHost=this.account.host,this.originInstanceUrl="https://"+this.originInstanceHost,this.pluginData=t.pluginData,this.aspectRatio=t.aspectRatio,this.automaticTags=t.automaticTags}isVideoNSFWForUser(t,e){return this.nsfw===!1?!1:t?t.nsfwPolicy!=="display":e.instance.defaultNSFWPolicy!=="display"}isRemovableBy(t){return t&&this.isLocal===!0&&(this.account.name===t.username||t.hasRight(i.REMOVE_ANY_VIDEO))}isBlockableBy(t){return this.blacklisted!==!0&&t&&t.hasRight(i.MANAGE_VIDEO_BLACKLIST)===!0}isUnblockableBy(t){return this.blacklisted===!0&&t&&t.hasRight(i.MANAGE_VIDEO_BLACKLIST)===!0}isUpdatableBy(t){return t&&this.isLocal===!0&&(this.account.name===t.username||t.hasRight(i.UPDATE_ANY_VIDEO))}isEditableBy(t,e){return e&&this.state?.id===s.PUBLISHED&&this.isUpdatableBy(t)}isOwner(t){return t&&this.isLocal===!0&&this.account.name===t.username}hasSeeAllVideosRight(t){return t?.hasRight(i.SEE_ALL_VIDEOS)}isOwnerOrHasSeeAllVideosRight(t){return this.isOwner(t)||this.hasSeeAllVideosRight(t)}canRemoveOneFile(t){return this.isLocal&&t&&t.hasRight(i.MANAGE_VIDEO_FILES)&&this.state.id!==s.TO_TRANSCODE&&d(this).length>1}canRemoveAllHLSOrWebFiles(t){return this.isLocal&&t&&t.hasRight(i.MANAGE_VIDEO_FILES)&&this.state.id!==s.TO_TRANSCODE&&this.hasHLS()&&this.hasWebVideos()}canRunTranscoding(t){return this.isLocal&&!this.isLive&&t?.hasRight(i.RUN_VIDEO_TRANSCODING)&&this.state?.id&&!this.transcodingAndTranscriptionIncompatibleStates().has(this.state.id)}canGenerateTranscription(t,e){return e&&this.isLocal&&!this.isLive&&t.hasRight(i.UPDATE_ANY_VIDEO)&&this.state?.id&&!this.transcodingAndTranscriptionIncompatibleStates().has(this.state.id)}transcodingAndTranscriptionIncompatibleStates(){return new Set([s.TO_IMPORT,s.TO_EDIT,s.TO_MOVE_TO_EXTERNAL_STORAGE,s.TO_MOVE_TO_FILE_SYSTEM])}hasHLS(){return this.streamingPlaylists?.some(t=>t.type===c.HLS)}hasWebVideos(){return this.files&&this.files.length!==0}isLiveInfoAvailableBy(t){return this.isLive&&t&&this.isLocal===!0&&(this.account.name===t.username||t.hasRight(i.GET_ANY_LIVE))}canBeDuplicatedBy(t){return t&&this.isLocal===!1&&t.hasRight(i.MANAGE_VIDEOS_REDUNDANCIES)}canAccessPasswordProtectedVideoWithoutPassword(t){return this.privacy.id===r.PASSWORD_PROTECTED&&t&&this.isLocal===!0&&(this.account.name===t.username||t.hasRight(i.SEE_ALL_VIDEOS))}};export{g as a};
/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*/
//# sourceMappingURL=chunk-R3OBDIDF.js.map
