@nomad-media/full 1.1.3

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.
@@ -0,0 +1,342 @@
1
+ import{promises as fs}from"fs";import path from"path";class NomadMediaSDK{constructor(e={}){return NomadMediaSDK.instance||(this.config=e,this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,this.debugMode=e.debugMode||!1,NomadMediaSDK.instance=this)}async _init(){await this.login(),this.__scheduleTokenRefresh()}async login(){_printDatetime("Logging in as "+this.config.username);try{var e=await _login(this.config.username,this.config.password,this.config.serviceApiUrl,this.debugMode);this.token=e.token,this.refreshTokenVal=e.refreshToken,this.expirationSeconds=Date.now()+1e3*e.expirationSeconds,this.userSessionId=e.userSessionId,this.id=e.id,_printDatetime("Login successful")}catch(e){throw _printDatetime("Login failed"),e}}async logout(){null===this.token&&await this._init(),_printDatetime("Logging out");try{await _logout(this.token,this.config.serviceApiUrl,this.debugMode),this.token=null,this.refreshTokenVal=null,this.expirationSeconds=null,this.userSessionId=null,this.id=null,_printDatetime("Logout successful")}catch(e){throw _printDatetime("Loggout failed"),e}}async refreshToken(){_printDatetime("Refreshing token");try{var e=await _refreshToken(this.token,this.config.serviceApiUrl,this.refreshTokenVal,this.debugMode);this.token=e.token,_printDatetime("Token refresh successful")}catch(e){throw _printDatetime("Token refresh failed"),e}}__scheduleTokenRefresh(){var e;this.token&&this.expirationSeconds&&0<(e=this.expirationSeconds-Date.now())&&(this.refreshTimer&&clearTimeout(this.refreshTimer),this.refreshTimer=setTimeout(async()=>{await this.refreshToken(),this.__scheduleTokenRefresh()},e-5e3))}async forgotPassword(){var t=this.config.username;_printDatetime("Sending code to "+t);try{await _forgotPassword(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code sent to "+t)}catch(e){throw _printDatetime("Code failed to send to "+t),e}}async resetPassword(e,t){var i=this.config.username;_printDatetime("Resetting password for "+i);try{await _resetPassword(this.config.serviceApiUrl,i,e,t,this.debugMode),_printDatetime("Password reset for "+i)}catch(e){throw _printDatetime("Password failed to reset for "+i),e}}async uploadAsset(t,i,a,n,r,o,s){null===this.token&&await this._init(),_printDatetime("Uploading asset");let l=null;try{let e=null;"string"==typeof r&&(e=r,(r=await fs.stat(r)).originalname=path.basename(e)),_printDatetime("Starting upload"),l=await _startUpload(this.token,this.config.serviceApiUrl,t,i,a,n,r,o,s,this.debugMode),r.buffer||(r.buffer=await fs.readFile(e)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,l,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode);var d=l.assetId;return _printDatetime("Upload successful"),d}catch(e){throw null!==l&&await _cancelUpload(this.token,this.config.serviceApiUrl,l.id,this.debugMode),_printDatetime("Upload failed"),e}}async uploadRelatedAsset(e,i,a,n,r,o){null===this.token&&await this._init(),_printDatetime("Uploading related asset");let s=null;try{let t=null;return"string"==typeof r&&(t=r,(r=await fs.stat(r)).originalname=path.basename(t)),s=await _startRelatedAssetUpload(this.token,this.config.serviceApiUrl,e,i,a,n,r,o,this.debugMode),r.buffer||(r.buffer=await fs.readFile(t)),await _multiThreadUpload(this.token,this.config.serviceApiUrl,r,s,this.debugMode),await _completeUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Related asset upload successful"),(await _getAssetDetails(this.token,this.config.serviceApiUrl,e,this.config.apiType,this.debugMode)).relatedAssets.find(e=>e.url.includes(path.basename(t))).id}catch(e){throw s&&await _cancelUpload(this.token,this.config.serviceApiUrl,s.id,this.debugMode),_printDatetime("Upload failed"),e}}async getAudit(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting audit for "+t);try{var e=await _getAudit(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Audit retrieved for "+t),e}catch(e){throw _printDatetime("Audit failed to retrieve for "+t),e}}async clearServerCache(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clearing server cache");try{await _clearServerCache(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Server cache cleared")}catch(e){throw _printDatetime("Server cache failed to clear"),e}}async getConfig(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting config");try{var t=await _getConfig(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Config retrieved"),t}catch(e){throw _printDatetime("Config failed to retrieve"),e}}async getServerTime(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting server time");try{var e=await _getServerTime(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Server time retrieved"),e}catch(e){throw _printDatetime("Server time failed to retrieve"),e}}async createContent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating content");try{var i=await _createContent(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Content created: "+i.contentId),i}catch(e){throw _printDatetime("Content failed to create"),e}}async deactivateContentUserTrack(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deactivating content user track: "+t);try{await _deactivateContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content user track deactivated: "+t)}catch(e){throw _printDatetime("Content user track failed to deactivate: "+t),e}}async deleteContent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting content: "+t);try{await _deleteContent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Content deleted: "+t)}catch(e){throw _printDatetime("Content failed to delete: "+t),e}}async getContent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content: "+t);try{var a=await _getContent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Content retrieved: "+t),a}catch(e){throw _printDatetime("Content failed to retrieve: "+t),e}}async getContentUserTrack(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track: "+t),n=n||0,r=r||100;try{var o=await _getContentUserTrack(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Content user track retrieved: "+t),o}catch(e){throw _printDatetime("Content user track failed to retrieve: "+t),e}}async getContentUserTrackTouch(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting content user track touch: "+t);try{var i=await _getContentUserTrackTouch(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content user track touch retrieved: "+t),i}catch(e){throw _printDatetime("Content user track touch failed to retrieve: "+t),e}}async updateContent(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating content: "+t);try{await _updateContent(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Content updated: "+t)}catch(e){throw _printDatetime("Content failed to update: "+t),e}}async addCustomProperties(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding custom properties to content: "+t);try{var n=await _addCustomProperties(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Custom properties added to content: "+t),n}catch(e){throw _printDatetime("Custom properties failed to add to content: "+t),e}}async addRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Adding related content to content: "+t);try{var a=await _addRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content added to content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to add to content: "+t),e}}async addTagOrCollection(t,i,e,a,n,r){null===this.token&&await this._init(),_printDatetime(`Adding ${t} to content `+i);try{var o=await _addTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,n,r,this.config.apiType,this.debugMode);return _printDatetime(t+" added to content: "+i),o.items[0]}catch(e){throw _printDatetime(`Adding ${t} to content: ${i} failed`),e}}async bulkUpdateMetadata(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating metadata");try{await _bulkUpdateMetadata(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Metadata updated")}catch(e){throw _printDatetime("Metadata failed to update"),e}}async createTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Creating ${t}: `+i);try{var e=await _createTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" created: "+i),e}catch(e){throw _printDatetime(t+" failed to create: "+i),e}}async deleteRelatedContent(t,e,i){null===this.token&&await this._init(),_printDatetime("Deleting related content from content: "+t);try{var a=await _deleteRelatedContent(this.token,this.config.serviceApiUrl,t,e,i,this.config.apiType,this.debugMode);return _printDatetime("Related content deleted from content: "+t),a.items[0]}catch(e){throw _printDatetime("Related content failed to delete from content: "+t),e}}async deleteTagOrCollection(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting tag or collection: "+t);try{var i=await _deleteTagOrCollection(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Tag or collection deleted: "+t),i}catch(e){throw _printDatetime("Tag or collection failed to delete: "+t),e}}async getTagOrCollection(t,i){null===this.token&&await this._init(),_printDatetime(`Getting ${t}: `+i);try{var e=await _getTagOrCollection(this.token,this.config.serviceApiUrl,t,i,this.debugMode);return _printDatetime(t+" retrieved: "+i),e}catch(e){throw _printDatetime(t+" failed to retrieve: "+i),e}}async removeTagOrCollection(t,i,e,a){null===this.token&&await this._init(),_printDatetime(`Removing ${t} from content: `+i);try{var n=await _removeTagOrCollection(this.token,this.config.serviceApiUrl,t,i,e,a,this.config.apiType,this.debugMode);return _printDatetime(t+" removed from content: "+i),n}catch(e){throw _printDatetime(t+" failed to remove from content: "+i),e}}async createAndUpdateEvent(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating/Updating event:");try{var p=await _createAndUpdateEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Event created/updated"),p}catch(e){throw _printDatetime("Event failed to create/update"),e}}async deleteEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting event: "+t);try{await _deleteEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Event deleted: "+t)}catch(e){throw _printDatetime("Event failed to delete: "+t),e}}async addLiveScheduleToEvent(t,e,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding Live Schedule to Event: "+t);try{await _addLiveScheduleToEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,this.debugMode),_printDatetime("Live Schedule added to Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to add to Event: "+t),e}}async extendLiveSchedule(t,e,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Extending Live Schedule of Event: "+t);try{await _extendLiveSchedule(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode),_printDatetime("Live Schedule extended of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to extend of Event: "+t),e}}async getLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Getting Live Schedule of Event: "+t);try{var e=await _getLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Schedule retrieved of Event: "+t),e}catch(e){throw _printDatetime("Live Schedule failed to retrieve of Event: "+t),e}}async startLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Starting Live Schedule of Event: "+t);try{await _startLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule started of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to start of Event: "+t),e}}async stopLiveSchedule(t){null===this.token&&await this._init(),_printDatetime("Stopping Live Schedule of Event: "+t);try{await _stopLiveSchedule(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Schedule stopped of Event: "+t)}catch(e){throw _printDatetime("Live Schedule failed to stop of Event: "+t),e}}async clipLiveChannel(t,e,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Clipping Live Channel: "+t);try{await _clipLiveChannel(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,this.debugMode);_printDatetime("Live Channel clipped: "+t)}catch(e){throw _printDatetime("Live Channel failed to clip: "+t),e}}async createLiveChannel(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Channel: "+e);try{var c=await _createLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Live Channel created: "+c.id),c}catch(e){throw _printDatetime("Live Channel failed to create"),e}}async deleteLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Channel: "+t);try{await _deleteLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel deleted: "+t)}catch(e){throw _printDatetime("Live Channel failed to delete: "+t),e}}async getLiveChannel(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channel: "+t);try{var e=await _getLiveChannel(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Channel gotten: "+t),e}catch(e){throw _printDatetime("Live Channel failed to get: "+t),e}}async getLiveChannels(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Channels");try{var e=await _getLiveChannels(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Channels gotten"),e}catch(e){throw _printDatetime("Live Channels failed to get"),e}}async liveChannelRefresh(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Refreshing Live Channels");try{await _liveChannelRefresh(this.token,this.config.serviceApiUrl,this.debugMode),_printDatetime("Live Channels refreshed")}catch(e){throw _printDatetime("Live Channels failed to refresh"),e}}async nextEvent(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Next Event of Live Channel: "+t);try{var e=await _nextEvent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Next Event gotten of Live Channel: "+t),e}catch(e){throw _printDatetime("Next Event failed to get of Live Channel: "+t),e}}async startLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Live Channel: "+t);try{await _startLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel started: "+t)}catch(e){throw _printDatetime("Live Channel failed to start: "+t),e}}async startOutputTracking(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting Output Tracking for Live Channel: "+t);try{await _startOutputTracking(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Output Tracking started for Live Channel: "+t)}catch(e){throw _printDatetime("Output Tracking failed to start for Live Channel: "+t),e}}async stopLiveChannel(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping Live Channel: "+t);try{await _stopLiveChannel(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Live Channel stopped: "+t)}catch(e){throw _printDatetime("Live Channel failed to stop: "+t),e}}async updateLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Channel: "+e);try{var h=await _updateLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,this.debugMode);return _printDatetime("Live Channel updated: "+e),h}catch(e){throw _printDatetime("Live Channel failed to update"),e}}async createLiveInput(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating Live Input: "+e);try{var s=await _createLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live Input created: "+s.id),s}catch(e){throw _printDatetime("Live Input failed to create"),e}}async deleteLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting Live Input: "+t);try{await _deleteLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Live Input deleted: "+t)}catch(e){throw _printDatetime("Live Input failed to delete: "+t),e}}async getLiveInput(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Input: "+t);try{var e=await _getLiveInput(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live Input gotten: "+t),e}catch(e){throw _printDatetime("Live Input failed to get: "+t),e}}async getLiveInputs(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting Live Inputs");try{var e=await _getLiveInputs(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live Inputs gotten"),e}catch(e){throw _printDatetime("Live Inputs failed to get"),e}}async updateLiveInput(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating Live Input: "+e);try{var l=await _updateLiveInput(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live Input updated: "+e),l}catch(e){throw _printDatetime("Live Input failed to update"),e}}async cancelBroadcast(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling broadcast: "+t);try{await _cancelBroadcast(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Broadcast cancelled: "+t)}catch(e){throw _printDatetime("Broadcast failed to cancel: "+t),e}}async cancelSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Cancelling segment: "+t);try{var e=await _cancelSegment(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Segment cancelled: "+t),e}catch(e){throw _printDatetime("Segment failed to cancel: "+t),e}}async completeSegment(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Completing segment: "+t);try{await _completeSegment(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Segment completed: "+t)}catch(e){throw _printDatetime("Segment failed to complete: "+t),e}}async getCompletedSegments(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting completed segments");try{var t=await _getCompletedSegments(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Completed segments gotten"),t}catch(e){throw _printDatetime("Completed segments failed to get"),e}}async getLiveOperator(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operator: "+t);try{var e=await _getLiveOperator(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Live operator gotten: "+t),e}catch(e){throw _printDatetime("Live operator failed to get: "+t),e}}async getLiveOperators(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live operators");try{var e=await _getLiveOperators(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live operators gotten"),e}catch(e){throw _printDatetime("Live operators failed to get"),e}}async startBroadcast(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting broadcast");try{var o=await _startBroadcast(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Broadcast started"),o}catch(e){throw _printDatetime("Broadcast failed to start"),e}}async startSegment(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting segment: "+t);try{await _startSegment(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Segment started: "+t)}catch(e){throw _printDatetime("Segment failed to start: "+t),e}}async stopBroadcast(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping broadcast");try{await _stopBroadcast(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Broadcast stopped")}catch(e){throw _printDatetime("Broadcast failed to stop"),e}}async addAssetScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding asset schedule event to channel: "+t);try{var r=await _addAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Asset schedule event added to channel: "+t),r}catch(e){throw _printDatetime("Asset schedule event failed to add to channel: "+t),e}}async addInputScheduleEvent(t,e,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Adding input schedule event to channel "+t);try{var r=await _addInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Input schedule event added to channel "+t),r}catch(e){throw _printDatetime("Input schedule event failed to add to channel "+t),e}}async getAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Asset schedule event failed to get: "+t),e}}async getInputScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset schedule event: "+t);try{var i=await _getInputScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset schedule event gotten: "+t),i}catch(e){throw _printDatetime("Input schedule event failed to get: "+t),e}}async moveScheduleEvent(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule event: "+t);try{var a=await _moveScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Schedule event moved: "+t),a}catch(e){throw _printDatetime("Schedule event failed to move: "+t),e}}async removeAssetScheduleEvent(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing asset schedule event: "+t);try{await _removeAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,this.debugMode),_printDatetime("Asset schedule event removed: "+t)}catch(e){throw _printDatetime("Asset schedule event failed to remove: "+t),e}}async removeInputScheduleEvent(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Removing input schedule event");try{await _removeInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Input schedule event removed")}catch(e){throw _printDatetime("Input schedule event failed to remove"),e}}async updateAssetScheduleEvent(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset schedule event: "+t);try{var o=await _updateAssetScheduleEvent(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset schedule event updated: "+t),o}catch(e){throw _printDatetime("Asset schedule event failed to update: "+t),e}}async updateInputScheduleEvent(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating input schedule event");try{var o=await _updateInputScheduleEvent(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Input schedule event updated"),o}catch(e){throw _printDatetime("Input schedule event failed to update"),e}}async createLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating live output profile");try{var f=await _createLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Live output profile created"),f}catch(e){throw _printDatetime("Live output profile failed to create"),e}}async deleteLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile");try{await _deleteLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile deleted")}catch(e){throw _printDatetime("Live output profile failed to delete"),e}}async getLiveOutputProfile(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile");try{var t=await _getLiveOutputProfile(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile gotten"),t}catch(e){throw _printDatetime("Live output profile failed to get"),e}}async getLiveOutputProfiles(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profiles");try{var e=await _getLiveOutputProfiles(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live outputs gotten"),e}catch(e){throw _printDatetime("Live output profiles failed to get"),e}}async getLiveOutputTypes(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output types");try{var e=await _getLiveOutputTypes(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output types gotten"),e}catch(e){throw _printDatetime("Live output types failed to get"),e}}async updateLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating live output profile");try{var y=await _updateLiveOutputProfile(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Live output updated"),y}catch(e){throw _printDatetime("Live output profile failed to update"),e}}async createLiveOutputProfileGroup(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===o&&(o=[]),_printDatetime("Creating live output profile group");try{var s=await _createLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Live output profile group created"),s}catch(e){throw _printDatetime("Live output profile group failed to create"),e}}async deleteLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting live output profile group");try{await _deleteLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Live output profile group deleted")}catch(e){throw _printDatetime("Live output profile group failed to delete"),e}}async getLiveOutputProfileGroup(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile group");try{var t=await _getLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Live output profile group gotten"),t}catch(e){throw _printDatetime("Live output profile group failed to get"),e}}async getLiveOutputProfileGroups(){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting live output profile groups");try{var e=await _getLiveOutputProfileGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Live output profile groups gotten"),e}catch(e){throw _printDatetime("Live output profile groups failed to get"),e}}async updateLiveOutputProfileGroup(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===s&&(s=[]),_printDatetime("Updating live output profile group");try{var l=await _updateLiveOutputProfileGroup(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode);return _printDatetime("Live output profile group updated"),l}catch(e){throw _printDatetime("Live output profile group failed to update"),e}}async createIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===e&&(e=[]),null===n&&(n=[]),null===l&&(l=[]),_printDatetime("Creating intelligent playlist");try{var p=await _createIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Intelligent playlist created"),p}catch(e){throw _printDatetime("Intelligent playlist failed to create"),e}}async createIntelligentSchedule(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating intelligent schedule");try{var n=await _createIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Intelligent schedule created"),n}catch(e){throw _printDatetime("Intelligent schedule failed to create"),e}}async createPlaylist(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist");try{var n=await _createPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Playlist created"),n}catch(e){throw _printDatetime("Playlist failed to create"),e}}async createPlaylistVideo(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating playlist video");try{var a=await _createPlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video created"),a}catch(e){throw _printDatetime("Playlist video failed to create"),e}}async createScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item asset");try{var s=await _createScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset created"),s}catch(e){throw _printDatetime("Schedule item asset failed to create"),e}}async createScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item live channel");try{var s=await _createScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel created"),s}catch(e){throw _printDatetime("Schedule item live channel failed to create"),e}}async createScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating schedule item playlist schedule");try{var s=await _createScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule created"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to create"),e}}async createScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===l&&(l=[]),_printDatetime("Creating schedule item search filter");try{var f=await _createScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,this.debugMode);return _printDatetime("Schedule item search filter created"),f}catch(e){throw _printDatetime("Schedule item search filter failed to create"),e}}async deleteIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent playlist");try{await _deleteIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent playlist deleted")}catch(e){throw _printDatetime("Intelligent playlist failed to delete"),e}}async deleteIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting intelligent schedule");try{await _deleteIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Intelligent schedule deleted")}catch(e){throw _printDatetime("Intelligent schedule failed to delete"),e}}async deletePlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting playlist");try{await _deletePlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Playlist deleted")}catch(e){throw _printDatetime("Playlist failed to delete"),e}}async deleteScheduleItem(e,t){null===this.token&&await this._init(),_printDatetime("Deleting schedule item");try{await _deleteScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Schedule item deleted")}catch(e){throw _printDatetime("Schedule item failed to delete"),e}}async getIntelligentPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent playlist");try{var t=await _getIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent playlist gotten"),t}catch(e){throw _printDatetime("Intelligent playlist failed to get"),e}}async getIntelligentSchedule(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting intelligent schedule");try{var t=await _getIntelligentSchedule(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Intelligent schedule gotten"),t}catch(e){throw _printDatetime("Intelligent schedule failed to get"),e}}async getPlaylist(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting playlist");try{var t=await _getPlaylist(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Playlist gotten"),t}catch(e){throw _printDatetime("Playlist failed to get"),e}}async getScheduleItem(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule item");try{var i=await _getScheduleItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule item gotten"),i}catch(e){throw _printDatetime("Schedule item failed to get"),e}}async getScheduleItems(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting schedule items");try{var t=await _getScheduleItems(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule items gotten"),t}catch(e){throw _printDatetime("Schedule items failed to get"),e}}async getSchedulePreview(e){null===this.token&&await this._init(),"admin"!==this.config.apiType&&_printDatetime("Getting schedule preview");try{var t=await _getSchedulePreview(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Schedule preview gotten"),t}catch(e){throw _printDatetime("Schedule preview failed to get"),e}}async moveScheduleItem(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving schedule item");try{var a=await _moveScheduleItem(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Schedule item moved"),a}catch(e){throw _printDatetime("Schedule item failed to move"),e}}async publishIntelligentSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Publishing intelligent schedule");try{var i=await _publishIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Intelligent schedule published"),i}catch(e){throw _printDatetime("Intelligent schedule failed to publish"),e}}async startSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting schedule");try{var i=await _startSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule started"),i}catch(e){throw _printDatetime("Schedule failed to start"),e}}async stopSchedule(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Stopping schedule");try{var i=await _stopSchedule(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Schedule stopped"),i}catch(e){throw _printDatetime("Schedule failed to stop"),e}}async updateIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");null===t&&(t=[]),null===r&&(r=[]),null===d&&(d=[]),_printDatetime("Updating intelligent playlist");try{var c=await _updateIntelligentPlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("Intelligent playlist updated"),c}catch(e){throw _printDatetime("Intelligent playlist failed to update"),e}}async updateIntelligentSchedule(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating intelligent schedule");try{var r=await _updateIntelligentSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Intelligent schedule updated"),r}catch(e){throw _printDatetime("Intelligent schedule failed to update"),e}}async updatePlaylist(e,t,i,a,n){null===this.token&&await this._init(),null===t&&(t={}),null===n&&(n={}),_printDatetime("Updating playlist");try{var r=await _updatePlaylist(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Playlist updated"),r}catch(e){throw _printDatetime("Playlist failed to update"),e}}async updatePlaylistVideo(e,t,i){null===this.token&&await this._init(),_printDatetime("Updating playlist video");try{var a=await _updatePlaylistVideo(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Playlist video updated"),a}catch(e){throw _printDatetime("Playlist video failed to update"),e}}async updateScheduleItemAsset(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item asset");try{var s=await _updateScheduleItemAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item asset updated"),s}catch(e){throw _printDatetime("Schedule item asset failed to update"),e}}async updateScheduleItemLiveChannel(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item live channel");try{var s=await _updateScheduleItemLiveChannel(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item live channel updated"),s}catch(e){throw _printDatetime("Schedule item live channel failed to update"),e}}async updateScheduleItemPlaylistSchedule(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item playlist schedule");try{var s=await _updateScheduleItemPlaylistSchedule(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,this.debugMode);return _printDatetime("Schedule item playlist schedule updated"),s}catch(e){throw _printDatetime("Schedule item playlist schedule failed to update"),e}}async updateScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating schedule item search filter");try{var y=await _updateScheduleItemSearchFilter(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,this.debugMode);return _printDatetime("Schedule item search filter updated"),y}catch(e){throw _printDatetime("Schedule item search filter failed to update"),e}}async deleteUser(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");e=e||this.id,_printDatetime("Deleting user");try{await _deleteUser(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User deleted")}catch(e){throw _printDatetime("User failed to delete"),e}}async deleteUserContentAttributeData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content attribute data");try{e=e||this.id,await _deleteUserContentAttributeData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content attribute data deleted")}catch(e){throw _printDatetime("User content attribute data failed to delete"),e}}async deleteUserContentGroupData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content group data");try{e=e||this.id,await _deleteUserContentGroupData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User content group data deleted")}catch(e){throw _printDatetime("User content group data failed to delete"),e}}async deleteUserContentSecurityData(e,t,i,a,n,r,o){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user content security data");try{a=a||this.id,await _deleteUserContentSecurityData(this.token,this.config.serviceApiUrl,e,t,a,i,n,r,o,this.debugMode),_printDatetime("User content security data deleted")}catch(e){throw _printDatetime("User content security data failed to delete"),e}}async deleteUserData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user data");try{e=e||this.id,await _deleteUserData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User data deleted")}catch(e){throw _printDatetime("User data failed to delete"),e}}async deleteUserDislikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user dislikes data");try{e=e||this.id,await _deleteUserDislikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User dislikes data deleted")}catch(e){throw _printDatetime("User dislikes data failed to delete"),e}}async deleteUserFavoritesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user favorites data");try{e=e||this.id,await _deleteUserFavoritesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User favorites data deleted")}catch(e){throw _printDatetime("User favorites data failed to delete"),e}}async deleteUserLikesData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user likes data");try{e=e||this.id,await _deleteUserLikesData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User likes data deleted")}catch(e){throw _printDatetime("User likes data failed to delete"),e}}async deleteUserSavedSearchData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user saved search data");try{e=e||this.id,await _deleteUserSavedSearchData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User saved search data deleted")}catch(e){throw _printDatetime("User saved search data failed to delete"),e}}async deleteUserSessionData(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user session data");try{e=e||this.id,await _deleteUserSessionData(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("User session data deleted")}catch(e){throw _printDatetime("User session data failed to delete"),e}}async deleteUserVideoTrackingData(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting user video tracking data");try{a=a||this.id,await _deleteUserVideoTrackingData(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode),_printDatetime("User video tracking data deleted")}catch(e){throw _printDatetime("User video tracking data failed to delete"),e}}async changeSessionStatus(e,t,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Changing session status"),e=e||this.userSessionId;try{var a=await _changeSessionStatus(this.token,this.config.serviceApiUrl,e,t,i,this.debugMode);return _printDatetime("Session status changed"),a}catch(e){throw _printDatetime("Session status failed to change"),e}}async getUserSession(e){null===this.token&&await this._init(),_printDatetime("Getting user session");try{e=e||this.userSessionId;var t=await _getUserSession(this.token,this.config.serviceApiUrl,this.config.apiType,e,this.debugMode);return _printDatetime("User session gotten"),t}catch(e){throw _printDatetime("User session failed to get"),e}}async register(t,e,i,a){_printDatetime("Registering user: "+t);try{var n=await _register(this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("User registered: "+t),n}catch(e){throw _printDatetime("User failed to register: "+t),e}}async resendCode(t){_printDatetime("Resending code: "+t);try{await _resendCode(this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Code resent: "+t)}catch(e){throw _printDatetime("Code failed to resend: "+t),e}}async verify(t,e){_printDatetime("Verifying user: "+t);try{var i=await _verify(this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("User verified: "+t),i}catch(e){throw _printDatetime("User failed to verify: "+t),e}}async archiveAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Archiving asset: "+t);try{var e=await _archiveAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset archived: "+t),e}catch(e){throw _printDatetime("Asset failed to archive: "+t),e}}async buildMedia(e,t,i,a,n,r,o,s){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Building media");try{await _buildMedia(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,this.debugMode),_printDatetime("Media built")}catch(e){throw _printDatetime("Media failed to build"),e}}async clipAsset(t,e,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Clipping asset: "+t);try{var p=await _clipAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,e,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Asset clipped: "+t),p}catch(e){throw _printDatetime("Asset failed to clip: "+t),e}}async copyAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Copying asset(s): "+t);try{var o=await _copyAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset(s) copied: "+t),o}catch(e){throw _printDatetime("Asset failed to copy: "+t),e}}async createAnnotation(e,t,i,a,n,r,o,s,l){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating annotation");try{var d={firstKeyword:a,secondKeyword:n,description:r,country:o},p=await _createAnnotation(this.token,this.config.serviceApiUrl,e,t,i,d,s,l,this.debugMode);return _printDatetime("Annotation created"),p}catch(e){throw _printDatetime("Annotation failed to create"),e}}async createAssetAdBreak(e,t,i,a){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating asset ad break");try{var n=await _createAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,this.debugMode);return _printDatetime("Asset ad break created"),n}catch(e){throw _printDatetime("Asset ad break failed to create"),e}}async createFolderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating folder asset");try{var i=await _createFolderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Folder asset created"),i}catch(e){throw _printDatetime("Folder asset failed to create"),e}}async createPlaceholderAsset(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");if(_printDatetime("Creating placeholder asset"),!t.includes("."))throw new Error("The asset name must contain file extension.");try{var i=await _createPlaceholderAsset(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Placeholder asset created"),i}catch(e){throw _printDatetime("Placeholder asset failed to create"),e}}async createScreenshotAtTimecode(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Creating screenshot at timecode");try{var i=await _createScreenshotAtTimecode(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Screenshot created at timecode"),i}catch(e){throw _printDatetime("Screenshot failed to create at timecode"),e}}async deleteAnnotation(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting annotation");try{await _deleteAnnotation(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotation deleted")}catch(e){throw _printDatetime("Annotation failed to delete"),e}}async deleteAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset: "+t);try{await _deleteAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset deleted: "+t)}catch(e){throw _printDatetime("Asset failed to delete: "+t),e}}async deleteAssetAdBreak(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Deleting asset ad break");try{await _deleteAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset ad break deleted")}catch(e){throw _printDatetime("Asset ad break failed to delete"),e}}async downloadArchiveAsset(e,t,i){null===this.token&&await this._init(),_printDatetime("Downloading archive asset");try{var a=await _downloadArchiveAsset(this.token,this.config.serviceApiUrl,this.config.apiType,e,t,i,this.debugMode);return _printDatetime("Archive asset downloaded"),a}catch(e){throw _printDatetime("Archive asset failed to download"),e}}async duplicateAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Duplicating asset: "+t);try{var e=await _duplicateAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset duplicated: "+t),e}catch(e){throw _printDatetime("Asset failed to duplicate: "+t),e}}async getAnnotations(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting annotations for "+t);try{var e=await _getAnnotations(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Annotations retrieved for "+t),e}catch(e){throw _printDatetime("Annotations failed to retrieve for "+t),e}}async getAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset for "+t);try{var e=await _getAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset retrieved for "+t),e}catch(e){throw _printDatetime("Asset failed to retrieve for "+t),e}}async getAssetAdBreaks(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset ad breaks for "+t);try{var e=await _getAssetAdBreaks(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset ad breaks retrieved for "+t),e}catch(e){throw _printDatetime("Asset ad breaks failed to retrieve for "+t),e}}async getAssetChildNodes(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset child nodes for "+t);try{var o=await _getAssetChildNodes(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Asset child nodes retrieved for "+t),o}catch(e){throw _printDatetime("Asset child nodes failed to retrieve for "+t),e}}async getAssetDetails(t){null===this.token&&await this._init(),_printDatetime("Getting asset details for "+t);try{var e=await _getAssetDetails(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode);return _printDatetime("Asset details retrieved for "+t),e}catch(e){throw _printDatetime("Asset details failed to retrieve for "+t),e}}async getAssetManifestWithCookies(t,e){null===this.token&&await this._init(),_printDatetime("Getting asset manifest with cookies for "+t);try{var i=await _getAssetManifestWithCookies(this.token,this.config.serviceApiUrl,t,e,this.config.apiType,this.debugMode);return _printDatetime("Asset manifest with cookies retrieved for "+t),i}catch(e){throw _printDatetime("Asset manifest with cookies failed to retrieve for "+t),e}}async getAssetMetadataSummary(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset metadata summary for "+t);try{var e=await _getAssetMetadataSummary(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Asset metadata summary retrieved for "+t),e}catch(e){throw _printDatetime("Asset metadata summary failed to retrieve for "+t),e}}async getAssetParentFolders(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset parent folders for "+t);try{var i=await _getAssetParentFolders(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset parent folders retrieved for "+t),i}catch(e){throw _printDatetime("Asset parent folders failed to retrieve for "+t),e}}async getAssetScreenshotDetails(t,e,i){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset screenshot details for "+t);try{var a=await _getAssetScreenshotDetails(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode);return _printDatetime("Asset screenshot details retrieved for "+t),a}catch(e){throw _printDatetime("Asset screenshot details failed to retrieve for "+t),e}}async getAssetSegmentDetails(t,e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting asset segment details for "+t);try{var i=await _getAssetSegmentDetails(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset segment details retrieved for "+t),i}catch(e){throw _printDatetime("Asset segment details failed to retrieve for "+t),e}}async getUserUploadParts(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user upload parts for "+t);try{var e=await _getUserUploadParts(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("User upload parts retrieved for "+t),e}catch(e){throw _printDatetime("User upload parts failed to retrieve for "+t),e}}async getUserUploads(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Getting user uploads");try{var t=await _getUserUploads(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("User uploads retrieved"),t}catch(e){throw _printDatetime("User uploads failed to retrieve"),e}}async importAnnotations(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Importing annotations");try{await _importAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Annotations imported")}catch(e){throw _printDatetime("Annotations failed to import"),e}}async indexAsset(t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Indexing asset: "+t);try{await _indexAsset(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Asset indexed: "+t)}catch(e){throw _printDatetime("Asset failed to index: "+t),e}}async localRestoreAsset(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Local restoring asset: "+t);try{var i=await _localRestoreAsset(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Asset local restored: "+t),i}catch(e){throw _printDatetime("Asset failed to local restore: "+t),e}}async moveAsset(t,e,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Moving asset: "+t);try{var o=await _moveAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.id,r,this.debugMode);return _printDatetime("Asset moved: "+t),o}catch(e){throw _printDatetime("Asset failed to move: "+t),e}}async recordsAssetTrackingBeacon(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Recording asset tracking beacon");try{await _recordsAssetTrackingBeacon(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode),_printDatetime("Asset tracking beacon recorded")}catch(e){throw _printDatetime("Asset tracking beacon failed to record"),e}}async registerAsset(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Registering asset: "+t);try{var v=await _registerAsset(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m,this.debugMode);return _printDatetime("Asset registered: "+t),v}catch(e){throw _printDatetime("Asset failed to register: "+t),e}}async reprocessAsset(e){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Reprocessing asset");try{var t=await _reprocessAsset(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Asset reprocessed"),t}catch(e){throw _printDatetime("Asset failed to reprocess"),e}}async restoreAsset(t){null===this.token&&await this._init(),_printDatetime("Restoring asset: "+t);try{await _restoreAsset(this.token,this.config.serviceApiUrl,t,this.config.apiType,this.debugMode),_printDatetime("Asset restored: "+t)}catch(e){throw _printDatetime("Asset failed to restore: "+t),e}}async shareAsset(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing asset: "+t);try{var n=await _shareAsset(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Asset shared: "+t),n}catch(e){throw _printDatetime("Asset failed to share: "+t),e}}async startWorkflow(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Starting workflow");try{var i=await _startWorkflow(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Workflow started"),i}catch(e){throw _printDatetime("Workflow failed to start"),e}}async transcribeAsset(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Transcribing asset: "+t);try{await _transcribeAsset(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Asset transcribed: "+t)}catch(e){throw _printDatetime("Asset failed to transcribe: "+t),e}}async updateAnnotation(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating annotation");try{var p=await _updateAnnotation(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Annotation updated"),p}catch(e){throw _printDatetime("Annotation failed to update"),e}}async updateAsset(e,t,i,a,n,r){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset");try{await _updateAsset(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode),_printDatetime("Asset updated")}catch(e){throw _printDatetime("Asset failed to update"),e}}async updateAssetAdBreak(e,t,i,a,n){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset ad break");try{var r=await _updateAssetAdBreak(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Asset ad break updated"),r}catch(e){throw _printDatetime("Asset ad break failed to update"),e}}async updateAssetLanguage(e,t){if(null===this.token&&await this._init(),"admin"!==this.config.apiType)throw new Error("This function is only available for admin API type.");_printDatetime("Updating asset language");try{await _updateAssetLanguage(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Asset language updated")}catch(e){throw _printDatetime("Asset language failed to update"),e}}async ping(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _ping(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async pingAuth(e,t){null===this.token&&await this._init(),_printDatetime("Pinging user");try{var i=await _pingAuth(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("User pinged"),i}catch(e){throw _printDatetime("User failed to ping"),e}}async search(e,t,i,a,n,r,o,s,l,d){null===this.token&&await this._init(),_printDatetime("Searching...");try{var p=await _search(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.config.apiType,this.debugMode);return _printDatetime("Search complete"),!!p.hasItems&&p}catch(e){throw _printDatetime("Search failed"),e}}async changeEmail(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing email: "+t);try{await _changeEmail(this.token,this.config.serviceApiUrl,t,this.config.password,this.debugMode),_printDatetime("Email changed: "+t)}catch(e){throw _printDatetime("Email failed to change: "+t),e}}async changePassword(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Changing password");try{await _changePassword(this.token,this.config.serviceApiUrl,this.config.password,e,this.debugMode),_printDatetime("Password changed")}catch(e){throw _printDatetime("Password failed to change"),e}}async getUser(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting user");try{var e=await _getUser(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("User gotten"),e}catch(e){throw _printDatetime("User failed to get"),e}}async updateUser(e,t,i,a,n,r,o,s,l,d,p){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating user");try{var c=await _updateUser(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,this.debugMode);return _printDatetime("User updated"),c}catch(e){throw _printDatetime("User failed to update"),e}}async addContentsToContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding content to content group: "+t);try{var i=await _addContentsToContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content added to content group: "+t),i}catch(e){throw _printDatetime("Content failed to add to content group: "+t),e}}async createContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating content group: "+t);try{var e=await _createContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group created: "+t),e}catch(e){throw _printDatetime("Content group failed to create: "+t),e}}async deleteContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting content group: "+t);try{var e=await _deleteContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group deleted: "+t),e}catch(e){throw _printDatetime("Content group failed to delete: "+t),e}}async getContentGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content group: "+t);try{var e=await _getContentGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Content group gotten: "+t),e}catch(e){throw _printDatetime("Content group failed to get: "+t),e}}async getContentGroups(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content groups");try{var e=await _getContentGroups(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Content groups gotten"),e}catch(e){throw _printDatetime("Content groups failed to get"),e}}async getPortalGroups(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting portal groups");try{var t=await _getPortalGroups(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Portal groups gotten"),t}catch(e){throw _printDatetime("Portal groups failed to get"),e}}async removeContentsFromContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing content from content group: "+t);try{var i=await _removeContentsFromContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content removed from content group: "+t),i}catch(e){throw _printDatetime("Content failed to remove from content group: "+t),e}}async renameContentGroup(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Renaming content group: "+t);try{var i=await _renameContentGroup(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group renamed: "+t),i}catch(e){throw _printDatetime("Content group failed to rename: "+t),e}}async shareContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Sharing content group with users: "+t);try{var i=await _shareContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group shared with users: "+t),i}catch(e){throw _printDatetime("Content group failed to share with users: "+t),e}}async stopSharingContentGroupWithUsers(t,e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Stopping sharing content group with users: "+t);try{var i=await _stopSharingContentGroupWithUsers(this.token,this.config.serviceApiUrl,t,e,this.debugMode);return _printDatetime("Content group stopped sharing with users: "+t),i}catch(e){throw _printDatetime("Content group failed to stop sharing with users: "+t),e}}async clearContinueWatching(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing continue watching");try{await _clearContinueWatching(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Continue watching cleared")}catch(e){throw _printDatetime("Continue watching failed to clear"),e}}async clearWatchlist(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Clearing watchlist");try{e=e||this.id,await _clearWatchlist(this.token,this.config.serviceApiUrl,e,this.debugMode),_printDatetime("Watchlist cleared")}catch(e){throw _printDatetime("Watchlist failed to clear"),e}}async createForm(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating form");try{var i=await _createForm(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Form created"),i}catch(e){throw _printDatetime("Form failed to create"),e}}async getContentCookies(e){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting content cookies");try{var t=await _getContentCookies(this.token,this.config.serviceApiUrl,e,this.debugMode);return _printDatetime("Content cookies gotten"),t}catch(e){throw _printDatetime("Content cookies failed to get"),e}}async getDefaultSiteConfig(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting default site config");try{var e=await _getDefaultSiteConfig(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Default site config gotten"),e}catch(e){throw _printDatetime("Default site config failed to get"),e}}async getDynamicContent(t){null===this.token&&await this._init(),_printDatetime("Getting dynamic content: "+t);try{var e=await _getDynamicContent(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Dynamic content gotten: "+t),e}catch(e){throw _printDatetime("Dynamic content failed to get: "+t),e}}async getDynamicContents(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting dynamic contents");try{var e=await _getDynamicContents(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Dynamic contents gotten"),e}catch(e){throw _printDatetime("Dynamic contents failed to get"),e}}async getMediaGroup(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media group: "+t);try{var e=await _getMediaGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media group gotten: "+t),e}catch(e){throw _printDatetime("Media group failed to get: "+t),e}}async getMediaItem(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media item: "+t);try{var e=await _getMediaItem(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media item gotten: "+t),e}catch(e){throw _printDatetime("Media item failed to get: "+t),e}}async getMyContent(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is not available for portal API type.");_printDatetime("Getting my content");try{var e=await _getMyContent(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("My content gotten"),e}catch(e){throw _printDatetime("My content failed to get"),e}}async getMyGroup(t){null===this.token&&await this._init(),_printDatetime("Getting my group: "+t);try{var e=await _getMyGroup(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("My group gotten: "+t),e}catch(e){throw _printDatetime("My group failed to get: "+t),e}}async getSiteConfig(t){null===this.token&&await this._init(),_printDatetime("Getting site config: "+t);try{var e=await _getSiteConfig(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Site config gotten: "+t),e}catch(e){throw _printDatetime("Site config failed to get: "+t),e}}async mediaSearch(e,t,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Searching media...");try{var r=await _mediaSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,this.debugMode);return _printDatetime("Media search complete"),r}catch(e){throw _printDatetime("Media search failed"),e}}async createMediaBuilder(e,t,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Creating media builder");try{var o=await _createMediaBuilder(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder created"),o}catch(e){throw _printDatetime("Media builder failed to create"),e}}async createMediaBuilderItem(e,t,i,a,n,r){null===this.token&&await this._init(),_printDatetime("Creating media builder item");try{var o=await _createMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,this.debugMode);return _printDatetime("Media builder item created"),o}catch(e){throw _printDatetime("Media builder item failed to create"),e}}async createMediaBuilderItemsAddAnnotations(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder item and adding annotations");try{var i=await _createMediaBuilderItemsAddAnnotations(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder item created and annotations added"),i}catch(e){throw _printDatetime("Media builder item failed to create and annotations failed to add"),e}}async createMediaBuilderItemsBulk(e,t){null===this.token&&await this._init(),_printDatetime("Creating media builder items");try{var i=await _createMediaBuilderItemsBulk(this.token,this.config.serviceApiUrl,e,t,this.debugMode);return _printDatetime("Media builder items created"),i}catch(e){throw _printDatetime("Media builder items failed to create"),e}}async deleteMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder: "+t);try{await _deleteMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Media builder deleted: "+t)}catch(e){throw _printDatetime("Media builder failed to delete: "+t),e}}async deleteMediaBuilderItem(e,t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting media builder item: "+t);try{await _deleteMediaBuilderItem(this.token,this.config.serviceApiUrl,e,t,this.debugMode),_printDatetime("Media builder item deleted: "+t)}catch(e){throw _printDatetime("Media builder item failed to delete: "+t),e}}async duplicateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Duplicating media builder: "+t);try{var o=await _duplicateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder duplicated: "+t),o}catch(e){throw _printDatetime("Media builder failed to duplicate: "+t),e}}async getMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder: "+t);try{var e=await _getMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder gotten: "+t),e}catch(e){throw _printDatetime("Media builder failed to get: "+t),e}}async getMediaBuilderIdsFromAsset(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder ids from asset: "+t);try{var e=await _getMediaBuilderIdsFromAsset(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder ids from asset gotten: "+t),e}catch(e){throw _printDatetime("Media builder ids from asset failed to get: "+t),e}}async getMediaBuilders(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builders");try{var e=await _getMediaBuilders(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Media builders gotten"),e}catch(e){throw _printDatetime("Media builders failed to get"),e}}async getMediaBuilderItems(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting media builder items: "+t);try{var e=await _getMediaBuilderItems(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder items gotten: "+t),e}catch(e){throw _printDatetime("Media builder items failed to get: "+t),e}}async moveMediaBuilderItem(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Moving media builder: "+t);try{await _moveMediaBuilderItem(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Media builder moved: "+t)}catch(e){throw _printDatetime("Media builder failed to move: "+t),e}}async renderMediaBuilder(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Rendering media builder: "+t);try{var e=await _renderMediaBuilder(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Media builder rendered: "+t),e}catch(e){throw _printDatetime("Media builder failed to render: "+t),e}}async updateMediaBuilder(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating media builder: "+t);try{var o=await _updateMediaBuilder(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Media builder updated: "+t),o}catch(e){throw _printDatetime("Media builder failed to update: "+t),e}}async guestInvite(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Inviting guest");try{var r=await _guestInvite(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest invited"),r}catch(e){throw _printDatetime("Guest failed to invite: "+t),e}}async registerGuest(t,e,i,a){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Registering guest: "+t);try{var n=await _registerGuest(this.token,this.config.serviceApiUrl,t,e,i,a,this.debugMode);return _printDatetime("Guest registered: "+t),n}catch(e){throw _printDatetime("Guest failed to register: "+t),e}}async removeGuest(t,e,i,a,n){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Removing guest");try{var r=await _removeGuest(this.token,this.config.serviceApiUrl,t,e,i,a,n,this.debugMode);return _printDatetime("Guest removed"),r}catch(e){throw _printDatetime("Guest failed to remove: "+t),e}}async addSavedSearch(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Adding saved search");try{var w=await _addSavedSearch(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,this.debugMode);return _printDatetime("Saved search added"),w}catch(e){throw _printDatetime("Saved search failed to add"),e}}async deleteSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Deleting saved search: "+t);try{await _deleteSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode),_printDatetime("Saved search deleted: "+t)}catch(e){throw _printDatetime("Saved search failed to delete: "+t),e}}async getSavedSearch(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved search: "+t);try{var e=await _getSavedSearch(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Saved search gotten: "+t),e}catch(e){throw _printDatetime("Saved search failed to get: "+t),e}}async getSavedSearches(){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting saved searches");try{var e=await _getSavedSearches(this.token,this.config.serviceApiUrl,this.debugMode);return _printDatetime("Saved searches gotten"),e}catch(e){throw _printDatetime("Saved searches failed to get"),e}}async getSearchSaved(e,t,i,a,n,r,o,s,l,d){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved");try{var p=await _getSearchSaved(this.token,this.config.serviceApiUrl,e,t,i,a,n,r,o,s,l,d,this.debugMode);return _printDatetime("Search saved gotten"),p}catch(e){throw _printDatetime("Search saved failed to get"),e}}async getSearchSavedById(t){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting search saved by ID: "+t);try{var e=await _getSearchSavedById(this.token,this.config.serviceApiUrl,t,this.debugMode);return _printDatetime("Search saved by ID gotten: "+t),e}catch(e){throw _printDatetime("Search saved by ID failed to get: "+t),e}}async patchSavedSearch(t,e,i,a,n,r){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Patching saved search: "+t);try{var o=await _patchSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,this.debugMode);return _printDatetime("Saved search patched: "+t),o}catch(e){throw _printDatetime("Saved search failed to patch: "+t),e}}async updateSavedSearch(t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Updating saved search: "+t);try{var g=await _updateSavedSearch(this.token,this.config.serviceApiUrl,t,e,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,this.debugMode);return _printDatetime("Saved search updated: "+t),g}catch(e){throw _printDatetime("Saved search failed to update: "+t),e}}async getVideoTracking(t,e,i){if(null===this.token&&await this._init(),"portal"!==this.config.apiType)throw new Error("This function is only available for portal API type.");_printDatetime("Getting video tracking: "+t);try{await _getVideoTracking(this.token,this.config.serviceApiUrl,t,e,i,this.debugMode),_printDatetime("Video tracking gotten: "+t)}catch(e){throw _printDatetime("Video tracking failed to get: "+t),e}}async miscFunctions(t,i,a,n){null===this.token&&await this._init(),_printDatetime("Calling function: "+t);try{let e=this.config.serviceApiUrl+"/"+t;n&&(e=(e=(e=e.replace("/api","")).replace("app-api.","")).replace("admin-app.",""));var r=new Headers,o=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+this.token),this.debugMode&&(console.log(`URL: ${e}
2
+ METHOD: `+i),a)&&console.log("BODY: "+JSON.stringify(a,null,4)),{method:i,headers:r}),s=(a&&(o.body=JSON.stringify(a)),await fetch(e,o));if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"API call failed")}}}export default NomadMediaSDK;async function _cancelUpload(e,t,i,a){t+=`/api/asset/upload/${i}/cancel`,i=new Headers;i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
3
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Cancel asset upload failed")}}const MAX_CONCURRENT_PROMISES=8;async function _multiThreadUpload(a,n,r,e,o){var t=e.parts;const s=t.length;for(let e=0;e<s;e+=MAX_CONCURRENT_PROMISES){var i=t.slice(e,e+MAX_CONCURRENT_PROMISES).map(async(e,t)=>{console.log(`Uploading part ${t+1} of ${s}...`);var i=await _uploadPart(r,e,o);await _uploadPartComplete(a,n,e.id,i,o),console.log(`Uploaded part ${t+1} of ${s} successfully`)});await Promise.all(i)}}async function _startUpload(e,t,i,a,n,r,o,s,l,d){var t=t+"/api/asset/upload/start",p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{displayName:i||o.originalname,contentLength:o.size,uploadOverwriteOption:r,relativePath:o.originalname,parentId:s,chunkSize:8388608,relatedContentId:n,languageId:l,existingAssetId:a});d&&console.log(`URL: ${t}
4
+ METHOD: POST
5
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(c.ok)return await c.json();throw await c.json()}catch(e){_apiExceptionHandler(e,"Start Upload Failed")}}async function _startRelatedAssetUpload(e,t,i,a,n,r,o,s,l){t+="/api/asset/upload/start-related-asset";let d=o.size/1e4;d<20971520&&(d=20971520);var p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{contentLength:o.size,chunkSize:d,existingAssetId:i,languageId:s,newRelatedAssetMetadataType:n,relatedAssetId:a,relativePath:o.originalname,uploadOverwriteOption:r});l&&console.log(`URL: ${t}
6
+ METHOD: POST
7
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(c.ok)return await c.json();throw await c.json()}catch(e){_apiExceptionHandler(e,"Start Upload Failed")}}async function _completeUpload(e,t,i,a){t+=`/api/asset/upload/${i}/complete`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
8
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Complete Upload Failed")}}async function _uploadPartComplete(e,t,i,a,n){t+=`/api/asset/upload/part/${i}/complete`,i={etag:a},a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
9
+ METHOD: POST
10
+ BODY: `+JSON.stringify(i,null,4));try{var r=await fetch(t,{method:"POST",headers:a,body:JSON.stringify(i)});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Upload Part Complete Failed")}}import{Buffer}from"buffer";async function _uploadPart(e,i,a,n=3){for(let t=0;t<n;t++)try{var r=Buffer.from(e.buffer,"binary").slice(i.startingPostion,i.endingPosition+1),o=new Headers,s=(o.append("Accept","application/json, text/plain, */*"),a&&console.log(`URL: ${i.url}
11
+ METHOD: PUT`),await fetch(i.url,{method:"PUT",headers:o,body:r}));if(s.ok)return s.headers.get("ETag");throw await s.json()}catch(e){if(!(t<n-1)){_apiExceptionHandler(e,"Upload Part Failed");break}console.error(`Upload attempt ${t+1} failed. Retrying...`)}}async function _getAudit(e,t,i,a){t=t+"/api/admin/audit/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
12
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Audit Failed")}}async function _clearServerCache(e,t,i){var t=t+"/api/config/clearServerCache",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
13
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:a});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Clear Server Cache Failed")}}async function _getConfig(e,t,i,a){t=t+"/api/config?configType="+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
14
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Config Failed")}}async function _getServerTime(e,t,i){var t=t+"/api/config/serverTime",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
15
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Server Time Failed")}}async function _createContent(e,t,i,a,n){let r=t+"/api/content/new?contentDefinitionId="+i;t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),a&&(r+="&language="+a),n&&console.log(`URL: ${r}
16
+ METHOD: GET`);try{var o=await fetch(r,{method:"GET",headers:t});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Create Content Failed")}}async function _deactivateContentUserTrack(e,t,i,a,n,r,o){t=t+`/api/content/${n}/user-track/${a}/${i}/`+r,n=new Headers;n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),o&&console.log(`URL: ${t}
17
+ METHOD: POST`);try{var s=await fetch(t,{method:"POST",headers:n});if(!s.ok)throw await s.json()}catch(e){_apiExceptionHandler(e,"Deactivate User Track Failed")}}async function _deleteContent(e,t,i,a,n){t=t+`/api/content/${i}?contentDefinitionId=`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e);try{n&&console.log(`URL: ${t}
18
+ METHOD: DELETE`);var r=await fetch(t,{method:"DELETE",headers:i});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Content Failed")}}async function _getContentUserTrackTouch(e,t,i,a,n){t+=`/api/content/${a}/user-track/${i}/touch`,a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
19
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:a});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Content User Track Touch Failed")}}async function _getContentUserTrack(e,t,i,a,n,r,o,s,l){t=new URL(t+`/content/${a}/user-track/`+i),a=new URLSearchParams,a.append("sortColumn",n),a.append("isDesc",r),a.append("pageIndex",o),a.append("sizeIndex",s),t.search=a.toString(),i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),l&&console.log(`URL: ${t}
20
+ METHOD: GET`);try{var d=await fetch(t,{method:"GET",headers:i});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Get Content User Track Failed")}}async function _getContent(e,t,i,a,n,r){let o=t+`/api/content/${i}?contentDefinitionId=`+a;null!=n&&(o+="&isRevision="+n);t=new Headers;t.append("Authorization","Bearer "+e),t.append("Content-Type","application/json"),r&&console.log(`URL: ${o}
21
+ METHOD: GET`);try{var s=await fetch(o,{method:"GET",headers:t});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Get Content Failed")}}import deepEqual from"deep-equal";async function _updateContent(e,t,i,a,n,r,o){var s=t+"/api/content/"+i,l=new Headers;l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e);let d=null;try{(d=await _getContent(e,t,i,a,null,o)).contentDefinitionId!==a&&(d.contentDefinitionId=a),d.contentId!==i&&(d.contentId=i),d.languageId!==r&&(d.languageId=r),_updateProperties(d,n)}catch(e){d={contentDefinitionId:a,contentId:i,languageId:r,properties:n}}o&&console.log(`URL: ${s}
22
+ METHOD: PUT
23
+ BODY: `+JSON.stringify(d,null,4));try{var p=await fetch(s,{method:"PUT",headers:l,body:JSON.stringify(d)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Update Content Failed")}}function _updateProperties(t,i){for(const a in i)if(Array.isArray(i[a]))for(let e=0;e<i[a].length;++e)deepEqual(t.properties[a][e],i[a][e])||(t.properties[a][e]=i[a][e]);else"object"==typeof i[a]?deepEqual(t.properties[a],i[a])||(t.properties[a]=i[a]):t.properties[a]!==i[a]&&(t.properties[a]=i[a])}async function _addLiveScheduleToEvent(e,t,i,a,n,r,o,s,l,d,p,c,h,u){var t=t+"/api/admin/liveSchedule",f=new Headers,e=(f.append("Content-Type","application/json"),f.append("Authorization","Bearer "+e),{contentId:i,slateVideo:null!==a?a:"",prerollVideo:null!==n?n:"",postrollVideo:null!==r?r:"",isSecureOutput:null!==o?o:"",archiveFolderAsset:null!==s?s:"",primaryLiveInput:null!==l?l:"",backupLiveInput:null!==d?d:"",primaryLivestreamInputUrl:null!==p?p:"",backupLivestreamInputUrl:null!==c?c:"",externalOutputProfiles:null!==h?h:""});u&&console.log(`URL: ${t}
24
+ METHOD: POST
25
+ BODY: `+JSON.stringify(e,null,4));try{var y=await fetch(t,{method:"POST",headers:f,body:JSON.stringify(e)});if(!y.ok)throw await y.json()}catch(e){_apiExceptionHandler(e,"Adding Live Schedule to Event Failed")}}async function _createAndUpdateEvent(e,t,i,a,n,r,o,s,l,d,p,c,h){var u=new Headers;if(u.append("Content-Type","application/json"),u.append("Authorization","Bearer "+e),!i){e=t+"/api/content/new?contentDefinitionId="+a;h&&console.log(`URL: ${e}
26
+ METHOD: GET`);try{var f=await fetch(e,{method:"GET",headers:u});if(!f.ok)throw await f.json();i=(await f.json()).contentId}catch(e){_apiExceptionHandler(e,"Get Content ID Failed")}}e=t+"/api/content/"+i,(c=c&&p?c:{}).name=n||l&&l.description,c.startDatetime=r,c.endDatetime=o,c.eventType=s,l&&(c.series=l),c.disabled=d,c.overideSeriesDetails=p,f={contentId:i,contentDefinitionId:a,properties:c};h&&console.log(`URL: ${e}
27
+ METHOD: PUT
28
+ BODY: `+JSON.stringify(f,null,4));try{var y=await fetch(e,{method:"PUT",headers:u,body:JSON.stringify(f)});if(y.ok)return await y.json();throw await y.json()}catch(e){_apiExceptionHandler(e,"Create and Update Event Instance Failed")}}async function _deleteEvent(e,t,i,a,n){t=t+`/api/content/${i}?contentDefinitionId=`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
29
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Event Failed")}}async function _extendLiveSchedule(e,t,i,a,n,r,o){t+=`/api/admin/liveSchedule/content/${i}/copy`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={endDate:null!==r?r:"",recurringDays:a,recurringWeeks:n,timeZoneOffsetSeconds:-60*(new Date).getTimezoneOffset()};o&&console.log(`URL: ${t}
30
+ METHOD: POST
31
+ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(!s.ok)throw await s.json()}catch(e){_apiExceptionHandler(e,"Extending Live Schedule Failed")}}async function _getLiveSchedule(e,t,i,a){t=t+"/api/admin/liveSchedule/content/"+i,i=new Headers;i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
32
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(!n.ok)throw await n.json();try{return await n.json()}catch(e){return!1}}catch(e){_apiExceptionHandler(e,"Get Live Schedule Failed")}}async function _startLiveSchedule(e,t,i,a){t+=`/api/admin/liveSchedule/content/${i}/start`,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
33
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Start Live Schedule Failed")}}async function _stopLiveSchedule(e,t,i,a){t+=`/api/admin/liveSchedule/content/${i}/stop`,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
34
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Stop Live Schedule Failed")}}async function _clipLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c,h){t+=`/api/liveChannel/${i}/clip`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={startTimeCode:a,endTimeCode:n,title:r,outputFolderId:o,tags:s,collections:l,relatedContent:d,videoBitrate:p,audioTracks:c};h&&console.log(`URL: ${t}
35
+ METHOD: POST
36
+ BODY: `+JSON.stringify(e,null,4));try{var u=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(!u.ok)throw await u.json()}catch(e){_apiExceptionHandler(e,"Clip Live Channel Failed")}}async function _createLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c,h,u){var f=t+"/api/liveChannel",y=new Headers,i=(y.append("Content-Type","application/json"),y.append("Authorization","Bearer "+e),{name:i,routeName:_slugify(i),enableHighAvailability:r,enableLiveClipping:o,externalOutputProfiles:c,isSecureOutput:s,outputScreenshots:l,type:{id:_LIVE_CHANNEL_TYPES[d],descrption:d}});a&&(i.thumbnailImage={id:a}),n&&(i.archiveFolderAsset={id:n}),"External"===d&&(i.externalUrl=p),h&&(r=await _getSecurityGroups(e,t,u),i.securityGroups=r.filter(e=>h.includes(e.description)).map(e=>({description:e.description,id:e.id}))),u&&console.log(`URL: ${f}
37
+ METHOD: POST
38
+ BODY: `+JSON.stringify(i,null,4));try{var w,g=await fetch(f,{method:"POST",headers:y,body:JSON.stringify(i)});if(g.ok)return await _waitForLiveChannelStatus(e,t,(w=await g.json()).id,_LIVE_CHANNEL_STATUSES.Idle,120,2,u),w;throw await g.json()}catch(e){_apiExceptionHandler(e,"Create Live Channel Failed")}}async function _deleteLiveChannel(t,e,i,a,n){e=e+"/api/liveChannel/"+i;let r=null;r=!0===a?(n&&console.log("Getting Live Channel Inputs IDs..."),await _getLiveChannelInputsIds(t,i)):null;i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+t),n&&console.log(`URL: ${e}
39
+ METHOD: DELETE`);try{var o=await fetch(e,{method:"DELETE",headers:i});if(!o.ok)throw await o.json();if(a&&r&&0<r.length){n&&console.log("Deleting Live Channel Live Inputs...");for(let e=0;e<r.length;e++)await _deleteLiveInput(t,r[e])}}catch(e){_apiExceptionHandler(e,"Delete Live Channel Failed")}}async function _getLiveChannelInputsIds(e,t,i,a){const n=[];a&&console.log("Getting Live Channel Schedule Events...");e=await _getLiveChannelScheduleEvents(e,t,i,a);return e&&0<e.length&&e.forEach(e=>{e&&e.liveInput&&null!=e.liveInput&&e.liveInput.lookupId&&n.push(e.liveInput.lookupId)}),n}async function _getLiveChannelScheduleEvents(e,t,i,a){t+=`/api/liveChannel/${i}/liveScheduleEvent`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
40
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Channel Schedule Events Failed")}}async function _getLiveChannelStatusMessage(e,t,i,a){a&&console.log("Getting Live Channel...");e=await _getLiveChannel(e,t,i,a);return!!(e&&e.statusMessages&&0<e.statusMessages.length)&&e.statusMessages[0]}async function _getLiveChannelStatus(e,t,i,a){a&&console.log("Getting Live Channel...");e=await _getLiveChannel(e,t,i,a);return e?e.status.description:"Deleted"}async function _getLiveChannel(e,t,i,a){t=t+"/api/liveChannel/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
41
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Channel Failed")}}async function _getLiveChannels(e,t,i){var t=t+"/api/liveChannel",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
42
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Channels Failed")}}async function _getSecurityGroups(e,t,i){var t=t+"/api/lookup/22?lookupKey=99e8767a-00ba-4758-b9c2-e07b52c47016",a=new Headers;a.append("Authorization","Bearer "+e),a.append("Content-Type","application/json"),i&&console.log(`URL: ${t}
43
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return(await n.json()).items;throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Security Groups Failed")}}async function _liveChannelRefresh(e,t,i){var t=t+"/api/liveChannel/refresh",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
44
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:a});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Refresh Live Channel Failed")}}const _SECURITY_GROUPS={"Content Manager":"e81e25ba-b6ab-4676-980c-f51385008eb3",Everyone:"740ea96a-9c15-4c2e-ba1a-050ea893514b",Guest:"8354ce06-deeb-4da9-a190-af0eca8d9f56"},_LIVE_CHANNEL_STATUSES={CreateFailed:"Create Failed",Creating:"Creating",Deleted:"Deleted",Deleting:"Deleting",Error:"Error",Idle:"Idle",New:"New",Pause:"Pause",Recovering:"Recovering",Running:"Running",Starting:"Starting",Stopping:"Stopping",Unmanaged:"Unmanaged",UpdateFailed:"Update Failed",Updating:"Updating"},_LIVE_CHANNEL_TYPES={External:"2bf01dd4-0a9c-4168-a61b-27e135732103",IVS:"2bf01dd4-0a9c-4168-a61b-27e135732102",Normal:"2bf01dd4-0a9c-4168-a61b-27e135732100",Realtime:"2bf01dd4-0a9c-4168-a61b-27e135732104"};async function _nextEvent(e,t,i,a){t+=`/api/liveChannel/${i}/nextEvent`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
45
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Start Output Tracking Failed")}}async function _startLiveChannel(e,t,i,a,n){var r=t+`/api/liveChannel/${i}/start`,o=new Headers;o.append("Content-Type","application/json"),o.append("Authorization","Bearer "+e),n&&console.log(`URL: ${r}
46
+ METHOD: POST`);try{var s=await fetch(r,{method:"POST",headers:o});if(!s.ok)throw await s.json();!1!==a&&await _waitForLiveChannelStatus(e,t,i,_LIVE_CHANNEL_STATUSES.Running,1200,20)}catch(e){_apiExceptionHandler(e,"Start Live Channel Failed")}}async function _startOutputTracking(e,t,i,a){t+=`/api/liveChannel/${i}/startOutputTracking`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
47
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Start Output Tracking Failed")}}async function _stopLiveChannel(e,t,i,a,n){var r=t+`/api/liveChannel/${i}/stop`,o=new Headers;o.append("Authorization","Bearer "+e),n&&console.log(`URL: ${r}
48
+ METHOD: POST`);try{var s=await fetch(r,{method:"POST",headers:o});if(!s.ok)throw await s.json();!1!==a&&await _waitForLiveChannelStatus(e,t,i,_LIVE_CHANNEL_STATUSES.Idle,1200,20,n)}catch(e){_apiExceptionHandler(e,"Stop Live Channel Failed")}}async function _updateLiveChannel(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f){var i=await _getLiveChannel(e,t,i,f),y=t+"/api/liveChannel",w=new Headers;w.append("Content-Type","application/json"),w.append("Authorization","Bearer "+e);a&&a!==i.name&&(i.name=a,i.routeName=_slugify(a)),n&&n!==i.thumbnailImage&&(i.thumbnailImage={id:n}),r&&r!==i.archiveFolderAsset.id&&(i.archiveFolderAsset={id:r}),o&&o!==i.enableHighAvailability&&(i.enableHighAvailability=o),s&&s!==i.enableLiveClipping&&(i.enableLiveClipping=s),l&&l!==i.isSecureOutput&&(i.isSecureOutput=l),d&&d!==i.outputScreenshots&&(i.outputScreenshots=d),p&&_LIVE_CHANNEL_STATUSES[p]!==i.type.id&&(i.type={id:_LIVE_CHANNEL_TYPES[p]}),h&&h!==i.externalOutputProfiles&&(i.externalOutputProfiles=h),"External"===p?c&&c!==i.externalUrl&&(i.externalUrl=c):c&&i.externalUrl&&delete i.externalUrl,u&&(a=(await _getSecurityGroups(e,t,f)).filter(e=>u.includes(e.description)).map(e=>({description:e.description,id:e.id})))!==i.securityGroups&&(i.securityGroups=a),f&&console.log(`URL: ${y}
49
+ METHOD: POST
50
+ BODY: `+JSON.stringify(i,null,4));try{var g,m=await fetch(y,{method:"PUT",headers:w,body:JSON.stringify(i)});if(m.ok)return await _waitForLiveChannelStatus(e,t,(g=await m.json()).id,_LIVE_CHANNEL_STATUSES.Idle,120,2,f),g;throw await m.json()}catch(e){_apiExceptionHandler(e,"Updating Live Channel Failed")}}async function _waitForLiveChannelStatus(e,t,i,a,n=30,r=2,o){var s=(new Date).getTime();let l=0;for(;l<n;){var d=await _getLiveChannelStatus(e,t,i,o);if(d===a)return void(o&&console.log(`Live Channel [${i}] transitioned to status [${a}]`));if(console.log(`Live Channel [${i}] current status is [${d}]`),"Error"===d)throw d=await _getLiveChannelStatusMessage(e,t,i,o),new Error(`Live Channel [${i}] is in [Error] status: `+d);if(l=((new Date).getTime()-s)/1e3,o&&console.log(`Waiting for Live Channel [${i}] to transition to status [${a}]... [${Math.round(l)}/${n}]`),l>n)break;await _sleep(r)}throw new Error(`Waiting for Live Channel [${i}] to transition to status [${a}] timed out`)}async function _createLiveInput(e,t,i,a,n,r,o,s,l,d){var p=t+"/api/liveInput",c=new Headers,i=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),{name:i,internalName:_slugify(i),type:{id:_LIVE_INPUT_TYPES[n],description:n}});"RTMP_PUSH"==n?a&&(i.sourceCidr=a):"RTMP_PULL"!==n&&"RTP_PUSH"!==n&&"URL_PULL"!==n||a&&(i.sources=[{url:a}]),r&&(i.isStandard=r),o&&(i.videoAsset={id:o}),s&&(i.destinations=s),l&&(i.sources=l),d&&console.log(`URL: ${p}
51
+ METHOD: POST
52
+ BODY: `+JSON.stringify(i,null,4));try{var h=await fetch(p,{method:"POST",headers:c,body:JSON.stringify(i)}),u=await h.json();if(h.ok)return await _waitForLiveInputStatus(e,t,u.id,_LIVE_INPUT_STATUSES.Detached,15,1,d),u;throw await h.json()}catch(e){_apiExceptionHandler(e,"Creating Live Input Failed")}}async function _deleteLiveInput(e,t,i,a){t=t+"/api/liveInput/"+i,i=new Headers;i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
53
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Live Input Failed")}}async function _getLiveInputStatusMessage(e,t,i,a){a&&console.log("Getting Live Input...");e=await _getLiveInput(e,t,i,a);return e&&e.statusMessage&&e.statusMessage?e.statusMessage:""}async function _getLiveInputStatus(e,t,i,a){a&&console.log("Getting Live Input...");e=await _getLiveInput(e,t,i,a);return e?e.status.description:"Deleted"}async function _getLiveInput(e,t,i,a){t=t+"/api/liveInput/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
54
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Input Failed")}}async function _getLiveInputs(e,t,i){var t=t+"/api/liveInput",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
55
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Inputs Failed")}}const _LIVE_INPUT_STATUSES={Attached:"Attached",Attaching:"Attaching",CreateFailed:"Create Failed",Creating:"Creating",Deleted:"Deleted",Deleting:"Deleting",Detached:"Detached",Detaching:"Detaching",Error:"Error",Paused:"Paused",Updating:"Updating"},_LIVE_INPUT_TYPES={RTMP_PULL:"78acb07d-ba87-48fa-ad8f-c00e318a1254",RTMP_PUSH:"78acb07d-ba87-48fa-ad8f-c00e318a1253",RTP_PUSH:"78acb07d-ba87-48fa-ad8f-c00e318a1252",UDP_PUSH:"78acb07d-ba87-48fa-ad8f-c00e318a1251",URL_PULL:"78acb07d-ba87-48fa-ad8f-c00e318a1255"};async function _updateLiveInput(e,t,i,a,n,r,o,s,l,d,p){var i=await _getLiveInput(e,t,i,p),c=t+"/api/liveInput",h=new Headers;h.append("Content-Type","application/json"),h.append("Authorization","Bearer "+e);a&&a!==i.name&&(i.name=a,i.internalName=_slugify(a)),r&&_LIVE_INPUT_TYPES[r]!==i.type.id&&(i.type={id:_LIVE_INPUT_TYPES[r]}),"RTMP_PUSH"==r?(n&&n!==i.sourceCidr&&(i.sourceCidr=n),i.sources&&delete i.sources):"RTMP_PULL"===r||"RTP_PUSH"===r||"URL_PULL"===r?(n&&n!==i.sources&&(i.sources=[{url:n}]),i.sourceCidr&&delete i.sourceCidr):(i.sourceCidr&&delete i.sourceCidr,i.sources&&delete i.sources),o&&o!==i.isStandard&&(i.isStandard=o),s&&s!==i.videoAsset.id&&(i.videoAsset={id:s}),l&&l!==i.destinations&&(i.destinations=l),d&&d!==i.SOURCES&&(i.sources=d),p&&console.log(`URL: ${c}
56
+ METHOD: PUT
57
+ BODY: `+JSON.stringify(i,null,4));try{var u,f=await fetch(c,{method:"PUT",headers:h,body:JSON.stringify(i)});if(f.ok)return await _waitForLiveInputStatus(e,t,(u=await f.json()).id,_LIVE_INPUT_STATUSES.Detached,15,1,p),u;throw await f.json()}catch(e){_apiExceptionHandler(e,"Updating Live Input Failed")}}async function _waitForLiveInputStatus(e,t,i,a,n=30,r=2,o){var s=(new Date).getTime();let l=0;for(;l<n;){var d=await _getLiveInputStatus(e,t,i,o);if(d===a)return void(o&&console.log(`Live Input ${i} transitioned to status `+a));if(console.log(`Live Input [${i}] is in status [${d}]`),"Error"===d)throw d=await _getLiveInputStatusMessage(e,i,o),new Error(`Live Input ${i} is in Error status: `+d);if(l=((new Date).getTime()-s)/1e3,o&&console.log(`Waiting for Live Input [${i}] to transition to status [${a}]... [${Math.round(l)}/${n}]`),l>n)break;await _sleep(r)}throw new Error(`Waiting for Live Input [${i}] to transition to status [${a}] timed out`)}async function _cancelBroadcast(e,t,i,a){var n=t+`/api/admin/liveOperator/${i}/cancel`,r=new Headers;r.append("Authorization","Bearer "+e),r.append("Content-Type","application/json"),a&&console.log(`URL: ${n}
58
+ METHOD: POST`);try{var o=await fetch(n,{method:"POST",headers:r});if(!o.ok)throw await o.json();await _waitForLiveOperatorStatus(e,t,i,"Idle",1200,20)}catch(e){_apiExceptionHandler(e,"Cancel Broadcast Failed")}}async function _cancelSegment(e,t,i,a){t+=`/api/admin/liveOperator/${i}/cancelSegment`,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
59
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Cancel Segment Failed")}}async function _completeSegment(e,t,i,a,n,r){var t=t+`/api/admin/liveOperator/${i}/completeSegment`,o=new Headers,e=(o.append("Authorization","Bearer "+e),o.append("Content-Type","application/json"),{liveOperatorId:i});a&&Array.isArray(a)&&0<a.length&&(e.relatedContent=a.map(e=>({id:e}))),n&&Array.isArray(n)&&0<n.length&&(e.tags=n.map(e=>({id:e}))),r&&console.log(`URL: ${t}
60
+ METHOD: POST
61
+ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok)throw await s.json()}catch(e){_apiExceptionHandler(e,"Complete Segment Failed")}}async function _getCompletedSegments(e,t,i,a){t+=`/api/admin/liveOperator/${i}/segments`,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
62
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Completed Segments Failed")}}async function _getLiveOperator(e,t,i,a){t=t+"/api/admin/liveOperator/"+i,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
63
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Operator Failed")}}async function _getLiveOperators(e,t,i){var t=t+"/api/admin/liveOperator",a=new Headers;a.append("Authorization","Bearer "+e),a.append("Content-Type","application/json"),i&&console.log(`URL: ${t}
64
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Operators Failed")}}async function _startBroadcast(e,t,i,a,n,r,o,s,l){var d=t+"/api/admin/liveOperator/start",p=new Headers,c=(p.append("Authorization","Bearer "+e),p.append("Content-Type","application/json"),{id:i});a&&(c.prerollAsset={id:a}),n&&(c.postrollAsset={id:n}),r&&(c.liveInput={id:r}),o&&Array.isArray(o)&&0<o.length&&(c.relatedContent=o.map(e=>({id:e}))),s&&Array.isArray(s)&&0<s.length&&(c.tags=s.map(e=>({id:e}))),l&&console.log(`URL: ${d}
65
+ METHOD: POST
66
+ BODY: `+JSON.stringify(c,null,4));try{var h=await fetch(d,{method:"POST",headers:p,body:JSON.stringify(c)});if(h.ok)return await _waitForLiveOperatorStatus(e,t,i,"Running",1200,20),await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Start Broadcast Failed")}}async function _startSegment(e,t,i,a){t+=`/api/admin/liveOperator/${i}/startSegment`,i=new Headers;i.append("Authorization","Bearer "+e),i.append("Content-Type","application/json"),a&&console.log(`URL: ${t}
67
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Start Segment Failed")}}async function _stopBroadcast(e,t,i,a){var n=t+`/api/admin/liveOperator/${i}/stop`,r=new Headers;r.append("Authorization","Bearer "+e),r.append("Content-Type","application/json"),a&&console.log(`URL: ${n}
68
+ METHOD: POST`);try{var o=await fetch(n,{method:"POST",headers:r});if(!o.ok)throw await o.json();await _waitForLiveOperatorStatus(e,t,i,"Idle",1200,20)}catch(e){_apiExceptionHandler(e,"Stop Broadcast Failed")}}async function _waitForLiveOperatorStatus(e,t,i,a,n=30,r=2,o){var s=(new Date).getTime();let l=0;for(;l<n;){var d=(await _getLiveOperator(e,t,i,o)).liveChannelStatus.description;if(d===a)return void(o&&console.log(`Live Operator ${i} transitioned to status `+a));if(console.log(`Live Operator [${i}] is in status [${d}]`),"Error"===d)throw new Error(`Live Operator ${i} is broken`);if(l=((new Date).getTime()-s)/1e3,o&&console.log(`Waiting for Live Operator [${i}] to transition to status [${a}]... [${Math.round(l)}/${n}]`),l>n)break;await _sleep(r)}throw new Error(`Waiting for Live Operator [${i}] to transition to status [${a}] timed out`)}async function _createLiveOutputProfileGroup(e,t,i,a,n,r,o,s,l,d){var t=t+"/api/liveOutputProfileGroup",p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{name:i,enabled:a,manifestType:n,isDefaultGroup:r,outputType:o,archiveOutputProfile:s,outputProfiles:l});d&&console.log(`API_URL: ${t}
69
+ METHOD: POST
70
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(c.ok)return await c.json();throw new Error}catch(e){_apiExceptionHandler(e,"Create Live Output Profile Group Failed")}}async function _deleteLiveOutputProfileGroup(e,t,i,a){t=t+"/api/liveOutputProfileGroup/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`API_URL: ${t}
71
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(n.ok)return await n.json();throw new Error}catch(e){_apiExceptionHandler(e,"Delete Live Output Profile Group Failed")}}async function _getLiveOutputProfileGroup(e,t,i,a){t=t+"/api/liveOutputProfileGroup/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`API_URL: ${t}
72
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw new Error}catch(e){_apiExceptionHandler(e,"Get Live Output Profile Group Failed")}}async function _getLiveOutputProfileGroups(e,t,i){var t=t+"/api/liveOutputProfileGroup",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`API_URL: ${t}
73
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw new Error}catch(e){_apiExceptionHandler(e,"Get Live Output Profile Groups Failed")}}async function _updateLiveOutputProfileGroup(e,t,i,a,n,r,o,s,l,d,p){var c=t+"/api/liveOutputProfileGroup",h=new Headers,e=(h.append("Content-Type","application/json"),h.append("Authorization","Bearer "+e),await _getLiveOutputProfileGroup(e,t,i,p)),t={id:i||e.id,name:a||e.name,isEnabled:n||e.isEnabled,manifestType:r||e.manifestType,isDefaultGroup:o||e.isDefaultGroup,outputType:s||e.outputType,archiveOutputProfile:l||e.archiveOutputProfile,outputProfiles:d||e.outputProfiles};p&&console.log(`API_URL: ${c}
74
+ METHOD: PUT
75
+ BODY: `+JSON.stringify(t,null,4));try{var u=await fetch(c,{method:"PUT",headers:h,body:JSON.stringify(t)});if(u.ok)return await u.json();throw new Error}catch(e){_apiExceptionHandler(e,"Update Live Output Profile Group Failed")}}async function _createLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){var t=t+"/api/liveOutputProfile",g=new Headers,e=(g.append("Content-Type","application/json"),g.append("Authorization","Bearer "+e),{name:i,outputType:a,enabled:n,audioBitrate:r,outputStreamKey:o,outputUrl:s,secondaryOutputStreamKey:l,secondaryOutputUrl:d,videoBitrate:p,videoBitrateMode:c,videoCodec:h,videoFramesPerSecond:u,videoHeight:f,videoWidth:y});w&&console.log(`URL: ${t}
76
+ METHOD: POST
77
+ BODY: `+JSON.stringify(e,null,4));try{var m=await fetch(t,{method:"POST",headers:g,body:JSON.stringify(e)});if(m.ok)return await m.json();throw await m.json()}catch(e){_apiExceptionHandler(e,"Create Live Output Profile Failed")}}async function _deleteLiveOutputProfile(e,t,i,a){t=t+"/api/liveOutputProfile/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
78
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Live Output Profile Failed")}}async function _getLiveOutputProfile(e,t,i,a){t=t+"/api/liveOutputProfile/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
79
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Output Profile Failed")}}async function _getLiveOutputProfiles(e,t,i){var t=t+"/api/liveOutputProfile",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
80
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Live Output Profiles Failed")}}async function _getLiveOutputTypes(e,t,i){var t=t+"/api/lookup/117",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
81
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Output Types Failed")}}async function _updateLiveOutputProfile(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g){var m=t+"/api/liveOutputProfile/"+i,v=new Headers,e=(v.append("Content-Type","application/json"),v.append("Authorization","Bearer "+e),await _getLiveOutputProfile(e,t,i,g)),t={name:a||e.name,outputType:n||e.outputType,enabled:r||e.enabled,audioBitrate:o||e.audioBitrate,outputStreamKey:s||e.outputStreamKey,outputUrl:l||e.outputUrl,secondaryOutputStreamKey:d||e.secondaryOutputStreamKey,secondaryOutputUrl:p||e.secondaryOutputUrl,videoBitrate:c||e.videoBitrate,videoBitrateMode:h||e.videoBitrateMode,videoCodec:u||e.videoCodec,videoFramesPerSecond:f||e.videoFramesPerSecond,videoHeight:y||e.videoHeight,videoWidth:w||e.videoWidth};g&&console.log(`URL: ${m}
82
+ METHOD: PUT
83
+ BODY: `+JSON.stringify(t,null,4));try{var _=await fetch(m,{method:"PUT",headers:v,body:JSON.stringify(t)});if(!_.ok)throw await _.json()}catch(e){_apiExceptionHandler(e,"Update Live Output Profile Failed")}}async function _addAssetScheduleEvent(e,t,i,a,n,r,o,s){var t=t+`/api/LiveChannel/${i}/liveScheduleEvent`,l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{isLoop:n,channelId:i,durationTimeCode:r,previousId:o,type:{id:_eventType.videoAsset,description:"Video Asset"},asset:a});s&&console.log(`URL: ${t}
84
+ METHOD: POST
85
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(d.ok)return(await d.json()).changeList[0];throw await d.json()}catch(e){_apiExceptionHandler(e,"Adding Asset Schedule Event Failed")}}async function _addInputScheduleEvent(e,t,i,a,n,r,o,s){var t=t+`/api/LiveChannel/${i}/liveScheduleEvent`,l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{channelId:i,fixedOnAirTimeUtc:r,type:{id:_eventType.liveInput,description:"Live Input"},liveInput:a,previousId:o});n&&(e.liveInput2=n),s&&console.log(`URL: ${t}
86
+ METHOD: POST
87
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(d.ok)return(await d.json()).changeList[0];throw await d.json()}catch(e){_apiExceptionHandler(e,"Adding Input Schedule Event Failed")}}const _eventType={liveInput:"eef7ef23-56dc-4f48-8c0e-1f4d52990405",videoAsset:"eef7ef23-56dc-4f48-8c0e-1f4d52990404"};async function _getAssetScheduleEvent(e,t,i,a,n){t=t+`/api/liveChannel/${i}/liveScheduleEvent/`+a,i=new Headers;i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
88
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(!r.ok)throw await r.json();try{return await r.json()}catch(e){return!1}}catch(e){_apiExceptionHandler(e,"Get Asset Schedule Event Failed")}}async function _getInputScheduleEvent(e,t,i,a,n){t=t+`/api/liveChannel/${i}/liveScheduleEvent/`+a,i=new Headers;i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
89
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(!r.ok)throw await r.json();try{return await r.json()}catch(e){return!1}}catch(e){_apiExceptionHandler(e,"Get Asset Schedule Event Failed")}}async function _moveScheduleEvent(e,t,i,a,n,r){t+=`/api/liveChannel/${i}/liveScheduleEvent/${a}/move`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a={previousScheduleEventId:n};r&&console.log(`URL: ${t}
90
+ METHOD: PUT`);try{var o=await fetch(t,{method:"PUT",headers:i,body:JSON.stringify(a)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Move Live Schedule Event Failed")}}async function _removeAssetScheduleEvent(e,t,i,a,n){t=t+`/api/LiveChannel/${i}/liveScheduleEvent/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
91
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Remove Asset Schedule Event Failed")}}async function _removeInputScheduleEvent(e,t,i,a,n){t=t+`/api/liveChannel/${i}/liveScheduleEvent/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
92
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"delete",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Remove Input Schedule Event Failed")}}async function _updateAssetScheduleEvent(e,t,i,a,n,r,o,s){var l=await _getAssetScheduleEvent(e,t,a,i,s),t=t+`/api/LiveChannel/${a}/liveScheduleEvent`,d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),{type:{id:_eventType.videoAsset,description:"Video Asset"}});e.id=i&&i!==l.id?i:l.id,e.isLoop=r&&r!==l.isLoop?r:l.isLoop,e.channelId=a&&a!==l.channelId?a:l.channelId,e.durationTimeCode=o&&o!==l.durationTimeCode?o:l.durationTimeCode,e.asset=n&&n!==l.asset?n:l.asset,s&&console.log(`URL: ${t}
93
+ METHOD: PUT
94
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"PUT",headers:d,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Updating Asset Schedule Event Failed")}}async function _updateInputScheduleEvent(e,t,i,a,n,r,o,s){var l=await _getInputScheduleEvent(e,t,a,i,s),t=t+`/api/LiveChannel/${a}/liveScheduleEvent`,d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),{type:{id:_eventType.liveInput,description:"Live Input"}});e.id=i&&i!==l.id?i:l.id,e.channelId=a&&a!==l.channelId?a:l.channelId,e.fixedOnAirTimeUtc=o&&o!==l.fixedOnAirTimeUtc?o:l.fixedOnAirTimeUtc,e.liveInput=n&&n!==l.liveInput?n:l.liveInput,e.liveInput2=r&&r!==l.liveInput2?r:l.liveInput2,s&&console.log(`URL: ${t}
95
+ METHOD: PUT
96
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"PUT",headers:d,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Updating Input Schedule Event Failed")}}async function _createIntelligentPlaylist(t,i,e,a,n,r,o,s,l,d,p,c,h){var u=i+"/api/admin/schedule",f=new Headers,r=(f.append("Content-Type","application/json"),f.append("Authorization","Bearer "+t),{name:r,scheduleType:"4",thumbnailAsset:c});h&&console.log(`URL: ${u}
97
+ METHOD: POST
98
+ BODY: `+JSON.stringify(r));let y=null;try{var w=await fetch(u,{method:"POST",headers:f,body:JSON.stringify(r)});if(!w.ok)throw await w.json();y=await w.json()}catch(e){_apiExceptionHandler(e,"Create Intelligent Playlist Failed")}c=u+`/${y.id}/item`,r={collections:e,endSearchDate:a,endSearchDurationInMinutes:n,relatedContent:o,scheduleItemType:"2",searchDate:s,searchDurationInMinutes:l,searchFilterType:d,sourceType:"2",tags:p};h&&console.log(`URL: ${c}
99
+ METHOD: POST
100
+ BODY: `+JSON.stringify(r));try{var g=await fetch(c,{method:"POST",headers:f,body:JSON.stringify(r)});if(!g.ok)throw await g.json();var m,v=await g.json();for(m in y)v[m]=y[m];return v}catch(e){await _deleteIntelligentPlaylist(t,i,y.id,h),_apiExceptionHandler(e,"Create Intelligent Playlist Failed")}}async function _createIntelligentSchedule(e,t,i,a,n,r,o){var t=t+"/api/admin/schedule",s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{defaultVideoAsset:i,name:a,scheduleType:3,thumbnailAsset:n,timeZoneId:r});o&&console.log(`URL: ${t}
101
+ METHOD: POST
102
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Create Intelligent Schedule Failed")}}async function _createPlaylistVideo(e,t,i,a,n,r){t+=`/api/admin/schedule/${i}/item`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={asset:a,previousItem:n};r&&console.log(`URL: ${t}
103
+ METHOD: POST
104
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Create Playlist Video Failed")}}async function _createPlaylist(e,t,i,a,n,r,o){var t=t+"/api/admin/schedule",s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{defaultVideoAsset:r,loopPlaylist:n,name:i,scheduleType:"1",thumbnailAsset:a});o&&console.log(`URL: ${t}
105
+ METHOD: POST
106
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Create Playlist Failed")}}async function _createScheduleItemAsset(e,t,i,a,n,r,o,s,l,d){t+=`/api/admin/schedule/${i}/item`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={asset:a,days:n,durationTimeCode:r,endTimeCode:o,previousItem:s,scheduleItemType:"1",sourceType:"3",timeCode:l};d&&console.log(`URL: ${t}
107
+ METHOD: POST
108
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Create Schedule Item Failed")}}async function _createScheduleItemLiveChannel(e,t,i,a,n,r,o,s,l,d){t+=`/api/admin/schedule/${i}/item`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={days:a,durationTimeCode:n,endTimeCode:r,liveChannel:o,previousItem:s,scheduleItemType:"1",sourceType:"4",timeCode:l};d&&console.log(`URL: ${t}
109
+ METHOD: POST
110
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Create Schedule Item Failed")}}async function _createScheduleItemPlaylistSchedule(e,t,i,a,n,r,o,s,l,d){t+=`/api/admin/schedule/${i}/item`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={days:a,durationTimeCode:n,endTimeCode:r,playlistSchedule:o,previousItem:s,scheduleItemType:"2",sourceType:"1",timeCode:l};d&&console.log(`URL: ${t}
111
+ METHOD: POST
112
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Create Schedule Item Failed")}}async function _createScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){t+=`/api/admin/schedule/${i}/item`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={collections:a,days:n,durationTimeCode:r,endSearchDate:o,endSearchDuratonInMinutes:s,endTimeCode:l,previousItem:d,relatedContent:p,scheduleItemType:"1",searchDate:c,searchDurationInMinutes:h,searchFilterType:u,sourceType:"2",tags:f,timeCode:y};w&&console.log(`URL: ${t}
113
+ METHOD: POST
114
+ BODY: `+JSON.stringify(e,null,4));try{var g=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(g.ok)return await g.json();throw await g.json()}catch(e){_apiExceptionHandler(e,"Create Schedule Item Failed")}}async function _deleteIntelligentPlaylist(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
115
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Intelligent Playlist Failed")}}async function _deleteIntelligentSchedule(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
116
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Intelligent Schedule Failed")}}async function _deletePlaylist(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
117
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Playlist Failed")}}async function _deleteScheduleItem(e,t,i,a,n){t=t+`/api/admin/schedule/${i}/item/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
118
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Schedule Item Failed")}}async function _getIntelligentPlaylist(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
119
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Intelligent Playlist Failed")}}async function _getIntelligentSchedule(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
120
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Schedule Failed")}}async function _getPlaylist(e,t,i,a){t=t+"/api/admin/schedule/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
121
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Playlist Failed")}}async function _getScheduleItem(e,t,i,a,n){t=t+`/api/admin/schedule/${i}/item/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
122
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Schedule Item Failed")}}async function _getScheduleItems(e,t,i,a){t+=`/api/admin/schedule/${i}/items`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
123
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Schedule Items Failed")}}async function _getSchedulePreview(e,t,i,a){t+=`/api/admin/schedule/${i}/preview`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
124
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Schedule Preview Failed")}}async function _moveScheduleItem(e,t,i,a,n,r){t+=`/api/admin/schedule/${i}/item/${a}/move`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={id:a,previousItem:n};r&&console.log(`URL: ${t}
125
+ METHOD: POST
126
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Move Schedule Items Failed")}}async function _publishIntelligentSchedule(e,t,i,a,n){t+=`/api/admin/schedule/${i}/publish`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={numberOfLockedDays:a};n&&console.log(`URL: ${t}
127
+ METHOD: POST
128
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Publish Schedule Failed")}}async function _startSchedule(e,t,i,a,n){t=t+`/api/admin/schedule/${i}/start`+(null!==a?"?skipCleanupOnFailure="+a:""),i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
129
+ METHOD: POST`);try{var r=await fetch(t,{method:"POST",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Start Schedule Failed")}}async function _stopSchedule(e,t,i,a,n){t=t+`/api/admin/schedule/${i}/stop`+(null!==a?"?forceStop="+a:""),i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
130
+ METHOD: POST`);try{var r=await fetch(t,{method:"POST",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Stop Schedule Failed")}}async function _updateIntelligentPlaylist(e,t,i,a,n,r,o,s,l,d,p,c,h,u){var f=t+"/api/admin/schedule/"+i,y=new Headers,w=(y.append("Content-Type","application/json"),y.append("Authorization","Bearer "+e),await _getIntelligentPlaylist(e,t,i,u)),o={name:o||w.name,scheduleType:"4",thumbnailAsset:h||w.thumbnailAsset,scheduleStatus:w.scheduleStatus,status:w.status};u&&console.log(`URL: ${f}
131
+ METHOD: PUT
132
+ BODY: `+JSON.stringify(o));let g=null;try{var m=await fetch(f,{method:"PUT",headers:y,body:JSON.stringify(o)});if(!m.ok)throw await m.json();g=await m.json()}catch(e){_apiExceptionHandler(e,"Update Intelligent Playlist Failed")}const v=await _getScheduleItems(e,t,i,u);h=v[0],w=f+"/item/"+h.id,o={id:h.id,collections:0===a.length?h.collections:a,endSearchDate:n||h.endSearchDate,endSearchDurationInMinutes:r||h.endSearchDurationInMinutes,relatedContent:0===s?h.relatedContent:s,scheduleItemType:"2",searchDate:l||h.searchDate,searchDurationInMinutes:d||h.searchDurationInMinutes,searchFilterType:p||h.searchFilterType,sourceType:"2",tags:0===c.length?h.tags:c};u&&console.log(`URL: ${w}
133
+ METHOD: PUT
134
+ BODY: `+JSON.stringify(o));try{var _,T=await fetch(w,{method:"PUT",headers:y,body:JSON.stringify(o)});if(!T.ok)throw await T.json();const v=await T.json();for(_ in g)v[_]=g[_];return v}catch(e){_apiExceptionHandler(e,"Update Intelligent Playlist Failed")}}async function _updateIntelligentSchedule(e,t,i,a,n,r,o,s){var l=t+"/api/admin/schedule/"+i,d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),await _getIntelligentSchedule(e,t,i,s)),t={defaultVideoAsset:a||e.defaultVideoAsset,id:i,name:n||e.name,scheduleType:3,thumbnailAsset:r||e.thumbnailAsset,timeZoneId:o||e.timeZoneId};s&&console.log(`URL: ${l}
135
+ METHOD: PUT
136
+ BODY: `+JSON.stringify(t,null,4));try{var p=await fetch(l,{method:"PUT",headers:d,body:JSON.stringify(t)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Update Intelligent Schedule Failed")}}async function _updatePlaylistVideo(e,t,i,a,n,r){t=t+`/api/admin/schedule/${i}/item/`+a,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a={asset:n};r&&console.log(`API_URL: ${t}
137
+ METHOD: PUT
138
+ BODY: `+JSON.stringify(a,null,4));try{var o=await fetch(t,{method:"PUT",headers:i,body:JSON.stringify(a)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Update Playlist Video failed")}}async function _updatePlaylist(e,t,i,a,n,r,o,s){var l=t+"/api/admin/schedule/"+i,d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),await _getPlaylist(e,t,i,s)),t={defaultVideoAsset:a||e.defaultVideoAsset,id:i,loopPlaylist:null===n?e.loopPlaylist:n,name:r||e.name,scheduleType:"1",thumbnailAsset:o||e.thumbnailAsset};s&&console.log(`URL: ${l}
139
+ METHOD: PUT
140
+ BODY: `+JSON.stringify(t,null,4));try{var p=await fetch(l,{method:"PUT",headers:d,body:JSON.stringify(t)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Update Playlist Failed")}}async function _updateScheduleItemAsset(e,t,i,a,n,r,o,s,l,d){var p=t+`/api/admin/schedule/${i}/item/`+a,c=new Headers,e=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),await _getScheduleItem(e,t,i,a,d)),t={asset:n||e.asset,days:r||e.days,durationTimeCode:o||e.durationTimeCode,endTimeCode:s||e.endTimeCode,id:a,scheduleItemType:"1",sourceType:"3",timeCode:l||e.timeCode};d&&console.log(`URL: ${p}
141
+ METHOD: PUT
142
+ BODY: `+JSON.stringify(t,null,4));try{var h=await fetch(p,{method:"PUT",headers:c,body:JSON.stringify(t)});if(h.ok)return await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Update Schedule Item Failed")}}async function _updateScheduleItemLiveChannel(e,t,i,a,n,r,o,s,l,d){var p=t+`/api/admin/schedule/${i}/item/`+a,c=new Headers,e=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),await _getScheduleItem(e,t,i,a,d)),t={days:n||e.days,durationTimeCode:r||e.durationTimeCode,endTimeCode:o||e.endTimeCode,id:a,liveChannel:s||e.liveChannel,scheduleItemType:"1",sourceType:"4",timeCode:l||e.timeCode};d&&console.log(`URL: ${p}
143
+ METHOD: PUT
144
+ BODY: `+JSON.stringify(t,null,4));try{var h=await fetch(p,{method:"PUT",headers:c,body:JSON.stringify(t)});if(h.ok)return await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Update Schedule Item Failed")}}async function _updateScheduleItemPlaylistSchedule(e,t,i,a,n,r,o,s,l,d){var p=t+`/api/admin/schedule/${i}/item/`+a,c=new Headers,e=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),await _getScheduleItem(e,t,i,a,d)),t={days:n||e.days,durationTimeCode:r||e.durationTimeCode,endTimeCode:o||e.endTimeCode,id:a,playlistSchedule:s||e.playlistSchedule,scheduleItemType:"2",sourceType:"1",timeCode:l||e.timeCode};d&&console.log(`URL: ${p}
145
+ METHOD: PUT
146
+ BODY: `+JSON.stringify(t,null,4));try{var h=await fetch(p,{method:"PUT",headers:c,body:JSON.stringify(t)});if(h.ok)return await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Update Schedule Item Failed")}}async function _updateScheduleItemSearchFilter(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w){var g=t+`/api/admin/schedule/${i}/item/`+a,m=new Headers,e=(m.append("Content-Type","application/json"),m.append("Authorization","Bearer "+e),await _getScheduleItem(e,t,i,a,w)),t={collections:n||e.collections,days:r||e.days,durationTimeCode:o||e.durationTimeCode,endSearchDate:s||e.endSearchDate,endSearchDuratonInMinutes:l||e.endSearchDuratonInMinutes,endTimeCode:d||e.endTimeCode,id:a,relatedContent:p||e.relatedContent,scheduleItemType:"1",searchDate:c||e.searchDate,searchDurationInMinutes:h||e.searchDurationInMinutes,searchFilterType:u||e.searchFilterType,sourceType:"2",tags:f||e.tags,timeCode:y||e.timeCode};w&&console.log(`URL: ${g}
147
+ METHOD: PUT
148
+ BODY: `+JSON.stringify(t,null,4));try{var v=await fetch(g,{method:"PUT",headers:m,body:JSON.stringify(t)});if(v.ok)return await v.json();throw await v.json()}catch(e){_apiExceptionHandler(e,"Update Schedule Item Failed")}}async function _changeSessionStatus(e,t,i,a,n,r){var t=t+"/api/admin/user-session",o=new Headers,e=(o.append("Content-Type","application/json"),o.append("Authorization","Bearer "+e),{id:i,userSessionStatus:a,applicationId:n});r&&console.log(`URL: ${t}
149
+ METHOD: POST
150
+ BODY: `+e);try{var s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify(e)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Change Session Status Failed")}}async function _getUserSession(e,t,i,a,n){i="admin"===i?t+"/api/admin/user-session/"+a:t+"/api/user-session/"+a,t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),n&&console.log(`URL: ${i}
151
+ METHOD: GET`);try{var r=await fetch(i,{method:"GET",headers:t});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get User Session Failed")}}async function _deleteUserContentAttributeData(e,t,i,a){t=t+"/api/admin/user/userContentAttribute/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
152
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Content Attribute Data Failed")}}async function _deleteUserContentGroupData(e,t,i,a){t=t+"/api/admin/user/contentGroup/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
153
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Content Group Data Failed")}}async function _deleteUserContentSecurityData(e,t,i,a,n,r,o,s,l,d){var t=t+"/api/admin/user/userContentSecurity/delete",p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{contentId:i,contentDefinitionId:a,userId:n,email:r,id:o,keyName:s,expirationDate:l});d&&console.log(`URL: ${t}
154
+ METHOD: POST
155
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(!c.ok)throw await c.json()}catch(e){_apiExceptionHandler(e,"Delete User Content Security Data Failed")}}async function _deleteUserData(e,t,i,a){t=t+"/api/admin/user/userData/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
156
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Data Failed")}}async function _deleteUserDislikesData(e,t,i,a){t=t+"/api/admin/user/dislike/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
157
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Dislikes Data Failed")}}async function _deleteUserFavoritesData(e,t,i,a){t=t+"/api/admin/user/favorite/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
158
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Favorites Data Failed")}}async function _deleteUserLikesData(e,t,i,a){t=t+"/api/admin/user/like/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
159
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Likes Data Failed")}}async function _deleteUserSavedSearchData(e,t,i,a){t=t+"/api/admin/user/savedSearch/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
160
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Saved Search Data Failed")}}async function _deleteUserSessionData(e,t,i,a){t=t+"/api/admin/user/userSession/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
161
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Session Data Failed")}}async function _deleteUserVideoTrackingData(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m){var t=t+"/api/admin/user/userVideoTracking/delete",v=new Headers,e=(v.append("Content-Type","application/json"),v.append("Authorization","Bearer "+e),{assetId:i,contentId:a,videoTrackingAttribute:n,userId:r,id:o,isFirstQuartile:s,isMidpoint:l,isThirdQuartile:d,isComplete:p,isHidden:c,isLiveStream:h,maxSecond:u,lastSecond:f,totalSeconds:y,lastBeaconDate:w,keyName:g});m&&console.log(`URL: ${t}
162
+ METHOD: POST
163
+ BODY: `+JSON.stringify(e,null,4));try{var _=await fetch(t,{method:"POST",headers:v,body:JSON.stringify(e)});if(!_.ok)throw await _.json()}catch(e){_apiExceptionHandler(e,"Delete User Video Tracking Data Failed")}}async function _deleteUser(e,t,i,a){t=t+"/api/admin/user/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
164
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete User Failed")}}async function _register(e,t,i,a,n,r){var e=e+"/api/account/register",o=new Headers,i=(o.append("Content-Type","application/json"),{firstName:i,lastName:a,email:t,password:n});r&&console.log(`URL: ${e}
165
+ METHOD: POST
166
+ BODY: `+JSON.stringify(i,null,4));try{var s=await fetch(e,{method:"POST",headers:o,body:JSON.stringify(i)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Register user failed")}}async function _resendCode(e,t,i){var e=e+"/api/account/resend-code",a=new Headers,t=(a.append("Content-Type","application/json"),{userName:t});i&&console.log(`URL: ${e}
167
+ METHOD: POST
168
+ BODY: `+JSON.stringify(t,null,4));try{var n=await fetch(e,{method:"POST",headers:a,body:JSON.stringify(t)});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Resend code failed")}}async function _verify(e,t,i,a){var e=e+"/api/account/verify",n=new Headers,t=(n.append("Content-Type","application/json"),{userName:t,token:i});a&&console.log(`URL: ${e}
169
+ METHOD: POST
170
+ BODY: `+JSON.stringify(t,null,4));try{var r=await fetch(e,{method:"POST",headers:n,body:JSON.stringify(t)});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Verify user failed")}}async function _forgotPassword(e,t,i){var e=e+"/api/account/forgot-password",a=new Headers,t=(a.append("Content-Type","application/json"),{username:t});i&&console.log(`URL: ${e}
171
+ METHOD: POST
172
+ BODY: `+JSON.stringify(t,null,4));try{var n=await fetch(e,{method:"POST",headers:a,body:JSON.stringify(t)}).catch(e=>{throw e});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Forgot Password Failed")}}async function _login(e,t,i,a){i+="/api/account/login",e={userName:e,password:t};a&&console.log(`URL: ${i}
173
+ METHOD: POST
174
+ BODY: `+JSON.stringify(e,null,4));try{var n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Login Failed")}}async function _logout(e,t,i){var t=t+"/api/account/logout",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
175
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:a});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Logout Failed")}}async function _refreshToken(e,t,i,a){var t=t+"/api/account/refresh-token",n=new Headers,e=(n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),{refreshToken:i});a&&console.log(`URL: ${t}
176
+ METHOD: POST
177
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Refreshing Token Failed")}}async function _resetPassword(e,t,i,a,n){var e=e+"/api/account/reset-password",r=new Headers,t=(r.append("Content-Type","application/json"),{userName:t,TOKEN:i,newPassword:a});n&&console.log(`URL: ${e}
178
+ METHOD: POST
179
+ BODY: `+JSON.stringify(t,null,4));try{var o=await fetch(e,{method:"POST",headers:r,body:JSON.stringify(t)});if(!o.ok)throw await o.json()}catch(e){_apiExceptionHandler(e,"Reset Password Failed")}}async function _archiveAsset(e,t,i,a){t+=`/api/admin/asset/${i}/archive`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
180
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Archive Asset Failed")}}async function _buildMedia(e,t,i,a,n,r,o,s,l,d,p){var t=t+"/api/asset/build-media",c=new Headers,e=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),{sources:i,title:a,tags:n,collections:r,relatedContent:o,destinationFolderId:s,videoBitrate:l,audioTracks:d});p&&console.log(`URL: ${t}
181
+ METHOD: POST
182
+ BODY: `+JSON.stringify(e,null,4));try{var h=await fetch(t,{method:"POST",headers:c,body:JSON.stringify(e)});if(h.ok)return await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Build Media Failed")}}async function _clipAsset(e,t,i,a,n,r,o,s,l,d,p,c,h,u){a="admin"===a?t+`/api/admin/asset/${i}/clip`:t+`/api/asset/${i}/clip`,t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),i={startTimeCode:n,endTimeCode:r,title:o,outputFolderId:s,tags:l,collections:d,relatedContent:p,videoBitrate:c,audioTracks:h};u&&console.log(`URL: ${a}
183
+ METHOD: POST
184
+ BODY: `+JSON.stringify(i,null,4));try{var f=await fetch(a,{method:"POST",headers:t,body:JSON.stringify(i)});if(f.ok)return await f.json();throw await f.json()}catch(e){_apiExceptionHandler(e,"Clip Asset Failed")}}async function _copyAsset(e,t,i,a,n,r,o,s,l,d){var t=t+"/api/admin/asset/copy",p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{batchAction:n,contentDefinitionId:r,schemaName:o,targetIds:i,userId:s,actionArguments:{destinationFolderAssetId:a},resolverExempt:l});d&&console.log(`URL: ${t}
185
+ METHOD: POST
186
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(c.ok)return await c.json();throw await c.json()}catch(e){_apiExceptionHandler(e,"Copy Asset Failed")}}async function _createAnnotation(e,t,i,a,n,r,o,s,l){var t=t+`/api/asset/${i}/annotation`,d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),l&&console.log(`URL: ${t}
187
+ METHOD: POST`),{id:i,startTimeCode:a,endTimeCode:n,properties:r,contentId:o,imageUrl:s});try{var p=await fetch(t,{method:"POST",headers:d,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Create Annotation Failed")}}async function _createAssetAdBreak(e,t,i,a,n,r,o){var t=t+`/api/admin/asset/${i}/adbreak`,s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{id:i,timeCode:a,tags:n,labels:r});o&&console.log(`URL: ${t}
188
+ METHOD: POST
189
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Create Asset Ad Break Failed")}}async function _createFolderAsset(e,t,i,a,n){t+=`/api/admin/asset/${i}/create-folder`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={displayName:a};n&&console.log(`URL: ${t}
190
+ METHOD: POST
191
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Create Folder Asset Failed")}}async function _createPlaceholderAsset(e,t,i,a,n){t+=`/api/admin/asset/${i}/create-placeholder`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={assetName:a};n&&console.log(`URL: ${t}
192
+ METHOD: POST
193
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Create Placeholder Asset Failed")}}async function _createScreenshotAtTimecode(e,t,i,a,n){t+=`/api/admin/asset/${i}/screenshot`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={timecode:a};n&&console.log(`URL: ${t}
194
+ METHOD: POST
195
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Create Screenshot At Timecode Failed")}}async function _deleteAnnotation(e,t,i,a,n){t=t+`/api/asset/${i}/annotation/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
196
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Annotation Failed")}}async function _deleteAssetAdBreak(e,t,i,a,n){t=t+`/api/admin/asset/${i}/adbreak/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
197
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Ad Break Failed")}}async function _deleteAsset(e,t,i,a){t=t+"/api/admin/asset/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
198
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Asset Failed")}}async function _downloadArchiveAsset(e,t,i,a,n,r,o){var t="admin"===i?t+"/api/admin/asset/download-archive":t+"/api/asset/download-archive",s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{assetIds:a});"admin"===i&&(e.fileName=n,e.downloadProxy=r),o&&console.log(`URL: ${t}
199
+ METHOD: POST
200
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Asset Download Archive Failed")}}async function _duplicateAsset(e,t,i,a){t+=`/api/admin/asset/${i}/duplicate`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
201
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Duplicate Asset Failed")}}async function _getAnnotations(e,t,i,a){t+=`/api/asset/${i}/annotation`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
202
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Annotations Failed")}}async function _getAssetAdBreaks(e,t,i,a){t+=`/api/admin/asset/${i}/adbreak`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
203
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Asset Ad Break Failed")}}async function _getAssetChildNodes(e,t,i,a,n,r,o,s,l){t=new URL(t+`/admin/asset/${i}/getAssetChildNodes`),i=new URLSearchParams,i.append("folderId",a),i.append("sortColumn",n),i.append("isDesc",r),i.append("pageIndex",o),i.append("pageSize",s),t.search=i.toString(),a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),l&&console.log(`URL: ${t}
204
+ METHOD: GET`);try{var d=await fetch(t,{method:"GET",headers:a});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Get Asset Child Node Failed")}}async function _getAssetDetails(e,t,i,a,n){a="admin"===a?t+`/api/admin/asset/${i}/detail`:t+`/api/asset/${i}/detail`,t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),n&&console.log(`URL: ${a}
205
+ METHOD: GET`);try{var r=await fetch(a,{method:"GET",headers:t});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Asset Details Failed")}}async function _getAssetManifestWithCookies(e,t,i,a,n,r){n="admin"===n?t+`/api/admin/asset/${i}/set-cookies/`+a:t+`/api/asset/${i}/set-cookies/`+a,t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),r&&console.log(`URL: ${n}
206
+ METHOD: GET`);try{var o=await fetch(n,{method:"GET",headers:t});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Get Asset Manifest Failed")}}async function _getAssetMetadataSummary(e,t,i,a){t+=`/api/admin/asset/${i}/metadata-summary`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
207
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Asset Metadata Summary Failed")}}async function _getAssetParentFolders(e,t,i,a,n){t+=`/api/admin/asset/${i}/parent-folders`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
208
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Parent Folders Failed")}}async function _getAssetScreenshotDetails(e,t,i,a,n,r){t+=`/api/admin/asset/${i}/${a}/${n}/detail`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),r&&console.log(`URL: ${t}
209
+ METHOD: GET`);try{var o=await fetch(t,{method:"GET",headers:i});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Get Asset Screenshot Details Failed")}}async function _getAssetSegmentDetails(e,t,i,a,n){t+=`/api/admin/asset/${i}/${a}/detail`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
210
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Get Asset Segment Details Failed")}}async function _getAsset(e,t,i,a){t=t+"/api/admin/asset/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
211
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Asset Failed")}}async function _getUserUploadParts(e,t,i,a){t=t+"/api/admin/asset/upload/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
212
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get User Upload Parts Failed")}}async function _getUserUploads(e,t,i,a){t=t+"/api/admin/asset/upload?includeCompletedUploads="+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
213
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get User Uploads Failed")}}async function _importAnnotations(e,t,i,a,n){t+=`/api/asset/${i}/annotation/import`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
214
+ METHOD: POST
215
+ BODY: `+JSON.stringify(a));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(a)});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Import Annotations Failed")}}async function _indexAsset(e,t,i,a){t+=`/api/admin/asset/${i}/index`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
216
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Index Asset Failed")}}async function _localRestoreAsset(e,t,i,a,n){t+=`/api/asset/${i}/localRestore`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={profile:a};n&&console.log(`URL: ${t}
217
+ METHOD: POST
218
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Local Restore Asset Failed")}}async function _moveAsset(e,t,i,a,n,r,o,s,l,d){var t=t+`/api/admin/asset/${i}/move`,p=new Headers,e=(p.append("Content-Type","application/json"),p.append("Authorization","Bearer "+e),{actionArguments:{destinationFolderAssetId:a},target_ids:[i],batchAction:n,contentDefinitionId:r,schemaName:o,userId:s,resolverExempt:l});d&&console.log(`URL: ${t}
219
+ METHOD: POST
220
+ BODY: `+JSON.stringify(e,null,4));try{var c=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(e)});if(!c.ok)throw await c.json()}catch(e){_apiExceptionHandler(e,"Move Asset Failed")}}async function _recordsAssetTrackingBeacon(e,t,i,a,n,r,o,s){var t=new URL`${t}/asset/tracking`,l=t.searchParams,a=(l.append("trackingEvent",a),l.append("assetId",i),l.append("liveChannelId",n),l.append("contentId",r),l.append("second",o),t.search=l.toString(),new Headers);a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),s&&console.log(`URL: ${t}
221
+ METHOD: GET`);try{var d=await fetch(t,{method:"GET",headers:a});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Records Asset Tracking Beacon Failed")}}async function _registerAsset(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m,v,_,T){var t=t+"/api/admin/asset/register",D=new Headers,e=(D.append("Content-Type","application/json"),D.append("Authorization","Bearer "+e),{id:i,parentId:a,displayObjectKey:n,bucketName:r,objectKey:o,eTag:s,tags:l,collections:d,relatedContent:p,sequencer:c,assetStatus:h,storageClass:u,assetType:f,contentLength:y,storageEventName:w,createdDate:g,storageSourceIpAddress:m,startMediaProcessor:v,deleteMissingAsset:_});T&&console.log(`URL: ${t}
222
+ METHOD: POST
223
+ BODY: `+JSON.stringify(e,null,4));try{var E=await fetch(t,{method:"POST",headers:D,body:JSON.stringify(e)});if(!E.ok)throw await E.json()}catch(e){_apiExceptionHandler(e,"Register Asset Failed")}}async function _reprocessAsset(e,t,i,a){var t=t+"/api/admin/asset/reprocess",n=new Headers,e=(n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),{targetIds:i});a&&console.log(`URL: ${t}
224
+ METHOD: POST
225
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Reprocess Asset Failed")}}async function _restoreAsset(e,t,i,a,n){a="admin"===a?t+`/api/admin/asset/${i}/restore`:t+`/api/asset/${i}/restore`,t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),n&&console.log(`URL: ${a}
226
+ METHOD: POST`);try{var r=await fetch(a,{method:"POST",headers:t});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Restore Asset Failed")}}async function _shareAsset(e,t,i,a,n,r,o){var t=t+`/api/asset/${i}/share`,s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{assetId:i,nomadUsers:a,externalUsers:n,shareDurationInHours:r});o&&console.log(`URL: ${t}
227
+ METHOD: POST
228
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Share Asset Failed")}}async function _startWorkflow(e,t,i,a,n){var t=t+"/api/admin/asset/startWorkflow",r=new Headers,e=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+e),{actionArguments:i,targetIds:a});n&&console.log(`URL: ${t}
229
+ METHOD: POST
230
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Start Workflow Failed")}}async function _transcribeAsset(e,t,i,a,n,r){t=t+`/api/admin/asset/${i}/transcript/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),r&&console.log(`URL: ${t}
231
+ METHOD: POST
232
+ BODY: `+JSON.stringify(n));try{var o=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(n)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Transcribe Asset Failed")}}async function _updateAnnotation(e,t,i,a,n,r,o,s,l,d,p,c,h){var u=t+`/api/asset/${i}/annotation/`+a,f=new Headers;f.append("Content-Type","application/json"),f.append("Authorization","Bearer "+e);e=_getAnnotations(e,t,i,h).find(e=>e.id===a),t={id:a||e.id,startTimeCode:n||e.startTimeCode,endTimeCode:r||e.endTimeCode,properties:{firstKeyword:o||e.properties.firstKeyword,secondKeyword:s||e.properties.secondKeyword,description:l||e.properties.description,country:d||e.properties.country},contentId:p||e.contentId,imageUrl:c||e.imageUrl};h&&console.log(`URL: ${u}
233
+ METHOD: PUT
234
+ BODY: `+JSON.stringify(t,null,4));try{var y=await fetch(u,{method:"PUT",headers:f,body:JSON.stringify(t)});if(y.ok)return await y.json();throw await y.json()}catch(e){_apiExceptionHandler(e,"Update Annotations Failed")}}async function _updateAssetAdBreak(e,t,i,a,n,r,o,s){var l=t+`/api/admin/asset/${i}/adbreak/`+a,d=new Headers;d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e);e=_getAssetAdBreaks(e,t,i,s).find(e=>e.id===a),t={id:a||e.id,timeCode:n||e.timeCode,tags:r||e.tags,labels:o||e.labels};s&&console.log(`URL: ${l}
235
+ METHOD: PUT
236
+ BODY: `+JSON.stringify(t,null,4));try{var p=await fetch(l,{method:"PUT",headers:d,body:JSON.stringify(t)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Update Asset Ad Break Failed")}}async function _updateAssetLanguage(e,t,i,a,n){t+=`/api/admin/asset/${i}/language`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={languageId:a};n&&console.log(`URL: ${t}
237
+ METHOD: POST
238
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Update Asset Language Failed")}}async function _updateAsset(e,t,i,a,n,r,o,s,l){t=t+"/api/admin/asset/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={displayName:a,displayDate:n,availableStartDate:r,availableEndDate:o,customProperties:s};l&&console.log(`URL: ${t}
239
+ METHOD: PATCH
240
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"PATCH",headers:i,body:JSON.stringify(e)});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Update Asset Failed")}}async function _addCustomProperties(e,t,i,a,n,r,o){t=t+"/api/admin/asset/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={displayName:a,displayDate:n,customProperties:r};o&&console.log(`URL: ${t}
241
+ METHOD: PATCH
242
+ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(t,{method:"PATCH",headers:i,body:JSON.stringify(e)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Adding Custom Properties Failed")}}async function _addRelatedContent(e,t,i,a,n,r,o){r="admin"===r?t+"/api/admin/related":t+"/api/content/related",t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:i,relatedContentId:a}]};o&&console.log(`URL: ${r}
243
+ METHOD: POST
244
+ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(r,{method:"POST",headers:t,body:JSON.stringify(e)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Adding Related Content Failed")}}async function _addTagOrCollection(e,t,i,a,n,r,o,s,l,d){l="admin"===l?t+`/api/admin/${i}/content`:t+"/api/content/"+i,t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:a,name:r,createNew:s}]};e.items[0][i+"Id"]=o,d&&console.log(`URL: ${l}
245
+ METHOD: POST
246
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(l,{method:"POST",headers:t,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Adding Tag or Collection Failed")}}async function _bulkUpdateMetadata(e,t,i,a,n,r,o,s){var t=t+"/api/admin/content/bulk-metadata-update",l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{collections:a,contents:i,relatedContents:n,tags:r,schemaName:o});s&&console.log(`URL: ${t}
247
+ METHOD: POST
248
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Bulk Update Metadata Failed")}}async function _createTagOrCollection(e,t,i,a,n){t=t+"/api/admin/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={name:a};n&&console.log(`URL: ${t}
249
+ METHOD: POST
250
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Adding Tag or Collection Failed")}}async function _deleteRelatedContent(e,t,i,a,n,r,o){r="admin"===r?t+"/api/admin/related/delete":t+"/api/content/related/delete",t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:i,relatedContentId:a}]};o&&console.log(`URL: ${r}
251
+ METHOD: POST
252
+ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(r,{method:"POST",headers:t,body:JSON.stringify(e)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Deleting Related Content Failed")}}async function _deleteTagOrCollection(e,t,i,a,n){t=t+`/api/admin/${i}/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
253
+ METHOD: POST`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Tag or Collection Failed")}}async function _getTagOrCollection(e,t,i,a,n){t=t+`/api/admin/${i}/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
254
+ METHOD: GET`);try{var r=await fetch(t,{method:"GET",headers:i});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Getting Tag or Collection Failed")}}async function _removeTagOrCollection(e,t,i,a,n,r,o,s){o="admin"===o?t+`/api/admin/${i}/content/delete`:t+`/api/content/${i}/delete`,t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:a}]};e.items[0][i+"Id"]=r,s&&console.log(`URL: ${o}
255
+ METHOD: POST
256
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(o,{method:"POST",headers:t,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Removing Tag or Collection Failed")}}async function _ping(e,t,i,a,n){var t=t+"/api/account/ping",r=new Headers,e=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+e),{userId:a});i&&(e.applicationId=i),n&&console.log(`URL: ${t}
257
+ METHOD: POST
258
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Ping user failed")}}async function _pingAuth(e,t,i,a,n){var t=t+"/api/account/ping/auth",r=new Headers,e=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+e),{userId:a});i&&(e.applicationId=i),n&&console.log(`URL: ${t}
259
+ METHOD: POST
260
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Ping user failed")}}async function _search(e,t,i,a,n,r,o,s,l,d,p,c,h,u){t+=`/api/${h}/search`,h=new Headers,h.append("Content-Type","application/json"),h.append("Authorization","Bearer "+e),e={};i&&(e.searchQuery=i),e.pageOffset=a||0,e.pageSize=n||100,r&&(e.filters=r),o&&(e.sortFields=o),s&&(e.searchResultFields=s),l&&(e.similarAssetId=l),d&&(e.minScore=d),p&&(e.excludeTotalRecordCount=p),c&&(e.filterBinder=c),u&&console.log(`URL: ${t}
261
+ METHOD: POST
262
+ BODY: `+JSON.stringify(e,null,4));try{var f=await fetch(t,{method:"POST",headers:h,body:JSON.stringify(e)});if(f.ok)return await f.json();throw await f.json()}catch(e){_apiExceptionHandler(e,"Search Failed")}}function _apiExceptionHandler(i,a){if(!i)throw new Error(a);if("string"==typeof i)throw new Error(a+": "+i);if(!i.errors)throw new Error(a+": "+i.message);if(Array.isArray(i.errors)){let t="";for(let e=0;e<i.errors.length;e++)t+=`${i.errors[e].code}: ${i.errors[e].field}: ${i.errors[e].message}\n`;throw new Error(a+": "+t)}if("object"==typeof i.errors){let e="";for(var t in i.errors)Object.prototype.hasOwnProperty.call(i.errors,t)&&(e+=`${t}: ${i.errors[t]}\n`);throw new Error(a+": "+e)}}import{getRandomValues}from"crypto";function _newGuid(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function _printDatetime(e){var t=(new Date).toLocaleTimeString();console.log(t+": "+e)}async function _sleep(t){if(t&&0!==t)return new Promise(e=>{setTimeout(()=>{e()},1e3*t)})}function _slugify(e){return e&&0!==e.trim().length?e.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-"):""}async function _changeEmail(e,t,i,a,n){var t=t+"/api/account/change-email",r=new Headers,e=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+e),{password:a,newEmail:i});n&&console.log(`URL: ${t}
263
+ METHOD: POST
264
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)});if(!o.ok)throw await o.json()}catch(e){_apiExceptionHandler(e,"Change email failed")}}async function _changePassword(e,t,i,a,n){var t=t+"/api/account/change-password",r=new Headers,e=(r.append("Content-Type","application/json"),r.append("Authorization","Bearer "+e),{password:i,newPassword:a});n&&console.log(`URL: ${t}
265
+ METHOD: POST
266
+ BODY: `+JSON.stringify(e,null,4));try{var o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)});if(!o.ok)return await o.json()}catch(e){_apiExceptionHandler(e,"Change password failed")}}async function _getCountries(e,t,i){var t=t.replace(/https:\/\/(.+?)\./,"https://").replace(/\/[^/]+$/,"")+"/config/ea1d7060-6291-46b8-9468-135e7b94021b/lookups.json",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
267
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return(await n.json())[5].children;throw await n.json()}catch(e){_apiExceptionHandler(e,"Get countries failed")}}async function _getStates(e,t,i){var t=t.replace(/https:\/\/(.+?)\./,"https://").replace(/\/[^/]+$/,"")+"/config/ea1d7060-6291-46b8-9468-135e7b94021b/lookups.json",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
268
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return(await n.json())[6].children;throw await n.json()}catch(e){_apiExceptionHandler(e,"Get countries failed")}}async function _getUser(e,t,i){var t=t+"/api/account/user",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
269
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get user failed")}}async function _updateUser(e,t,i,a,n,r,o,s,l,d,p,c,h,u){var f,y=await _getUser(e,t,u),w=t+"/api/account/user",g=new Headers,m=(g.append("Content-Type","application/json"),g.append("Authorization","Bearer "+e),{}),v=(await _getCountries(e,t,u)).find(e=>e.label===r),_={address:i,address2:a,city:n,state:(await _getStates(e,t,u)).find(e=>e.label===h).label,country:v,firstName:o,lastName:s,phone:d,phoneExt:p,postalCode:c,organization:l};for(const D in _)null!==_[D]?m[D]=_[D]:null!=(f=y[D])&&(m[D]=f);u&&console.log(`URL: ${w}
270
+ METHOD: PUT
271
+ BODY: `+JSON.stringify(m,null,4));try{var T=await fetch(w,{method:"PUT",headers:g,body:JSON.stringify(m)});return T.ok||await T.json(),await T.json()}catch(e){_apiExceptionHandler(e,"Update user failed")}}async function _addContentsToContentGroup(e,t,i,a,n){t=t+"/api/contentgroup/add/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`URL: ${t}
272
+ METHOD: POST
273
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Adding Contents to Content Group Failed")}}async function _createContentGroup(e,t,i,a){var t=t+"/api/contentGroup",n=new Headers,e=(n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),{});i&&(e.name=i),a&&console.log(`URL: ${t}
274
+ METHOD: POST
275
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Creating Content Group Failed")}}async function _deleteContentGroup(e,t,i,a){t=t+"/api/contentgroup/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
276
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Content Group Failed")}}async function _getContentGroup(e,t,i,a){t=t+"/api/contentgroup/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
277
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Content Group Failed")}}async function _getContentGroups(e,t,i){var t=t+"/api/contentgroup",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
278
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Content Groups Failed")}}async function _getPortalGroups(e,t,i,a){var t=t+"/api/portal/groups",n=new Headers,e=(n.append("Content-Type","application/json"),n.append("Authorization","Bearer "+e),{returnedGroupNames:i});a&&console.log(`URL: ${t}
279
+ METHOD: POST
280
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Getting Portal Groups Failed")}}async function _removeContentsFromContentGroup(e,t,i,a,n){t=t+"/api/contentgroup/remove/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`URL: ${t}
281
+ METHOD: POST
282
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Removing Content From Content Group Failed")}}async function _renameContentGroup(e,t,i,a,n){t=t+"/api/contentgroup/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={Name:a};n&&console.log(`URL: ${t}
283
+ METHOD: PATCH
284
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"PATCH",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Renaming Content Group Failed")}}async function _shareContentGroupWithUsers(e,t,i,a,n){t=t+"/api/contentgroup/share/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`URL: ${t}
285
+ METHOD: POST
286
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Sharing Content Group With Users Failed")}}async function _stopSharingContentGroupWithUsers(e,t,i,a,n){t=t+"/api/contentgroup/stopshare/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`URL: ${t}
287
+ METHOD: POST
288
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Stop Sharing Content Group With Users Failed")}}async function _guestInvite(e,t,i,a,n,r,o,s){var t=t+"/api/account/invite-user",l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{contentId:i,contentDefinitionId:a,userId:n,emails:r,contentSecurityAttribute:o});s&&console.log(`URL: ${t}
289
+ METHOD: POST
290
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Guest Invite failed")}}async function _registerGuest(e,t,i,a,n,r,o){var t=t+"/api/account/register-guest",s=new Headers,e=(s.append("Content-Type","application/json"),s.append("Authorization","Bearer "+e),{email:i,firstName:a,lastName:n,password:r});o&&console.log(`URL: ${t}
291
+ METHOD: POST
292
+ BODY: `+JSON.stringify(e,null,4));try{var l=await fetch(t,{method:"POST",headers:s,body:JSON.stringify(e)});if(l.ok)return await l.json();throw await l.json()}catch(e){_apiExceptionHandler(e,"Register guest failed")}}async function _removeGuest(e,t,i,a,n,r,o,s){var t=t+"/api/account/remove-user",l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{contentId:i,contentDefinitionId:a,userId:n,emails:r,contentSecurityAttribute:o});s&&console.log(`URL: ${t}
293
+ METHOD: POST
294
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Remove guest failed")}}async function _createMediaBuilderItem(e,t,i,a,n,r,o,s,l){t+=`/api/mediaBuilder/${i}/items`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={sourceAssetId:a,startTimeCode:n,endTimeCode:r,sourceAnnotationId:o,relatedContent:s};l&&console.log(`URL: ${t}
295
+ METHOD: POST
296
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Create Media Builder Item Failed")}}async function _createMediaBuilderItemsAddAnnotations(e,t,i,a,n){t+=`/api/mediaBuilder/${i}/items/${a}/add-annotations`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`API_URL: ${t}
297
+ METHOD: POST`);try{var r=await fetch(t,{method:"POST",headers:i});if(r.ok)return await r.json();throw new Error}catch(e){_apiExceptionHandler(e,"Create Media Builder Items Add Annotations Failed")}}async function _createMediaBuilderItemsBulk(e,t,i,a,n){t+=`/api/mediaBuilder/${i}/items/bulk`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`API_URL: ${t}
298
+ METHOD: POST
299
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw new Error}catch(e){_apiExceptionHandler(e,"Create Media Builder Items Bulk Failed")}}async function _createMediaBuilder(e,t,i,a,n,r,o,s,l){var t=t+"/api/mediaBuilder",d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),{name:i,destinationFolderId:a,collections:n,relatedContent:r,tags:o,properties:s});l&&console.log(`URL: ${t}
300
+ METHOD: POST
301
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(t,{method:"POST",headers:d,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Create Media Builder Failed")}}async function _deleteMediaBuilderItem(e,t,i,a,n){t=t+`/api/mediaBuilder/${i}/items/`+a,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
302
+ METHOD: DELETE`);try{var r=await fetch(t,{method:"DELETE",headers:i});if(!r.ok)throw await r.json()}catch(e){_apiExceptionHandler(e,"Delete Media Builder Item Failed")}}async function _deleteMediaBuilder(e,t,i,a){t=t+"/api/mediaBuilder/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
303
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Media Builder Failed")}}async function _duplicateMediaBuilder(e,t,i,a,n,r,o,s,l){t+=`/api/mediaBuilder/${i}/duplicate`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={name:a,destinationFolderId:n,collections:r,relatedContent:o,properties:s};l&&console.log(`URL: ${t}
304
+ METHOD: POST
305
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Duplicate Media Builder Failed")}}async function _getMediaBuilderIdsFromAsset(e,t,i,a){t=t+"/api/mediaBuilder/idsbysource/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`API_URL: ${t}
306
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw new Error}catch(e){_apiExceptionHandler(e,"Get Media Builder Ids From Asset Failed")}}async function _getMediaBuilderItems(e,t,i,a){t+=`/api/mediaBuilder/${i}/items`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
307
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Media Builder Items Failed")}}async function _getMediaBuilder(e,t,i,a){t=t+"/api/mediaBuilder/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
308
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Media Builder Failed")}}async function _getMediaBuilders(e,t,i){var t=t+"/api/mediaBuilder",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
309
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Media Builders Failed")}}async function _moveMediaBuilderItem(e,t,i,a,n,r){t+=`/api/mediaBuilder/${i}/items/${a}/move`,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a={previousId:n};r&&console.log(`URL: ${t}
310
+ METHOD: POST
311
+ BODY: `+JSON.stringify(a,null,4));try{var o=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(a)});if(o.ok)return await o.json();throw await o.json()}catch(e){_apiExceptionHandler(e,"Move Media Builder Item Failed")}}async function _renderMediaBuilder(e,t,i,a){t+=`/api/mediaBuilder/${i}/render`,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
312
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Render Media Builder Failed")}}async function _updateMediaBuilder(e,t,i,a,n,r,o,s,l,d){var p=t+"/api/mediaBuilder/"+i,c=new Headers,e=(c.append("Content-Type","application/json"),c.append("Authorization","Bearer "+e),await _getMediaBuilder(e,t,i,d)),t={name:a||e.name,destinationFolderId:n||e.destinationFolderId,collections:r||e.collections,relatedContent:o||e.relatedContent,tags:s||e.tags,properties:l||e.properties};d&&console.log(`URL: ${p}
313
+ METHOD: PUT
314
+ BODY: `+JSON.stringify(t,null,4));try{var h=await fetch(p,{method:"PUT",headers:c,body:JSON.stringify(t)});if(h.ok)return await h.json();throw await h.json()}catch(e){_apiExceptionHandler(e,"Update Media Builder Failed")}}async function _clearContinueWatching(e,t,i,a,n){var t=t+"/api/media/clear-watching",r=[],i=(i&&r.push("userId="+i),a&&r.push("assetId="+a),t+=r.length?"?"+r.join("&"):"",new Headers);i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),n&&console.log(`URL: ${t}
315
+ METHOD: POST`);try{var o=await fetch(t,{method:"POST",headers:i});if(!o.ok)throw await o.json()}catch(e){_apiExceptionHandler(e,"Clear Continue Watching Failed")}}async function _clearWatchlist(e,t,i,a){t=t+"/api/media/clear-watchlist?userId="+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
316
+ METHOD: POST`);try{var n=await fetch(t,{method:"POST",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Clear Watchlist Failed")}}async function _createForm(e,t,i,a,n){t=t+"/api/media/form/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e=a;n&&console.log(`URL: ${t}
317
+ METHOD: POST
318
+ BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Creating Form Failed")}}async function _getContentCookies(e,t,i,a){t=t+"/api/media/set-cookies/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
319
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Content Cookies Failed")}}async function _getDefaultSiteConfig(e,t,i){var t=t+"/api/media/config",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
320
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Default Site Config Failed")}}async function _getDynamicContent(e,t,i,a){t=t+"/api/media/content/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
321
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Dynamic Content Failed")}}async function _getDynamicContents(e,t,i){var t=t+"/api/media/content",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
322
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Dynamic Contents Failed")}}async function _getMediaGroup(e,t,i,a){t=t+"/api/media/group/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
323
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Media Group Failed")}}async function _getMediaItem(e,t,i,a){t=t+"/api/media/item/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
324
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Media Item Failed")}}async function _getMyContent(e,t,i){var t=t+"/api/media/my-content",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
325
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get My Content Failed")}}async function _getMyGroup(e,t,i,a){t=t+"/api/media/my-group/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
326
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get My Group Failed")}}async function _getSiteConfig(e,t,i,a){t=t+"/api/media/config/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
327
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Site Config Failed")}}async function _mediaSearch(e,t,i,a,n,r,o,s){var t=t+"/api/media/search",l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{searchQuery:i,ids:a,sortFields:n});e.pageOffset=r||0,e.pageSize=o||100,s&&console.log(`URL: ${t}
328
+ METHOD: POST
329
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Media Search Failed")}}async function _addSavedSearch(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m){var t=t+"/api/portal/savedsearch",v=new Headers,e=(v.append("Content-Type","application/json"),v.append("Authorization","Bearer "+e),{name:i,featured:a,bookmarked:n,public:r,pageSize:p,sequence:o,type:s,criteria:{}});l&&(e.criteria.query=l),e.criteria.pageOffset=d||0,e.criteria.pageSize=p||10,c&&(e.criteria.filters=c),h&&(e.criteria.sortFields=h),u&&(e.criteria.searchResultFields=u),f&&(e.criteria.similarAssetId=f),y&&(e.criteria.minScore=y),w&&(e.criteria.excludeTotalRecordCount=w),g&&(e.criteria.filterBinder=g),m&&console.log(`URL: ${t}
330
+ METHOD: POST
331
+ BODY: `+JSON.stringify(e,null,4));try{var _=await fetch(t,{method:"POST",headers:v,body:JSON.stringify(e)});if(_.ok)return await _.json();throw await _.json()}catch(e){_apiExceptionHandler(e,"Add Saved Search Failed")}}async function _deleteSavedSearch(e,t,i,a){t=t+"/api/portal/savedsearch/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
332
+ METHOD: DELETE`);try{var n=await fetch(t,{method:"DELETE",headers:i});if(!n.ok)throw await n.json()}catch(e){_apiExceptionHandler(e,"Delete Saved Search Failed")}}async function _getSavedSearch(e,t,i,a){t=t+"/api/portal/savedsearch/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
333
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Saved Search Failed")}}async function _getSavedSearches(e,t,i){var t=t+"/api/portal/savedsearch",a=new Headers;a.append("Content-Type","application/json"),a.append("Authorization","Bearer "+e),i&&console.log(`URL: ${t}
334
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:a});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Saved Searchs Failed")}}async function _getSearchSavedById(e,t,i,a){t=t+"/api/portal/search-saved/"+i,i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),a&&console.log(`URL: ${t}
335
+ METHOD: GET`);try{var n=await fetch(t,{method:"GET",headers:i});if(n.ok)return await n.json();throw await n.json()}catch(e){_apiExceptionHandler(e,"Get Search Saved By Id Failed")}}async function _getSearchSaved(e,t,i,a,n,r,o,s,l,d,p,c,h){var t=t+"/api/portal/search-saved",u=new Headers,e=(u.append("Content-Type","application/json"),u.append("Authorization","Bearer "+e),{}),i=(i&&(e.query=i),e.pageOffset=a||0,e.pageSize=n||100,r&&(e.filters=r),o&&(e.sortFields=o),s&&(e.searchResultFields=s),l&&(e.similarAssetId=l),d&&(e.minScore=d),p&&(e.excludeTotalRecordCount=p),c&&(e.filterBinder=c),{criteria:e});h&&console.log(`URL: ${t}
336
+ METHOD: POST
337
+ BODY: `+JSON.stringify(i,null,4));try{var f=await fetch(t,{method:"POST",headers:u,body:JSON.stringify(i)});if(f.ok)return await f.json();throw await f.json()}catch(e){_apiExceptionHandler(e,"Get Search Saved Failed")}}async function _patchSavedSearch(e,t,i,a,n,r,o,s,l){t=t+"/api/portal/savedsearch/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={};a&&(e.name=a),!n&&!1!==n||(e.featured=n),!r&&!1!==r||(e.bookmarked=r),!o&&!1!==o||(e.public=o),s&&(e.sequence=s),l&&console.log(`URL: ${t}
338
+ METHOD: PATCH
339
+ BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"PATCH",headers:i,body:JSON.stringify(e)});if(d.ok)return await d.json();throw await d.json()}catch(e){_apiExceptionHandler(e,"Patch Saved Search Failed")}}async function _updateSavedSearch(e,t,i,a,n,r,o,s,l,d,p,c,h,u,f,y,w,g,m,v){var _=t+"/api/portal/savedsearch/"+i,T=new Headers,e=(T.append("Content-Type","application/json"),T.append("Authorization","Bearer "+e),await _getSavedSearch(e,t,i,v)),t={id:i,name:a||e.name,featured:n||e.featured,bookmarked:r||e.bookmarked,public:o||e.public,pageSize:c||e.pageSize,sequence:l||e.sequence,type:s||e.type,user:e.user,criteria:{query:d||e.criteria.query,pageOffset:p||e.criteria.pageOffset,pageSize:c||e.criteria.pageSize,filters:h||e.criteria.filters,sortFields:u||e.criteria.sortFields,searchResultFields:f||e.criteria.searchResultFields,similarAssetId:y||e.criteria.similarAssetId,minScore:w||e.criteria.minScore,excludeTotalRecordCount:g||e.criteria.excludeTotalRecordCount,filterBinder:m||e.criteria.filterBinder}};v&&console.log(`URL: ${_}
340
+ METHOD: PUT
341
+ BODY: `+JSON.stringify(t,null,4));try{var D=await fetch(_,{method:"PUT",headers:T,body:JSON.stringify(t)});if(D.ok)return await D.json();throw await D.json()}catch(e){_apiExceptionHandler(e,"Update Saved Search Failed")}}async function _getVideoTracking(e,t,i,a,n,r){let o=t+"/api/asset/tracking?assetId="+i;t=new Headers;t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),a&&(o+="&trackingEvent="+a),n&&(o+="&second="+n),r&&console.log(`URL: ${o}
342
+ METHOD: GET`);try{var s=await fetch(o,{method:"GET",headers:t});if(!s.ok)throw await s.json()}catch(e){_apiExceptionHandler(e,"Get Video Tracking Failed")}}